bcm-v4

[Specification

int N PHY Poll RSSI (u8 type, s32 *buf, u8 nsamp)

  1. Create i8 array tmp_buf with 4 elements
  2. If PHY Revision >= 3

    1. Save PHY Registers 0xF9, 0xFB, 0xA6, 0xA7, 0x8F, 0xA5, 0xE5 and 0xE6
  3. Otherwise
    1. Save PHY Registers 0xA6, 0xA7, 0xA5, 0x78, 0xEC, 0x7A, and 0x7D
  4. Call N PHY RSSI Select with 5, type as arguments

  5. Save PHI Register 0xCA
  6. If PHY Revision < 2

    1. Write 5 to PHY Register 0xCA
  7. Write 0 to all 4 elements of buf
  8. Loop nsamp times
    1. If the PHY Revision is < 2

      1. Read PHY Register 0x1C9 and save as s0
      2. Read PHY Register 0x1CA and save as s1
    2. Otherwise
      1. Read PHY Register 0x219 and save as s0
      2. Read PHY Register 0x21A and save as s1
    3. Write ((s8)((s0 & 0x3F) << 2)) >> 2 to tmp_buf[0]

    4. Write ((s8)(((s0 >> 8) & 0x3F) << 2)) >> 2 to tmp_buf[1]

    5. Write ((s8)((s1 & 0x3F) << 2)) >> 2 to tmp_buf[2]

    6. Write ((s8)(((s1 >> 8) & 0x3F) << 2)) >> 2 to tmp_buf[3]

  9. Loop 4 times with index i
    1. Add tmp_buf[i] to current contents of buf[i]
  10. Set out to (buf[0] & 0xFF) << 24 | (buf[1] & 0xFF) << 16 | (buf[2] & 0xFF) << 8 | (buf[3] & 0xFF)

  11. If PHY Revision < 2

    1. Restore PHY Register 0xCA
  12. If PHY Revision >= 3

    1. Restore PHY Registers 0xF9, 0xFB, 0xA6, 0xA7, 0x8F, 0xA5, 0xE5, and 0xE6
  13. Otherwise
    1. Restore PHY Registers 0xA6, 0xA7, 0xA5, 0x78, 0xEC, 0x7A, and 0x7D
  14. Return out

Exported/Archived from the wiki to HTML on 2016-10-27