5946b465e74cba918d5f41de53a1eb70065d6e1f
[o-du/phy.git] / fapi_5g / include / fapi_interface.h
1 /******************************************************************************
2 *
3 *   Copyright (c) 2019 Intel.
4 *
5 *   Licensed under the Apache License, Version 2.0 (the "License");
6 *   you may not use this file except in compliance with the License.
7 *   You may obtain a copy of the License at
8 *
9 *       http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *   Unless required by applicable law or agreed to in writing, software
12 *   distributed under the License is distributed on an "AS IS" BASIS,
13 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *   See the License for the specific language governing permissions and
15 *   limitations under the License.
16 *
17 *******************************************************************************/
18
19 #ifndef _FAPI_INTERFACE_H_
20 #define _FAPI_INTERFACE_H_
21
22 #if defined(__cplusplus)
23 extern "C" {
24 #endif
25
26 #include "stdint.h"
27
28 #define FAPI_PARAM_REQUEST                                                                      0x00
29 #define FAPI_PARAM_RESPONSE                                                                     0x01
30 #define FAPI_CONFIG_REQUEST                                                                     0x02
31 #define FAPI_CONFIG_RESPONSE                                                            0x03
32 #define FAPI_START_REQUEST                                                                      0x04
33 #define FAPI_STOP_REQUEST                                                                       0x05
34 #define FAPI_STOP_INDICATION                                                            0x06
35 #define FAPI_ERROR_INDICATION                               0x07
36 // Reserved 0x08 - 0x7f
37 #define FAPI_VENDOR_EXT_SHUTDOWN_REQUEST                    0x08
38 #define FAPI_VENDOR_MESSAGE                                 0x09
39 #ifdef DEBUG_MODE
40 #define FAPI_VENDOR_EXT_DL_IQ_SAMPLES                       0x0A
41 #define FAPI_VENDOR_EXT_UL_IQ_SAMPLES                       0x0B
42 #endif
43 // WLS operation 
44 #define FAPI_MSG_HEADER_IND                                 0x2A
45
46 // WLS operation with PDSCH Payload
47 #define FAPI_MSG_PHY_ZBC_BLOCK_REQ                          0x2B
48
49 // WLS operation with PUSCH Payload
50 #define FAPI_MSG_PHY_ZBC_BLOCK_IND                          0x2C
51
52 #define FAPI_DL_TTI_REQUEST                                                             0x80
53 #define FAPI_UL_TTI_REQUEST                                                             0x81
54 #define FAPI_SLOT_INDICATION                                                            0x82
55 #define FAPI_UL_DCI_REQUEST                                                             0x83
56 #define FAPI_TX_DATA_REQUEST                                                            0x84
57 #define FAPI_RX_DATA_INDICATION                                                         0x85
58 #define FAPI_CRC_INDICATION                                                             0x86
59 #define FAPI_UCI_INDICATION                                                             0x87
60 #define FAPI_SRS_INDICATION                                                             0x88
61 #define FAPI_RACH_INDICATION                                                            0x89
62 // Reserved 0x8a -0xff
63 #ifdef DEBUG_MODE
64 #define FAPI_VENDOR_EXT_START_RESPONSE                      0x8A
65 #endif
66 #define FAPI_VENDOR_EXT_SHUTDOWN_RESPONSE                   0x8B
67
68 // Tags per 5G FAPI
69 // Cell Parameters
70 #define FAPI_RELEASE_CAPABILITY_TAG                                             0x0001
71 #define FAPI_PHY_STATE_TAG                                                  0x0002
72 #define FAPI_SKIP_BLANK_DL_CONFIG_TAG                                           0x0003
73 #define FAPI_SKIP_BLANK_UL_CONFIG_TAG                                   0x0004
74 #define FAPI_NUM_CONFIG_TLVS_TO_REPORT_TYPE_TAG                         0x0005
75 #define FAPI_CYCLIC_PREFIX_TAG                              0x0006
76 // PDCCH Parameters
77 #define FAPI_SUPPORTED_SUBCARRIER_SPACING_DL_TAG                    0x0007
78 #define FAPI_SUPPORTED_BANDWIDTH_DL_TAG                                     0x0008
79 #define FAPI_SUPPORTED_SUBCARRIER_SPACING_UL_TAG                        0x0009
80 #define FAPI_SUPPORTED_BANDWIDTH_UL_TAG                                         0x000A
81 #define FAPI_CCE_MAPPING_TYPE_TAG                                               0x000B
82 #define FAPI_CORESET_OUTSIDE_FIRST_3_OFDM_SYMS_OF_SLOT_TAG      0x000c
83 #define FAPI_PRECODER_GRANULARITY_CORESET_TAG                           0x000d
84 #define FAPI_PDCCH_MU_MIMO_TAG                                                          0x000e
85 #define FAPI_PDCCH_PRECODER_CYCLING_TAG                                     0x000f
86 #define FAPI_MAX_PDCCHS_PER_SLOT_TAG                                    0x0010
87 // PUCCH Parameters
88 #define FAPI_PUCCH_FORMATS_TAG                                                  0x0011
89 #define FAPI_MAX_PUCCHS_PER_SLOT_TAG                                        0x0012
90 // PDSCH Parameters
91 #define FAPI_PDSCH_MAPPING_TYPE_TAG                                             0x0013
92 #define FAPI_PDSCH_ALLOCATION_TYPES_TAG                         0x0014
93 #define FAPI_PDSCH_VRB_TO_PRB_MAPPING_TAG                                       0x0015
94 #define FAPI_PDSCH_CBG_TAG                                                          0x0016
95 #define FAPI_PDSCH_DMRS_CONFIG_TYPES_TAG                                        0x0017
96 #define FAPI_PDSCH_DMRS_MAX_LENGTH_TAG                                          0x0018
97 #define FAPI_PDSCH_DMRS_ADDITIONAL_POS_TAG                                      0x0019
98 #define FAPI_MAX_PDSCHS_TBS_PER_SLOT_TAG                                        0x001a
99 #define FAPI_MAX_NUMBER_MIMO_LAYERS_PDSCH_TAG                           0x001b
100 #define FAPI_SUPPORTED_MAX_MODULATION_ORDER_DL_TAG                  0x001c
101 #define FAPI_MAX_MU_MIMO_USERS_DL_TAG                                           0x001d
102 #define FAPI_PDSCH_DATA_IN_DMRS_SYMBOLS_TAG                                 0x001e
103 #define FAPI_PREMPTIONSUPPORT_TAG                                                       0x001f
104 #define FAPI_PDSCH_NON_SLOT_SUPPORT_TAG                                     0x0020
105 // PUSCH Parameters
106 #define FAPI_UCI_MUX_ULSCH_IN_PUSCH_TAG                             0x0021
107 #define FAPI_UCI_ONLY_PUSCH_TAG                                         0x0022
108 #define FAPI_PUSCH_FREQUENCY_HOPPING_TAG                                    0x0023
109 #define FAPI_PUSCH_DMRS_CONFIG_TYPES_TAG                                0x0024
110 #define FAPI_PUSCH_DMRS_MAX_LEN_TAG                                             0x0025
111 #define FAPI_PUSCH_DMRS_ADDITIONAL_POS_TAG                                  0x0026
112 #define FAPI_PUSCH_CBG_TAG                                  0x0027
113 #define FAPI_PUSCH_MAPPING_TYPE_TAG                         0x0028
114 #define FAPI_PUSCH_ALLOCATION_TYPES_TAG                     0x0029
115 #define FAPI_PUSCH_VRB_TO_PRB_MAPPING_TAG                   0x002a
116 #define FAPI_PUSCH_MAX_PTRS_PORTS_TAG                       0x002b
117 #define FAPI_MAX_PDUSCHS_TBS_PER_SLOT_TAG                   0x002c
118 #define FAPI_MAX_NUMBER_MIMO_LAYERS_NON_CB_PUSCH_TAG        0x002d
119 #define FAPI_SUPPORTED_MODULATION_ORDER_UL_TAG              0x002e
120 #define FAPI_MAX_MU_MIMO_USERS_UL_TAG                       0x002f
121 #define FAPI_DFTS_OFDM_SUPPORT_TAG                          0x0030
122 #define FAPI_PUSCH_AGGREGATION_FACTOR_TAG                   0x0031
123 // PRACH Parameters
124 #define FAPI_PRACH_LONG_FORMATS_TAG                         0x0032
125 #define FAPI_PRACH_SHORT_FORMATS_TAG                        0x0033
126 #define FAPI_PRACH_RESTRICTED_SETS_TAG                      0x0034
127 #define FAPI_MAX_PRACH_FD_OCCASIONS_IN_A_SLOT_TAG           0x0035
128 // Measurement Parameters
129 #define FAPI_RSSI_MEASUREMENT_SUPPORT_TAG                   0x0036
130
131 // CONFIG TLV TAGS per 5G FAPI
132 // Carrier Configuration
133 #define FAPI_DL_BANDWIDTH_TAG                               0x1001
134 #define FAPI_DL_FREQUENCY_TAG                               0x1002
135 #define FAPI_DL_K0_TAG                                      0x1003
136 #define FAPI_DL_GRIDSIZE_TAG                                0x1004
137 #define FAPI_NUM_TX_ANT_TAG                                 0x1005
138 #define FAPI_UPLINK_BANDWIDTH_TAG                           0x1006
139 #define FAPI_UPLINK_FREQUENCY_TAG                           0x1007
140 #define FAPI_UL_K0_TAG                                      0x1008
141 #define FAPI_UL_GRID_SIZE_TAG                               0x1009
142 #define FAPI_NUM_RX_ANT_TAG                                 0x100a
143 #define FAPI_FREQUENCY_SHIFT_7P5_KHZ_TAG                    0x100b
144 // Cell Configuration
145 #define FAPI_PHY_CELL_ID_TAG                                0x100c
146 #define FAPI_FRAME_DUPLEX_TYPE_TAG                          0x100d
147 // SSB Configuration
148 #define FAPI_SS_PBCH_POWER_TAG                              0x100e
149 #define FAPI_BCH_PAYLOAD_TAG                                0x100f
150 #define FAPI_SCS_COMMON_TAG                                 0x1010
151 // PRACH Configuration
152 #define FAPI_PRACH_SEQUENCE_LENGTH_TAG                      0x1011
153 #define FAPI_PRACH_SUBC_SPACING_TAG                         0x1012
154 #define FAPI_RESTRICTED_SET_CONFIG_TAG                      0x1013
155 #define FAPI_NUM_PRACH_FD_OCCASIONS_TAG                     0x1014
156 #define FAPI_PRACH_ROOT_SEQUENCE_INDEX_TAG                  0x1015
157 #define FAPI_NUM_ROOT_SEQUENCES_TAG                         0x1016
158 #define FAPI_K1_TAG                                         0x1017
159 #define FAPI_PRACH_ZERO_CORR_CONF_TAG                       0x1018
160 #define FAPI_NUM_UNUSED_ROOT_SEQUENCES_TAG                  0x1019
161 #define FAPI_UNUSED_ROOT_SEQUENCES_TAG                      0x101a
162 #define FAPI_SSB_PER_RACH_TAG                               0x101b
163 #define FAPI_PRACH_MULTIPLE_CARRIERS_IN_A_BAND_TAG          0x101c
164 // SSB Table
165 #define FAPI_SSB_OFFSET_POINT_A_TAG                         0x101d
166 #define FAPI_BETA_PSS_TAG                                   0x101e
167 #define FAPI_SSB_PERIOD_TAG                                 0x101f
168 #define FAPI_SSB_SUBCARRIER_OFFSET_TAG                      0x1020
169 #define FAPI_MIB_TAG                                        0x1021
170 #define FAPI_SSB_MASK_TAG                                   0x1022
171 #define FAPI_BEAM_ID_TAG                                    0x1023
172 #define FAPI_SS_PBCH_MULTIPLE_CARRIERS_IN_A_BAND_TAG        0x1024
173 #define FAPI_MULTIPLE_CELLS_SS_PBCH_IN_A_CARRIER_TAG        0x1025
174 // TDD Table
175 #define FAPI_TDD_PERIOD_TAG                                 0x1026
176 #define FAPI_SLOT_CONFIG_TAG                                0x1027
177 // Measurement Configuration
178 #define FAPI_RSSI_MEASUREMENT_TAG                           0x1028
179 // Prach Configuration Index
180 #define FAPI_PRACH_CONFIG_INDEX_TAG                                                     0x1029
181 // DMRS-TypeA Pos
182 #define FAPI_DMRS_TYPE_A_POS_TAG                                                        0x102A
183
184 // Error Codes updated per 5G FAPI Table 3-31
185 #define FAPI_MSG_OK                                                                                     0x0
186 #define FAPI_MSG_INVALID_STATE                                                          0x1
187 #define FAPI_MSG_INVALID_CONFIG                                                         0x2
188 #define FAPI_MSG_SFN_OUT_OF_SYNC                                                        0x3
189 #define FAPI_MSG_SLOT_ERR                                                               0x4
190 #define FAPI_MSG_BCH_MISSING                                                            0x5
191 #define FAPI_MSG_INVALID_SFN                                                            0x6
192 #define FAPI_MSG_UL_DCI_ERR                                                                     0x7
193 #define FAPI_MSG_TX_ERR                                                                         0x8
194
195 // TODO : Work out what the correct maximums should be// Needs Review for 5G
196 #if 0
197 // Number of UL/DL configurations, I, as defined by 36.212 section 5.3.3.1.4
198 // todo : work out what the max is
199 #define FAPI_MAX_UL_DL_CONFIGURATIONS                                           4
200 #define FAPI_MAX_NUM_PHYSICAL_ANTENNAS                                          4
201 #define FAPI_MAX_NUM_SCHEDULED_UES                                                      8
202 #define FAPI_MAX_NUM_SUBBANDS                                                           8
203 #define FAPI_MAX_ANTENNA_PORT_COUNT                                                     2
204 #endif
205
206 // 5G FAPI Definitions
207 #define FAPI_NUMEROLOGIES                                   5
208 #define FAPI_MAX_NUM_UNUSED_ROOT_SEQUENCES                  63  // 38.331 page 383
209 #define FAPI_MAX_NUM_PRACH_FD_OCCASIONS                     64  // 38.331 page 383
210 #define FAPI_MAX_NUM_OF_SYMBOLS_PER_SLOT                    14
211 #define FAPI_MAX_TDD_PERIODICITY                            160 // 38.212 11.1 for u=4 and P=10 ms
212 // m=p*q with p number of panels and q number of TxRU/RxRU per panel,
213 // depends on the RF configuration, currently n=m=4, q=1, p=4 and k=21
214 // (number of beams per pannel). n number of antenna ports
215 #define FAPI_MAX_NUMBER_TX_RUS                              4
216 #define FAPI_MAX_NUMBER_OF_BEAMS                            64  // Intel API Page 27
217 #define FAPI_MAX_NUM_ANT_PORTS                              8   // Based on current RF
218 #define FAPI_MAX_NUM_LAYERS                                 8   // 38.211 Table 7.3.1.3-1
219 #define FAPI_MAX_NUM_TLVS_CELL_PARMS                        1505    // 5G FAPI Table 3-9  (A)
220 #define FAPI_MAX_NUM_TLVS_CARRIER_PARMS                                 27  // 5G FAPI Table 3-10 (B)
221 #define FAPI_MAX_NUM_TLVS_PDCCH_PARMS                       6   // 5G FAPI Table 3-11 (C)
222 #define FAPI_MAX_NUM_TLVS_PUCCH_PARMS                       2   // 5G FAPI Table 3-12 (D)
223 #define FAPI_MAX_NUM_TLVS_PDSCH_PARMS                       14  // 5G FAPI Table 3-13 (E)
224 #define FAPI_MAX_NUM_TLVS_PUSCH_PARMS                       17  // 5G FAPI Table 3-14 (F)
225 #define FAPI_MAX_NUM_TLVS_PRACH_PARMS                       4   // 5G FAPI Table 3-15 (G)
226 #define FAPI_MAX_NUM_TLVS_MEAS_PARMS                        1   // 5G FAPI Table 3-16 (H)
227 #define FAPI_MAX_NUM_TLVS_PARAMS                            1576    //  A+B+C+D+E+F+G+H + Padding
228 // Carrier Table 11 + Cell Config 2 + SSB Config 3 + PRACH Config 414 + SSB
229 // Table 71 + TDD Table  141 + Measurements 1
230 #define FAPI_MAX_NUM_TLVS_CONFIG                                                        1500
231
232 #define FAPI_UL_DCI_REQUEST_PDCCH_PDU                                   0
233
234 #define FAPI_MAX_NUMBER_UNSUPPORTED_TLVS                    74
235 #define FAPI_MAX_NUMBER_OF_INVALID_IDLE_ONLY_TLVS           74
236 #define FAPI_MAX_NUMBER_OF_INVALID_RUNNING_ONLY_TLVS        74
237 #define FAPI_MAX_NUMBER_OF_MISSING_TLVS                     74
238 #define FAPI_MAX_NUM_DIGBFINTERFACES                        4   // Based on RF, 5G FAPI says {0,255}
239 #define FAPI_MAX_NUM_PRGS_PER_TTI                           4   // Based on 38.214 5.1.2.3
240 #define FAPI_DCI_PAYLOAD_BYTE_LEN                           32  // Based on Intel API MAX_DCI_BIT_BYTE_LEN
241 #define FAPI_MAX_NUMBER_DL_DCI                              1   // Based on Intel API MAX_NUM_PDCCH
242 #define FAPI_MAX_NUMBER_OF_CODEWORDS_PER_PDU                2   // Based on MAX_DL_CODEWORD
243 // Based on (MAX_NUM_PDSCH*MAX_DL_CODEWORD + MAX_NUM_PDCCH + MAX_NUM_SRS +
244 // 1 PBCH/SLOT)
245 #define FAPI_MAX_NUMBER_DL_PDUS_PER_TTI                     129
246
247 #define FAPI_MAX_NUMBER_OF_UES_PER_TTI                      16  // Per common_ran_parameters.h
248 // Based on Max Tb size of 1376264 bits + 24 crc over (8848-24) and O/H
249 #define FAPI_MAX_NUM_CB_PER_TTI_IN_BYTES                    192
250
251 #define FAPI_MAX_NUM_PTRS_PORTS                             2   // Per 3GPP 38.212 Table 7.3.1.1.2-21
252 #define FAPI_MAX_NUMBER_OF_GROUPS_PER_TTI                   16  // FlexRAN API Table 33
253 #define FAPI_MAX_NUMBER_UL_PDUS_PER_TTI                     328 // (MAX_NUM_PUSCH+MAX_NUM_PUCCH+MAX_NUM_SRS+MAX_NUM_PRACH_DET)
254 #define FAPI_MAX_NUMBER_DCI_PDUS_PER_TTI                    32  // Based on MAX_NUM_PDCCH
255 #define FAPI_MAX_NUMBER_OF_TLVS_PER_PDU                     2   // one for each codeword
256 #define FAPI_MAX_NUMBER_TX_PDUS_PER_TTI                     129 // Same as FAPI_MAX_NUMBER_DL_PDUS_PER_TTI
257 // Based on 38.214 5.1.3.4, the TBS is 1376264 bits and divided by 8 and
258 // aligned to 64 bytes
259 #define FAPI_MAX_PDU_LENGTH                                 172096
260
261 #define FAPI_MAX_NUMBER_OF_PDUS_PER_TTI                     129 // Same as FAPI_MAX_NUMBER_DL_PDUS_PER_TTI
262 #define FAPI_MAX_NUMBER_OF_ULSCH_PDUS_PER_SLOT              64  // NUM_PUSCH_CHAN*FAPI_MAX_NUMBER_OF_CODEWORDS_PER_PDU
263 #define FAPI_MAX_NUMBER_OF_CRCS_PER_SLOT                    32  // Based on MAX_NUM_UL_CHAN
264 #define FAPI_MAX_HARQ_INFO_LEN_BYTES                        214 // Based on 5G FAPI Table 3-70
265 #define FAPI_MAX_CSI_PART1_DATA_BYTES                       214 // Based on 5G FAPI Table 3-71
266 #define FAPI_MAX_CSI_PART2_DATA_BYTES                       214 // Based on 5G FAPI Table 3-72
267 #define FAPI_MAX_NUMBER_OF_HARQS_PER_IND                    2   // Based on 5G FAPI Table 3-68
268 #define FAPI_MAX_SR_PAYLOAD_SIZE                            1   // Based on 5G FAPI Table 3-69
269 #define FAPI_MAX_HARQ_PAYLOAD_SIZE                          214 // Based on 5G FAPI Table 3-70
270 #define FAPI_MAX_NUMBER_UCI_PDUS_PER_SLOT                   200 // Based on MAX_NUM_PUCCH
271 #define FAPI_MAX_NUMBER_RBS                                 273 // Based on MAX_NUM_OF_PRB_IN_FULL_BAND
272 #define FAPI_MAX_NUMBER_OF_REP_SYMBOLS                      4   // Based on 5g FAPI Table 3-73
273 #define FAPI_MAX_NUMBER_SRS_PDUS_PER_SLOT                   32  // Based on MAX_NUM_SRS
274 #define FAPI_MAX_NUM_PREAMBLES_PER_SLOT                     64  // Based on MAX_NUM_PRACH_DET
275 #define FAPI_MAX_NUMBER_RACH_PDUS_PER_SLOT                  64  // Based on MAX_NUM_PRACH_DET
276 #define FAPI_MAX_PDUS_PER_SLOT                                                          64
277 #define FAPI_MAX_NUM_TLVS_START                             3   // Based on Timer Mode requirement.
278 #define FAPI_MAX_NUM_TLVS_SHUTDOWN                          1   // Based on Timer Mode requirement.
279 #define FAPI_MAX_UCI_BIT_BYTE_LEN                           256
280
281 #ifdef DEBUG_MODE
282 #define FAPI_MAX_IQ_SAMPLE_FILE_SIZE                        576
283 #define FAPI_MAX_IQ_SAMPLE_DL_PORTS                           8
284 #define FAPI_MAX_IQ_SAMPLE_UL_PORTS                           2
285 #define FAPI_MAX_IQ_SAMPLE_UL_VIRTUAL_PORTS                   4
286 #define FAPI_MAX_IQ_SAMPLE_UL_ANTENNA                         32
287 #define FAPI_MAX_IQ_SAMPLE_BUFFER_SIZE                     4096
288 #endif
289
290 #define FAPI_PRACH_PDU_TYPE                                   0
291 #define FAPI_PUSCH_PDU_TYPE                                   1
292 #define FAPI_PUCCH_PDU_TYPE                                   2
293 #define FAPI_SRS_PDU_TYPE                                     3
294
295 #define FAPI_PDCCH_PDU_TYPE                                   0
296 #define FAPI_PDSCH_PDU_TYPE                                   1
297 #define FAPI_PBCH_PDU_TYPE                                    2
298 #define FAPI_CSIRS_PDU_TYPE                                   3
299
300 //------------------------------------------------------------------------------------------------------------
301 // Linked list header prent at the top of all messages
302     typedef struct _fapi_api_queue_elem {
303         struct _fapi_api_queue_elem *p_next;
304         // p_tx_data_elm_list used for TX_DATA.request processing
305         struct _fapi_api_queue_elem *p_tx_data_elm_list;
306         uint8_t msg_type;
307         uint8_t num_message_in_block;
308         uint32_t msg_len;
309         uint32_t align_offset;
310         uint64_t time_stamp;
311     } fapi_api_queue_elem_t, *p_fapi_api_queue_elem_t;
312
313 // Updated per 5G FAPI
314     typedef struct {
315         uint8_t num_msg;
316         // Can be used for Phy Id or Carrier Id  5G FAPI Table 3-2
317         uint8_t handle;
318         uint8_t pad[2];
319     } fapi_msg_header_t, *p_fapi_msg_header_t;
320
321 // Updated per 5G FAPI
322     typedef struct {
323         uint16_t msg_id;
324         uint16_t pad;
325         uint32_t length;        // Length of the message body in bytes  5G FAPI Table 3-3
326     } fapi_msg_t;
327 // Updated per 5G FAPI
328     typedef struct {
329         uint16_t tag;
330         uint16_t length;        // 5G FAPI Table 3-7 Fixed part
331     } fapi_tl_t;
332 // Updated per 5G FAPI
333     typedef struct {
334         fapi_tl_t tl;
335         uint8_t value;          // TLV with byte value
336         uint8_t rsv[3];         // Per 5g FAPI 3.3.1.4 the lenght of the value parameter must be 32 bits
337     } fapi_uint8_tlv_t;
338     typedef struct {
339         fapi_tl_t tl;
340         uint8_t *value;         // TLV with unsigned 32 bit value
341     } fapi_uint8_ptr_tlv_t;
342 // Updated per 5G FAPI
343     typedef struct {
344         fapi_tl_t tl;
345         uint16_t value;         // TLV with unsigned 16 bit value
346         uint8_t rsv[2];         // Per 5g FAPI 3.3.1.4 the lenght of the value parameter must be 32 bits
347     } fapi_uint16_tlv_t;
348 // Updated per 5G FAPI
349     typedef struct {
350         fapi_tl_t tl;
351         int16_t value;          // TLV with signed 16 bit value
352         uint8_t rsv[2];         // Per 5g FAPI 3.3.1.4 the lenght of the value parameter must be 32 bits
353     } fapi_int16_tlv_t;
354 // Updated per 5G FAPI
355     typedef struct {
356         fapi_tl_t tl;
357         uint32_t value;         // TLV with unsigned 32 bit value
358     } fapi_uint32_tlv_t;
359 // Updated per 5G FAPI
360     typedef struct {
361         uint16_t tag;           // In 5G FAPI for Cell Params inside Table 3-9 under NumConfigTLVsToReport Loop
362         uint8_t length;
363         uint8_t value;
364     } fapi_config_tlv_t;
365
366     typedef struct {
367         fapi_tl_t tl;
368         uint16_t value[FAPI_NUMEROLOGIES];
369         uint16_t rsv;           // To be 32-bit aligned, if FAPI_NUMEROLOGIES changes to some other value than 5 please ensure 32 bit alignment
370     } fapi_config_num_tlv_t;
371
372     typedef struct {
373         uint16_t hopping_id;
374         uint8_t carrier_aggregation_level;
375         uint8_t group_hop_flag;
376         uint8_t sequence_hop_flag;
377         // uint8_t                     nDMRS_type_A_pos;
378         uint8_t pad[3];
379     } fapi_config_req_vendor_msg_t;
380
381     typedef struct {
382         uint16_t sfn;
383         uint16_t slot;
384         uint32_t mode;
385 #ifdef DEBUG_MODE
386         uint32_t count;
387         uint32_t period;
388 #endif
389     } fapi_start_req_vendor_msg_t;
390
391     typedef struct {
392         uint16_t sfn;
393         uint16_t slot;
394     } fapi_stop_req_vendor_msg_t;
395
396     typedef struct {
397         fapi_msg_t header;
398         fapi_config_req_vendor_msg_t config_req_vendor;
399         fapi_start_req_vendor_msg_t start_req_vendor;
400         fapi_stop_req_vendor_msg_t stop_req_vendor;
401     } fapi_vendor_msg_t;
402
403 // Updated per 5G FAPI
404     typedef struct {
405         fapi_msg_t header;      // For PARAM.req message length in fapi_msg_t is zero per 5G FAPI 3.3.1.1
406     } fapi_param_req_t;
407
408 // Updated per 5G FAPI
409     typedef struct {
410         fapi_uint16_tlv_t releaseCapability;
411         fapi_uint16_tlv_t phyState;
412         fapi_uint8_tlv_t skipBlankDlConfig;
413         fapi_uint8_tlv_t skipBlankUlConfig;
414         fapi_uint16_tlv_t numTlvsToReport;
415         fapi_config_tlv_t tlvStatus[FAPI_MAX_NUM_TLVS_CONFIG];  // 5G FAPI Table 3-9
416     } fapi_cell_parms_t;
417
418 // Updated per 5G FAPI
419     typedef struct {
420         fapi_uint8_tlv_t cyclicPrefix;
421         fapi_uint8_tlv_t supportedSubcarrierSpacingDl;
422         fapi_uint16_tlv_t supportedBandwidthDl;
423         fapi_uint8_tlv_t supportedSubcarrierSpecingsUl;
424         fapi_uint16_tlv_t supportedBandwidthUl; // 5G FAPI Table 3-10
425     } fapi_carrier_parms_t;
426
427 // Updated per 5G FAPI    
428     typedef struct {
429         fapi_uint8_tlv_t cceMappingType;
430         fapi_uint8_tlv_t coresetOutsideFirst3OfdmSymsOfSlot;
431         fapi_uint8_tlv_t precoderGranularityCoreset;
432         fapi_uint8_tlv_t pdcchMuMimo;
433         fapi_uint8_tlv_t pdcchPrecoderCycling;
434         fapi_uint8_tlv_t maxPdcchsPerSlot;  // 5G FAPI Table 3-11
435     } fapi_pdcch_parms_t;
436
437 // Updated per 5G FAPI
438     typedef struct {
439         fapi_uint8_tlv_t pucchFormats;
440         fapi_uint8_tlv_t maxPucchsPerSlot;  // 5G FAPI Table 3-12
441     } fapi_pucch_parms_t;
442
443 // Updated per 5G FAPI
444     typedef struct {
445         fapi_uint8_tlv_t pdschMappingType;
446         fapi_uint8_tlv_t pdschAllocationTypes;
447         fapi_uint8_tlv_t pdschVrbToPrbMapping;
448         fapi_uint8_tlv_t pdschCbg;
449         fapi_uint8_tlv_t pdschDmrsConfigTypes;
450         fapi_uint8_tlv_t pdschDmrsMaxLength;
451         fapi_uint8_tlv_t pdschDmrsAdditionalPos;
452         fapi_uint8_tlv_t maxPdschsTBsPerSlot;
453         fapi_uint8_tlv_t maxNumberMimoLayersPdsch;
454         fapi_uint8_tlv_t supportedMaxModulationOrderDl;
455         fapi_uint8_tlv_t maxMuMimoUsersDl;
456         fapi_uint8_tlv_t pdschDataInDmrsSymbols;
457         fapi_uint8_tlv_t premptionSupport;
458         fapi_uint8_tlv_t pdschNonSlotSupport;   // 5G FAPI Table 3-13
459     } fapi_pdsch_parms_t;
460
461 // Updated per 5G FAPI
462     typedef struct {
463         fapi_uint8_tlv_t uciMuxUlschInPusch;
464         fapi_uint8_tlv_t uciOnlyPusch;
465         fapi_uint8_tlv_t puschFrequencyHopping;
466         fapi_uint8_tlv_t puschDmrsConfigTypes;
467         fapi_uint8_tlv_t puschDmrsMaxLen;
468         fapi_uint8_tlv_t puschDmrsAdditionalPos;
469         fapi_uint8_tlv_t puschCbg;
470         fapi_uint8_tlv_t puschMappingType;
471         fapi_uint8_tlv_t puschAllocationTypes;
472         fapi_uint8_tlv_t puschVrbToPrbMapping;
473         fapi_uint8_tlv_t puschMaxPtrsPorts;
474         fapi_uint8_tlv_t maxPduschsTBsPerSlot;
475         fapi_uint8_tlv_t maxNumberMimoLayersNonCbPusch;
476         fapi_uint8_tlv_t supportedModulationOrderUl;
477         fapi_uint8_tlv_t maxMuMimoUsersUl;
478         fapi_uint8_tlv_t dftsOfdmSupport;
479         fapi_uint8_tlv_t puschAggregationFactor;    // 5G FAPI Table 3-14
480     } fapi_pusch_parms_t;
481
482 // Updated per 5G FAPI
483     typedef struct {
484         fapi_uint8_tlv_t prachLongFormats;
485         fapi_uint16_tlv_t prachShortFormats;
486         fapi_uint8_tlv_t prachRestrictedSets;
487         fapi_uint8_tlv_t maxPrachFdOccasionsInASlot;    // 5G FAPI Table 3-15
488     } fapi_prach_parms_t;
489
490 // Updated per 5G FAPI
491     typedef struct {
492         fapi_uint8_tlv_t rssiMeasurementSupport;    // 5G FAPI Table 3-16
493     } fapi_meas_parms_t;
494
495 // Updated per 5G FAPI
496     typedef struct {
497         fapi_cell_parms_t cell_parms;
498         fapi_carrier_parms_t carr_parms;
499         fapi_pdcch_parms_t pdcch_parms;
500         fapi_pucch_parms_t pucch_parms;
501         fapi_pdsch_parms_t pdsch_parms;
502         fapi_pusch_parms_t pusch_parms;
503         fapi_prach_parms_t prach_parms;
504         fapi_meas_parms_t meas_parms;   // 5G FAPI Table 3-8
505     } fapi_params_t;
506
507 // Updated per 5G FAPI
508     typedef struct {
509         fapi_msg_t header;
510         uint8_t error_code;
511         uint8_t number_of_tlvs;
512         uint8_t pad[2];
513         fapi_uint16_tlv_t tlvs[FAPI_MAX_NUM_TLVS_PARAMS];   // 5G FAPI Table 3-5
514     } fapi_param_resp_t;
515
516 // Updated per 5G FAPI
517     typedef struct {
518         fapi_uint16_tlv_t dlBandwidth;
519         fapi_uint32_tlv_t dlFrequency;
520         fapi_config_num_tlv_t dlk0;
521         fapi_config_num_tlv_t dlGridSize;
522         fapi_uint16_tlv_t numTxAnt;
523         fapi_uint16_tlv_t uplinkBandwidth;
524         fapi_uint32_tlv_t uplinkFrequency;
525         fapi_config_num_tlv_t ulk0;
526         fapi_config_num_tlv_t ulGridSize;
527         fapi_uint16_tlv_t numRxAnt;
528         fapi_uint8_tlv_t frequencyShift7p5KHz;  // 5G FAPI Table 3-21
529     } fapi_carrier_config_t;
530
531 // Updated per 5G FAPI
532     typedef struct {
533         fapi_uint8_tlv_t phyCellId;
534         fapi_uint8_tlv_t frameDuplexType;   // 5G FAPI Table 3-22
535     } fapi_cell_config_t;
536
537 // Updated per 5G FAPI
538     typedef struct {
539         fapi_uint32_tlv_t ssPbchPower;
540         fapi_uint8_tlv_t bchPayload;
541         fapi_uint8_tlv_t scsCommon; // 5G FAPI Table 3-23
542     } fapi_ssb_config_t;
543
544 // Updated per 5G FAPI
545     typedef struct {
546         fapi_uint16_tlv_t prachRootSequenceIndex;
547         fapi_uint8_tlv_t numRootSequences;
548         fapi_uint16_tlv_t k1;
549         fapi_uint8_tlv_t prachZeroCorrConf;
550         fapi_uint16_tlv_t numUnusedRootSequences;   // 5G FAPI Table 3-24 Subset
551         fapi_uint16_tlv_t
552             unusedRootSequences[FAPI_MAX_NUM_UNUSED_ROOT_SEQUENCES];
553     } fapi_prachFdOccasion_t;
554
555 // Updated per 5G FAPI_
556     typedef struct {
557         fapi_uint8_tlv_t prachSequenceLength;
558         fapi_uint8_tlv_t prachSubCSpacing;
559         fapi_uint8_tlv_t restrictedSetConfig;
560         fapi_uint8_tlv_t numPrachFdOccasions;
561         fapi_uint8_tlv_t prachConfigIndex;
562         fapi_prachFdOccasion_t prachFdOccasion[FAPI_MAX_NUM_PRACH_FD_OCCASIONS];
563         fapi_uint8_tlv_t ssbPerRach;
564         fapi_uint8_tlv_t prachMultipleCarriersInABand;  // 5G FAPI Table 3-24
565     } fapi_prach_configuration_t;
566
567 //Updated per 5G FAPI
568     typedef struct {
569         fapi_uint16_tlv_t ssbOffsetPointA;
570         fapi_uint8_tlv_t betaPss;
571         fapi_uint8_tlv_t ssbPeriod;
572         fapi_uint8_tlv_t ssbSubCarrierOffset;
573         fapi_uint32_tlv_t mib;
574         fapi_uint32_tlv_t ssbMask[2];
575         fapi_uint8_tlv_t beamId[64];
576         fapi_uint8_tlv_t ssPbchMultipleCarriersInABand;
577         fapi_uint8_tlv_t multipleCellsSsPbchInACarrier; // 5G FAPI Table 3-25
578     } fapi_ssb_table_t;
579
580 // Updated per 5G FAPI
581     typedef struct {
582         fapi_uint8_tlv_t slotConfig[FAPI_MAX_NUM_OF_SYMBOLS_PER_SLOT];  // 5G FAPI Table 3-26 Subset
583     } fapi_slotconfig_t;
584
585 // Updated per 5G FAPI
586     typedef struct {
587         fapi_uint8_tlv_t tddPeriod;
588         fapi_slotconfig_t slotConfig[FAPI_MAX_TDD_PERIODICITY]; // 5G FAPI Table 3-26
589     } fapi_tdd_table_t;
590
591 // Updated per 5G FAPI
592     typedef struct {
593         fapi_uint8_tlv_t rssiMeasurement;   // 5G FAPI Table 3-27
594     } fapi_meas_config_t;
595
596 // Updated per 5G FAPI
597     typedef struct {
598         int16_t digBeamWeightRe;
599         int16_t digBeamWeightIm;    // 5G FAPI Table 3-32 Subset
600     } fapi_dig_beam_weight_t;
601
602 // Updated per 5G FAPI
603     typedef struct {
604         uint16_t beamIdx;
605         fapi_dig_beam_weight_t digBeamWeight[FAPI_MAX_NUMBER_TX_RUS];   // 5G FAPI Table 3-32 Subset
606     } fapi_dig_beam_config_t;
607
608 // Updated per 5G FAPI
609     typedef struct {
610         uint16_t numDigBeams;
611         uint16_t numTxRus;
612         fapi_dig_beam_config_t digBeam[FAPI_MAX_NUMBER_OF_BEAMS];   // 5G FAPI Table 3-32
613     } fapi_beamforming_table_t;
614
615 // Updated per 5G FAPI
616     typedef struct {
617         int16_t preCoderWeightRe;
618         int16_t preCoderWeightIm;   // 5G FAPI Table 3-33 Subset
619     } fapi_precoderWeight_t;
620
621 // Updated per 5G FAPI
622     typedef struct {
623         fapi_precoderWeight_t precoder_weight[FAPI_MAX_NUM_ANT_PORTS];  // 5G FAPI Table 3-33 Subset
624     } fapi_precoder_weight_t;
625
626 // Updated per 5G FAPI
627     typedef struct {
628         uint16_t pmIdx;
629         uint16_t numLayers;
630         uint16_t numAntPorts;
631         uint16_t pad[1];
632         fapi_precoder_weight_t precoderWeight[FAPI_MAX_NUM_LAYERS]; // 5G FAPI Table 3-33
633     } fapi_precoding_table_t;
634
635 // Updated per 5G FAPI
636     typedef struct {
637         fapi_carrier_config_t carrierConfig;
638         fapi_cell_config_t cellConfig;
639         fapi_ssb_config_t ssbConfig;
640         fapi_prach_configuration_t prachConfig;
641         fapi_ssb_table_t ssbTable;
642         fapi_tdd_table_t tddTable;
643         fapi_meas_config_t measConfig;
644         fapi_beamforming_table_t beamformingTable;
645         fapi_precoding_table_t precodingTable;  // 5G FAPI Table 3-20
646     } fapi_config_t;
647
648 // Updated per 5G FAPI 
649     typedef struct {
650         fapi_msg_t header;
651         uint8_t number_of_tlvs;
652         uint8_t pad[3];
653         fapi_uint32_tlv_t tlvs[FAPI_MAX_NUM_TLVS_CONFIG];   // 5G FAPI Table 3-17
654     } fapi_config_req_t;
655
656 // Updated per 5G FAPI
657     typedef struct {
658         fapi_msg_t header;
659         uint8_t error_code;
660         uint8_t number_of_invalid_tlvs;
661         uint8_t number_of_inv_tlvs_idle_only;
662         uint8_t number_of_inv_tlvs_running_only;
663         uint8_t number_of_missing_tlvs;
664         uint8_t pad[3];
665         fapi_uint16_tlv_t tlvs[4 * FAPI_MAX_NUM_TLVS_CONFIG];   // 5G FAPI Table 3-18
666         //   fapi_uint16_tlv_t unsupported_or_invalid_tlvs[FAPI_MAX_NUMBER_UNSUPPORTED_TLVS];
667         //   fapi_uint16_tlv_t invalid_idle_only_tlvs[FAPI_MAX_NUMBER_OF_INVALID_IDLE_ONLY_TLVS];
668         //   fapi_uint16_tlv_t invalid_running_only_tlvs[FAPI_MAX_NUMBER_OF_INVALID_RUNNING_ONLY_TLVS];
669         //   fapi_uint16_tlv_t missing_tlvs[FAPI_MAX_NUMBER_OF_MISSING_TLVS];            
670     } fapi_config_resp_t;
671
672 // Updated per 5G FAPI
673     typedef struct {
674         fapi_msg_t header;
675     } fapi_start_req_t;
676
677 // Updated per 5G FAPI
678     typedef struct {
679         fapi_msg_t header;      // Message Length is zero for STOP.request
680     } fapi_stop_req_t;
681
682 // Updated per 5G FAPI
683     typedef struct {
684         fapi_msg_t header;      // Message Length is zero for STOP.indication
685     } fapi_stop_ind_t;
686
687 // Updated per 5G FAPI
688     typedef struct {
689         fapi_msg_t header;
690         uint16_t sfn;
691         uint16_t slot;
692         uint8_t message_id;
693         uint8_t error_code;     // 5G FAPI Table 3-30
694         uint8_t pad[2];
695     } fapi_error_ind_t;
696
697 // Updated per 5G FAPI
698     typedef struct {
699         fapi_msg_t header;
700         uint16_t sfn;
701         uint16_t slot;          // 5G FAPI Table 3-34
702     } fapi_slot_ind_t;
703
704 // Updated per 5G FAPI
705     typedef struct {
706         uint16_t beamidx;       // 5G FAPI Table 3-43 subset
707     } fapi_bmi_t;
708
709 // Updated per 5G FAPI
710     typedef struct {
711         uint16_t pmIdx;
712         uint8_t pad[2];
713         fapi_bmi_t beamIdx[FAPI_MAX_NUM_DIGBFINTERFACES];   // 5G FAPI Table 3-43 subset
714     } fapi_pmi_bfi_t;
715
716 // Updated per 5G FAPI
717     typedef struct {
718         uint16_t numPrgs;
719         uint16_t prgSize;
720         uint8_t digBfInterfaces;
721         uint8_t pad[3];
722         fapi_pmi_bfi_t pmi_bfi[FAPI_MAX_NUM_PRGS_PER_TTI];  // 5G FAPI Table 3-43
723     } fapi_precoding_bmform_t;
724
725 // Updated per 5G FAPI
726     typedef struct {
727         uint16_t rnti;
728         uint16_t scramblingId;
729         uint16_t scramblingRnti;
730         uint8_t cceIndex;
731         uint8_t aggregationLevel;
732         fapi_precoding_bmform_t pc_and_bform;
733         uint8_t beta_pdcch_1_0;
734         uint8_t powerControlOfssetSS;
735         uint16_t payloadSizeBits;
736         uint8_t payload[FAPI_DCI_PAYLOAD_BYTE_LEN]; // 5G FAPI Table 3-37
737     } fapi_dl_dci_t;
738
739 // Updated per 5G FAPI
740     typedef struct {
741         uint16_t bwpSize;
742         uint16_t bwpStart;
743         uint8_t subCarrierSpacing;
744         uint8_t cyclicPrefix;
745         uint8_t startSymbolIndex;
746         uint8_t durationSymbols;
747         uint8_t freqDomainResource[6];
748         uint8_t cceRegMappingType;
749         uint8_t regBundleSize;
750         uint8_t interleaverSize;
751         uint8_t coreSetSize;
752         uint16_t shiftIndex;
753         uint8_t precoderGranularity;
754         uint8_t coreSetType;
755         uint16_t numDlDci;      // 5G FAPI Table 3-36
756         fapi_dl_dci_t dlDci[FAPI_MAX_NUMBER_DL_DCI];
757     } fapi_dl_pdcch_pdu_t;
758
759     // Updated per 5G FAPI
760     typedef struct {
761         uint16_t targetCodeRate;
762         uint8_t qamModOrder;
763         uint8_t mcsIndex;
764         uint8_t mcsTable;
765         uint8_t rvIndex;
766         uint8_t pad[2];
767         uint32_t tbSize;        // 5G FAPI Table 3-38 Subset
768     } fapi_codeword_pdu_t;
769
770     // Updated per 5G FAPI
771     typedef struct {
772         uint16_t pduBitMap;
773         uint16_t rnti;
774         uint16_t pdu_index;
775         uint16_t bwpSize;
776         uint16_t bwpStart;
777         uint8_t subCarrierSpacing;
778         uint8_t cyclicPrefix;
779         uint8_t nrOfCodeWords;
780         uint8_t pad[3];
781         fapi_codeword_pdu_t cwInfo[FAPI_MAX_NUMBER_OF_CODEWORDS_PER_PDU];
782         uint16_t dataScramblingId;
783         uint8_t nrOfLayers;
784         uint8_t transmissionScheme;
785         uint8_t refPoint;
786         uint8_t dmrsConfigType;
787         uint16_t dlDmrsSymbPos;
788         uint8_t scid;
789         uint8_t numDmrsCdmGrpsNoData;
790         uint8_t resourceAlloc;
791         uint8_t pad1;
792         uint16_t dlDmrsScramblingId;
793         uint16_t dmrsPorts;
794         uint16_t rbStart;
795         uint16_t rbSize;
796         uint8_t rbBitmap[36];
797         uint8_t vrbToPrbMapping;
798         uint8_t startSymbIndex;
799         uint8_t nrOfSymbols;
800         uint8_t ptrsPortIndex;
801         uint8_t ptrsTimeDensity;
802         uint8_t ptrsFreqDensity;
803         uint8_t ptrsReOffset;
804         uint8_t nEpreRatioOfPdschToPtrs;
805         fapi_precoding_bmform_t preCodingAndBeamforming;
806         uint8_t powerControlOffset;
807         uint8_t powerControlOffsetSS;
808         uint8_t isLastCbPresent;
809         uint8_t isInlineTbCrc;
810         uint32_t dlTbCrc;       // 5G FAPI Table 3-38
811         uint8_t mappingType;
812         uint8_t nrOfDmrsSymbols;
813         uint8_t dmrsAddPos;
814         uint8_t pad2;
815     } fapi_dl_pdsch_pdu_t;
816
817     // Updated per 5G FAPI
818     typedef struct {
819         uint16_t bwpSize;
820         uint16_t bwpStart;
821         uint8_t subCarrierSpacing;
822         uint8_t cyclicPrefix;
823         uint16_t startRb;
824         uint16_t nrOfRbs;
825         uint8_t csiType;
826         uint8_t row;
827         uint16_t freqDomain;
828         uint8_t symbL0;
829         uint8_t symbL1;
830         uint8_t cdmType;
831         uint8_t freqDensity;
832         uint16_t scramId;
833         uint8_t powerControlOffset;
834         uint8_t powerControlOffsetSs;
835         uint8_t pad[2];
836         fapi_precoding_bmform_t preCodingAndBeamforming;    // 5G FAPI Table 3-39
837     } fapi_dl_csi_rs_pdu_t;
838
839 // Updated per 5G FAPI 
840     typedef struct {
841         uint8_t dmrsTypeAPosition;
842         uint8_t pdcchConfigSib1;
843         uint8_t cellBarred;
844         uint8_t intraFreqReselection;   // 5G FAPI Table 3-42
845     } fapi_phy_mib_pdu_t;
846
847 // Updated per 5G FAPI 
848     typedef struct {
849         union {
850             uint32_t bchPayload;
851             fapi_phy_mib_pdu_t phyMibPdu;   // 5G FAPI Table 3-40 Subset
852         };
853     } fapi_bch_payload_t;
854
855     // Updated per 5G FAPI
856     typedef struct {
857         uint16_t physCellId;
858         uint8_t betaPss;
859         uint8_t ssbBlockIndex;
860         uint8_t ssbSubCarrierOffset;
861         uint8_t bchPayloadFlag;
862         uint16_t ssbOffsetPointA;
863         fapi_bch_payload_t bchPayload;
864         fapi_precoding_bmform_t preCodingAndBeamforming;    // 5G FAPI Table 3-40
865     } fapi_dl_ssb_pdu_t;
866
867 // Updated per 5G FAPI
868     typedef struct {
869         uint16_t pduType;
870         uint16_t pduSize;
871         union {
872             fapi_dl_pdcch_pdu_t pdcch_pdu;
873             fapi_dl_pdsch_pdu_t pdsch_pdu;
874             fapi_dl_csi_rs_pdu_t csi_rs_pdu;
875             fapi_dl_ssb_pdu_t ssb_pdu;  // 5G FAPI Table 3-35 Subset
876         } pdu;
877     } fapi_dl_tti_req_pdu_t;
878
879 // Updated per 5G FAPI
880     typedef struct {
881         uint8_t nUe;
882         uint8_t pad[3];
883         uint8_t pduIdx[FAPI_MAX_NUMBER_OF_UES_PER_TTI]; // 5G FAPI Subset Table 3-35 and Table 3-44
884     } fapi_ue_info_t;
885
886 // Updated per 5G FAPI
887     typedef struct {
888         fapi_msg_t header;
889         uint16_t sfn;
890         uint16_t slot;
891         uint8_t nPdus;
892         uint8_t nGroup;
893         uint8_t pad[2];
894         fapi_dl_tti_req_pdu_t pdus[FAPI_MAX_PDUS_PER_SLOT]; // 5G FAPI Table 3-35
895         fapi_ue_info_t ue_grp_info[FAPI_MAX_NUMBER_OF_GROUPS_PER_TTI];
896     } fapi_dl_tti_req_t;
897
898 // Updated per 5G FAPI
899     typedef struct {
900         uint8_t rvIndex;
901         uint8_t harqProcessId;
902         uint8_t newDataIndicator;
903         uint8_t pad;
904         uint32_t tbSize;
905         uint16_t numCb;         // 5G FAPI Table 3-47
906         uint8_t cbPresentAndPosition[2];    // Since the maximum number of Code Blocks per TCB in a CBG is 8 for 1 CW or 4 for 2CW and this is a bit field with pading to align to 32 bits
907     } fapi_pusch_data_t;
908
909 // Updated per 5G FAPI
910     typedef struct {
911         uint16_t harqAckBitLength;
912         uint16_t csiPart1BitLength;
913         uint16_t csiPart2BitLength;
914         uint8_t alphaScaling;
915         uint8_t betaOffsetHarqAck;
916         uint8_t betaOffsetCsi1;
917         uint8_t betaOffsetCsi2; // 5G FAPI Table 3-48
918         uint8_t pad[2];
919     } fapi_pusch_uci_t;
920
921 // Updated per 5G FAPI
922     typedef struct {
923         uint16_t ptrsPortIndex;
924         uint8_t ptrsDmrsPort;
925         uint8_t ptrsReOffset;   // 5G FAPI Table 3-49 Subset
926     } fapi_ptrs_info_t;
927
928 // Updated per 5G FAPI
929     typedef struct {
930         uint8_t numPtrsPorts;
931         uint8_t ptrsTimeDensity;
932         uint8_t ptrsFreqDensity;    // 5G FAPI Table 3-49 Subset
933         uint8_t ulPtrsPower;
934         fapi_ptrs_info_t ptrsInfo[FAPI_MAX_NUM_PTRS_PORTS];
935     } fapi_pusch_ptrs_t;
936
937 // Updated per 5G FAPI
938     typedef struct {
939         uint16_t lowPaprSequenceNumber;
940         uint8_t lowPaprGroupNumber;
941         uint8_t ulPtrsSampleDensity;
942         uint8_t ulPtrsTimeDensityTransformPrecoding;
943         uint8_t pad;            // 5G FAPI Table 3-50
944     } fapi_dfts_ofdm_t;
945
946 // Updated per 5G FAPI
947     typedef struct {
948         fapi_bmi_t beamIdx[FAPI_MAX_NUM_DIGBFINTERFACES];
949     } fapi_rx_bfi_t;
950
951 // Updated per 5G FAPI
952     typedef struct {
953         uint16_t numPrgs;
954         uint16_t prgSize;
955         uint8_t digBfInterface;
956         uint8_t pad[3];
957         fapi_rx_bfi_t rx_bfi[FAPI_MAX_NUM_PRGS_PER_TTI];    // 5G FAPI Table 3-53
958     } fapi_ul_rx_bmform_pdu_t;
959
960 // Updated per 5G FAPI
961     typedef struct {
962         uint16_t physCellId;
963         uint8_t numPrachOcas;
964         uint8_t prachFormat;
965         uint8_t numRa;
966         uint8_t prachStartSymbol;
967         uint16_t numCs;
968         fapi_ul_rx_bmform_pdu_t beamforming;
969     } fapi_ul_prach_pdu_t;      // 5G FAPI Table 3-45
970
971 // Updated per 5G FAPI
972     typedef struct {
973         uint16_t pduBitMap;
974         uint16_t rnti;
975         uint32_t handle;
976         uint16_t bwpSize;
977         uint16_t bwpStart;
978         uint8_t subCarrierSpacing;
979         uint8_t cyclicPrefix;
980         uint8_t mcsIndex;
981         uint8_t mcsTable;
982         uint16_t targetCodeRate;
983         uint8_t qamModOrder;
984         uint8_t transformPrecoding;
985         uint16_t dataScramblingId;
986         uint8_t nrOfLayers;
987         uint8_t dmrsConfigType;
988         uint16_t ulDmrsSymbPos;
989         uint16_t ulDmrsScramblingId;
990         uint8_t scid;
991         uint8_t numDmrsCdmGrpsNoData;
992         uint16_t dmrsPorts;
993         uint16_t nTpPuschId;
994         uint16_t tpPi2Bpsk;
995         uint8_t rbBitmap[36];
996         uint16_t rbStart;
997         uint16_t rbSize;
998         uint8_t vrbToPrbMapping;
999         uint8_t frequencyHopping;
1000         uint16_t txDirectCurrentLocation;
1001         uint8_t resourceAlloc;
1002         uint8_t uplinkFrequencyShift7p5khz;
1003         uint8_t startSymbIndex;
1004         uint8_t nrOfSymbols;
1005         uint8_t mappingType;
1006         uint8_t nrOfDmrsSymbols;
1007         uint8_t dmrsAddPos;
1008         uint8_t pad;
1009
1010         fapi_pusch_data_t puschData;
1011         fapi_pusch_uci_t puschUci;
1012         fapi_pusch_ptrs_t puschPtrs;
1013         fapi_dfts_ofdm_t dftsOfdm;
1014         fapi_ul_rx_bmform_pdu_t beamforming;    // 5G FAPI Table 3-46
1015     } fapi_ul_pusch_pdu_t;
1016
1017 // Updated per 5G FAPI
1018     typedef struct {
1019         uint16_t rnti;
1020         uint8_t pad1[2];
1021         uint32_t handle;
1022         uint16_t bwpSize;
1023         uint16_t bwpStart;
1024         uint8_t subCarrierSpacing;
1025         uint8_t cyclicPrefix;
1026         uint8_t formatType;
1027         uint8_t multiSlotTxIndicator;
1028         uint8_t pi2Bpsk;
1029         uint8_t pad2;
1030         uint16_t prbStart;
1031         uint16_t prbSize;
1032         uint8_t startSymbolIndex;
1033         uint8_t nrOfSymbols;
1034         uint8_t freqHopFlag;
1035         uint8_t groupHopFlag;
1036         uint8_t sequenceHopFlag;
1037         uint8_t pad3;
1038         uint16_t secondHopPrb;
1039         uint16_t hoppingId;
1040         uint16_t initialCyclicShift;
1041         uint16_t dataScramblingId;
1042         uint8_t timeDomainOccIdx;
1043         uint8_t preDftOccIdx;
1044         uint8_t preDftOccLen;
1045         uint8_t addDmrsFlag;
1046         uint16_t dmrsScramblingId;
1047         uint8_t dmrsCyclicShift;
1048         uint8_t srFlag;
1049         uint16_t bitLenHarq;
1050         uint8_t pad4[2];
1051         uint16_t bitLenCsiPart1;
1052         uint16_t bitLenCsiPart2;
1053         fapi_ul_rx_bmform_pdu_t beamforming;    // 5G FAPI Table 3-51
1054     } fapi_ul_pucch_pdu_t;
1055
1056 // Updated per 5G FAPI
1057     typedef struct {
1058         uint16_t rnti;
1059         uint8_t pad[2];
1060         uint32_t handle;
1061         uint16_t bwpSize;
1062         uint16_t bwpStart;
1063         uint8_t subCarrierSpacing;
1064         uint8_t cyclicPrefix;
1065         uint8_t numAntPorts;
1066         uint8_t numSymbols;
1067         uint8_t numRepetitions;
1068         uint8_t timeStartPosition;
1069         uint8_t configIndex;
1070         uint8_t bandwidthIndex;
1071         uint16_t sequenceId;
1072         uint8_t combSize;
1073         uint8_t combOffset;
1074         uint8_t cyclicShift;
1075         uint8_t frequencyPosition;
1076         uint16_t frequencyShift;
1077         uint8_t frequencyHopping;
1078         uint8_t groupOrSequenceHopping;
1079         uint8_t resourceType;
1080         uint8_t pad1[2];
1081         uint16_t tSrs;
1082         uint16_t tOffset;
1083         fapi_ul_rx_bmform_pdu_t beamforming;    // 5G FAPI Table 3-52
1084     } fapi_ul_srs_pdu_t;
1085
1086 // Updated per 5G FAPI
1087     typedef struct {
1088         uint16_t pduType;
1089         uint16_t pduSize;
1090         union {
1091             fapi_ul_prach_pdu_t prach_pdu;
1092             fapi_ul_pusch_pdu_t pusch_pdu;
1093             fapi_ul_pucch_pdu_t pucch_pdu;
1094             fapi_ul_srs_pdu_t srs_pdu;
1095         } pdu;
1096     } fapi_ul_tti_req_pdu_t;    // 5G FAPI Subset Table 3-44
1097
1098 // Updated per 5G FAPI
1099     typedef struct {
1100         fapi_msg_t header;
1101         uint16_t sfn;
1102         uint16_t slot;
1103         uint8_t nPdus;
1104         uint8_t rachPresent;
1105         uint8_t nUlsch;
1106         uint8_t nUlcch;
1107         uint8_t nGroup;
1108         uint8_t pad[3];
1109         fapi_ul_tti_req_pdu_t pdus[FAPI_MAX_NUMBER_UL_PDUS_PER_TTI];    // 5G FAPI Table 3-44
1110         fapi_ue_info_t ueGrpInfo[FAPI_MAX_NUMBER_OF_GROUPS_PER_TTI];
1111     } fapi_ul_tti_req_t;
1112
1113 // Updated per 5G FAPI
1114     typedef struct {
1115         uint16_t pduType;
1116         uint16_t pduSize;
1117         fapi_dl_pdcch_pdu_t pdcchPduConfig; // 5G FAPI Table 3-54 Subset
1118     } fapi_dci_pdu_t;
1119
1120     // Updated per 5G FAPI
1121     typedef struct {
1122         fapi_msg_t header;
1123         uint16_t sfn;
1124         uint16_t slot;
1125         uint8_t numPdus;
1126         uint8_t pad[3];
1127         fapi_dci_pdu_t pdus[FAPI_MAX_NUMBER_UCI_PDUS_PER_SLOT]; // 5G FAPI Table 3-54
1128     } fapi_ul_dci_req_t;
1129
1130 // Updated per 5G FAPI
1131     typedef struct {
1132         uint16_t pdu_length;
1133         uint16_t pdu_index;
1134         uint32_t num_tlvs;
1135         fapi_uint8_ptr_tlv_t tlvs[FAPI_MAX_NUMBER_OF_TLVS_PER_PDU]; // 5G FAPI Table 3-58 Subset
1136     } fapi_tx_pdu_desc_t;
1137
1138 // Updated per 5G FAPI
1139     typedef struct {
1140         fapi_msg_t header;
1141         uint16_t sfn;
1142         uint16_t slot;
1143         uint16_t num_pdus;
1144         uint8_t pad[2];
1145         fapi_tx_pdu_desc_t pdu_desc[FAPI_MAX_NUMBER_DL_PDUS_PER_TTI];   // 5G FAPI Table 3-58
1146     } fapi_tx_data_req_t;
1147
1148 // Updated per 5G FAPI
1149     typedef struct {
1150         uint32_t handle;
1151         uint16_t rnti;
1152         uint8_t harqId;
1153         uint8_t ul_cqi;
1154         uint16_t timingAdvance;
1155         uint16_t rssi;
1156         uint16_t pdu_length;
1157         uint8_t pad[2];
1158         void *pduData;          // 5G FAPI Table 3-61 Subset
1159     } fapi_pdu_ind_info_t;
1160
1161     // Updated per 5G FAPI
1162     typedef struct {
1163         fapi_msg_t header;
1164         uint16_t sfn;
1165         uint16_t slot;
1166         uint16_t numPdus;
1167         uint8_t pad[2];
1168         fapi_pdu_ind_info_t pdus[FAPI_MAX_NUMBER_OF_ULSCH_PDUS_PER_SLOT];   // 5G FAPI Table 3-61
1169     } fapi_rx_data_indication_t;
1170
1171 // Updated per 5G FAPI
1172     typedef struct {
1173         uint32_t handle;
1174         uint16_t rnti;
1175         uint8_t harqId;
1176         uint8_t tbCrcStatus;
1177         uint8_t ul_cqi;
1178         uint8_t pad;
1179         uint16_t numCb;
1180         uint16_t timingAdvance;
1181         uint16_t rssi;
1182         uint8_t cbCrcStatus[FAPI_MAX_NUM_CB_PER_TTI_IN_BYTES];  // 5G FAPI Table 3-62 subset
1183     } fapi_crc_ind_info_t;
1184
1185 // Updated per 5G FAPI
1186     typedef struct {
1187         fapi_msg_t header;
1188         uint16_t sfn;
1189         uint16_t slot;
1190         uint16_t numCrcs;
1191         uint8_t pad[2];
1192         fapi_crc_ind_info_t crc[FAPI_MAX_NUMBER_OF_CRCS_PER_SLOT];  // 5G FAPI Table 3-62
1193     } fapi_crc_ind_t;
1194
1195 // Updated per 5G FAPI
1196     typedef struct {
1197         uint8_t harqCrc;
1198         uint8_t pad;
1199         uint16_t harqBitLen;
1200         uint8_t harqPayload[FAPI_MAX_HARQ_INFO_LEN_BYTES];  // 5G FAPI Table 3-70
1201     } fapi_harq_info_t;
1202
1203 // Updated per 5G FAPI
1204     typedef struct {
1205         uint8_t csiPart1Crc;
1206         uint8_t pad;
1207         uint16_t csiPart1BitLen;
1208         uint8_t csiPart1Payload[FAPI_MAX_CSI_PART1_DATA_BYTES]; // 5G FAPI Table 3-71
1209     } fapi_csi_p1_info_t;
1210
1211 // Updated per 5G FAPI
1212     typedef struct {
1213         uint8_t csiPart2Crc;
1214         uint8_t pad;
1215         uint16_t csiPart2BitLen;
1216         uint8_t csiPart2Payload[FAPI_MAX_CSI_PART2_DATA_BYTES]; // 5G FAPI Table 3-72
1217     } fapi_csi_p2_info_t;
1218
1219 // Updated per 5G FAPI
1220     typedef struct {
1221
1222         uint32_t handle;
1223         uint8_t pduBitmap;
1224         uint8_t ul_cqi;
1225         uint16_t rnti;
1226         uint16_t timingAdvance;
1227         uint16_t rssi;          // 5G FAPI Table 3-64
1228         fapi_harq_info_t harqInfo;  // This is included if indicated by the pduBitmap
1229         fapi_csi_p1_info_t csiPart1info;    // This is included if indicated by the pduBitmap
1230         fapi_csi_p2_info_t csiPart2info;    // This is included if indicated by the pduBitmap
1231     } fapi_uci_o_pusch_t;
1232
1233 // Updated per 5G FAPI
1234     typedef struct {
1235         uint8_t srIndication;
1236         uint8_t srConfidenceLevel;  // 5G FAPI Table 3-67
1237         uint8_t pad[2];
1238     } fapi_sr_f0f1_info_t;
1239
1240 // Updated per 5G FAPI
1241     typedef struct {
1242         uint8_t numHarq;
1243         uint8_t harqConfidenceLevel;
1244         uint8_t harqValue[FAPI_MAX_NUMBER_OF_HARQS_PER_IND];    // 5G FAPI Table 3-68
1245     } fapi_harq_f0f1_info_t;
1246
1247 // Updated per 5G FAPI
1248     typedef struct {
1249         uint16_t srBitlen;
1250         uint8_t srPayload[FAPI_MAX_SR_PAYLOAD_SIZE + 1];    // 5G FAPI Table 3-69
1251     } fapi_sr_f2f3f4_info_t;
1252
1253 // Updated per 5G FAPI
1254     typedef struct {
1255         uint8_t harqCrc;
1256         uint8_t pad;
1257         uint16_t harqBitLen;
1258         uint8_t harqPayload[FAPI_MAX_HARQ_PAYLOAD_SIZE + 2];    // 5G FAPI Table 3-70
1259     } fapi_harq_f2f3f4_info_t;
1260
1261 // Updated per 5G FAPI
1262     typedef struct {
1263         uint32_t handle;
1264         uint8_t pduBitmap;
1265         uint8_t pucchFormat;
1266         uint8_t ul_cqi;
1267         uint8_t pad;
1268         uint16_t rnti;
1269         uint16_t timingAdvance;
1270         uint16_t rssi;          // 5G FAPI Table 3-66
1271         uint16_t num_uci_bits;
1272         uint8_t uciBits[FAPI_MAX_UCI_BIT_BYTE_LEN];
1273     } fapi_uci_o_pucch_f2f3f4_t;
1274
1275 // Updated per 5G FAPI
1276     typedef struct {
1277         uint32_t handle;
1278         uint8_t pduBitmap;
1279         uint8_t pucchFormat;
1280         uint8_t ul_cqi;
1281         uint8_t pad;
1282         uint16_t rnti;
1283         uint16_t timingAdvance;
1284         uint16_t rssi;          // 5G FAPI Table 3-65
1285         uint8_t pad1[2];
1286         uint8_t uciBits[FAPI_MAX_UCI_BIT_BYTE_LEN];
1287         fapi_sr_f0f1_info_t srInfo; // This is included if indicated by the pduBitmap
1288         fapi_harq_f0f1_info_t harqInfo; // This is included if indicated by the pduBitmap
1289     } fapi_uci_o_pucch_f0f1_t;
1290
1291 // Updated per 5G FAPI
1292     typedef struct {
1293         uint16_t pduType;
1294         uint16_t pduSize;
1295         union {
1296             fapi_uci_o_pusch_t uciPusch;
1297             fapi_uci_o_pucch_f0f1_t uciPucchF0F1;
1298             fapi_uci_o_pucch_f2f3f4_t uciPucchF2F3F4;   // 5G FAPI Table 3-63 subset
1299         } uci;
1300     } fapi_uci_pdu_info_t;
1301
1302 // Updated per 5G FAPI
1303     typedef struct {
1304         fapi_msg_t header;
1305         uint16_t sfn;
1306         uint16_t slot;
1307         uint16_t numUcis;       // 5G FAPI Table 3-63
1308         uint8_t pad[2];
1309         fapi_uci_pdu_info_t uciPdu[FAPI_MAX_NUMBER_UCI_PDUS_PER_SLOT];
1310     } fapi_uci_indication_t;
1311
1312 // Updated per 5G FAPI
1313     typedef struct {
1314         uint16_t numRbs;
1315         uint8_t pad[2];
1316         uint8_t rbSNR[FAPI_MAX_NUMBER_RBS]; // 5G FAPI Table 3-73 Subset
1317     } fapi_symb_snr_t;
1318
1319 // Updated per 5G FAPI
1320     typedef struct {
1321         uint32_t handle;
1322         uint16_t rnti;
1323         uint16_t timingAdvance;
1324         uint8_t numSymbols;
1325         uint8_t wideBandSnr;
1326         uint8_t numReportedSymbols;
1327         uint8_t pad;
1328         fapi_symb_snr_t symbSnr[FAPI_MAX_NUMBER_OF_REP_SYMBOLS];    // 5G FAPI Table 3-73 subset
1329     } fapi_srs_pdu_t;
1330
1331 // Updated per 5G FAPI
1332     typedef struct {
1333         fapi_msg_t header;
1334         uint16_t sfn;
1335         uint16_t slot;
1336         uint8_t numPdus;
1337         uint8_t pad[3];
1338         fapi_srs_pdu_t srsPdus[FAPI_MAX_NUMBER_SRS_PDUS_PER_SLOT];  // 5G FAPI Table 3-73
1339     } fapi_srs_indication_t;
1340
1341 // Updated per 5G FAPI
1342     typedef struct {
1343         uint8_t preambleIndex;
1344         uint8_t pad;
1345         uint16_t timingAdvance;
1346         uint32_t preamblePwr;   // 5G FAPI Table 3-74 Subset
1347     } fapi_preamble_info_t;
1348
1349 // Updated per 5G FAPI
1350     typedef struct {
1351         uint16_t phyCellId;
1352         uint8_t symbolIndex;
1353         uint8_t slotIndex;
1354         uint8_t freqIndex;
1355         uint8_t avgRssi;
1356         uint8_t avgSnr;
1357         uint8_t numPreamble;
1358         fapi_preamble_info_t preambleInfo[FAPI_MAX_NUM_PREAMBLES_PER_SLOT]; // 5G FAPI Table 3-74 Subset
1359     } fapi_rach_pdu_t;
1360
1361 // Updated per 5G FAPI
1362     typedef struct {
1363         fapi_msg_t header;
1364         uint16_t sfn;
1365         uint16_t slot;
1366         uint8_t numPdus;
1367         uint8_t pad[3];
1368         fapi_rach_pdu_t rachPdu[FAPI_MAX_NUMBER_RACH_PDUS_PER_SLOT];    // 5G FAPI Table 3-74
1369     } fapi_rach_indication_t;
1370
1371 //Vendor extension messages
1372     typedef struct {
1373         fapi_msg_t header;
1374         uint16_t sfn;
1375         uint16_t slot;
1376         uint32_t test_type;
1377     } fapi_vendor_ext_shutdown_req_t;
1378
1379     typedef struct {
1380         fapi_msg_t header;
1381         uint16_t sfn;
1382         uint16_t slot;
1383         uint32_t nStatus;
1384     } fapi_vendor_ext_shutdown_res_t;
1385
1386 #ifdef DEBUG_MODE
1387     typedef struct {
1388         uint32_t carrNum;
1389         uint32_t numSubframes;
1390         uint32_t testUeMode;
1391         uint32_t timerModeFreqDomain;
1392         uint32_t phaseCompensationEnable;
1393         uint32_t startFrameNum;
1394         uint32_t startSlotNum;
1395         char filename_in_ul_iq[FAPI_MAX_IQ_SAMPLE_UL_VIRTUAL_PORTS]
1396             [FAPI_MAX_IQ_SAMPLE_FILE_SIZE];
1397         char filename_in_ul_urllc[FAPI_MAX_IQ_SAMPLE_UL_VIRTUAL_PORTS]
1398             [FAPI_MAX_IQ_SAMPLE_FILE_SIZE];
1399         char filename_in_prach_iq[FAPI_MAX_IQ_SAMPLE_UL_VIRTUAL_PORTS]
1400             [FAPI_MAX_IQ_SAMPLE_FILE_SIZE];
1401         char filename_in_srs_iq[FAPI_MAX_IQ_SAMPLE_UL_ANTENNA]
1402             [FAPI_MAX_IQ_SAMPLE_FILE_SIZE];
1403         char filename_out_dl_iq[FAPI_MAX_IQ_SAMPLE_FILE_SIZE];
1404         char filename_out_dl_iq_urllc[FAPI_MAX_IQ_SAMPLE_FILE_SIZE];
1405         char filename_out_dl_beam[FAPI_MAX_IQ_SAMPLE_DL_PORTS]
1406             [FAPI_MAX_IQ_SAMPLE_FILE_SIZE];
1407         char filename_out_ul_beam[FAPI_MAX_IQ_SAMPLE_UL_VIRTUAL_PORTS]
1408             [FAPI_MAX_IQ_SAMPLE_FILE_SIZE];
1409         uint8_t buffer[FAPI_MAX_IQ_SAMPLE_BUFFER_SIZE];
1410     } fapi_vendor_ext_iq_samples_info_t;
1411
1412     typedef struct {
1413         fapi_msg_t header;
1414         fapi_vendor_ext_iq_samples_info_t iq_samples_info;
1415     } fapi_vendor_ext_iq_samples_req_t;
1416
1417     typedef struct {
1418         fapi_msg_t header;
1419     } fapi_vendor_ext_dl_iq_samples_res_t;
1420
1421     typedef struct {
1422         fapi_msg_t header;
1423     } fapi_vendor_ext_ul_iq_samples_res_t;
1424
1425     typedef struct {
1426         fapi_msg_t header;
1427     } fapi_vendor_ext_start_response_t;
1428 #endif
1429 //------------------------------------------------------------------------------
1430
1431 #if defined(__cplusplus)
1432 }
1433 #endif
1434 #endif