LP PHY Set TX Power by Index (int index)
- Construct an LP PHY table and an lpphy_txgains_t gains object
Bitwise mask the parameter "index" with 0xFF and store in lppphy_tx_power_idx_override
- If the PHY revision is less than 2
- Set the table ID to 0xA
- Otherwise
- Set the table ID to 7
- Set the table width to 32 and the table length to 1
If a call to PHY Register 0x4A4 bitwise masked with 0xE000 is not zero
Call LP PHY Set TX Power Control with 0x8000 as the argument
- Set the table offset to the input parameter "index" + 320
- Set the table data pointer to a u32 variable iqcomp
- Set the table offset to the input parameter "index" + 192
- Set the table data pointer to a u32 variable txgain
- If the PHY revision is less than 2
MaskSet PHY Register 0x4B5 with mask 0xF800 and set with txgain rightshifted by 4 and masked with 0x7FF
Call LP PHY Set DAC Gain with txgain & 0x7 as the argument
- Otherwise
Set gains.pad_gain to (txgain >> 0x10) & 0xff
Set gains.gm_gain to txgain & 0xff
Set gains.pga_gain to (txgain >> 0x8) & 0xff
Set gains.dac_gain to (iqcomp >> 0x1c) & 0x7
Call LP PHY Set TX Gain with &gains as the argument
Call LP PHY Set PA Gain with (txgain >> 0x18) & 0x7f) as argument
Call LP PHY Set BBMult with (iqcomp >> 0x14) & 0xff) as argument
Call LP PHY Set TX IQCC with (iqcomp >> 0xa) & 0x3ff and iqcomp & 0x3ff as arguments
- Set the table data pointer to a u32 variable coef
- Set the table offset to the input parameter "index" + 448
Call LP PHY Set TX Locc with (locoeffs & 0xFFFF) as the argument
If the PHY revision >= 2
- Set the table data pointer to a u32 variable rfpower
- Set the table offset to the input parameter "index" + 576
MaskSet PHY Register 0x4D3 with mask 0xFF00 and set with rfpower & 0xFFFF
Call LP PHY Set TX Gain Override with 1 as argument