Front Haul Interface Library first seed code contribution
[o-du/phy.git] / fhi_lib / lib / api / xran_pkt_cp.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
20 /**
21  * @brief This file provides the definition of Control Plane Messages
22  *      for XRAN Front Haul layer as defined in XRAN-FH.CUS.0-v02.01.
23  *
24  * @file xran_pkt_cp.h
25  * @ingroup group_lte_source_xran
26  * @author Intel Corporation
27  *
28  **/
29
30 #ifndef _XRAN_PKT_CP_H_
31 #define _XRAN_PKT_CP_H_
32
33
34 /**********************************************************************
35  * Common structures for C/U-plane
36  **********************************************************************/
37 /**
38  * @ingroup xran_cp_pkt
39  *
40  * @description
41  *      user data compression header defined in 5.4.4.10 / 6.3.3.13
42  */
43 struct xran_radioapp_udComp_header {
44     uint8_t     udCompMeth:4;           /**< Compression method, XRAN_COMPMETHOD_xxxx */
45     uint8_t     udIqWidth:4;            /**< IQ bit width, 1 ~ 16 */
46     } __attribute__((__packed__));
47
48
49 /**********************************************************************
50  * Definition of C-Plane Protocol 5.4
51  **********************************************************************/
52 /**
53  * @ingroup xran_cp_pkt
54  *
55  * @description
56  *      Common Radio Application Header for C-Plane
57  */
58 struct xran_cp_radioapp_common_header {     /* 6bytes, first 4bytes need the conversion for byte order */
59     uint32_t    startSymbolId:6;        /**< 5.4.4.7 start symbol identifier */
60     uint32_t    slotId:6;               /**< 5.4.4.6 slot identifier */
61     uint32_t    subframeId:4;           /**< 5.4.4.5 subframe identifier */
62     uint32_t    frameId:8;              /**< 5.4.4.4 frame identifier */
63     uint32_t    filterIndex:4;          /**< 5.4.4.3 filter index, XRAN_FILTERINDEX_xxxx */
64     uint32_t    payloadVer:3;           /**< 5.4.4.2 payload version, should be 1 */
65     uint32_t    dataDirection:1;        /**< 5.4.4.1 data direction (gNB Tx/Rx) */
66     uint8_t     numOfSections;          /**< 5.4.4.8 number of sections */
67     uint8_t     sectionType;            /**< 5.4.4.9 section type */
68     } __attribute__((__packed__));
69
70 /**
71  * @ingroup xran_cp_pkt
72  *
73  * @description
74  *      frame structure defined in 5.4.4.13
75  */
76 struct xran_cp_radioapp_frameStructure {
77     uint8_t     uScs:4;                 /**< sub-carrier spacing, XRAN_SCS_xxx */
78     uint8_t     fftSize:4;              /**< FFT size,  XRAN_FFTSIZE_xxx */
79     } __attribute__((__packed__));
80
81 /**
82  * @ingroup xran_cp_pkt
83  *
84  * @description
85  *      Section headers definition for C-Plane.
86  *      Section type 6 and 7 are not present since those have different fields.
87  */
88 struct xran_cp_radioapp_section_header {    // 8bytes, need the conversion for byte order
89     union {
90         struct {
91             uint32_t    reserved:16;
92             uint32_t    numSymbol:4;    /**< 5.4.5.7 number of symbols */
93             uint32_t    reMask:12;      /**< 5.4.5.5 resource element mask */
94             } s0;
95         struct {
96             uint32_t     beamId:15;     /**< 5.4.5.9 beam identifier */
97             uint32_t     ef:1;          /**< 5.4.5.8 extension flag */
98             uint32_t     numSymbol:4;   /**< 5.4.5.7 number of symbols */
99             uint32_t     reMask:12;     /**< 5.4.5.5 resource element mask */
100             } s1;
101         struct {
102             uint32_t    beamId:15;      /**< 5.4.5.9 beam identifier */
103             uint32_t    ef:1;           /**< 5.4.5.8 extension flag */
104             uint32_t    numSymbol:4;    /**< 5.4.5.7 number of symbols */
105             uint32_t    reMask:12;      /**< 5.4.5.5 resource element mask */
106             } s3;
107         struct {
108             uint32_t    ueId:15;        /**< 5.4.5.10 UE identifier */
109             uint32_t    ef:1;           /**< 5.4.5.8 extension flag */
110             uint32_t    numSymbol:4;    /**< 5.4.5.7 number of symbols */
111             uint32_t    reMask:12;      /**< 5.4.5.5 resource element mask */
112             } s5;
113         } u;
114
115     uint32_t    numPrbc:8;              /**< 5.4.5.6 number of contiguous PRBs per control section */
116     uint32_t    startPrbc:10;           /**< 5.4.5.4 starting PRB of control section */
117     uint32_t    symInc:1;               /**< 5.4.5.3 symbol number increment command XRAN_SYMBOLNUMBER_xxxx */
118     uint32_t    rb:1;                   /**< 5.4.5.2 resource block indicator, XRAN_RBIND_xxx */
119     uint32_t    sectionId:12;           /**< 5.4.5.1 section identifier */
120     } __attribute__((__packed__));
121
122
123 /**********************************************************
124  * Scheduling and Beam-forming Commands 5.4.2
125  **********************************************************/
126 /**
127  * @ingroup xran_cp_pkt
128  *
129  * @description
130  *      Section header definition for type 0
131  */
132 struct xran_cp_radioapp_section0_header {   // 12bytes (6+2+1+2+1)
133     struct xran_cp_radioapp_common_header cmnhdr;
134     uint16_t    timeOffset;             /**< 5.4.4.12 time offset */
135
136     struct xran_cp_radioapp_frameStructure  frameStructure;
137     uint16_t    cpLength;               /**< 5.4.4.14 cyclic prefix length */
138     uint8_t     reserved;
139     } __attribute__((__packed__));
140
141 /**
142  * @ingroup xran_cp_pkt
143  *
144  * @description
145  *      Section definition for type 0: Unused RB or Symbols in DL or UL (Table 5-2)
146  *      Not supported in this release
147  */
148 struct xran_cp_radioapp_section0 {          // 8bytes (4+4)
149     struct xran_cp_radioapp_section_header hdr;
150     } __attribute__((__packed__));
151
152 /**
153  * @ingroup xran_cp_pkt
154  *
155  * @description
156  *      Section header definition for type 1
157  */
158 struct xran_cp_radioapp_section1_header {   // 8bytes (6+1+1)
159     struct xran_cp_radioapp_common_header cmnhdr;
160     struct xran_radioapp_udComp_header udComp;
161     uint8_t     reserved;
162     } __attribute__((__packed__));
163
164 /**
165  * @ingroup xran_cp_pkt
166  *
167  * @description
168  *      Section definition for type 1: Most DL/UL Radio Channels (Table 5-3)
169  */
170 struct xran_cp_radioapp_section1 {          // 8bytes (4+4)
171     struct xran_cp_radioapp_section_header hdr;
172
173     // section extensions               // 5.4.6 & 5.4.7
174     //  .........
175     } __attribute__((__packed__));
176
177 /**
178  * @ingroup xran_cp_pkt
179  *
180  * @description
181  *      Section header definition for type 3
182  */
183 struct xran_cp_radioapp_section3_header {   // 12bytes (6+2+1+2+1)
184     struct xran_cp_radioapp_common_header cmnhdr;
185     uint16_t    timeOffset;             /**< 5.4.4.12 time offset */
186
187     struct xran_cp_radioapp_frameStructure  frameStructure;
188     uint16_t    cpLength;               /**< 5.4.4.14 cyclic prefix length */
189     struct xran_radioapp_udComp_header udComp;
190     } __attribute__((__packed__));
191
192 /**
193  * @ingroup xran_cp_pkt
194  *
195  * @description
196  *      Section definition for type 3: PRACH and Mixed-numerology Channels (Table 5-4)
197  */
198 struct xran_cp_radioapp_section3 {          // 12bytes (4+4+4)
199     struct xran_cp_radioapp_section_header hdr;
200     uint32_t    freqOffset:24;          /**< 5.4.5.11 frequency offset */
201     uint32_t    reserved:8;
202
203     // section extensions               // 5.4.6 & 5.4.7
204     //  .........
205     } __attribute__((__packed__));
206
207 /**
208  * @ingroup xran_cp_pkt
209  *
210  * @description
211  *      Section header definition for type 5
212  */
213 struct xran_cp_radioapp_section5_header {   // 8bytes (6+1+1)
214     struct xran_cp_radioapp_common_header cmnhdr;
215     struct xran_radioapp_udComp_header udComp;
216     uint8_t     reserved;
217     } __attribute__((__packed__));
218
219 /**
220  * @ingroup xran_cp_pkt
221  *
222  * @description
223  *      Section definition for type 5: UE scheduling information (Table 5-5)
224  *      Not supported in this release
225  */
226 struct xran_cp_radioapp_section5 {
227     struct xran_cp_radioapp_section_header hdr;
228
229     // section extensions               // 5.4.6 & 5.4.7
230     //  .........
231     } __attribute__((__packed__));
232
233 /**
234  * @ingroup xran_cp_pkt
235  *
236  * @description
237  *      Section header definition for type 6
238  */
239 struct xran_cp_radioapp_section6_header {   // 8bytes (6+1+1)
240     struct xran_cp_radioapp_common_header cmnhdr;
241     uint8_t     numberOfUEs;            /**< 5.4.4.11 number of UEs */
242     uint8_t     reserved;
243     } __attribute__((__packed__));
244
245 /**
246  * @ingroup xran_cp_pkt
247  *
248  * @description
249  *      Section definition for type 5: Channel Information (Table 5-6)
250  *      Not supported in this release
251  */
252 struct xran_cp_radioapp_section6 {
253     uint32_t    regularizationFactor:16;/**< 5.4.5.12 regularization Factor */
254     uint32_t    ueId:15;                /**< 5.4.5.10 UE identifier */
255     uint32_t    ef:1;                   /**< 5.4.5.8 extension flag */
256     uint8_t     startPrbch:2;           /**< 5.4.5.4 starting PRB of control section */
257     uint8_t     symInc:1;               /**< 5.4.5.3 symbol number increment command XRAN_SYMBOLNUMBER_xxxx */
258     uint8_t     rb:1;                   /**< 5.4.5.2 resource block indicator, XRAN_RBIND_xxx */
259     uint8_t     reserved:4;
260     uint8_t     startPrbcl:8;           /**< 5.4.5.4 starting PRB of control section */
261     uint8_t     numPrbc:8;              /**< 5.4.5.6 number of contiguous PRBs per control section */
262
263     // ciIQsamples start from here      // 5.4.5.13 channel information I and Q values
264     //  .........
265     //
266     // section extensions               // 5.4.6 & 5.4.7
267     //  .........
268     } __attribute__((__packed__));
269
270 /**
271  * @ingroup xran_cp_pkt
272  *
273  * @description
274  *      Section header definition for type 7: LAA
275  *      Not supported in this release
276  */
277 struct xran_cp_radioapp_section7_header {
278     struct xran_cp_radioapp_common_header cmnhdr;
279     uint16_t    reserved;
280     uint8_t     laaMsgLen:4;            /**< 5.4.5.15 LAA message length */
281     uint8_t     laaMsgType:4;           /**< 5.4.5.14 LAA message type */
282
283     // Payload start from here          // 5.4.5.16 ~ 5.4.5.32
284     } __attribute__((__packed__));
285
286
287 #endif  /* _XRAN_PKT_CP_H_ */