LP PHY RC Calibration Rev 0
- Create a 21-element u32 data array for ideal power with the following entries:
- 0x10000, 0x10557, 0x10e2d, 0x113e0, 0x10f22, 0x0ff64,
- 0x0eda2, 0x0e5d4, 0x0efd1, 0x0fbe8, 0x0b7b8, 0x04b35,
- 0x01a5e, 0x00a0b, 0x00444, 0x001fd, 0x000ff, 0x00088,
- 0x0004c, 0x0002c, 0x0001a
- Create an lpphy_iq_est structure and set its contents to zero
- Define a variable for the least mean square power and initialize it to zero
Create Channel Spec for channel 7 and call Set Channel Spec for LP PHY with that chanspec
- If PHY register 0x43B ANDed with 0x40 is not zero
- Set old TX gain override to 1
- Set old TX gain override to 0
Call LP PHY Get BB Mult and save result as the old bbmult
- If the saved value of old_tx_gain_override is not zero
Call LP PHY Get TX Gain with an lpphy_txgains structure as the argument
Save PHY Register 0x44C
Save PHY Register 0x44D
Save PHY Register 0x43B
Save PHY Register 0x43C
Save PHY Register 0x4B0
Save PHY Register 0x4B1
Save PHY Register 0x448
Read PHY Register 0x4A4, AND with 0xE000 and save the result as the old TX power control
Call LP PHY Set TX Power Control with argument 0
Call LP PHY Disable CRS with argument TRUE
Call LP PHY Loopback and save the result as tmp
- If tmp is -1
- Go to finish
Call LP PHY Set RX Gain by Index with tmp as the argument
MaskSet PHY Register 0x448 with mask 0xFFBF and set 0x40
MaskSet PHY Register 0x4B1 with mask 0xFFF8 and set 0x1
MaskSet PHY Register 0x4B1 with mask 0xFFC7 and set 0x8
MaskSet PHY Register 0x4B1 with mask 0xFF3F and set 0xC0
- Loop with index i from 128 through 159 (inclusive) in steps of 1
Write i to Radio Register 0x3A
- Clear an inner loop summation variable
- Loop with index j from 5 to 25 (inclusive) in steps of 1
Call LP PHY Run DDFS with arguments (1, 1, j, j, 0)
Call LP PHY RX IQ Est with arguments (1000, 32, lpphy_iq_est structure)
- If the result is zero
- Go to finish
- Calculate the mean square power by adding the Q and I power values from the lpphy_iq_est structure
- If this is the first time through the inner loop
- Save the value of the mean square power as temp
- Calculate ideal power as the j-5 th entry in the ideal power data array, shift right by 3, add 1, and right shift 1.
Calculate normal power by calling LP PHY Qdiv Roundup with mean square power, temp, and 12 as the arguments
- Subtract normal power from ideal power
- Square the result and save as the mean square power
- Add the result to the inner loop summation variable
- If i equals 0x80 OR the inner loop summation is less then the least mean squarepower
- Set lpphy_rc_cap to the outer loop variable
- Save the inner loop summation variable as the new least mean square power
Call LP PHY Stop DDFS
- Fall through to finish
Finish:
LP PHY Restore CRS with argument TRUE
Restore the old value of PHY Register 0x44D
Restore the old value of PHY Register 0x44C
Restore the old value of PHY Register 0x43C
Restore the old value of PHY Register 0x43B
Restore the old value of PHY Register 0x4B1
Restore the old value of PHY Register 0x4B0
Restore the old value of PHY Register 0x448
Call LP PHY Set BB Mult with the old value of bbmult as the argument
- If the old TX gain override is not zero
Call LP PHY Set TX Gain with the lpphy_txgains structure defined above as the argument(Note: The Broadcom driver has "Get", but that makes no sense)
Restore the gains using LP PHY Set TX Power Control with the old TX power control value as argument
- If lpphy_rc_cap is not zero
Call LP PHY Set RC Cap with lpphy_rc_cap as the argument
Note: lpphy_rc_cap is in the struct containing PHY variables. All other variables are local.