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 RFCCpeIntClear (uint32_t ui32Mask)
 Clear HW interrupt flags. More...
 
static void RFCHwIntClear (uint32_t ui32Mask)
 Clear CPE interrupt flags. More...
 
static void RFCCpe0IntSelect (uint32_t ui32Mask)
 Select interrupt sources to CPE0 (assign to INT_RFC_CPE_0 interrupt vector). More...
 
static void RFCCpe1IntSelect (uint32_t ui32Mask)
 Select interrupt sources to CPE1 (assign to INT_RFC_CPE_1 interrupt vector). More...
 
static void RFCCpeIntEnable (uint32_t ui32Mask)
 Enable CPEx interrupt sources. More...
 
static void RFCCpe0IntSelectClearEnable (uint32_t ui32Mask)
 Select, clear, and enable interrupt sources to CPE0. More...
 
static void RFCCpe1IntSelectClearEnable (uint32_t ui32Mask)
 Select, clear, and enable interrupt sources to CPE1. More...
 
static void RFCHwIntEnable (uint32_t ui32Mask)
 Enable HW interrupt sources. More...
 
static void RFCCpeIntDisable (uint32_t ui32Mask)
 Disable CPE interrupt sources. More...
 
static void RFCHwIntDisable (uint32_t ui32Mask)
 Disable HW interrupt sources. More...
 
uint32_t RFCCpeIntGetAndClear (uint32_t ui32Mask)
 Get and clear CPE interrupt flags. More...
 
static void RFCAckIntClear (void)
 Clear ACK interrupt flag. More...
 
uint32_t RFCDoorbellSendTo (uint32_t pOp)
 Send a radio operation to the doorbell and wait for an acknowledgment. More...
 
void RFCSynthPowerDown (void)
 This function implements a fast way to turn off the synthesizer. More...
 
void RFCCpePatchReset (void)
 Reset previously patched CPE RAM to a state where it can be patched again. More...
 
uint8_t RFCOverrideSearch (const uint32_t *pOverride, const uint32_t pattern, const uint32_t mask, const uint8_t searchDepth)
 
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...
 
void RFCRfTrimRead (rfc_radioOp_t *pOpSetup, rfTrim_t *rfTrim)
 Get the type of currently selected PA. More...
 
void RFCRfTrimSet (rfTrim_t *rfTrim)
 Write preloaded RF trim values directly into CPE. More...
 
uint8_t RFCRTrim (rfc_radioOp_t *pOpSetup)
 Check Override RTrim vs FCFG RTrim. More...
 
void RFCAdi3VcoLdoVoltageMode (bool bEnable)
 Function to set VCOLDO reference to voltage mode. More...
 

Detailed Description

Function Documentation

static void RFCAckIntClear ( void  )
inlinestatic

Clear ACK interrupt flag.

Referenced by RFCDoorbellSendTo().

321 {
322  // Clear any pending interrupts.
323  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG) = 0x0;
324 }
void RFCAdi3VcoLdoVoltageMode ( bool  bEnable)

Function to set VCOLDO reference to voltage mode.

349 {
350  // Function is left blank for compatibility reasons.
351 }
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 are safely gated. I.e. the RF core should be safely 'parked'.

Returns
None
155 {
156  // Disable all clocks
157  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = 0x0;
158 }
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
130 {
131  // Enable basic clocks to get the CPE run
132  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = RFC_PWR_PWMCLKEN_CPERAM
135 }
static void RFCCpe0IntSelect ( uint32_t  ui32Mask)
inlinestatic

Select interrupt sources to CPE0 (assign to INT_RFC_CPE_0 interrupt vector).

Referenced by RFCCpe0IntSelectClearEnable().

197 {
198  // Multiplex RF Core interrupts to CPE0 IRQ.
199  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEISL) &= ~ui32Mask;
200 }
static void RFCCpe0IntSelectClearEnable ( uint32_t  ui32Mask)
inlinestatic

Select, clear, and enable interrupt sources to CPE0.

236 {
237  // Multiplex RF Core interrupts to CPE0 IRQ.
238  RFCCpe0IntSelect(ui32Mask);
239 
240  // Clear the masked interrupts.
241  RFCCpeIntClear(ui32Mask);
242 
243  // Enable the masked interrupts.
244  RFCCpeIntEnable(ui32Mask);
245 }
static void RFCCpeIntClear(uint32_t ui32Mask)
Clear HW interrupt flags.
Definition: rfc.h:167
static void RFCCpeIntEnable(uint32_t ui32Mask)
Enable CPEx interrupt sources.
Definition: rfc.h:222
static void RFCCpe0IntSelect(uint32_t ui32Mask)
Select interrupt sources to CPE0 (assign to INT_RFC_CPE_0 interrupt vector).
Definition: rfc.h:196

Here is the call graph for this function:

static void RFCCpe1IntSelect ( uint32_t  ui32Mask)
inlinestatic

Select interrupt sources to CPE1 (assign to INT_RFC_CPE_1 interrupt vector).

Referenced by RFCCpe1IntSelectClearEnable().

210 {
211  // Multiplex RF Core interrupts to CPE1 IRQ.
212  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEISL) |= ui32Mask;
213 }
static void RFCCpe1IntSelectClearEnable ( uint32_t  ui32Mask)
inlinestatic

Select, clear, and enable interrupt sources to CPE1.

255 {
256  // Multiplex RF Core interrupts to CPE1 IRQ.
257  RFCCpe1IntSelect(ui32Mask);
258 
259  // Clear the masked interrupts.
260  RFCCpeIntClear(ui32Mask);
261 
262  // Enable the masked interrupts.
263  RFCCpeIntEnable(ui32Mask);
264 }
static void RFCCpe1IntSelect(uint32_t ui32Mask)
Select interrupt sources to CPE1 (assign to INT_RFC_CPE_1 interrupt vector).
Definition: rfc.h:209
static void RFCCpeIntClear(uint32_t ui32Mask)
Clear HW interrupt flags.
Definition: rfc.h:167
static void RFCCpeIntEnable(uint32_t ui32Mask)
Enable CPEx interrupt sources.
Definition: rfc.h:222

Here is the call graph for this function:

static void RFCCpeIntClear ( uint32_t  ui32Mask)
inlinestatic

Clear HW interrupt flags.

Referenced by RFCCpe0IntSelectClearEnable(), RFCCpe1IntSelectClearEnable(), and RFCCpeIntGetAndClear().

168 {
169  // Clear the masked pending interrupts.
170  do
171  {
172  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIFG) = ~ui32Mask;
173  }while(HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIFG) & ui32Mask);
174 }
static void RFCCpeIntDisable ( uint32_t  ui32Mask)
inlinestatic

Disable CPE interrupt sources.

287 {
288  // Disable the masked interrupts
289  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIEN) &= ~ui32Mask;
290 }
static void RFCCpeIntEnable ( uint32_t  ui32Mask)
inlinestatic

Enable CPEx interrupt sources.

Referenced by RFCCpe0IntSelectClearEnable(), and RFCCpe1IntSelectClearEnable().

223 {
224  // Enable CPE interrupts from RF Core.
225  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIEN) |= ui32Mask;
226 }
uint32_t RFCCpeIntGetAndClear ( uint32_t  ui32Mask)

Get and clear CPE interrupt flags.

113 {
114  // Read the CPE interrupt flags which match the provided bitmask
115  uint32_t ui32Ifg = HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFCPEIFG) & ui32Mask;
116 
117  // Clear the interrupt flags
118  RFCCpeIntClear(ui32Ifg);
119 
120  // Return with the interrupt flags
121  return (ui32Ifg);
122 }
static void RFCCpeIntClear(uint32_t ui32Mask)
Clear HW interrupt flags.
Definition: rfc.h:167

Here is the call graph for this function:

void RFCCpePatchReset ( void  )

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

185 {
186  uint8_t *pPatchTab = (uint8_t *) (_CPERAM_START + _PARSER_PATCH_TAB_OFFSET);
187  uint32_t *pIrqPatch = (uint32_t *)(_CPERAM_START + _IRQPATCH_OFFSET);
188 
189  memset(pPatchTab, 0xFF, _IRQPATCH_OFFSET - _PARSER_PATCH_TAB_OFFSET);
190 
191  int i;
192  for (i = 0; i < sizeof(rfc_defaultIrqAddr)/sizeof(rfc_defaultIrqAddr[0]); i++)
193  {
194  pIrqPatch[i * 2 + 1] = rfc_defaultIrqAddr[i];
195  }
196 
197 }
static const uint16_t rfc_defaultIrqAddr[]
Definition: rfc.c:85
#define _IRQPATCH_OFFSET
Definition: rfc.c:78
#define _CPERAM_START
Definition: rfc.c:75
#define _PARSER_PATCH_TAB_OFFSET
Definition: rfc.c:76
uint32_t RFCDoorbellSendTo ( uint32_t  pOp)

Send a radio operation to the doorbell and wait for an acknowledgment.

132 {
133  // Wait until the doorbell becomes available
134  while(HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) != 0);
135  RFCAckIntClear();
136 
137  // Submit the command to the CM0 through the doorbell
138  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = pOp;
139 
140  // Wait until the CM0 starts to parse the command
141  while(!HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFACKIFG));
142  RFCAckIntClear();
143 
144  // Return with the content of status register
145  return(HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDSTA));
146 }
static void RFCAckIntClear(void)
Clear ACK interrupt flag.
Definition: rfc.h:320

Here is the call graph for this function:

static void RFCHwIntClear ( uint32_t  ui32Mask)
inlinestatic

Clear CPE interrupt flags.

Referenced by RFCHwIntGetAndClear().

184 {
185  // Clear the masked pending interrupts.
186  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIFG) = ~ui32Mask;
187 }
static void RFCHwIntDisable ( uint32_t  ui32Mask)
inlinestatic

Disable HW interrupt sources.

300 {
301  // Disable the masked interrupts
302  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIEN) &= ~ui32Mask;
303 }
static void RFCHwIntEnable ( uint32_t  ui32Mask)
inlinestatic

Enable HW interrupt sources.

274 {
275  // Enable the masked interrupts
276  HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIEN) |= ui32Mask;
277 }
uint32_t RFCHwIntGetAndClear ( uint32_t  ui32Mask)

Get and clear HW interrupt flags.

287 {
288  // Read the CPE interrupt flags which match the provided bitmask
289  uint32_t ui32Ifg = HWREG(RFC_DBELL_BASE + RFC_DBELL_O_RFHWIFG) & ui32Mask;
290 
291  // Clear the interupt flags
292  RFCHwIntClear(ui32Ifg);
293 
294  // Return with the interrupt flags
295  return (ui32Ifg);
296 }
static void RFCHwIntClear(uint32_t ui32Mask)
Clear CPE interrupt flags.
Definition: rfc.h:183

Here is the call graph for this function:

uint8_t RFCOverrideSearch ( const uint32_t *  pOverride,
const uint32_t  pattern,
const uint32_t  mask,
const uint8_t  searchDepth 
)

Referenced by RFCOverrideUpdate().

207 {
208  // Search from start of the override list, to look for first override entry that matches search pattern
209  uint8_t override_index;
210  for(override_index = 0; (override_index < searchDepth) && (pOverride[override_index] != END_OVERRIDE); override_index++)
211  {
212  // Compare the value to the given pattern
213  if((pOverride[override_index] & mask) == pattern)
214  {
215  // Return with the index of override in case of match
216  return override_index;
217  }
218  }
219 
220  // Return with an invalid index
221  return 0xFF;
222 }
#define END_OVERRIDE
End of string for override register.
Definition: rf_mailbox.h:325
uint8_t RFCOverrideUpdate ( rfc_radioOp_t pOpSetup,
uint32_t *  pParams 
)

Function to update override list.

231 {
232  uint32_t* overrideLists[3]; // [0] pRegOverrideCommon;
233  // [1] pRegOverride1Mbps;
234  // [2] pRegOverride2Mbps;
235  uint32_t fcfg1_value; // Value pulled from FCFG1
236  uint8_t override_index; // Index in Override list to edit
237  uint8_t i; // Index used in loop
238 
239  // Based on the type of setup command, decode the override list
240  switch (pOpSetup->commandNo)
241  {
243  overrideLists[0] = ((rfc_CMD_BLE5_RADIO_SETUP_t *)pOpSetup)->pRegOverrideCommon;
244  overrideLists[1] = ((rfc_CMD_BLE5_RADIO_SETUP_t *)pOpSetup)->pRegOverride1Mbps;
245  overrideLists[2] = ((rfc_CMD_BLE5_RADIO_SETUP_t *)pOpSetup)->pRegOverride2Mbps;
246  break;
247  case CMD_RADIO_SETUP:
250  default:
251  return 1;
252  }
253 
254  // Read FCFG1 value
255  fcfg1_value = (HWREG(FCFG1_BASE + FCFG1_O_CONFIG_RF_FRONTEND)
257 
258  // Search for a specific entry within three override lists
259  for (i = 0; i < 3; i++)
260  {
261  // If list is missing simply skip it
262  if (overrideLists[i] != NULL)
263  {
264  override_index = RFCOverrideSearch(overrideLists[i], RFC_BLE5_OVERRIDE_PATTERN, 0xFFFFFFFF, RFC_MAX_SEARCH_DEPTH);
265 
266  // Skip if the specific override is not present in the list
267  if (override_index < RFC_MAX_SEARCH_DEPTH)
268  {
269  // Update override entry to FCFG1 limit value
270  (overrideLists[i])[override_index] = ((overrideLists[i])[override_index] & RFC_BLE5_OVERRIDE_M) | (fcfg1_value << RFC_BLE5_OVERRIDE_S);
271  }
272  }
273  }
274 
275  // Success
276  return 0;
277 }
#define RFC_BLE5_OVERRIDE_M
Definition: rfc.c:103
struct __RFC_STRUCT rfc_CMD_BLE5_RADIO_SETUP_s rfc_CMD_BLE5_RADIO_SETUP_t
Definition: rf_ble_cmd.h:79
#define CMD_PROP_RADIO_SETUP
Definition: rf_prop_cmd.h:453
#define CMD_PROP_RADIO_DIV_SETUP
Definition: rf_prop_cmd.h:557
#define RFC_BLE5_OVERRIDE_S
Definition: rfc.c:104
#define CMD_BLE5_RADIO_SETUP
Definition: rf_ble_cmd.h:637
uint8_t RFCOverrideSearch(const uint32_t *pOverride, const uint32_t pattern, const uint32_t mask, const uint8_t searchDepth)
Definition: rfc.c:206
#define CMD_RADIO_SETUP
Definition: rf_common_cmd.h:170
#define RFC_MAX_SEARCH_DEPTH
Definition: rfc.h:82
#define RFC_BLE5_OVERRIDE_PATTERN
Definition: rfc.c:102

Here is the call graph for this function:

void RFCRfTrimRead ( rfc_radioOp_t pOpSetup,
rfTrim_t rfTrim 
)

Get the type of currently selected PA.

Read RF trim from flash using CM3.

305 {
306  // Definition of position and bitmask of divider value
307  const uint32_t CONFIG_MISC_ADC_DIVIDER = 27;
308  const uint32_t CONFIG_MISC_ADC_DIVIDER_BM = 0xF8000000U;
309 
310  // Read trim values from FCFG1
311  pRfTrim->configIfAdc = HWREG(FCFG1_BASE + FCFG1_O_CONFIG_IF_ADC);
312  pRfTrim->configRfFrontend = HWREG(FCFG1_BASE + FCFG1_O_CONFIG_RF_FRONTEND);
313  pRfTrim->configSynth = HWREG(FCFG1_BASE + FCFG1_O_CONFIG_SYNTH);
314  // Make sure configMiscAdc is not 0 by setting an unused bit to 1
315  pRfTrim->configMiscAdc = (HWREG(FCFG1_BASE + FCFG1_O_CONFIG_MISC_ADC)
316  & ~CONFIG_MISC_ADC_DIVIDER_BM) | (2U << CONFIG_MISC_ADC_DIVIDER);
317 }
void RFCRfTrimSet ( rfTrim_t rfTrim)

Write preloaded RF trim values directly into CPE.

326 {
327  memcpy((void*)&HWREG(0x21000018), (void*)pRfTrim, sizeof(rfTrim_t));
328 }
Definition: rfc.h:74
uint8_t RFCRTrim ( rfc_radioOp_t pOpSetup)

Check Override RTrim vs FCFG RTrim.

337 {
338  // Function is left blank for compatibility reasons.
339  return 0;
340 }
void RFCSynthPowerDown ( void  )

This function implements a fast way to turn off the synthesizer.

156 {
157  // Definition of reserved words
158  const uint32_t RFC_RESERVED0 = 0x40044108;
159  const uint32_t RFC_RESERVED1 = 0x40044114;
160  const uint32_t RFC_RESERVED2 = 0x4004410C;
161  const uint32_t RFC_RESERVED3 = 0x40044100;
162 
163  // Disable CPE clock, enable FSCA clock.
164  HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN) = (HWREG(RFC_PWR_NONBUF_BASE + RFC_PWR_O_PWMCLKEN)
166 
167  HWREG(RFC_RESERVED0) = 3;
168  HWREG(RFC_RESERVED1) = 0x1030;
169  HWREG(RFC_RESERVED2) = 1;
170  HWREG(RFC_RESERVED1) = 0x50;
171  HWREG(RFC_RESERVED2) = 1;
172  HWREG(RFC_RESERVED1) = 0x650;
173  HWREG(RFC_RESERVED2) = 1;
174  HWREG(RFC_RESERVED3) = 1;
175 
176 }

Macro Definition Documentation

#define RFC_MAX_SEARCH_DEPTH   5

Referenced by RFCOverrideUpdate().