N PHY Adjust Min Noise Variable (int ntones, int tone buffer, u32 noise buffer)
- If the current channel width is 40 MHz
- Set a table length to 256
- Otherwise
- Set table length to 128
If nphy_noisevars_adjusted
Loop nphy_saved_noisevars.bufcount times with i as loop index
Set id to the i'th element of nphy_saved_noisevars.tone_id
If id >= 0
- Set offset to id * 2 + 1
- Otherwise
- Set offset to the table length + id * 2 + 1
Write the N PHY table with ID 16, length 1, offset as above, width 32, and the data given by the i'th element of nphy_saved_noisevars.min_noise_vars
Set nphy_saved_noisevars.bufcount to 0
Set nphy_noisevars_adjusted to 0
- If the noise and tone buffer pointers are both not NULL
Set nphy_saved_noisevars.bufcount to 0
- Loop ntones times with i as index
- Set id to the i'th element of the tone buffer
If id >= 0
- Set offset to 2 * id + 1
- Otherwise
- Set offset to the table length + 2 * id + 1
Read the N PHY table with ID 16, length 1, offset as above, width 32, and the data given by the i'th element of nphy_saved_noisevars.min_noise_vars
- Write the N PHY table with ID 16, length 1, offset as above, width 32, and the data given by the i'th element of the noise buffer
Increment nphy_saved_noisevars.bufcount
Set nphy_noisevars_adjusted to 1