Contents
- int N PHY Cal TX IQ LO (struct nphy_txgains target, bool full, bool mphase)
- tbl_tx_iqlo_cal_loft_ladder_40
- tbl_tx_iqlo_cal_loft_ladder_20
- tbl_tx_iqlo_cal_iqimb_ladder_40
- tbl_tx_iqlo_cal_iqimb_ladder_20
- tbl_tx_iqlo_cal_startcoefs_nphyrev3
- tbl_tx_iqlo_cal_startcoefs
- tbl_tx_iqlo_cal_cmds_recal_nphyrev3
- tbl_tx_iqlo_cal_cmds_recal
- tbl_tx_iqlo_cal_cmds_fullcal
- tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3
int N PHY Cal TX IQ LO (struct nphy_txgains target, bool full, bool mphase)
- Establish an 11-element u16 array named buffer
- Set diq_start to 0
- Set last to 0
- Establish 2-element u16 arrays named save and gain
- Establish a 2-element struct nphy_iqcal_params named params
- Establish a 2-element bool array named updated and initialized to 0
Call N PHY Stay in Carrier Search with argument 1
If PHY Revision >= 4
Set avoid to phyhang_avoid
Set phyhang_avoid to 0
- Read an N PHY Table with ID 7, length 2, offset 0x110, width 16, and data pointer save
- Loop 2 times with index i
Call N PHY IQ Cal Gain Params with i, target, ¶ms[i] as arguments
- Set gain[i] to params[i].cal_gain
- Write an N PHY Table with ID 7, length 2, offset 0x110, width 16, and data pointer gain
If PHY Revision >= 6 or ((PHY Revision is 5) and ((nphy_ipa2g_on and the band is 2GHz)))
- If the band width is 40 MHz
- Set the table_pointer to tbl_tx_iqlo_cal_loft_ladder_40
- Set the table_length to the value for that table
- Otherwise
- Set the table_pointer to tbl_tx_iqlo_cal_loft_ladder_20
- Set the table_length to the value for that table
- Write an N PHY Table with ID 15, length from above, offset 0, width 16, and data pointer from above
- If the band width is 40 MHz
- Set the table_pointer to tbl_tx_iqlo_cal_iqimb_ladder_40
- Set the table_length to the value for that table
- Otherwise
- Set the table_pointer to tbl_tx_iqlo_cal_iqimb_ladder_20
- Set the table_length to the value for that table
- Write an N PHY Table with ID 15, table_length from above, offset 32, width 16, and data pointer from above
- If the band width is 40 MHz
- Write 0x8AA9 to PHY Register 0xC2
- If the band width is 20 MHz
- Set freq to 2500
- Otherwise
- Set freq to 5000
If mphase_cal_phase_id > 2
Call N PHY Run Samples with (band width * 8), 0xFFFF, 0, 1, 0 as arguments
- Set error to 0
- Otherwise
Call N PHY TX Tone with freq, 250, 1, 0 as arguments and save result as error
- If error is zero
If mphase_cal_phase_id > 2
Set table_pointer to mphase_txcal_bestcoeffs
- Set table_length to the length of that table
If PHY Revision < 3
- Decrease table_length by 2
- Otherwise
If full is zero and nphy_txiqlocal_coeffsvalid
Set table_pointer to nphy_txiqlocal_bestc
- Set table_length to the length of that table
If PHY Revision < 3
- Decrease table_length by 2
- Otherwise
- Set full to 1
If PHY Revision >= 3
- Set table_pointer to tbl_tx_iqlo_cal_startcoefs_nphyrev3
- Set table_length to the length of that table
- Otherwise
- Set a table_pointer to tbl_tx_iqlo_cal_startcoefs
- Set the table_length to the length of that table
- Write an N PHY Table with ID 15, table_length, offset 64, width 16, and the data from table_pointer
- If full
If PHY Revision >= 3
- Set max to the number of entries in tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3
- Otherwise
- Set max to the number of entries in tbl_tx_iqlo_cal_cmds_fullcal
- Otherwise
If PHY Revision >= 3
- Set max to the number of entries in tbl_tx_iqlo_cal_cmds_recal_nphyrev3
- Otherwise
- Set max to the number of entries in tbl_tx_iqlo_cal_cmds_recal
- If mphase
Set count to mphase_txcal_cmdidx
If (count + mphase_txcal_numcmds) < max
Set numb to count + mphase_txcal_numcmds
- Otherwise
- Set numb to max
- Otherwise
- Set count to 0
- Set numb to max
- Loop with index count, starting with current value, stop at numb (non-inclusive)
- If full
If PHY Revision >= 3
- Set cmd to tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3[count]
- Otherwise
- Set cmd to tbl_tx_iqlo_cal_cmds_fullcal[count]
- Otherwise
If PHY Revision >= 3
- Set cmd to tbl_tx_iqlo_cal_cmds_recal_nphyrev3[count]
- Otherwise
- Set cmd to tbl_tx_iqlo_cal_cmds_recal[count]
Set core to (cmd & 0x3000) >> 12
Set type to (cmd & 0x0F00) >> 8
- If (PHY Revision is 6) or ((PHY Revision is 5) and (band is 2 GHz))
- If updated[core] is zero
Call N PHY Update TX Cal Ladder with core as argument
- Set updated[core] to 1
- If updated[core] is zero
Set tmp to (params[core].ncorr[type] << 8) | 0x66
- Write tmp to PHY Register 0xC1
- If type is 1, 3, or 4
- Read an N PHY Table with ID 15, length 1, offset 69 + core, width 16, and data pointer buffer
- Set diq_start to buffer[0]
- Set buffer[0] to 0
- Write an N PHY Table with ID 15, length 1, offset 69 + core, width 16, and data of 0
- Write cmd to PHY Register 0xC0
Spin wait for (PHY Register 0xC0 & 0xC000) to be non-zero. Wait a maximum 0f 20,000 usec with tests every 10 usec
- Read an N PHY Table with ID 15, length table_length, offset 96, width 16, and data pointer buffer
- Write an N PHY Table with ID 15, length table_length, offset 64, width 16, and data pointer buffer
- If type is 1, 3, or 4
- Set buffer[0] to diq_start
- If full
- If mphase
If numb >= max
Set mphase_txcal_cmdidx to 0
- Otherwise
Set mphase_txcal_cmdidx to numb
If PHY Revision < 3
- Set last to 6
- Otherwise
- Set last to 7
If mphase is 0 or mphase_cal_phase_id equals last
- Read an N PHY Table with ID 15, length 4, offset 96, width 16, and data pointer buffer
- Write an N PHY Table with ID 15, length 4, offset 80, width 16, and data pointer buffer
If the PHY Revision < 2
- Set buffer[0], buffer[1], buffer[2] and buffer[3] to 0
- Write an N PHY Table with ID 15, length 4, offset 88, width 16, and data pointer buffer
- Read an N PHY Table with ID 15, length 2, offset 101, width 16, and data pointer buffer
- Write an N PHY Table with ID 15, length 2, offset 85, width 16, and data pointer buffer
- Write an N PHY Table with ID 15, length 2, offset 93, width 16, and data pointer buffer
Set length to the number of elements in nphy_txiqlocal_bestc
If PHY Revision < 3
- Reduce length by 2
Read an N PHY Table with ID 15, length length, offset 96, width 16, and data pointer nphy_txiqlocal_bestc
Set nphy_txiqlocal_coeffsvalid to 1
Set nphy_txiqlocal_chanspec to radio_chanspec
- Otherwise
Set length to the length of mphase_txcal_bestcoeffs
If PHY Revision < 3
- Reduce length by 2
Read an N PHY Table with ID 5, length length, offset 96, width 16, and data pointer mphase_txcal_bestcoeffs
Call N PHY Stop Playback
- Write 0 to PHY Register 0xC2
- Write an N PHY Table with ID 7, length 2, offset 0x110, width 16, and data from save
If PHY Revision < 2 and ((mphase is zero) or (mphase_cal_phase_id equals last))
If PHY Revision >= 4
Set phyhang_avoid to avoid
Call N PHY Stay in Carrier Search with argument 0
- Return error
tbl_tx_iqlo_cal_loft_ladder_40
0x0200 |
0x0300 |
0x0400 |
0x0700 |
0x0900 |
0x0c00 |
0x1200 |
0x1201 |
0x1202 |
0x1203 |
0x1204 |
0x1205 |
0x1206 |
0x1207 |
0x1907 |
0x2307 |
0x3207 |
0x4707 |
tbl_tx_iqlo_cal_loft_ladder_20
0x0300 |
0x0500 |
0x0700 |
0x0900 |
0x0d00 |
0x1100 |
0x1900 |
0x1901 |
0x1902 |
0x1903 |
0x1904 |
0x1905 |
0x1906 |
0x1907 |
0x2407 |
0x3207 |
0x4607 |
0x6407 |
tbl_tx_iqlo_cal_iqimb_ladder_40
0x0100 |
0x0200 |
0x0400 |
0x0700 |
0x0900 |
0x0c00 |
0x1200 |
0x1900 |
0x2300 |
0x3200 |
0x4700 |
0x4701 |
0x4702 |
0x4703 |
0x4704 |
0x4705 |
0x4706 |
0x4707 |
tbl_tx_iqlo_cal_iqimb_ladder_20
0x0200 |
0x0300 |
0x0600 |
0x0900 |
0x0d00 |
0x1100 |
0x1900 |
0x2400 |
0x3200 |
0x4600 |
0x6400 |
0x6401 |
0x6402 |
0x6403 |
0x6404 |
0x6405 |
0x6406 |
0x6407 |
tbl_tx_iqlo_cal_startcoefs_nphyrev3
0x0000 |
0x0000 |
0x0000 |
0x0000 |
0x0000 |
0x0000 |
0x0000 |
0x0000 |
0x0000 |
0x0000 |
0x0000 |
tbl_tx_iqlo_cal_startcoefs
0x0000 |
0x0000 |
0x0000 |
0x0000 |
0x0000 |
0x0000 |
0x0000 |
0x0000 |
0x0000 |
tbl_tx_iqlo_cal_cmds_recal_nphyrev3
0x8423 |
0x8323 |
0x8073 |
0x8256 |
0x8045 |
0x8223 |
0x9423 |
0x9323 |
0x9073 |
0x9256 |
0x9045 |
0x9223 |
tbl_tx_iqlo_cal_cmds_recal
0x8101 |
0x8253 |
0x8053 |
0x8234 |
0x8034 |
0x9101 |
0x9253 |
0x9053 |
0x9234 |
0x9034 |
tbl_tx_iqlo_cal_cmds_fullcal
0x8123 |
0x8264 |
0x8086 |
0x8245 |
0x8056 |
0x9123 |
0x9264 |
0x9086 |
0x9245 |
0x9056 |
tbl_tx_iqlo_cal_cmds_fullcal_nphyrev3
0x8434 |
0x8334 |
0x8084 |
0x8267 |
0x8056 |
0x8234 |
0x9434 |
0x9334 |
0x9084 |
0x9267 |
0x9056 |
0x9234 |