N PHY TX Power Index (u8 core, s8 txindex, bool restore)
If phyhang_avoid
Call N PHY Carrier Search with TRUE as argument
- Loop 2 times with index i
If core & (1 << i) is zero
- Continue
If txindex < 0
If nphy_txpwrindex[i].index < 0
- Continue
If PHY Revision >= 3
MaskSet PHY register 0x8F with mask 0xFEFF and set with nphy_txpwrindex[i].AfectrlOverride
MaskSet PHY register 0xA5 with mask 0xFEFF and set with nphy_txpwrindex[i].AfectrlOverride
- Otherwise
MaskSet PHY register 0x8F with mask 0xBFFF and set with nphy_txpwrindex[i].AfectrlOverride
- if i is 0
Write nphy_txpwrindex[i].AfeCtrlDacGain to PHY register 0xAA
- Otherwise
Write nphy_txpwrindex[i].AfeCtrlDacGain to PHY register 0xAB
- Write (0x1D10 + i) to PHY Register 0x72
Write nphy_txpwrindex[i].rad_gain to PHY Register 0x73
- Write 0x3C57 to PHY Register 0x72
- Read PHY Register 0x73 and store in tmp
- If i is 0
Replace tmp with (tmp & 0x00FF) | (nphy_txpwrindex[i].bbmult << 8)
- Otherwise
Replace tmp with (tmp & 0xFF00) | (nphy_txpwrindex[i].bbmult)
- Write 0x3C57 to PHY Register 0x72
- Write tmp to PHY Register 0x73
- If restore is true
- Write (0x3C50 + 2 * i) to PHY Register 0x72
Write nphy_txpwrindex[i].iqcomp_a to PHY Register 0x73
Write nphy_txpwrindex[i].iqcomp_b to PHY Register 0x73
- Write (0x3C55 + i) to PHY Register 0x72
Write nphy_txpwrindex[i].locomp to PHY Register 0x73
- Write (0x3C5D + i) to PHY Register 0x72
Write nphy_txpwrindex[i].locomp to PHY Register 0x73
Call N PHY TX Power Control Enable with nphy_txpwrctrl as argument
Set nphy_txpwrindex[i].index_internal to nphy_txpwrindex[i].index_internal_save
- Otherwise
If nphy_txpwrindex[i].index < 0
If PHY Revision >= 3
MaskSet PHY Register 0x8F with mask 0xFEFF and set with nphy_txpwrindex[i].AfectrlOverride
MaskSet PHY Register 0xA5 with mask 0xFEFF and set with nphy_txpwrindex[i].AfectrlOverride
- Otherwise
Set nphy_txpwrindex[i].AfectrlOverride to the contents of PHY Register 0xA5
- If i is 0
Set nphy_txpwrindex[i].AfeCtrlDacGain to the contents of PHY Register 0xAA
- Otherwise
Set nphy_txpwrindex[i].AfeCtrlDacGain to the contents of PHY Register 0xAB
- Write (0x1D10 + i) to PHY Register 0x72
Set nphy_txpwrindex[i].rad_gain to the contents of PHY Register 0x73
- Write 0x3C57 to PHY Register 0x72
- Set tmp to the contents of PHY Register 0x73
- If i is 0
- Right shift tmp by 8
Write (tmp & 0xFF) to nphy_txpwrindex[i].bbmult
- Write (0x3C50 + 2 * i) to PHY Register 0x72
Set nphy_txpwrindex[i].iqcomp_a to the contents of PHY Register 0x73
Set nphy_txpwrindex[i].iqcomp_b to the contents of PHY Register 0x73
- Write (0x3C55 + i) to PHY Register 0x72
Set nphy_txpwrindex[i].locomp to the contents of PHY Register 0x73
Set nphy_txpwrindex[i].index_internal_save to nphy_txpwrindex[i].index_internal
Save the value of nphy_txpwrctrl
Call N PHY TX Power Control Enable with 0 as argument
- If PHY Revision is 1
- Set bit 0x20000 in coreflags
- If i is 0
- Set gain to 0x68C0
- Otherwise
- Set gain to 0x6CC0
- Write (gain + index) to PHY Register 0x72
- Read PHY Register 0x73 and save in gain
- Read PHY Register 0x74, left shift by 16, or with gain and save in gain (32 bit)
If PHY Revision id >= 3
Set rad to (gain >> 16) & 0x1FFFF
- Otherwise
Set rad to (gain >> 16) & 0x1FFF
Set dac to (gain >> 8) & 0x3F
Set bbmult to gain & 0xFF
If PHY Revision >= 3
- If i is 0
- Set bit 0x0100 in PHY Register 0x8F
- Otherwise
- Set bit 0x0100 in PHY Register 0xA5
- If i is 0
- Otherwise
- Set bit 0x4000 in PHY Register 0xA5
- If i is 0
- Write dac to PHY Register 0xAA
- Otherwise
- Write dac to PHY Register 0xAB
- Write (0x1D10 + i) to PHY Register 0x72
- Write rad to PHY Register 0x73
- Write 0x3C57 to PHY Register 0x72
- Read PHY Register 0x73 and save as tmp
- Write 0x3C57 to PHY Register 0x72
- If i is 0
Write (tmp & 0x00FF) | (bbmult <<8) to PHY Register 0x73
- Otherwise
Write ((tmp & 0xFF00) | bbmult to PHY Register 0x73
FIXME - Incomplete
If phyhang_avoid
Call N PHY Carrier Search with FALSE as argument