u16 Radio 205X Rcal
If PHY Revision >= 7
- If Radio Revision is 5
- AND PHY Register 0x342 with ~0x2
- Delay 10 usec
- Set bit 1 in Radio Register 0xcd
- Mask set Radio Register 0x1ca with mask ~0x2 and set with 0x1
- Set bit 1 in Radio Register 0x04
- Wait 10 usec
- Set bits 0x3 in Radio Register 0x04
- Wait for bit 0x1 to be set in Radio Register 0x162. Try a maximum of 10,000 times with 100 usec between tries (This is a long time to wait.)
- If wait loop fails, log error and return 0
- Clear bit 2 in Radio Register 0x04
- Read Radio Register 0x163, mask with 0x3E, and save as tmp
- Clear bit 0x1 in Radio Register 0x04
- If Radio Revision is 5
- Clear bit 0x1 in Radio Register 0x64
- Clear bit 0x2 in Radio Register 0x1CA
If Radio Revision <= 4 OR Radio Revision is 6
- Maskset Radio Register 0x0C with mask ~0x3C and set with tmp
Maskset Radio Register 0x0A with mask ~0xF0 and set with tmp << 2
- If Radio Revision is 5
- Else if PHY Revision is 3
- Save contents of Radio Register 0x3D
- Write saved value ORed with 0x7 to Radio Register 0x3D
- Delay 10 usec
- Write 0x01 to Radio Register 0x2C
- Delay 10 usec
- Write 0x09 to Radio Register 0x2C
- Wait for bit 0x80 to be set in Radio Register 0x2D. Try a maximum of 10,000 times with 100 usec between tries (This is a long time to wait.)
- If wait loop fails, log error and return 0
- Write 0x01 to Radio Register 0x2C
- Set tmp to Radio Register 0x2D
- Write 0 to Radio Register 0x2C
- Restore saved value of Radio Register 0x3D
Return tmp & 0x1F
Return tmp & 0x3E