radio_controller Driver
Driver for WARP radio_controller (radio_controller_v3_00_b)
Functions

Functions

int radio_controller_init (u32 ba, u32 rfSel, u8 clkDiv_SPI, u8 clkDiv_TxDelays)
 
int radio_controller_TxEnable (u32 ba, u32 rfSel)
 
int radio_controller_RxEnable (u32 ba, u32 rfSel)
 
int radio_controller_TxRxDisable (u32 ba, u32 rfSel)
 
int radio_controller_setCenterFrequency (u32 ba, u32 rfSel, u8 bandSel, u8 chanNum)
 
u16 radio_controller_SPI_read (u32 ba, u32 rfSel, u8 regAddr)
 
int radio_controller_SPI_setRegBits (u32 ba, u32 rfSel, u8 regAddr, u16 regDataMask, u16 regData)
 
int radio_controller_setRxHP (u32 ba, u32 rfSel, u8 mode)
 
int radio_controller_setCtrlSource (u32 ba, u32 rfSel, u32 ctrlSrcMask, u8 ctrlSrc)
 
int radio_controller_setTxGainTarget (u32 ba, u32 rfSel, u8 gainTarget)
 
int radio_controller_setTxGainSource (u32 ba, u32 rfSel, u8 gainSrc)
 
int radio_controller_setRxGainSource (u32 ba, u32 rfSel, u8 gainSrc)
 
int radio_controller_setRadioParam (u32 ba, u32 rfSel, u32 paramID, u32 paramVal)
 
int radio_controller_apply_TxDCO_calibration (u32 ad_ba, u32 iic_ba, u32 rfSel)
 
void rc_usleep (int d)
 

Detailed Description

Example:

//Assumes user code sets RC_BASEADDR to base address of radio_controller core, as set in xparameters.h
//Initialize the radio controller logic
radio_controller_init(RC_CONTROLLER, 1, 1);

Function Documentation

int radio_controller_init ( u32  ba,
u32  rfSel,
u8  clkDiv_SPI,
u8  clkDiv_TxDelays 
)

Initializes the radio controller core and the selected MAX2829 transceivers. The selected transceivers are reset, configured with sane defaults and set to the Standby state. User code should call this function once at boot for all RF interfaces.

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interface to initialize (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
clkDiv_SPIClock divider for SPI serial clock (set to 3 for 160MHz bus)
clkDiv_TxDelaysClock divider for Tx sequencing state machine (set to 1 for normal operation)
Returns
Returns -1 if any MAX2829 indicates no PLL lock after init; otherwise returns 0
int radio_controller_TxEnable ( u32  ba,
u32  rfSel 
)

Sets the selected RF interfaces to the Transmit state. The corresponding MAX2829s, PAs and RF switches are all set to the correct state for transmission. This call initiates the Tx sequencing state machine. Refer to the radio_controller user guide for more details.

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
Returns
Returns non-zero value if an input parameter was invalid; else returns 0
int radio_controller_RxEnable ( u32  ba,
u32  rfSel 
)

Sets the selected RF interfaces to the Receive state. The corresponding MAX2829s and RF switches are set to the correct state for reception. The PAs in the selected RF interfaces are disabled.

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
Returns
Returns non-zero value if an input parameter was invalid; else returns 0
int radio_controller_TxRxDisable ( u32  ba,
u32  rfSel 
)

Sets the selected RF interfaces to the Standby state (Tx and Rx disabled). The corresponding MAX2829s and PAs are set to the correct state for standby.

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
Returns
Returns non-zero value if an input parameter was invalid; else returns 0
int radio_controller_setCenterFrequency ( u32  ba,
u32  rfSel,
u8  bandSel,
u8  chanNum 
)

Sets the selected RF interfaces to the Standby state (Tx and Rx disabled). The corresponding MAX2829s and PAs are set to the correct state for standby.

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
bandSelSelects the 2.4GHz or 5GHz band; must be RC_24GHZ or RC_5GHZ
chanNumNew center frequency channel number, in [1,14] for 2.4GHz or [1,23] for 5GHz. The channel numbers and corresponding center frequencies are listed in the table below.
Returns
Returns non-zero value if an input parameter was invalid; else returns 0
2.4GHz
Chan
Freq
(MHz)
5GHz
Chan
Freq
(MHz)
1 2412 1 5180
2 2417 2 5200
3 2422 3 5220
4 2427 4 5240
5 2432 5 5260
6 2437 6 5280
7 2442 7 5300
8 2447 8 5320
9 2452 9 5500
10 2457 10 5520
11 2462 11 5540
12 2467 12 5560
13 2472 13 5580
14 2484 14 5600
- - 15 5620
- - 16 5640
- - 17 5660
- - 18 5680
- - 19 5700
- - 20 5745
- - 21 5765
- - 22 5785
- - 23 5805
u16 radio_controller_SPI_read ( u32  ba,
u32  rfSel,
u8  regAddr 
)

Reads the radio controller "mirror" register corresponding to the MAX2829 register at regAddr.

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interface to read (must be one of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
regAddrRegister address to read, in [0x0,0xC]
Returns
Returns 255 if input parameters are invalid; otherwise returns 14-bit register value
int radio_controller_SPI_setRegBits ( u32  ba,
u32  rfSel,
u8  regAddr,
u16  regDataMask,
u16  regData 
)

Sets specific bits in a single register in selected MAX2829s.

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
regAddrRegister address to write, in [0x0,0xC]
regDataMask14-bit mask of bits to affect (1 in mask selects bit for writing)
regData14-bit value to set; only bits with 1 in regDataMask are used
Returns
Returns non-zero if input parameters are invalid; otherwise returns 0
int radio_controller_setRxHP ( u32  ba,
u32  rfSel,
u8  mode 
)

Sets state of RXHP pin on selected MAX2829s. This function only affects state if the RXHP control source is set to software on the selected RF interfaces.

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
modeRXHP is asserted if mode=RC_RXHP_ON, else RXHP is deasserted
Returns
Returns non-zero if input parameters are invalid; otherwise returns 0
int radio_controller_setCtrlSource ( u32  ba,
u32  rfSel,
u32  ctrlSrcMask,
u8  ctrlSrc 
)

Selects between register or hardware control for the various radio control signals on the selected RF interfaces.

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
ctrlSrcMaskSpecifies which control signals should have new control source; OR'd combination of [RC_REG0_TXEN_CTRLSRC, RC_REG0_RXEN_CTRLSRC, RC_REG0_RXHP_CTRLSRC, RC_REG0_SHDN_CTRLSRC]
ctrlSrcSelects register (from C code) or hardware (usr_ ports) control; must be RC_CTRLSRC_REG or RC_CTRLSRC_HW
Returns
Returns non-zero if input parameters are invalid; otherwise returns 0
int radio_controller_setTxGainTarget ( u32  ba,
u32  rfSel,
u8  gainTarget 
)

Sets the final Tx VGA gain set by the Tx sequencing state machine for the selected RF interfaces.

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
gainTargetTx VGA gain setting, in [0,63]
Returns
Returns non-zero if input parameters are invalid; otherwise returns 0
int radio_controller_setTxGainSource ( u32  ba,
u32  rfSel,
u8  gainSrc 
)

Sets the control source for Tx gains in the selected RF interfaces.

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
gainSrcmust be one of [RC_GAINSRC_SPI, RC_GAINSRC_REG, RC_GAINSRC_HW], for SPI control, register control or hardware (usr_RFx_TxGain port) control
Returns
Returns non-zero if input parameters are invalid; otherwise returns 0
int radio_controller_setRxGainSource ( u32  ba,
u32  rfSel,
u8  gainSrc 
)

Sets the control source for Rx gains in the selected RF interfaces. Note that when hardware control is selected, the corresponding RXHP should also be set for hardware control using radio_controller_setCtrlSource().

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
gainSrcmust be one of [RC_GAINSRC_SPI, RC_GAINSRC_REG, RC_GAINSRC_HW], for SPI control, register control or hardware (usr_RFx_TxGain port) control
Returns
Returns non-zero if input parameters are invalid; otherwise returns 0
int radio_controller_setRadioParam ( u32  ba,
u32  rfSel,
u32  paramID,
u32  paramVal 
)

Sets a MAX2829 parameter via a SPI register write.

Parameters
baBase memory address of radio_controller pcore
rfSelSelects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
paramIDParameter ID to update. Must be valid RC_PARAMID_* (see table below)
paramValParameter value to set. Valid values depend on the selected parameter (see table below)
Returns
Returns non-zero if input parameters are invalid; otherwise returns 0
Parameter ID Description Parameter Values
RC_PARAMID_RXGAIN_RF Rx RF gain value 1: 0dB
2: 15dB
3: 30dB
RC_PARAMID_RXGAIN_BB Rx baseband gain value [0,31]: approx [0,63]dB
RC_PARAMID_TXGAIN_RF Tx RF gain value [0,63]: approx [0,31]dB
RC_PARAMID_TXGAIN_BB Tx baseband gain value 0: 0
1: -1.5dB
2: -3dB
3: -5dB
RC_PARAMID_TXLPF_BW Tx low pass filter corner frequency
(Tx bandwidth is 2x corner frequency)
1: 12MHz
2: 18MHz
3: 24MHz
RC_PARAMID_RXLPF_BW Rx low pass filter corner frequency
(Rx bandwidth is 2x corner frequency)
0: 7.5MHz
1: 9.5MHz
2: 14MHz
3: 18MHz
RC_PARAMID_RXLPF_BW_FINE Rx low pass filter corner fine adjustment 0: 90%
1: 95%
2: 100%
3: 105%
4: 110%
RC_PARAMID_RXHPF_HIGH_CUTOFF_EN Set corner frequency for Rx high pass filter when RXHP=00: Low corner (100Hz)
1: High corner (30kHz)
RC_PARAMID_RSSI_HIGH_BW_EN En/disable high bandwidth RSSI signal 0: Disable high bandwidth RSSI
1: Enable high bandwidth RSSI
RC_PARAMID_TXLINEARITY_PADRIVER Linearity of Tx PA driver circuit [0,3]: [min,max] linearity
RC_PARAMID_TXLINEARITY_VGA Linearity of Tx VGA circuit [0,3]: [min,max] linearity
RC_PARAMID_TXLINEARITY_UPCONV Linearity of Tx upconverter circuit [0,3]: [min,max] linearity
RC_PARAMID_TXGAINS_SPI_CTRL_EN En/disable SPI control of Tx gains 0: Disable SPI control
1: Enable SPI control
RC_PARAMID_RXGAINS_SPI_CTRL_EN En/disable SPI control of Rx gains 0: Disable SPI control
1: Enable SPI control
int radio_controller_apply_TxDCO_calibration ( u32  ad_ba,
u32  iic_ba,
u32  rfSel 
)

Reads the TxDCO calibration values from the EEPROM and writes the values to the DACs of the selected RF interface. This function requires the w3_iic_eeprom and w3_ad_controller cores.

Parameters
ad_baBase memory address of w3_ad_controller core
iic_baBase memory address of w3_iic_eeprom core
rfSelSelects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD])
Returns
Returns non-zero if w3_ad_controller or w3_iic_eeprom core is not found; otherwise returns 0
void rc_usleep ( int  d)

Simple pseudo-usleep implementation (since MicroBlaze lacks internal timer for native usleep implementation). The actual sleep time is not guaranteed to be d microseconds.

Parameters
dNumber of "microseconds" to sleep (proportional to sleep time; actual sleep time will depend on processor and instruction memory clocks)