CC26xx Driver Library
RF Core

Data Structures

struct  rfTrim_t
 

Functions

static void RFCClockEnable (void)
 Enable the RF core clocks. More...
 
static void RFCClockDisable (void)
 Disable the RF core clocks. More...
 
static void RFCClockSet (uint32_t ui32Mask)
 Enable some of the RF core clocks. More...
 
static void RFCClockClear (uint32_t ui32Mask)
 Disable some of the RF core clocks. More...
 
static void RFCCpe0IntEnable (uint32_t ui32Mask)
 Enable CPE0 interrupt. More...
 
static void RFCCpe1IntEnable (uint32_t ui32Mask)
 Enable CPE1 interrupt. More...
 
static void RFCHwIntEnable (uint32_t ui32Mask)
 
static void RFCCpeIntDisable (uint32_t ui32Mask)
 Disable CPE interrupt. More...
 
static void RFCHwIntDisable (uint32_t ui32Mask)
 Disable HW interrupt. More...
 
uint32_t RFCCpeIntGetAndClear (void)
 Get and clear CPE interrupt flags. More...
 
static void RFCCpeIntClear (uint32_t ui32Mask)
 Clear interrupt flags. More...
 
static void RFCHwIntClear (uint32_t ui32Mask)
 Clear interrupt flags. More...
 
static void RFCAckIntClear (void)
 Clear interrupt flags. More...
 
static uint8_t RFCOverrideSearch (const uint32_t *pOverride, const uint32_t pattern, const uint32_t mask)
 Function to search top RFC_MAX_SEARCH_DEPTH (5) overrides. More...
 
uint32_t RFCDoorbellSendTo (uint32_t pOp)
 Send command to doorbell and wait for ack. More...
 
void RFCSynthPowerDown (void)
 Turn off synth, NOTE: Radio will no longer respond to commands! More...
 
void RFCRfTrimRead (rfc_radioOp_t *pOpSetup, rfTrim_t *rfTrim)
 Read RF trim from flash using CM3. More...
 
void RFCRfTrimSet (rfTrim_t *rfTrim)
 Write preloaded RF trim values to CM0. More...
 
void RFCRTrim (rfc_radioOp_t *pOpSetup)
 Check Override RTrim vs FCFG RTrim. More...
 
void RFCCPEPatchReset (void)
 Reset previously patched CPE RAM to a state where it can be patched again. More...
 
void RFCAdi3VcoLdoVoltageMode (bool bEnable)
 Function to set VCOLDO reference to voltage mode. More...
 
uint8_t RFCOverrideUpdate (rfc_radioOp_t *pOpSetup, uint32_t *pParams)
 Function to update override list. More...
 
uint32_t RFCHWIntGetAndClear (uint32_t ui32Mask)
 Get and clear HW interrupt flags. More...
 

Detailed Description

Function Documentation

static void RFCAckIntClear ( void  )
inlinestatic

Clear interrupt flags.

Referenced by RFCDoorbellSendTo().

341 {
342  // Clear any pending interrupts.
343  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG) = 0x0;
344 }
void RFCAdi3VcoLdoVoltageMode ( bool  bEnable)

Function to set VCOLDO reference to voltage mode.

239 {
240  // Function is left blank for compatibility reasons.
241 }
static void RFCClockClear ( uint32_t  ui32Mask)
inlinestatic

Disable some of the RF core clocks.

As soon as the RF core is started it will handle clock control autonomously. No check should be performed to check the clocks. Instead the radio can be ping'ed through the command interface.

When disabling clocks it is the programmers responsibility that the RF core clocks can be safely gated. I.e. the RF core should be safely 'parked'.

Returns
None
203 {
204  //
205  // Disable clocks
206  //
207  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) &= ~ui32Mask;
208 }
static void RFCClockDisable ( void  )
inlinestatic

Disable the RF core clocks.

As soon as the RF core is started it will handle clock control autonomously. No check should be performed to check the clocks. Instead the radio can be ping'ed through the command interface.

When disabling clocks it is the programmers responsibility that the RF core clocks can be safely gated. I.e. the RF core should be safely 'parked'.

Returns
None
161 {
162  // Disable all clocks
163  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = 0x0;
164 }
static void RFCClockEnable ( void  )
inlinestatic

Enable the RF core clocks.

As soon as the RF core is started it will handle clock control autonomously. No check should be performed to check the clocks. Instead the radio can be ping'ed through the command interface.

Returns
None
128 {
129  // Enable all clocks
130  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) =
142 }
static void RFCClockSet ( uint32_t  ui32Mask)
inlinestatic

Enable some of the RF core clocks.

As soon as the RF core is started it will handle clock control autonomously. No check should be performed to check the clocks. Instead the radio can be ping'ed through the command interface.

Returns
None
179 {
180  //
181  // Enable clocks
182  //
183  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) |= ui32Mask;
184 }
static void RFCCpe0IntEnable ( uint32_t  ui32Mask)
inlinestatic

Enable CPE0 interrupt.

217 {
218  // Multiplex RF Core interrupts to CPE0 IRQ.
219  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEISL) &= ~ui32Mask;
220 
221  do
222  {
223  // Clear any pending interrupts.
224  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0;
225  }while(HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIFG) != 0x0);
226 
227  // Enable the masked interrupts
228  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIEN) |= ui32Mask;
229 }
static void RFCCpe1IntEnable ( uint32_t  ui32Mask)
inlinestatic

Enable CPE1 interrupt.

239 {
240  // Multiplex RF Core interrupts to CPE1 IRQ.
241  HWREG( RFC_DBELL_BASE + RFC_DBELL_O_RFCPEISL) |= ui32Mask;
242 
243  do
244  {
245  // Clear any pending interrupts.
246  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIFG) = 0x0;
247  }while(HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIFG) != 0x0);
248 
249  // Enable the masked interrupts
250  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIEN) |= ui32Mask;
251 }
static void RFCCpeIntClear ( uint32_t  ui32Mask)
inlinestatic

Clear interrupt flags.

312 {
313  do
314  {
315  // Clear interrupts that may now be pending
316  HWREG(RFC_DBELL_BASE+RFC_DBELL_O_RFCPEIFG) = ~ui32Mask;
317  }while (HWREG(RFC_DBELL_BASE+RFC_DBELL_O_RFCPEIFG) & ui32Mask);
318 }
static void RFCCpeIntDisable ( uint32_t  ui32Mask)
inlinestatic

Disable CPE interrupt.

278 {
279  // Disable the masked interrupts
280  HWREG( RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIEN ) &= ~ui32Mask;
281 }
uint32_t RFCCpeIntGetAndClear ( void  )

Get and clear CPE interrupt flags.

119 {
120  uint32_t ui32Ifg = HWREG(RFC_DBELL_BASE+RFC_DBELL_O_RFCPEIFG);
121 
122  do {
123  HWREG(RFC_DBELL_BASE+RFC_DBELL_O_RFCPEIFG) = ~ui32Ifg;
124  } while (HWREG(RFC_DBELL_BASE+RFC_DBELL_O_RFCPEIFG) & ui32Ifg);
125 
126  return (ui32Ifg);
127 }
void RFCCPEPatchReset ( void  )

Reset previously patched CPE RAM to a state where it can be patched again.

219 {
220  uint8_t *pPatchTab = (uint8_t *) (_CPERAM_START + _PARSER_PATCH_TAB_OFFSET);
221  uint32_t *pIrqPatch = (uint32_t *) (_CPERAM_START + _IRQPATCH_OFFSET);
222 
223  memset(pPatchTab, 0xFF, _IRQPATCH_OFFSET - _PARSER_PATCH_TAB_OFFSET);
224 
225  int i;
226  for (i = 0; i < sizeof(rfc_defaultIrqAddr)/sizeof(rfc_defaultIrqAddr[0]); i++)
227  {
228  pIrqPatch[i * 2 + 1] = rfc_defaultIrqAddr[i];
229  }
230 }
static const uint16_t rfc_defaultIrqAddr[]
Definition: rfc.c:91
#define _IRQPATCH_OFFSET
Definition: rfc.c:88
#define _CPERAM_START
Definition: rfc.c:85
#define _PARSER_PATCH_TAB_OFFSET
Definition: rfc.c:86
uint32_t RFCDoorbellSendTo ( uint32_t  pOp)

Send command to doorbell and wait for ack.

137 {
138  while(HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) != 0);
139 
140  RFCAckIntClear();
141 
142  HWREG(RFC_DBELL_BASE+RFC_DBELL_O_CMDR) = pOp;
143 
144  while(!HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG));
145  RFCAckIntClear();
146 
147  return(HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDSTA));
148 }
static void RFCAckIntClear(void)
Clear interrupt flags.
Definition: rfc.h:340

Here is the call graph for this function:

static void RFCHwIntClear ( uint32_t  ui32Mask)
inlinestatic

Clear interrupt flags.

328 {
329  // Clear pending interrupts.
330  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIFG) = ~ui32Mask;
331 }
static void RFCHwIntDisable ( uint32_t  ui32Mask)
inlinestatic

Disable HW interrupt.

291 {
292  // Disable the masked interrupts
293  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIEN) &= ~ui32Mask;
294 }
static void RFCHwIntEnable ( uint32_t  ui32Mask)
inlinestatic

This function is used to map only HW interrupts, and clears/unmasks them. These interrupts are then enabled.

262 {
263  // Clear any pending interrupts.
264  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIFG) = 0x0;
265 
266  // Enable the masked interrupts
267  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIEN) |= ui32Mask;
268 }
uint32_t RFCHWIntGetAndClear ( uint32_t  ui32Mask)

Get and clear HW interrupt flags.

306 {
307  uint32_t ui32Ifg = HWREG(RFC_DBELL_BASE+RFC_DBELL_O_RFHWIFG) & ui32Mask;
308 
309  do {
310  HWREG(RFC_DBELL_BASE+RFC_DBELL_O_RFHWIFG) = ~ui32Ifg;
311  } while (HWREG(RFC_DBELL_BASE+RFC_DBELL_O_RFHWIFG) & ui32Ifg);
312 
313  return (ui32Ifg);
314 }
static uint8_t RFCOverrideSearch ( const uint32_t *  pOverride,
const uint32_t  pattern,
const uint32_t  mask 
)
inlinestatic

Function to search top RFC_MAX_SEARCH_DEPTH (5) overrides.

Referenced by RFCOverrideUpdate().

354 {
355  uint8_t override_index;
356 
357  // Search top overrides for RTRIM
358  for(override_index = 0; override_index < RFC_MAX_SEARCH_DEPTH; override_index++)
359  {
360  if((pOverride[override_index] & mask) == pattern)
361  {
362  return override_index;
363  }
364  }
365  return 0xFF;
366 }
#define RFC_MAX_SEARCH_DEPTH
Definition: rfc.h:81
uint8_t RFCOverrideUpdate ( rfc_radioOp_t pOpSetup,
uint32_t *  pParams 
)

Function to update override list.

250 {
251  uint32_t* overrideLists[3]; // [0] pRegOverrideCommon;
252  // [1] pRegOverride1Mbps;
253  // [2] pRegOverride2Mbps;
254  uint32_t fcfg1_value; // Value pulled from FCFG1
255  uint8_t override_index; // Index in Override list to edit
256  uint8_t i; // Index used in loop
257 
258  // Check which setup command is used
259  switch (pOpSetup->commandNo)
260  {
262  overrideLists[0] = ((rfc_CMD_BLE5_RADIO_SETUP_t *)pOpSetup)->pRegOverrideCommon;
263  overrideLists[1] = ((rfc_CMD_BLE5_RADIO_SETUP_t *)pOpSetup)->pRegOverride1Mbps;
264  overrideLists[2] = ((rfc_CMD_BLE5_RADIO_SETUP_t *)pOpSetup)->pRegOverride2Mbps;
265  break;
266  case CMD_RADIO_SETUP:
269  default:
270  return 1;
271  }
272 
273  // Read FCFG1 value
274  fcfg1_value = (HWREG(FCFG1_BASE + FCFG1_O_CONFIG_RF_FRONTEND)
276 
277  // Walk through override lists and make the change
278  for (i = 0; i < 3; i++)
279  {
280  // If list is missing simply skip
281  if (overrideLists[i] != NULL)
282  {
283  override_index = RFCOverrideSearch(overrideLists[i], RFC_BLE5_OVERRIDE_PATTERN, 0xFFFFFFFF);
284 
285  // If specific override is missing in list then skip
286  if (override_index < RFC_MAX_SEARCH_DEPTH)
287  {
288  // Update override entry to FCFG1 limit value
289  (overrideLists[i])[override_index] = ((overrideLists[i])[override_index] & RFC_BLE5_OVERRIDE_M) | (fcfg1_value << RFC_BLE5_OVERRIDE_S);
290  }
291  }
292  }
293 
294  // Success
295  return 0;
296 }
#define RFC_BLE5_OVERRIDE_M
Definition: rfc.c:109
struct __RFC_STRUCT rfc_CMD_BLE5_RADIO_SETUP_s rfc_CMD_BLE5_RADIO_SETUP_t
Definition: rf_ble_cmd.h:73
#define CMD_PROP_RADIO_SETUP
Definition: rf_prop_cmd.h:447
#define CMD_PROP_RADIO_DIV_SETUP
Definition: rf_prop_cmd.h:546
#define RFC_BLE5_OVERRIDE_S
Definition: rfc.c:110
static uint8_t RFCOverrideSearch(const uint32_t *pOverride, const uint32_t pattern, const uint32_t mask)
Function to search top RFC_MAX_SEARCH_DEPTH (5) overrides.
Definition: rfc.h:353
#define CMD_BLE5_RADIO_SETUP
Definition: rf_ble_cmd.h:628
#define CMD_RADIO_SETUP
Definition: rf_common_cmd.h:164
#define RFC_MAX_SEARCH_DEPTH
Definition: rfc.h:81
#define RFC_BLE5_OVERRIDE_PATTERN
Definition: rfc.c:108

Here is the call graph for this function:

void RFCRfTrimRead ( rfc_radioOp_t pOpSetup,
rfTrim_t rfTrim 
)

Read RF trim from flash using CM3.

180 {
181  // Read trim from FCFG1
182  pRfTrim->configIfAdc = HWREG(FCFG1_BASE + FCFG1_O_CONFIG_IF_ADC);
183  pRfTrim->configRfFrontend = HWREG(FCFG1_BASE + FCFG1_O_CONFIG_RF_FRONTEND);
184  pRfTrim->configSynth = HWREG(FCFG1_BASE + FCFG1_O_CONFIG_SYNTH);
185  // Make sure configMiscAdc is not 0 by setting an unused bit to 1
186  pRfTrim->configMiscAdc = (HWREG(FCFG1_BASE + FCFG1_O_CONFIG_MISC_ADC)
188 }
#define CONFIG_MISC_ADC_DIVIDER_BM
Definition: rfc.c:83
#define CONFIG_MISC_ADC_DIVIDER
Definition: rfc.c:82
void RFCRfTrimSet ( rfTrim_t rfTrim)

Write preloaded RF trim values to CM0.

208 {
209  memcpy((void*)&HWREG(0x21000018), (void*)pRfTrim, sizeof(rfTrim_t));
210 }
Definition: rfc.h:73
void RFCRTrim ( rfc_radioOp_t pOpSetup)

Check Override RTrim vs FCFG RTrim.

197 {
198  // Function is left blank for compatibility reasons.
199 }
void RFCSynthPowerDown ( void  )

Turn off synth, NOTE: Radio will no longer respond to commands!

158 {
159  // Disable CPE clock, enable FSCA clock. NOTE: Radio will no longer respond to commands!
160  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = (HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) & ~RFC_PWR_PWMCLKEN_CPE_M) | RFC_PWR_PWMCLKEN_FSCA_M;
161 
162  HWREG(RFC_RESERVED0) = 3;
163  HWREG(RFC_RESERVED1) = 0x1030;
164  HWREG(RFC_RESERVED2) = 1;
165  HWREG(RFC_RESERVED1) = 0x50;
166  HWREG(RFC_RESERVED2) = 1;
167  HWREG(RFC_RESERVED1) = 0x650;
168  HWREG(RFC_RESERVED2) = 1;
169  HWREG(RFC_RESERVED3) = 1;
170 
171 }
#define RFC_RESERVED0
Definition: rfc.c:72
#define RFC_RESERVED3
Definition: rfc.c:75
#define RFC_RESERVED2
Definition: rfc.c:74
#define RFC_RESERVED1
Definition: rfc.c:73

Macro Definition Documentation

#define RFC_MAX_SEARCH_DEPTH   5