PHY Noise Sample Request (u8 reason, u8 channel)
Save phynoise_state
- Set wait to TRUE
- If reason is 1
Set phynoise_chan_watchdog to channel
OR phynoise_state with 0x1
- Else if reason is 2
Set phy_noise_list[channel] to -92
Set phynoise_chan_scan to channel
OR phynoise_state with 0x2
- Else if reason is 3
Set phynoise_chan_cqrm to channel
OR phynoise_state with 0x4
- Otherwise
- Warn on improper value
If the saved value of phynoise_state is not zero
- Return
Copy now to phynoise_now
If phy_fixed_noise is not zero
- If this is an N PHY
- *** TODO ***
- If this is an LP PHY
- noise = -95
- Otherwise
- Error - A/B/G PHYs do not use this routine
- Set wait to FALSE
- Go to finish
- If this is an N PHY
- If this is an LP PHY
If phynoise_polling is not zero OR reason is 3
- Write 0 to shared memory location 0x88
- Write 0 to shared memory location 0x8A
- Write 0 to shared memory location 0x310
- Write 0 to shared memory location 0x314
- Write 0 to shared memory location 0x318
- Write 0 to shared memory location 0x31C
- Bitwise OR the MAC command register with 0x10
- Otherwise
- Suspend MAC
Call LP PHY Set Deaf with argument 0
Call LP PHY RX Signal Power with argument 20. Save the result as noise
Call LP PHY Clear Deaf with argument 0
- Enable MAC
- Set wait to 0
- Else if this is an N PHY
- *** TODO ***
- Otherwise
- Error - This PHY is not supported here.
- If wait is zero
Call PHY Noise CB with channel, noise as arguments