int N PHY Poll RSSI (u8 type, s32 *buf, u8 nsamp)
- Create i8 array tmp_buf with 4 elements
If PHY Revision >= 3
- Save PHY Registers 0xF9, 0xFB, 0xA6, 0xA7, 0x8F, 0xA5, 0xE5 and 0xE6
- Otherwise
- Save PHY Registers 0xA6, 0xA7, 0xA5, 0x78, 0xEC, 0x7A, and 0x7D
Call N PHY RSSI Select with 5, type as arguments
- Save PHI Register 0xCA
If PHY Revision < 2
- Write 5 to PHY Register 0xCA
- Write 0 to all 4 elements of buf
- Loop nsamp times
If the PHY Revision is < 2
- Read PHY Register 0x1C9 and save as s0
- Read PHY Register 0x1CA and save as s1
- Otherwise
- Read PHY Register 0x219 and save as s0
- Read PHY Register 0x21A and save as s1
Write ((s8)((s0 & 0x3F) << 2)) >> 2 to tmp_buf[0]
Write ((s8)(((s0 >> 8) & 0x3F) << 2)) >> 2 to tmp_buf[1]
Write ((s8)((s1 & 0x3F) << 2)) >> 2 to tmp_buf[2]
Write ((s8)(((s1 >> 8) & 0x3F) << 2)) >> 2 to tmp_buf[3]
- Loop 4 times with index i
- Add tmp_buf[i] to current contents of buf[i]
Set out to (buf[0] & 0xFF) << 24 | (buf[1] & 0xFF) << 16 | (buf[2] & 0xFF) << 8 | (buf[3] & 0xFF)
If PHY Revision < 2
- Restore PHY Register 0xCA
If PHY Revision >= 3
- Restore PHY Registers 0xF9, 0xFB, 0xA6, 0xA7, 0x8F, 0xA5, 0xE5, and 0xE6
- Otherwise
- Restore PHY Registers 0xA6, 0xA7, 0xA5, 0x78, 0xEC, 0x7A, and 0x7D
- Return out