bcm-v4

[Specification

int LP PHY Calc RX IQ Comp ( u16 num_samps)

  1. Create a struct {u32 iq_prod; u32 i_pwr; u32 q_pwr} called iq_est
  2. Read PHY Register 0x49E, mask with 0xFF00, right shift by 8, and save as c0_new

  3. Read PHY Register 0x49E, mask with 0x00FF and save as c1_new

  4. MaskSet PHY Register 0x49E with mask 0xFF00 and set with 0x00C0

  5. MaskSet PHY Register 0x49E with mask 0x00FF and set with 0

  6. Set value to LP PHY RX IQ Est with arguments ( num_samps, 32, &iq_est)

  7. If value is zero
    1. Goto cleanup
  8. Set iq to the iq_prod member of iq_est
  9. Set ii to the i_pwr member of iq_est
  10. Set qq to the q_pwr member of iq_est
  11. If ii + qq < 2

    1. Set value to 0
    2. Goto cleanup
  12. Use PHY Nbits to calculate the number of bits in iq, save as iq_nbits

  13. Use PHY Nbits to calculate the number of bits in qq, save as qq_nbits

  14. Set crsh to iq_nbits - 20
  15. If crsh >= 0

    1. Set c to ((iq << (30 - iq_nbits)) + (ii >> (1 + crsh))) / (ii >> crsh)

  16. Otherwise
    1. Set c to ((iq << (30 - iq_nbits)) + (ii << (-1 - crsh))) / (ii << -crsh)

  17. Set arsh to qq_nbits - 11
  18. If arsh >= 0

    1. Set a to (qq << (31 - qq_nbits)) / (ii >> arsh)

  19. Otherwise
    1. Set a to (qq << (31 - qq_nbits)) / (ii << -arsh)

  20. Subtract c * c from a
  21. a = -int_sqrt(a)
  22. Set c0_new to c >> 3

  23. Set c1_new to a >> 4

cleanup:

  1. MaskSet PHY Register 0x49E with mask 0xFF00 and set with c1_new

  2. MaskSet PHY Register 0x49E with mask 0x00FF and set with c0_new << 8

  3. Return value

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