bcm-v4

[Specification

LP PHY Start TX Tone (s32 f_kHz, u16 max_val)

This routine uses a macro CONVERT(X) defined as (((X) >= 0) ? ((((X) >> 15) + 1) >> 1) : -((((-(X)) >> 15) + 1) >> 1))

  1. Create a table structure
  2. Create a u16 data buffer of size 64
  3. Create a complex integer structure called tone_samp
  4. Copy f_kHz to phy_tx_tone_freq

  5. If f_kHz is not zero
    1. Set a counter (k) to 1
    2. Start a loop
      1. Set bw to 20000 * k
      2. Set the number of samples to bw / abs(f_kHz) ?? Can f_kHz be negative
      3. Error if number of samples is greater than 63
      4. Increment k
      5. Repeat as long as the number of samples * abs(f_kHz) is not equal to bw
  6. Otherwise
    1. Set the number of samples to 2
  7. Calculate rotation equal to (((36 * f_kHz)/20) << 16) /100

  8. Set starting angle to 0
  9. Loop from 0 through the number of samples (non-inclusive)
    1. Perform the PHY Cordic routine with the angle and &tone_samp as arguments

    2. Add the rotation to the angle
    3. Calculate the imaginary part as CONVERT((tone_samp.i * max_val) masked with 0xFF)
    4. Calculate the real part as CONVERT((tone_samp.q * max_val) masked with 0xFF)
    5. Store imaginary part left-shifted by 8 and bitwise ORed by the real part into the data array using the loop index
  10. Set the table data pointer to the data buffer, the table length to the number of samples, and the table ID to 5
  11. Set the table offset to 0 and the table width to 16
  12. Perform an LP table-write

  13. Perform the LP PHY Run Samples with (number of samples, 0xFFFF, 0) as the arguments


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