bcm-v4

[Specification

N PHY Calc RX IQ Comp (u8 mask)

  1. Establish a struct nphy_iq_est named est
  2. Establist 2 struct nphy_iq_comp named old and new
  3. Set error to 0
  4. If mask is 0
    1. Return
  5. Call N PHY RX IQ Coeffs with 0, &old as arguments

  6. Set new.a0, new.b0, new.a1, and new.b1 to 0
  7. Call N PHY RX IQ Coeffs with 1, &new as arguments

  8. Call N PHY RX IQ Est with &est, 0x4000, 32, 0 as arguments

  9. Set new to old
  10. Loop 2 times with i as index
    1. If i is zero and (mask & 1) is not zero

      1. Set iq to est.iq0_prod
      2. Set ii to est.i0_pwr
      3. Set qq to est.q0_pwr
    2. Else if i is 1 and (mask & 2) is not zero

      1. Set iq to est.iq1_prod
      2. Set ii to est.i1_pwr
      3. Set qq to est.q1_pwr
    3. Otherwise
      1. Continue
    4. If ii + qq < 2

      1. Set error to -1
      2. Break from loop
    5. Set iq_nbits to Number of bits in iq

    6. Set qq_nbits to Number of bits in qq

    7. Set arsh to iq_nbits - 20
    8. If arsh >= 0

      1. Set a to -((iq << (30 - iq_nbits)) + (ii >> (1 + arsh)))

      2. Set tmp to ii >> arsh

      3. If tmp is zero
        1. Set error to -1
        2. Break from loop
    9. Otherwise
      1. Set a to -((iq << (30 - iq_nbits)) + (ii << (-1 - arsh)))

      2. Set tmp to ii << -arsh

      3. If tmp is zero
        1. Set error to -1
        2. Break from loop
    10. Replace a by a / tmp
    11. Set brsh to qq_nbits - 11
    12. If brsh >= 0

      1. Set b to (qq << (31 - qq_nbits))

      2. Set tmp to ii >> brsh

      3. If tmp is zero
        1. Set error to -1
        2. Break
    13. Otherwise
      1. Set b to (qq << (31 - qq_nbits))

      2. Set tmp to (ii << -brsh)

      3. If tmp is zero
        1. Set error to -1
        2. Break
    14. Set b to sqrt (b / tmp - a * a) - (1 << 10)

    15. If i is zero and (mask & 0x1) is not zero

      1. If PHY Revision >= 3

        1. Set new.a0 to a & 0x3FF

        2. Set new.b0 to b & 0x3FF

      2. Otherwise
        1. Set new.a0 to b & 0x3FF

        2. Set new.b0 to a & 0x3FF

    16. If i is 1 and mask & 0x2 is not zero

      1. If PHY Revision >= 3

        1. Set new.a1 to a & 0x3FF

        2. Set new.b1 to b & 0x3FF

      2. Otherwise
        1. Set new.a1 to b & 0x3FF

        2. Set new.b1 to a & 0x3FF

  11. If error is not zero
    1. Set new to old
  12. Call N PHY RX IQ Coeffs with 1, &new as arguments


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