LP PHY PAPD Cal (struct lpphy_txcalgains *txgains, int mode)
- Create a lpphy_txgains gains structure
- If PHY revision less than 2
- Return
- If txgains is not NULL
- If the useindex member of txgains is not zero
Call LP PHY Set TX Power by Index with the index member of txgains as argument
- Otherwise
Call LP PHY Set TX Gain with the gains member of txgains as argument
- If the useindex member of txgains is not zero
Call Set Deaf with 0 as argument
Perform a LP PHY BTCX Override Enable
- If PHY Revision is 2
Call LP PHY Set TX Filter BW with 0 as argument
- Otherwise
MaskSet PHY Register 0x4EA with mask 0xFFF8 and set with 0x0000
MaskSet PHY Register 0x4EB with mask 0xFFF8 and set with 0x0003
Save Radio Register 0x4C
Save Radio Register 0xF3
- Set bits 0x0003 in Radio Register 0xF3
- If the current band is 2GHz
MaskSet Radio Register 0x4C with mask 0xFFCF and set with 0x0020
- Otherwise
MaskSet Radio Register 0x4C with mask 0xFFCF and set with 0x0010
Set bit 0x8000 in PHY Register 0x44C
Set bit 0x2000 in PHY Register 0x44D
Perform a LP PHY Set RX Gain with 0x40000 as the argument
Perform a LP PHY Set TRSW Override with (1, 0) as the arguments
Set bit 0x0001 in PHY Register 0x43B
Bitwise AND PHY Register 0x43C with 0xFFFE
Perform a LP PHY Set BB Mult with argument 0x17
- If mode is 0
- Set index to 20
- Otherwise
- Set index to 63
Bitwise AND PHY Register 0x4D0 with 0xFFDF
Bitwise OR PHY Register 0x4D0 with 0x0008
MaskSet PHY Register 0x4D5 with mask 0xFFC0 and set with index
Bitwise OR PHY Register 0x4D5 with 0x3F00
MaskSet PHY Register 0x4D6 with mask 0xFFF0 and set with 0x0008
Read PHY Register 0x4D3 and bitwise AND with 0xFF and save as tmp (u16)
- Replace tmp with -62 - tmp/2 (?? on a u16)
MaskSet PHY Register 0x4D6 with mask 0x00FF and set with tmp << 8
If lpphy_papd_slow_cal is not zero
- (So far, the only place that this variable is set to non-zero seems to be in in some kind of ioctl. It may be used for debugging. The non-zero branch is left in the specs, but probably should be ignored for the moment.)
- Write 0x2000 to PHY Register 0x4D7
MaskSet PHY Register 0x4D3 with mask 0xF0FF and set with 0x0800
MaskSet PHY Register 0x4D9 with mask 0xFF00 and set with 0x007F
- Write 0x0200 to PHY Register 0x4D8
MaskSet PHY Register 0x4D9 with mask 0x00FF and set with 0
- Otherwise
- If mode is 4
MaskSet PHY Register 0x4D9 with mask 0xFF00 and set with 0x0040
Call Set Deaf with argument 0
Call Start TX Tone with arguments 3750, 100
- Set bit 0x0001 in PHY Register 0x4D0
- Spin Wait for bit 0x0001 to be set in PHY Register 0x4D0. Test every 10 usec with a maximum of 1,000,000 loops (??)
- If mode is 4
Call LP PHY Set BB Mult with argument 0
- Otherwise
Call LP PHY Stop TX Tone
Call LP PHY Clear Deaf with argument 0
- If mode is 0
- Read the 32-bit LP PHY table with ID 9, length 1 and offset of index
- Loop from 0 to index (non inclusive) in steps of 1
- Write the above table with the offset changed to the loop counter value
Call LP PHY Smooth PAPD with arguments (5, 0, 32)
- Restore the saved value of Radio Register 0x4C
- Restore the saved value of Radio Register 0xF3
- Clear bit 0x0800 in PHY Register 0x44C
Call LP PHY RX Gain Override Enable with argument 0
- Clear bit 0x0001 in PHY Register 0x43B
Call Clear Deaf with argument 0