## N PHY RSSI Select (u8 code, u8 type)

If PHY Revision >= 3

- If code is 0
MaskSet PHY Register 0x8F with mask 0xFDFF and set with 0

MaskSet PHY Register 0xA5 with mask 0xFDFF and set with 0

MaskSet PHY Register 0xA6 with mask 0xFCFF and set with 0

MaskSet PHY Register 0xA7 with mask 0xFCFF and set with 0

MaskSet PHY Register 0xE5 with mask 0xFFDF and set with 0

MaskSet PHY Register 0xE6 with mask 0xFFDF and set with 0

MaskSet PHY Register 0xF9 with mask 0xFFC3 and set with 0

MaskSet PHY Register 0xFB with mask 0xFFC3 and set with 0

- Otherwise
- Loop 2 times with index i
- If code is 1 and i is 1
- Continue

- Else if code is 2 and i is 0
- Continue

- If i is 0
MaskSet PHY Register 0x8F with mask 0xFDFF and set with 0x0200

- Otherwise
MaskSet PHY Register 0xA5 with mask 0xFDFF and set with 0x0200

- If type is 0, 1, or 2
- If i is 0
- Otherwise
- If type is 0
- If band is 5G
- Set val to 4

- Otherwise
- Set val to 8

- If band is 5G
- Else if type is 1
- Set val to 16

- Otherwise
- Set val to 32

- If i is 0
- Set the bits in val in PHY Register 0xF9
- Set bit 0x0020 in PHY Register 0xE5

- Otherwise
- Set the bits in val in PHY Register 0xFB
- Set bit 0x0020 in PHY Register 0xE6

Otherwise (type > 2)

- If type is 6
- Else if type is 3
- Otherwise
- if i is 0
- Otherwise
If (

**nphy_ipa2g_on**and band is 2 GHz) or (**nphy_ipa5g_on**and band is 5 GHz)- If band is 5 GHz
- Set tmp to 0xC

- Otherwise
- Set tmp to 0xE

- If i is 0
- Write tmp to Radio Register 0x202D
- Write 0x11 to Radio Register 0x202D

- Otherwise
- Write tmp to Radio Register 0x302D
- Write 0x11 to Radio Register 0x302D

- If band is 5 GHz
- If i is 0
- Set bit 0x0200 in PHY Register 0x8F

- Otherwise
- Set bit 0x0200 in PHY Register 0xA5

- If code is 1 and i is 1

- Loop 2 times with index i

- If code is 0
Otherwise (PHY Rev < 3)

- If type is 0, 1, or 2
- Set val to 0

- Else if type is 6
- Set val to 1

- Else if type is 3
- Set val to 2

- Otherwise
- Set val to 3

MaskSet PHY Register 0xA6 with mask 0x0FFF and set with val << 12 | val << 14

MaskSet PHY Register 0xA7 with mask 0x0FFF and set with val << 12 | val << 14

- If type is 0, 1, or 2
- If code is 0
MaskSet PHY Register 0xA5 with mask 0xCFFF and set with 0

- If type is 0, 1, or 2

- Otherwise
MaskSet PHY Register 0xA5 with mask 0xCFFF and set with 0x3000

- If type is 0, 1, or 2

- If type is 0, 1, or 2