Added support for the WNC M14A2A Cellular LTE Data Module.

Dependencies:   WNC14A2AInterface

Embed: (wiki syntax)

« Back to documentation index

SPIRIT_Radio.c File Reference

SPIRIT_Radio.c File Reference

This file provides all the low level API to manage Analog and Digital radio part of SPIRIT. More...

Go to the source code of this file.

Functions

uint8_t SpiritRadioInit (SRadioInit *pxSRadioInitStruct)
 Initializes the SPIRIT analog and digital radio part according to the specified parameters in the pxSRadioInitStruct.
void SpiritRadioGetInfo (SRadioInit *pxSRadioInitStruct)
 Returns the SPIRIT analog and digital radio structure according to the registers value.
void SpiritRadioSetXtalFlag (XtalFlag xXtal)
 Sets the Xtal configuration in the ANA_FUNC_CONF0 register.
XtalFlag SpiritRadioGetXtalFlag (void)
 Returns the Xtal configuration in the ANA_FUNC_CONF0 register.
uint8_t SpiritRadioSearchWCP (uint32_t lFc)
 Returns the charge pump word for a given VCO frequency.
uint32_t SpiritRadioGetSynthWord (void)
 Returns the synth word.
void SpiritRadioSetSynthWord (uint32_t lSynthWord)
 Sets the SYNTH registers.
void SpiritRadioSetBand (BandSelect xBand)
 Sets the operating band.
BandSelect SpiritRadioGetBand (void)
 Returns the operating band.
void SpiritRadioSetChannel (uint8_t cChannel)
 Sets the channel number.
uint8_t SpiritRadioGetChannel (void)
 Returns the actual channel number.
void SpiritRadioSetChannelSpace (uint32_t fChannelSpace)
 Sets the channel space factor in channel space register.
uint32_t SpiritRadioGetChannelSpace (void)
 Returns the channel space register.
void SpiritRadioSetFrequencyOffsetPpm (int16_t nXtalPpm)
 Sets the FC OFFSET register starting from xtal ppm value.
void SpiritRadioSetFrequencyOffset (int32_t lFOffset)
 Sets the FC OFFSET register starting from frequency offset expressed in Hz.
int32_t SpiritRadioGetFrequencyOffset (void)
 Returns the actual frequency offset.
uint8_t SpiritRadioSetFrequencyBase (uint32_t lFBase)
 Sets the Synth word and the Band Select register according to desired base carrier frequency.
void SpiritRadioVcoCalibrationWAFB (SpiritFunctionalState xNewstate)
 To say to the set frequency base if do or not the VCO calibration WA.
uint32_t SpiritRadioGetFrequencyBase (void)
 Returns the base carrier frequency.
uint32_t SpiritRadioGetCenterFrequency (void)
 Returns the actual channel center frequency.
void SpiritRadioSearchDatarateME (uint32_t lDatarate, uint8_t *pcM, uint8_t *pcE)
 Returns the mantissa and exponent, whose value used in the datarate formula will give the datarate value closer to the given datarate.
void SpiritRadioSearchChannelBwME (uint32_t lBandwidth, uint8_t *pcM, uint8_t *pcE)
 Returns the mantissa and exponent for a given bandwidth.
void SpiritRadioSearchFreqDevME (uint32_t lFDev, uint8_t *pcM, uint8_t *pcE)
 Returns the mantissa and exponent, whose value used in the frequency deviation formula will give a frequency deviation value most closer to the given frequency deviation.
void SpiritRadioSetDatarate (uint32_t lDatarate)
 Sets the datarate.
uint32_t SpiritRadioGetDatarate (void)
 Returns the datarate.
void SpiritRadioSetFrequencyDev (uint32_t lFDev)
 Sets the frequency deviation.
uint32_t SpiritRadioGetFrequencyDev (void)
 Returns the frequency deviation.
void SpiritRadioSetChannelBW (uint32_t lBandwidth)
 Sets the channel filter bandwidth.
uint32_t SpiritRadioGetChannelBW (void)
 Returns the channel filter bandwidth.
void SpiritRadioSetModulation (ModulationSelect xModulation)
 Sets the modulation type.
ModulationSelect SpiritRadioGetModulation (void)
 Returns the modulation type used.
void SpiritRadioCWTransmitMode (SpiritFunctionalState xNewState)
 Enables or Disables the Continuous Wave transmit mode.
void SpiritRadioSetOokPeakDecay (OokPeakDecay xOokDecay)
 Sets the OOK Peak Decay.
OokPeakDecay SpiritRadioGetOokPeakDecay (void)
 Returns the OOK Peak Decay.
uint8_t SpiritRadioGetdBm2Reg (uint32_t lFBase, float fPowerdBm)
 Returns the PA register value that corresponds to the passed dBm power.
float SpiritRadioGetReg2dBm (uint32_t lFBase, uint8_t cPowerReg)
 Returns the dBm power that corresponds to the value of PA register.
void SpiritRadioSetPATabledBm (uint8_t cPALevelMaxIndex, uint8_t cWidth, PALoadCapacitor xCLoad, float *pfPAtabledBm)
 Configures the Power Amplifier Table and registers with value expressed in dBm.
void SpiritRadioGetPATabledBm (uint8_t *pcPALevelMaxIndex, float *pfPAtabledBm)
 Returns the Power Amplifier Table and registers, returning values in dBm.
void SpiritRadioSetPALeveldBm (uint8_t cIndex, float fPowerdBm)
 Sets a specific PA_LEVEL register, with a value given in dBm.
float SpiritRadioGetPALeveldBm (uint8_t cIndex)
 Returns a specific PA_LEVEL register, returning a value in dBm.
void SpiritRadioSetPATable (uint8_t cPALevelMaxIndex, uint8_t cWidth, PALoadCapacitor xCLoad, uint8_t *pcPAtable)
 Configures the Power Amplifier Table and registers.
void SpiritRadioGetPATable (uint8_t *pcPALevelMaxIndex, uint8_t *pcPAtable)
 Returns the Power Amplifier Table and registers.
void SpiritRadioSetPALevel (uint8_t cIndex, uint8_t cPower)
 Sets a specific PA_LEVEL register.
uint8_t SpiritRadioGetPALevel (uint8_t cIndex)
 Returns a specific PA_LEVEL register.
void SpiritRadioSetPACwc (PALoadCapacitor xCLoad)
 Sets the output stage additional load capacitor bank.
PALoadCapacitor SpiritRadioGetPACwc (void)
 Returns the output stage additional load capacitor bank.
void SpiritRadioSetPALevelMaxIndex (uint8_t cIndex)
 Sets a specific PA_LEVEL_MAX_INDEX.
uint8_t SpiritRadioGetPALevelMaxIndex (void)
 Returns the actual PA_LEVEL_MAX_INDEX.
void SpiritRadioSetPAStepWidth (uint8_t cWidth)
 Sets a specific PA_RAMP_STEP_WIDTH.
uint8_t SpiritRadioGetPAStepWidth (void)
 Returns the actual PA_RAMP_STEP_WIDTH.
void SpiritRadioPARamping (SpiritFunctionalState xNewState)
 Enables or Disables the Power Ramping.
SpiritFunctionalState SpiritRadioGetPARamping (void)
 Returns the Power Ramping enable bit.
void SpiritRadioAFC (SpiritFunctionalState xNewState)
 Enables or Disables the AFC.
void SpiritRadioAFCFreezeOnSync (SpiritFunctionalState xNewState)
 Enables or Disables the AFC freeze on sync word detection.
void SpiritRadioSetAFCMode (AFCMode xMode)
 Sets the AFC working mode.
AFCMode SpiritRadioGetAFCMode (void)
 Returns the AFC working mode.
void SpiritRadioSetAFCPDLeakage (uint8_t cLeakage)
 Sets the AFC peak detector leakage.
uint8_t SpiritRadioGetAFCPDLeakage (void)
 Returns the AFC peak detector leakage.
void SpiritRadioSetAFCFastPeriod (uint8_t cLength)
 Sets the length of the AFC fast period expressed as number of samples.
uint8_t SpiritRadioGetAFCFastPeriod (void)
 Returns the AFC fast period expressed as number of samples.
void SpiritRadioSetAFCFastGain (uint8_t cGain)
 Sets the AFC loop gain in fast mode.
uint8_t SpiritRadioGetAFCFastGain (void)
 Returns the AFC loop gain in fast mode.
void SpiritRadioSetAFCSlowGain (uint8_t cGain)
 Sets the AFC loop gain in slow mode.
uint8_t SpiritRadioGetAFCSlowGain (void)
 Returns the AFC loop gain in slow mode.
int8_t SpiritRadioGetAFCCorrectionReg (void)
 Returns the AFC correction from the corresponding register.
int32_t SpiritRadioGetAFCCorrectionHz (void)
 Returns the AFC correction expressed in Hz.
void SpiritRadioAGC (SpiritFunctionalState xNewState)
 Enables or Disables the AGC.
void SpiritRadioSetAGCMode (AGCMode xMode)
 Sets the AGC working mode.
AGCMode SpiritRadioGetAGCMode (void)
 Returns the AGC working mode.
void SpiritRadioAGCFreezeOnSteady (SpiritFunctionalState xNewState)
 Enables or Disables the AGC freeze on steady state.
void SpiritRadioAGCFreezeOnSync (SpiritFunctionalState xNewState)
 Enable or Disable the AGC freeze on sync detection.
void SpiritRadioAGCStartMaxAttenuation (SpiritFunctionalState xNewState)
 Enable or Disable the AGC to start with max attenuation.
void SpiritRadioSetAGCMeasureTimeUs (uint16_t nTime)
 Sets the AGC measure time.
uint16_t SpiritRadioGetAGCMeasureTimeUs (void)
 Returns the AGC measure time.
void SpiritRadioSetAGCMeasureTime (uint8_t cTime)
 Sets the AGC measure time.
uint8_t SpiritRadioGetAGCMeasureTime (void)
 Returns the AGC measure time.
void SpiritRadioSetAGCHoldTimeUs (uint8_t cTime)
 Sets the AGC hold time.
uint8_t SpiritRadioGetAGCHoldTimeUs (void)
 Returns the AGC hold time.
void SpiritRadioSetAGCHoldTime (uint8_t cTime)
 Sets the AGC hold time.
uint8_t SpiritRadioGetAGCHoldTime (void)
 Returns the AGC hold time.
void SpiritRadioSetAGCHighThreshold (uint8_t cHighThreshold)
 Sets the AGC high threshold.
uint8_t SpiritRadioGetAGCHighThreshold (void)
 Returns the AGC high threshold.
void SpiritRadioSetAGCLowThreshold (uint8_t cLowThreshold)
 Sets the AGC low threshold.
uint8_t SpiritRadioGetAGCLowThreshold (void)
 Returns the AGC low threshold.
void SpiritRadioSetClkRecMode (ClkRecMode xMode)
 Sets the clock recovery algorithm.
ClkRecMode SpiritRadioGetClkRecMode (void)
 Returns the Clock Recovery working mode.
void SpiritRadioSetClkRecPGain (uint8_t cPGain)
 Sets the clock recovery proportional gain.
uint8_t SpiritRadioGetClkRecPGain (void)
 Returns the log2 of the clock recovery proportional gain.
void SpiritRadioSetClkRecIGain (uint8_t cIGain)
 Sets the clock recovery integral gain.
uint8_t SpiritRadioGetClkRecIGain (void)
 Returns the clock recovery integral gain.
void SpiritRadioSetClkRecPstFltLength (PstFltLength xLength)
 Sets the postfilter length for clock recovery algorithm.
PstFltLength SpiritRadioGetClkRecPstFltLength (void)
 Returns the postfilter length for clock recovery algorithm.
void SpiritRadioCsBlanking (SpiritFunctionalState xNewState)
 Enables or Disables the received data blanking when the CS is under the threshold.
void SpiritRadioPersistenRx (SpiritFunctionalState xNewState)
 Enables or Disables the persistent RX mode.
void SpiritRadioSetRefDiv (SpiritFunctionalState xNewState)
 Enables or Disables the synthesizer reference divider.
SpiritFunctionalState SpiritRadioGetRefDiv (void)
 Get the the synthesizer reference divider state.
void SpiritRadioSetDigDiv (SpiritFunctionalState xNewState)
 Enables or Disables the synthesizer reference divider.
SpiritFunctionalState SpiritRadioGetDigDiv (void)
 Get the the synthesizer reference divider state.
uint32_t SpiritRadioGetXtalFrequency (void)
 Returns the XTAL frequency.
void SpiritRadioSetXtalFrequency (uint32_t lXtalFrequency)
 Sets the XTAL frequency.

Variables

static uint32_t s_lXtalFrequency
 The Xtal frequency.
static const uint8_t s_vectcBHalfFactor [4] = {(HIGH_BAND_FACTOR/2), (MIDDLE_BAND_FACTOR/2), (LOW_BAND_FACTOR/2), (VERY_LOW_BAND_FACTOR/2)}
 Factor is: B/2 used in the formula for SYNTH word calculation.
static const uint8_t s_vectcBandRegValue [4] = {SYNT0_BS_6, SYNT0_BS_12, SYNT0_BS_16, SYNT0_BS_32}
 BS value to write in the SYNT0 register according to the selected band.
static const uint16_t s_vectnBandwidth26M [90]
 It represents the available channel bandwidth times 10 for 26 Mhz xtal.
static const uint16_t s_vectnVCOFreq [16]
 It represents the available VCO frequencies.
static SpiritFunctionalState xDoVcoCalibrationWA = S_ENABLE
 This variable is used to enable or disable the VCO calibration WA called at the end of the SpiritRadioSetFrequencyBase fcn.
static const float fPowerFactors [5][6]
 These values are used to interpolate the power curves.

Detailed Description

This file provides all the low level API to manage Analog and Digital radio part of SPIRIT.

Author:
VMA division - AMS
Version:
3.2.2
Date:
08-July-2015
Attention:

© COPYRIGHT(c) 2015 STMicroelectronics

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file SPIRIT_Radio.c.