radio_controller Driver
Driver for WARP radio_controller (radio_controller_v3_00_b)
|
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) |
Example:
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.
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interface to initialize (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
clkDiv_SPI | Clock divider for SPI serial clock (set to 3 for 160MHz bus) |
clkDiv_TxDelays | Clock divider for Tx sequencing state machine (set to 1 for normal operation) |
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.
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
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.
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
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.
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
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.
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
bandSel | Selects the 2.4GHz or 5GHz band; must be RC_24GHZ or RC_5GHZ |
chanNum | New 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. |
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.
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interface to read (must be one of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
regAddr | Register address to read, in [0x0,0xC] |
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.
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
regAddr | Register address to write, in [0x0,0xC] |
regDataMask | 14-bit mask of bits to affect (1 in mask selects bit for writing) |
regData | 14-bit value to set; only bits with 1 in regDataMask are used |
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.
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
mode | RXHP is asserted if mode=RC_RXHP_ON, else RXHP is deasserted |
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.
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
ctrlSrcMask | Specifies 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] |
ctrlSrc | Selects register (from C code) or hardware (usr_ ports) control; must be RC_CTRLSRC_REG or RC_CTRLSRC_HW |
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.
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
gainTarget | Tx VGA gain setting, in [0,63] |
int radio_controller_setTxGainSource | ( | u32 | ba, |
u32 | rfSel, | ||
u8 | gainSrc | ||
) |
Sets the control source for Tx gains in the selected RF interfaces.
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
gainSrc | must be one of [RC_GAINSRC_SPI, RC_GAINSRC_REG, RC_GAINSRC_HW], for SPI control, register control or hardware (usr_RFx_TxGain port) control |
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().
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
gainSrc | must be one of [RC_GAINSRC_SPI, RC_GAINSRC_REG, RC_GAINSRC_HW], for SPI control, register control or hardware (usr_RFx_TxGain port) control |
int radio_controller_setRadioParam | ( | u32 | ba, |
u32 | rfSel, | ||
u32 | paramID, | ||
u32 | paramVal | ||
) |
Sets a MAX2829 parameter via a SPI register write.
ba | Base memory address of radio_controller pcore |
rfSel | Selects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
paramID | Parameter ID to update. Must be valid RC_PARAMID_* (see table below) |
paramVal | Parameter value to set. Valid values depend on the selected parameter (see table below) |
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=0 | 0: 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.
ad_ba | Base memory address of w3_ad_controller core |
iic_ba | Base memory address of w3_iic_eeprom core |
rfSel | Selects RF interfaces to affect (OR'd combination of [RC_RFA, RC_RFB, RC_RFC, RC_RFD]) |
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.
d | Number of "microseconds" to sleep (proportional to sleep time; actual sleep time will depend on processor and instruction memory clocks) |