bcm-specs

[Specification

Hardware Power Control

For boards with HardwarePowerControl (A or G PHY):

  1. Save SHM offset 0x32 for use later

A PHY (Not Hardware Power Control)

We only recalculate the transmission power if we have a saved power control register value, if (in DBm^2) the TSSI isn't 0 and we don't have a Board Type of 0x40A or 0x416 with Board Vendor Broadcom.

  1. Read SHM offset 0x68 (This is 2 TSSI values)

  2. Read SHM offset 0x6A (This is 2 TSSI values)

  3. If any of the 4 TSSI values are 0x7F
    1. Abort, we can't measure the transmit power
  4. Add the 4 TSSI values together, then add 2
  5. If the result is less than 0
    1. Add 5
  6. FIXME
  7. If the result isn't 0
    1. Subtract the result from FIXME
    2. Clamp the result to 0x2F
    3. Lock the PHYRegisterLock

    4. Lock the RadioRegisterLock

    5. SetTXPower for an APHY with the result

    6. Unlock the RadioRegisterLock

    7. Unlock the PHYRegisterLock

B/G PHY (Not Hardware Power Control)

We only recalculate the transmission power if we have a saved power control register value and we don't have a Board Type of 0x416 with Board Vendor Broadcom.

All dBm values are in Q5.2 to get better accuracy. You need as an input the desired power in dBm (in Q5.2 to match the other dBm values).

  1. Get the 4 TSSI (1) values from SHM.

  2. If they are invalid (any of them is 0x7F), then
    1. Get the 4 TSSI (2) values from SHM.

    2. If they are invalid (any of them is 0x7F), then abort (nothing has been transmitted so transmit power could not be measured)
    3. Add 0x20 to each of the 4 values and mask it with 0x3F
  3. ClearTSSI

  4. Calculate the average of the four values each incremented by 1/2.
  5. If the second set of TSSI values was used and the Microcode flag 0x8 is set, subtract 13.
  6. EstimatePowerOut with the result as the TSSI value

  7. Get the maximum power the board supports from the maxpower value given in the SPROM and note that it is 0.75 dBm too high if the board has GPIO 9 controlling the PA (as per BoardFlags) and the PHY is a G PHY.

  8. Adjust the maximum power to match regulatory limits observing the antenna gain value given in the SPROM. Also note that the actual transmission power may fluctuate so subtract 1.5 dBm to be on the safe side (FIXME not exactly sure if this is the reason but I think so).

  9. Adjust the desired power so it is neither below 0 nor above the maximum power.
  10. Calculate the difference between the estimated current power and the desired power (power_adjust)
  11. The radio attenuation must be changed by radio_atten_delta := - (power_adjust + 7)>>3

  12. The baseband attenuation must be changed by bb_atten_delta := - power_adjust>>1 - 4*radio_atten_delta

  13. if neither radio nor baseband attenuation must be changed, mark the current AttenuationControl value combination as used (see LocalOscillator) and return

  14. calculate the new baseband and radio attenuation values
  15. Try to get both baseband and radio attenuation into their permitted ranges, observing that radio attenuation affects the power level four times as much as baseband attenuation. (Note: Use the small range [0,9] for radio attenuation.)
  16. if radio attenuation ends up smaller than 0, set it to 0
  17. if this is for a 2050 radio with revision 2
    1. if the radio attenuation less or equal to one
      1. if the current txctl1 value is 0, set it to 3 and increase both radio and baseband attenuation by two
      2. otherwise, if the board has GPIO 9 controlling the PA, set the radio attenuation to 2 while keeping the total attenuation constant (see above: radio attenuation affects the power level four times as much as baseband attenuation)
    2. otherwise, if the radio attenuation is bigger than 4 and the current txctl1 value is not 0
      1. set txctl1 to 0
      2. if the baseband attenuation is less than 3, decrease radio attenuation by 3 and increase baseband attenuation by 2
      3. otherwise, decrease both radio and baseband attenuation by 2
  18. Clamp the baseband attenuation to [0,11] and the radio attenuation to [0,9]
  19. Enable the PHYRegisterLock

  20. Enable the RadioRegisterLock

  21. SetTXPower

  22. Mark the current value combination as used (see LocalOscillator)

  23. Disable the RadioRegisterLock

  24. Disable the PHYRegisterLock

  25. UpdateTXPowerSHM


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