N PHY ACI Control ( bool enable, int aci_pwr )
Note: The locations used to save/restore the variables must be preserved across calls.
- Initialize a u16 array gains to {0x8136, 0x8136, 0x8136, 0x8136}
- If enable
If (aci_state & 2) not equal to 0
- Return
If phyhang_avoid
Set bit 0x0002 in aci_state
Copy pub->now to aci_start_time
If PHY revision >= 3
Save PHY Register 0x24C
Write 0x0002 to PHY Register 0x24C
Save PHY Registers 0x020 and 0x2A7
Write 0x1D06 to PHY Register 0x72
- Loop 4 times with i as index
Save PHY Register 0x73 in array1 indexed by i
Write 0x826C to PHY Register 0x20
Write 0x826C to PHY Register 0x2A7
Call NPHY Table Write with ( 7, 4, 0x106, 16, gains ) as arguments
Save PHY Registers 0x22 and 0x2A9
Write 0x126C to PHY Register 0x22
Write 0x126C to PHY Register 0x2A9
Save PHY Registers 0x2B and 0x41
Write 0x0069 to PHY Register 0x2B
Write 0x0069 to PHY Register 0x41
Write 0x1010 to PHY Register 0x72
- Loop 4 times with loop index i
Save PHY Register 0x73 in array2 indexed by i
Write 0x1050 to PHY Register 0x72
- Loop 4 times with loop index i
Save PHY Register 0x73 in array3 indexed by i
Write 0x1013 PHY Register 0x72
Write 0x007F to PHY Register 0x73
Write 0x1053 PHY Register 0x72
Write 0x007F to PHY Register 0x73
Save PHY Registers 0x37 and 0x2AD
Write 0x026C to PHY Registers 0x37 and 0x2AD
Save Radio Registers 0x6023 and 0x7023
Write 0x0090 to Radio Registers 0x6023 and 0x7023
Save PHY Registers 0x27 and 0x3D
MaskSet PHY Register 0x27 with mask 0xFFC0 and set with 0x0015
MaskSet PHY Register 0x3D with mask 0xFFC0 and set with 0x0015
- Otherwise
Save Radio Registers 0x66 and 0x95
OR Radio Register 0x66 with 0x02
OR Radio Register 0x95 with 0x02
Save nphy_gain_boost
Set nphy_gain_boost to 0
Save Radio Registers 0x71 and 0xA0
Read Radio Register 0x2B, add 0x000C, and save as tmp
If tmp > 0x1F
- Set tmp to 0x1F
OR tmp with 0x20 and write the result to Radio Registers 0x71 and 0xA0
Save PHY Registers 0x153 and 0xC33
Set bit 0x0008 in PHY Register 0x153
MaskSet PHY Register 0x153 with mask 0xFFF8 and set with 0x0004
Write 0xC0 to PHY Register 0xC33
Save PHY Registers 0x20 and 0x36
Write 0x1D06 to PHY Register 0x72
- Loop 4 times with loop index i
Save PHY Register 0x73 in array1[i]
MaskSet PHY Register 0x20 with mask 0xF07F and set with 0x280
MaskSet PHY Register 0x36 with mask 0xF07F and set with 0x280
Write 0x1C00 to PHY Register 0x72
- Loop 4 times
Write 0x057C to PHY Register 0x73
Save PHY Registers 0x21 and 0x37
Write 0x10BE to PHY Registers 0x21 and 0x37
Save PHY Registers 0x22 and 0x38
Write 0x101E to PHY Registers 0x22 and 0x38
Save PHY Registers 0x23 and 0x39
Write 0x203E to PHY Registers 0x23 and 0x39
Save PHY Registers 0x2B and 0x41
Write 0x0053 to PHY Registers 0x2B and 0x41
Save PHY Registers 0x27 and 0x3D
Write 0x0015 to PHY Registers 0x27 and 0x3D
Save PHY Registers 0x1D and 0x33
MaskSet PHY Register 0x1D with mask 0xFE1F and set with 0x0080
MaskSet PHY Register 0x33 with mask 0xFE1F and set with 0x0080
Save PHY Register 0x24C
Write 0x0002 to PHY Register 0x24C
Save PHY Register 0x1D7
Write 0x2078 to PHY Register 0x1D7
Call NPHY ACI Power Update with aci_pwr as argument
If phyhang_avoid
- Otherwise
If (aci_state & 2) is 0
- Return
If phyhang_avoid
Clear bit 0x2 in aci_state
If PHY revision >= 3
Restore PHY Registers 0x24C, 0x20, and 0x2A7
Call NPHY Table Write with ( 7, 4, 0x106, 16, array1 ) as arguments
Restore PHY Registers 0x22, 0x2A9, 0x2B, and 0x41
Write 0x1010 to PHY Register 0x72
- Loop 4 times with loop index i
Write array2[i] to PHY Register 0x73
Write 0x1050 to PHY Register 0x72
- Loop 4 times with loop index i
Write array3[i] to PHY Register 0x73
Restore PHY Registers 0x37 and 0x2AD
Restore Radio Registers 0x6023 and 0x7023
Restore PHY Registers 0x27 and 0x3D
- Otherwise
Restore nphy_gain_boost
Restore Radio Registers 0x66, 0x95, 0x71 and 0xA0
Restore PHY Registers 0x153, 0xC33, 0x20, and 0x36
Write 0x1D06 to PHY Register 0x72
- Loop 4 times with loop index i
Write array1[i] to PHY Register 0x73
Restore PHY Registers 0x21, 0x37, 0x22, 0x38, 0x23, 0x39, 0x2B, 0x41, 0x27, 0x3D, 0x1D, 0x33, 0x24C, and 0x1D7
If phyhang_avoid