-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyuc_rfic_common.h
More file actions
287 lines (260 loc) · 7.07 KB
/
yuc_rfic_common.h
File metadata and controls
287 lines (260 loc) · 7.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
* Copyright 2020-2022 NXP
*
*/
#ifndef __YUC_RFIC_COMMON_H__
#define __YUC_RFIC_COMMON_H__
#include <yuc_rfic_types.h>
/* Each command has command spefic data, defined
* by sw_cmd_* structs as given below.
*
* NOTE:XXX: The size of these structs should not exceed
* RFIC_SWCMD_DATA_SIZE 32 bit words,if it does then please
* change RFIC_SWCMD_DATA_SIZE macro to required size
*/
typedef struct sw_cmd_setget_path
{
uint32_t rtc;
uint32_t path;
uint32_t band;
uint32_t mode;
uint32_t rssi_mode;
uint32_t dpd;
uint32_t rxbw;
uint32_t txbw;
} __attribute__( ( packed ) ) sw_cmd_setget_path_t;
typedef struct sw_cmd_setget_calpll
{
uint32_t rtc;
uint32_t mode;
uint32_t freq_khz;
uint32_t cal_band;
} __attribute__( ( packed ) ) sw_cmd_setget_calpll_t;
typedef struct sw_cmd_set_gain
{
uint32_t path;
uint32_t manual;
uint32_t channel;
uint32_t hash_mode;
uint32_t bb_gain;
uint32_t rf_gain;
uint32_t tx_gain;
uint32_t rx_gain;
} __attribute__( ( packed ) ) sw_cmd_set_gain_t;
typedef struct sw_cmd_get_gain
{
uint32_t rtc;
uint32_t rx1_manual;
uint32_t rx1_hash_mode;
uint32_t channel;
uint32_t rx1_gain;
uint32_t rx1_bbgain;
uint32_t rx1_rfgain;
uint32_t rx2_manual;
uint32_t rx2_hash_mode;
uint32_t rx2_gain;
uint32_t rx2_bbgain;
uint32_t rx2_rfgain;
uint32_t tx1_gain;
uint32_t tx2_gain;
uint32_t rx1_gain_raw;
uint32_t rx2_gain_raw;
uint32_t tx1_gain_raw;
uint32_t tx2_gain_raw;
uint32_t tx_gain_idx;
uint32_t rx_gain_idx;
} __attribute__( ( packed ) ) sw_cmd_get_gain_t;
typedef struct sw_cmd_set_bbloopback
{
uint32_t rtc;
uint32_t rx;
uint32_t txbw;
uint32_t rxbw;
} __attribute__( ( packed ) ) sw_cmd_set_bbloopback_t;
typedef struct sw_cmd_set_rfloopback
{
uint32_t rtc;
uint32_t rx;
uint32_t band;
uint32_t loop_mode;
} __attribute__( ( packed ) ) sw_cmd_set_rfloopback_t;
typedef struct sw_cmd_setget_rxdc
{
uint32_t rtc;
uint32_t rx;
uint32_t channel;
uint32_t iq_select;
int32_t fine0;
int32_t coarse0;
int32_t fine1;
int32_t coarse1;
int32_t fine2;
int32_t coarse2;
int32_t fine3;
int32_t coarse3;
int32_t fine4;
int32_t coarse4;
int32_t fine5;
int32_t coarse5;
int32_t fine6;
int32_t coarse6;
int32_t fine7;
int32_t coarse7;
} __attribute__( ( packed ) ) sw_cmd_setget_rxdc_t;
typedef struct sw_cmd_get_version
{
uint32_t rtc;
uint32_t hw_ver;
uint32_t min_ver;
uint32_t maj_ver;
uint32_t tgt_ver;
uint32_t bld_nr;
uint32_t test_nr;
uint32_t dbg_flg;
} __attribute__( ( packed ) ) sw_cmd_get_vers_t;
typedef struct sw_cmd_get_sys_status
{
uint32_t rtc;
uint32_t sys_state;
uint32_t trxpll_vco_det_lo;
uint32_t trxpll_vco_det_hi;
uint32_t trxpll_vtune_det_lo;
uint32_t trxpll_vtune_det_hi;
uint32_t trxpll_unlock;
uint32_t calpll_vtune_det_lo;
uint32_t calpll_vtune_det_hi;
uint32_t calpll_unlock;
} __attribute__( ( packed ) ) sw_cmd_get_sys_status_t;
typedef struct sw_cmd_setget_property
{
uint32_t rtc;
uint32_t property_id;
uint32_t length;
uint32_t value1;
uint32_t value2;
uint32_t value3;
uint32_t value4;
uint32_t value5;
uint32_t value6;
uint32_t value7;
uint32_t value8;
} __attribute__( ( packed ) ) sw_cmd_setget_property_t;
typedef struct sw_cmd_setactive
{
uint32_t rtc;
uint32_t mode;
uint32_t dpd_rx;
} __attribute__( ( packed ) ) sw_cmd_setactive_t;
typedef struct sw_cmd_setcal_rxdc
{
uint32_t rtc;
uint32_t rx;
uint32_t mode;
int32_t ifine;
int32_t icoarse;
int32_t qfine;
int32_t qcoarse;
} __attribute__( ( packed ) ) sw_cmd_setcal_rxdc_t;
typedef struct sw_cmd_setget_register
{
uint32_t rtc;
uint32_t addr;
uint32_t length;
uint32_t mask;
uint32_t value1;
uint32_t value2;
uint32_t value3;
uint32_t value4;
uint32_t value5;
uint32_t value6;
uint32_t value7;
uint32_t value8;
} __attribute__( ( packed ) ) sw_cmd_setget_register_t;
typedef struct sw_cmd_get_temperature
{
uint32_t rtc;
uint32_t temperature;
uint32_t value_raw;
} __attribute__( ( packed ) ) sw_cmd_get_temperature_t;
typedef struct sw_cmd_setget_lnabypass_t
{
uint32_t enable;
} __attribute__( ( packed ) ) sw_cmd_setget_lnabypass_t;
typedef struct sw_cmd_setget_dpdsw_t
{
uint32_t enable;
} __attribute__( ( packed ) ) sw_cmd_setget_dpdsw_t;
typedef struct sw_cmd_setget_rssi
{
uint32_t rtc;
uint32_t receiver;
uint32_t mode;
uint32_t rate;
uint32_t threshold;
uint32_t ref_g0_0;
uint32_t ref_g0_1;
uint32_t ref_g0_2;
uint32_t ref_g1_0;
uint32_t ref_g1_1;
uint32_t ref_g1_2;
uint32_t ref_gother_0;
uint32_t ref_gother_1;
uint32_t ref_gother_2;
} __attribute__( ( packed ) ) sw_cmd_setget_rssi_t;
typedef struct yuc_pll_cal {
/* TRX PLL */
uint32_t cal_cap;
uint32_t cal_current;
uint32_t vco_sel;
} __attribute__((packed)) yuc_pll_cal_t;
typedef struct yuc_IQ_dcoc {
int32_t i_coarse;
int32_t i_fine;
int32_t q_coarse;
int32_t q_fine;
} __attribute__((packed)) yuc_IQ_dcoc_t;
typedef struct yuc_IQ_zgain_dc {
int16_t Idc;
int16_t Qdc;
} __attribute__((packed)) yuc_IQ_zgain_dc_t;
typedef struct yuc_rxdc_gain_cal {
yuc_IQ_dcoc_t gain_rxdc[YUC_RX_RF_GAIN_LEVELS];//8*16 =128
yuc_IQ_dcoc_t gain_dpd_rxdc[YUC_RX_RF_GAIN_LEVELS];//128+8*16=256
yuc_IQ_dcoc_t gain_calp_rxdc;//256+16=272
yuc_IQ_zgain_dc_t rxdc_zgain;//272+4 =276
yuc_IQ_zgain_dc_t dpd_rxdc_zgain;//=276+4=280
yuc_IQ_zgain_dc_t calp_rxdc_zgain;//280+4=284
} __attribute__((packed)) yuc_rxdc_gain_cal_t;
typedef struct yuc_rxdc_rx_cal {
yuc_rxdc_gain_cal_t rx_rxdc[YUC_CAL_RXDC_RX_CNT];//2*284=568
} __attribute__((packed)) yuc_rxdc_rx_cal_t;
typedef struct yuc_IQ_imb {
uint32_t num_tones;//4
int32_t gimb_arr[YUC_IQIMB_TONE_MAX_CNT];//4+8*4=36
int32_t pimb_arr[YUC_IQIMB_TONE_MAX_CNT];//36+8*4=68
int32_t mean_gimb;//68+4=72
int32_t mean_pimb;//72+4=76
int32_t cmp_dc_real[YUC_IQIMB_TONE_MAX_CNT];//76+8*4=108
int32_t cmp_dc_imag[YUC_IQIMB_TONE_MAX_CNT];//108+8*4=140
int32_t mean_cmp_dc_real;//140+4=144
int32_t mean_cmp_dc_imag;//144+4=148
int32_t skew;//148+4=152
} __attribute__((packed)) yuc_IQ_imb_t;
typedef struct yuc_cal_data {
uint32_t magic;
uint32_t ver;/**< For checking compatility */
uint32_t state;
uint32_t recalib;
/* calib data starts from here */
int32_t vcxo_tune;//20
yuc_pll_cal_t pll[YUC_CAL_PLL_FREQ_CNT];//20+4*12=68
uint32_t tx_bw[YUC_CAL_TXBW_MAX];//68+2*4=76
uint32_t rx_bw[YUC_CAL_RXBW_MAX];//76+10*4 = 116
yuc_rxdc_rx_cal_t freq_rxdc[YUC_CAL_RXDC_FREQ_CNT];//116+4*568=116+2272 =2388
/* Can add extra params below */
yuc_IQ_imb_t rx_IQimb[YUC_IQIMB_RX_CNT];//2388+2*152=2692
yuc_IQ_imb_t tx_IQimb[YUC_IQIMB_TX_CNT];//2692+2*152=2996
/* Padding as caldata size is not aligned to 64bytes */
uint32_t padding[3];//2996+3*4=3008
} __attribute__( ( packed ) ) yuc_cal_data_t;
#endif /* ifndef __YUC_RFIC_COMMON_H__ */