Radio Control Layer (RCL)
LRFCC23X0.c File Reference
#include <stdint.h>
#include <stdlib.h>
#include <ti/drivers/rcl/LRF.h>
#include <ti/drivers/rcl/RCL_Scheduler.h>
#include <ti/drivers/rcl/RCL_Command.h>
#include <ti/log/Log.h>
#include <ti/drivers/dpl/HwiP.h>
#include <ti/devices/DeviceFamily.h>
+ Include dependency graph for LRFCC23X0.c:

Macros

#define LRF_REFSYS_ENABLE_TIME   RCL_SCHEDULER_SYSTIM_US(30)
 
#define LRF_EXTTRIM1_TEMPERATURE_SCALE_EXP   4U
 
#define LRF_DIVLDO_LOW_TEMP_ADJ_FACTOR   10U
 
#define LRF_DIVLDO_HIGH_TEMP_ADJ_FACTOR   10U
 
#define LRF_TDCLDO_LOW_TEMP_ADJ_FACTOR   10U
 
#define LRF_TDCLDO_HIGH_TEMP_ADJ_FACTOR   10U
 
#define LRF_RTRIM_LOW_TEMP_ADJ_FACTOR   1U
 
#define LRF_RTRIM_HIGH_TEMP_ADJ_FACTOR   1U
 
#define LRF_DEFAULT_RTRIM_MAX   12U
 
#define LRF_EXTTRIM0_TEMPERATURE_SCALE_EXP   7
 
#define LRF_TEMPERATURE_MIN   (-40)
 
#define LRF_TEMPERATURE_MAX   125
 
#define LRF_TEMPERATURE_NOM   25
 
#define RFE_SPARE0_LOW_GAIN_BM   0x000F
 
#define RFE_SPARE0_LOW_GAIN   0
 
#define RFE_SPARE0_HIGH_GAIN_BM   0x00F0
 
#define RFE_SPARE0_HIGH_GAIN   4
 
#define RFE_SPARE1_AGC_VALUE_BM   0x000FF
 
#define RFE_SPARE1_AGC_VALUE   0
 
#define LRF_ONE_THIRD_MANTISSA   21845U /* (round(1/3 * 2^16)) */
 
#define LRF_ONE_THIRD_NEG_EXP   16
 
#define FXTALINVL   0x00001E52U
 
#define FXTALINVH   0x02CBD3F0U
 
#define NUM_TX_FILTER_TAPS   24
 
#define P_FACTOR   9
 
#define P_SHIFT   4
 
#define Q_MAGN_SHIFT   6
 
#define FRAC_NUM_BITS   28
 
#define FRAC_EXTRA_BITS   (32 - FRAC_NUM_BITS)
 
#define RFE_PA0_IB_MIN_USED   1
 

Functions

static uint32_t LRF_findPllMBase (uint32_t frequency)
 
static uint32_t countLeadingZeros (uint16_t value)
 
static uint32_t LRF_findCalM (uint32_t frequency, uint32_t prediv)
 
static uint32_t LRF_findFoff (int32_t frequencyOffset, uint32_t invSynthFreq)
 
static void LRF_programShape (const LRF_TxShape *txShape, uint32_t deviation, uint32_t invSynthFreq)
 
static uint32_t LRF_findLog2Bde1 (uint32_t demmisc3)
 
static uint32_t LRF_programPQ (uint32_t pllMBase)
 
static void LRF_programCMixN (int32_t rxIntFrequency, uint32_t invSynthFreq)
 
static void LRF_applyTrim (const LRF_TrimDef *trimDef, const LRF_SwConfig *swConfig)
 
static void LRF_updateTrim (const LRF_TrimDef *trimDef, const LRF_SwConfig *swConfig)
 
static void LRF_setTrimCommon (const LRF_TrimDef *trimDef, const LRF_SwConfig *swConfig)
 
static void LRF_setTemperatureTrim (const LRF_TrimDef *trimDef)
 
static void LRF_temperatureCompensateTrim (const LRF_TrimDef *trimDef)
 
static uint32_t LRF_findExtTrim1TrimAdjustment (uint32_t temperatureDiff, uint32_t tempThreshFactor, uint32_t maxAdjustment)
 
static int32_t LRF_findExtTrim0TrimAdjustment (int32_t temperature, int32_t tempCompFactor, int32_t offset)
 
static uint32_t LRF_scaleFreqWithHFXTOffset (uint32_t frequency)
 
static void LRF_writeFifoPtr (uint32_t value, uintptr_t regAddr)
 
static void LRF_writeFifoPtrs (uint32_t value, uintptr_t regAddr0, uintptr_t regAddr1)
 
LRF_SetupResult LRF_setupRadio (const LRF_Config *lrfConfig, uint16_t phyFeatures, LRF_RadioState lrfState)
 
bool LRF_imagesNeedUpdate (const LRF_Config *lrfConfig)
 
void LRF_enable (void)
 
void LRF_disable (void)
 
void LRF_waitForTopsmReady (void)
 
uint32_t LRF_prepareRxFifo (void)
 
uint32_t LRF_prepareTxFifo (void)
 
uint32_t LRF_peekRxFifo (int32_t offset)
 
uint32_t LRF_peekTxFifo (int32_t offset)
 
uint8_t * LRF_getTxFifoWrAddr (int32_t offset)
 
void LRF_skipTxFifoWords (uint32_t wordLength)
 
void LRF_discardRxFifoWords (uint32_t wordLength)
 
void LRF_readRxFifoWords (uint32_t *data32, uint32_t wordLength)
 
void LRF_writeTxFifoWords (const uint32_t *data32, uint32_t wordLength)
 
void LRF_setRxFifoEffSz (uint32_t maxSz)
 
void LRF_programFrequency (uint32_t frequency, bool tx)
 
uint32_t LRF_enableSynthRefsys (void)
 
void LRF_disableSynthRefsys (void)
 
void LRF_rclEnableRadioClocks (void)
 
void LRF_rclDisableRadioClocks (void)
 
int8_t LRF_readRssi (void)
 
void LRF_setRawTxPower (uint32_t value, uint32_t temperatureCoefficient)
 
LRF_TxPowerTable_Entry LRF_getRawTxPower (void)
 
void LRF_programTemperatureCompensatedTxPower (void)
 Programs current TX power setting in radio with temperature compensation. More...
 
LRF_TxPowerResult LRF_programTxPower (LRF_TxPowerTable_Index powerLevel)
 Finds settings corresponding to the highest tx power lower than the specified value in the tx power table and programs it in the radio. More...
 

Variables

uint32_t swParamList [sizeof(LRF_SwParam)/sizeof(uint32_t)]
 
const size_t swParamListSz = sizeof(LRF_SwParam)
 
struct {
const LRF_TOPsmImage * pbeLoaded
 
const LRF_TOPsmImage * mceLoaded
 
const LRF_TOPsmImage * rfeLoaded
 
uint16_t phyFeatures
 
LRF_TxPowerTable_Entry currentTxPower
 
LRF_TxPowerTable_Entry rawTxPower
 
lrfPhyState = {0}
 
static bool rxFifoDeallocated = true
 
LRF_DoubleWord fXtalInv
 

Macro Definition Documentation

§ LRF_REFSYS_ENABLE_TIME

#define LRF_REFSYS_ENABLE_TIME   RCL_SCHEDULER_SYSTIM_US(30)

Referenced by LRF_enableSynthRefsys().

§ LRF_EXTTRIM1_TEMPERATURE_SCALE_EXP

#define LRF_EXTTRIM1_TEMPERATURE_SCALE_EXP   4U

§ LRF_DIVLDO_LOW_TEMP_ADJ_FACTOR

#define LRF_DIVLDO_LOW_TEMP_ADJ_FACTOR   10U

§ LRF_DIVLDO_HIGH_TEMP_ADJ_FACTOR

#define LRF_DIVLDO_HIGH_TEMP_ADJ_FACTOR   10U

§ LRF_TDCLDO_LOW_TEMP_ADJ_FACTOR

#define LRF_TDCLDO_LOW_TEMP_ADJ_FACTOR   10U

§ LRF_TDCLDO_HIGH_TEMP_ADJ_FACTOR

#define LRF_TDCLDO_HIGH_TEMP_ADJ_FACTOR   10U

§ LRF_RTRIM_LOW_TEMP_ADJ_FACTOR

#define LRF_RTRIM_LOW_TEMP_ADJ_FACTOR   1U

§ LRF_RTRIM_HIGH_TEMP_ADJ_FACTOR

#define LRF_RTRIM_HIGH_TEMP_ADJ_FACTOR   1U

§ LRF_DEFAULT_RTRIM_MAX

#define LRF_DEFAULT_RTRIM_MAX   12U

§ LRF_EXTTRIM0_TEMPERATURE_SCALE_EXP

#define LRF_EXTTRIM0_TEMPERATURE_SCALE_EXP   7

§ LRF_TEMPERATURE_MIN

#define LRF_TEMPERATURE_MIN   (-40)

§ LRF_TEMPERATURE_MAX

#define LRF_TEMPERATURE_MAX   125

§ LRF_TEMPERATURE_NOM

#define LRF_TEMPERATURE_NOM   25

§ RFE_SPARE0_LOW_GAIN_BM

#define RFE_SPARE0_LOW_GAIN_BM   0x000F

§ RFE_SPARE0_LOW_GAIN

#define RFE_SPARE0_LOW_GAIN   0

§ RFE_SPARE0_HIGH_GAIN_BM

#define RFE_SPARE0_HIGH_GAIN_BM   0x00F0

§ RFE_SPARE0_HIGH_GAIN

#define RFE_SPARE0_HIGH_GAIN   4

§ RFE_SPARE1_AGC_VALUE_BM

#define RFE_SPARE1_AGC_VALUE_BM   0x000FF

§ RFE_SPARE1_AGC_VALUE

#define RFE_SPARE1_AGC_VALUE   0

§ LRF_ONE_THIRD_MANTISSA

#define LRF_ONE_THIRD_MANTISSA   21845U /* (round(1/3 * 2^16)) */

§ LRF_ONE_THIRD_NEG_EXP

#define LRF_ONE_THIRD_NEG_EXP   16

§ FXTALINVL

#define FXTALINVL   0x00001E52U

§ FXTALINVH

#define FXTALINVH   0x02CBD3F0U

§ NUM_TX_FILTER_TAPS

#define NUM_TX_FILTER_TAPS   24

Referenced by LRF_programShape().

§ P_FACTOR

#define P_FACTOR   9

Referenced by LRF_programPQ().

§ P_SHIFT

#define P_SHIFT   4

Referenced by LRF_programPQ().

§ Q_MAGN_SHIFT

#define Q_MAGN_SHIFT   6

Referenced by LRF_programPQ().

§ FRAC_NUM_BITS

#define FRAC_NUM_BITS   28

§ FRAC_EXTRA_BITS

#define FRAC_EXTRA_BITS   (32 - FRAC_NUM_BITS)

Referenced by LRF_programPQ().

§ RFE_PA0_IB_MIN_USED

#define RFE_PA0_IB_MIN_USED   1

Function Documentation

§ LRF_findPllMBase()

static uint32_t LRF_findPllMBase ( uint32_t  frequency)
static

References LRF_DoubleWord::word.

Referenced by LRF_programFrequency().

§ countLeadingZeros()

static uint32_t countLeadingZeros ( uint16_t  value)
static

Referenced by LRF_programPQ(), and LRF_programShape().

§ LRF_findCalM()

static uint32_t LRF_findCalM ( uint32_t  frequency,
uint32_t  prediv 
)
static

References LRF_DoubleWord::word.

Referenced by LRF_programFrequency().

§ LRF_findFoff()

static uint32_t LRF_findFoff ( int32_t  frequencyOffset,
uint32_t  invSynthFreq 
)
static

Referenced by LRF_programFrequency().

§ LRF_programShape()

static void LRF_programShape ( const LRF_TxShape txShape,
uint32_t  deviation,
uint32_t  invSynthFreq 
)
static

§ LRF_findLog2Bde1()

static uint32_t LRF_findLog2Bde1 ( uint32_t  demmisc3)
static

Referenced by LRF_programCMixN(), and LRF_programPQ().

§ LRF_programPQ()

static uint32_t LRF_programPQ ( uint32_t  pllMBase)
static

§ LRF_programCMixN()

static void LRF_programCMixN ( int32_t  rxIntFrequency,
uint32_t  invSynthFreq 
)
static

References LRF_findLog2Bde1().

Referenced by LRF_programFrequency().

§ LRF_applyTrim()

§ LRF_updateTrim()

static void LRF_updateTrim ( const LRF_TrimDef trimDef,
const LRF_SwConfig swConfig 
)
static

§ LRF_setTrimCommon()

static void LRF_setTrimCommon ( const LRF_TrimDef trimDef,
const LRF_SwConfig swConfig 
)
static

§ LRF_setTemperatureTrim()

static void LRF_setTemperatureTrim ( const LRF_TrimDef trimDef)
static

§ LRF_temperatureCompensateTrim()

§ LRF_findExtTrim1TrimAdjustment()

static uint32_t LRF_findExtTrim1TrimAdjustment ( uint32_t  temperatureDiff,
uint32_t  tempThreshFactor,
uint32_t  maxAdjustment 
)
static

§ LRF_findExtTrim0TrimAdjustment()

static int32_t LRF_findExtTrim0TrimAdjustment ( int32_t  temperature,
int32_t  tempCompFactor,
int32_t  offset 
)
static

§ LRF_scaleFreqWithHFXTOffset()

static uint32_t LRF_scaleFreqWithHFXTOffset ( uint32_t  frequency)
static

§ LRF_writeFifoPtr()

static void LRF_writeFifoPtr ( uint32_t  value,
uintptr_t  regAddr 
)
static

§ LRF_writeFifoPtrs()

static void LRF_writeFifoPtrs ( uint32_t  value,
uintptr_t  regAddr0,
uintptr_t  regAddr1 
)
static

Referenced by LRF_discardRxFifoWords().

§ LRF_setupRadio()

§ LRF_imagesNeedUpdate()

bool LRF_imagesNeedUpdate ( const LRF_Config lrfConfig)

§ LRF_enable()

§ LRF_disable()

§ LRF_waitForTopsmReady()

§ LRF_prepareRxFifo()

§ LRF_prepareTxFifo()

§ LRF_peekRxFifo()

§ LRF_peekTxFifo()

uint32_t LRF_peekTxFifo ( int32_t  offset)

Referenced by LRF_resetSettingsState().

§ LRF_getTxFifoWrAddr()

§ LRF_skipTxFifoWords()

void LRF_skipTxFifoWords ( uint32_t  wordLength)

§ LRF_discardRxFifoWords()

void LRF_discardRxFifoWords ( uint32_t  wordLength)

§ LRF_readRxFifoWords()

§ LRF_writeTxFifoWords()

void LRF_writeTxFifoWords ( const uint32_t *  data32,
uint32_t  wordLength 
)

§ LRF_setRxFifoEffSz()

§ LRF_programFrequency()

§ LRF_enableSynthRefsys()

§ LRF_disableSynthRefsys()

§ LRF_rclEnableRadioClocks()

void LRF_rclEnableRadioClocks ( void  )

§ LRF_rclDisableRadioClocks()

void LRF_rclDisableRadioClocks ( void  )

§ LRF_readRssi()

int8_t LRF_readRssi ( void  )

§ LRF_setRawTxPower()

void LRF_setRawTxPower ( uint32_t  value,
uint32_t  temperatureCoefficient 
)

§ LRF_getRawTxPower()

§ LRF_programTemperatureCompensatedTxPower()

void LRF_programTemperatureCompensatedTxPower ( void  )

§ LRF_programTxPower()

LRF_TxPowerResult LRF_programTxPower ( LRF_TxPowerTable_Index  powerLevel)

Finds settings corresponding to the highest tx power lower than the specified value in the tx power table and programs it in the radio.

Parameters
powerLevelmaximum allowed power level in dBm, or special value (LRF_TxPower_Use_Min, LRF_TxPower_Use_Max, LRF_TxPower_Use_Raw, or LRF_TxPower_None)
Returns
TxPowerResult_Ok on success; TxPowerResult_Error if no valid settings were found

References LRF_programTemperatureCompensatedTxPower(), LRF_TxPower_None, LRF_TxPowerTable_findValue(), LRF_TxPowerTable_INVALID_VALUE, lrfPhyState, LRF_TxPowerTable_Value::rawValue, LRF_TxPowerTable_Index::rawValue, swParamList, TxPowerResult_Error, TxPowerResult_Ok, LRF_SwParam::txPowerTable, and LRF_TxPowerTable_Entry::value.

Referenced by LRF_getTxFifoWritable(), RCL_Handler_BLE5_adv(), RCL_Handler_BLE5_aux_adv(), RCL_Handler_BLE5_conn(), RCL_Handler_BLE5_dtmTx(), RCL_Handler_BLE5_genericTx(), RCL_Handler_BLE5_scan_init(), RCL_Handler_Ble5_txTest(), RCL_Handler_Generic_Tx(), RCL_Handler_Generic_TxRepeat(), RCL_Handler_Generic_TxTest(), RCL_Handler_Ieee_RxTx(), RCL_Handler_Ieee_TxTest(), RCL_Handler_Nesb_Prx(), and RCL_Handler_Nesb_Ptx().

Variable Documentation

§ swParamList

uint32_t swParamList[sizeof(LRF_SwParam)/sizeof(uint32_t)]

§ swParamListSz

const size_t swParamListSz = sizeof(LRF_SwParam)

§ lrfPhyState

§ rxFifoDeallocated

bool rxFifoDeallocated = true
static

§ fXtalInv

LRF_DoubleWord fXtalInv
Initial value:
=
{
.word = {FXTALINVL, FXTALINVH},
}
#define FXTALINVL
Definition: LRFCC23X0.c:927
#define FXTALINVH
Definition: LRFCC23X0.c:928