bcm-v4

[Specification

int LP PHY RX IQ Cal (struct lpphy_rx_iqcomp *iqcomp, int iqcomp_sz, int use_noise, int tx_switch, int rx_switch, int pa, struct lpphy_txgains *tx_gain)

Note: Struct lpphy_rx_iqcomp { u8 chan; s8 c1; s8 c0;}

Struct lpphy_txgains { u16 gm_gain; u16 pga_gain; u16 pad_gain; uint16 dac_gain;}

  1. Initialize answer to 0, and tmp1 to 0
  2. Create old_gains as struct lpphy_txgains
  3. If iqcomp is not NULL
    1. Loop while iqcomp_sz > 0

      1. Decrement iqcomp_sz
      2. If iqcomp[iqcomp_sz].chan equals the current channel
        1. MaskSet PHY Register 0x49E with mask 0xFF00 and set with iqcomp[iqcomp_sz].c1

        2. MaskSet PHY Register 0x49E with mask 0x00FF and set with iqcomp[iqcomp_sz].c0 << 8

        3. Set answer to 1
        4. Break from loop
    2. If answer is 0
      1. Warn on impossible case
      2. Return 0
  4. If use_noise is non-zero
    1. Set tx_switch to 1
    2. Set rx_switch to 0
    3. Set pa to 0
  5. Call LP PHY Set Trsw Override with arguments tx_switch and rx_switch

  6. If the current band is 2G
    1. Set bit 0x0008 in PHY Register 0x44C
    2. If pa is non-zero
      1. Set bit 0x0008 in PHY Register 0x44D
    3. Otherwise
      1. Clear bit 0x0008 in PHY Register 0x44D
  7. Otherwise
    1. Set bit 0x0020 in PHY Register 0x44C
    2. If pa is non-zero
      1. Set bit 0x0020 in PHY Register 0x44D
    3. Otherwise
      1. Clear bit 0x0020 in PHY Register 0x44D
  8. If use_noise is not zero
    1. Call LP PHY Set RX Gain with 0x2D5D as argument

  9. Otherwise
    1. Read PHY Register 0x43B) masked with 0x0040 and save as tmp1
    2. If tmp1 is not zero
      1. Call LP PHY Get TX Gain with old_gains as argument

    3. If tx_gains is NULL
      1. Create an lpphy_txgains structure that contains zeros
      2. Call LP PHY Set TX Gain with that structure as argument

    4. Otherwise
      1. Call LP PHY Set TX Gain with tx_gain as the argument

  10. Mask PHY Register 0x43B with mask 0xFFFE
  11. Mask PHY Register 0x43C with mask 0xFFFE
  12. Set bit 0x0800 in PHY Register 0x44C
  13. Set bit 0x0800 in PHY Register 0x44D
  14. Call LP PHY Set Deaf with 0 as argument

  15. If use_noise is not zero
    1. Call LP PHY Calc RX IQ Comp with 0xFFF0 as argument, save returned value as answer

  16. Otherwise
    1. Call LP PHY Start TX Tone with 4000 and 100 as arguments

    2. Call LP PHY Calc RX IQ Comp with 0x4000 as argument, save returned value as answer

    3. Call LP PHY Stop TX Tone

  17. Call LP PHY Clear Deaf with 0 as argument

  18. Call LP PHY Clear TRSW Override

  19. Clear bit 0x8 in PHY Register 0x44C

  20. Clear bit 0x20 in PHY Register 0x44C

  21. If use_noise is zero
    1. If tmp1 is not zero
      1. Call LP PHY Set TX Gain with &old_gains as argument

    2. Otherwise
      1. Call LP PHY Set TX Gain Override with argument 0

  22. Call LP PHY RX Gain Override Enable with argument 0

  23. Clear bit 0x1 in PHY Register 0x43B

  24. Clear bit 0x800 in PHY Register 0x43C

  25. Return answer

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