39cfc2dfec764e053b0ab7e277b7b4fcde959048
[o-du/phy.git] / fhi_lib / lib / api / xran_pkt_up.h
1 /******************************************************************************\r
2 *\r
3 *   Copyright (c) 2019 Intel.\r
4 *\r
5 *   Licensed under the Apache License, Version 2.0 (the "License");\r
6 *   you may not use this file except in compliance with the License.\r
7 *   You may obtain a copy of the License at\r
8 *\r
9 *       http://www.apache.org/licenses/LICENSE-2.0\r
10 *\r
11 *   Unless required by applicable law or agreed to in writing, software\r
12 *   distributed under the License is distributed on an "AS IS" BASIS,\r
13 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14 *   See the License for the specific language governing permissions and\r
15 *   limitations under the License.\r
16 *\r
17 *******************************************************************************/\r
18 \r
19 /**\r
20  * @brief Definitions and support functions to process XRAN packet\r
21  * @file xran_pkt_up.h\r
22  * @ingroup group_source_xran\r
23  * @author Intel Corporation\r
24  **/\r
25 \r
26 /**\r
27  *****************************************************************************\r
28  * @file xran_pkt_up.h\r
29  *\r
30  * @defgroup xran_up_pkt U-Plane XRAN Packet definitions and functions\r
31  * @ingroup xran\r
32  *\r
33  * @description\r
34  *      Structures relevant to U-plane packets only (data now only)\r
35  *****************************************************************************/\r
36 #ifndef _XRAN_PKT_UP_H_\r
37 #define _XRAN_PKT_UP_H_\r
38 \r
39 #ifdef __cplusplus\r
40 extern "C" {\r
41 #endif\r
42 \r
43 #include "xran_pkt.h"\r
44 \r
45 #define IQ_PAIR_NUM_IN_RB 12\r
46 #define MAX_DATA_SECTIONS_NUM 273\r
47 #define MAX_IQ_BIT_WIDTH 16\r
48 \r
49 /* currently library supports I and Q sizes of 8 and 16 bits each */\r
50 #define IQ_BITS MAX_IQ_BIT_WIDTH\r
51 \r
52 /*\r
53  * Structure holding data section header fields\r
54  * It is repeated for every section ID in xRAN packet\r
55  */\r
56 \r
57 /**\r
58  ******************************************************************************\r
59  * @ingroup xran_up_pkt\r
60  *\r
61  * @description\r
62  *       Structure holding data section header fields\r
63  *       It is repeated for every section ID in xRAN packet\r
64  *       5.4.5  Coding of Information Elements - Application Layer, Sections\r
65  *       for U-plane as per 6.3.2       DL/UL Data\r
66  *****************************************************************************/\r
67 struct data_section_hdr {\r
68     union {\r
69         uint32_t all_bits;\r
70         struct {\r
71             uint32_t     num_prbu:8;    /**< 5.4.5.6 number of contiguous PRBs per control section */\r
72             uint32_t     start_prbu:10; /**< 5.4.5.4 starting PRB of control section */\r
73             uint32_t     sym_inc:1;     /**< 5.4.5.3 symbol number increment command XRAN_SYMBOLNUMBER_xxxx */\r
74             uint32_t     rb:1;          /**< 5.4.5.2 resource block indicator, XRAN_RBIND_xxx */\r
75             uint32_t     sect_id:12;    /**< 5.4.5.1 section identifier */\r
76         };\r
77     }fields;\r
78 } __rte_packed;\r
79 \r
80 \r
81 /*\r
82  ******************************************************************************\r
83  * @ingroup xran_up_pkt\r
84  *\r
85  * @description\r
86  *       Structure holds compression header structure and field reserved for future use.\r
87  *       reserved goes always with udCompHdr in u-plane pkt\r
88  *       U-plane as per 6.3.2   DL/UL Data\r
89  *****************************************************************************/\r
90 struct data_section_compression_hdr\r
91 {\r
92     struct compression_hdr ud_comp_hdr;\r
93     uint8_t rsrvd; /**< This parameter provides 1 byte for future definition,\r
94     should be set to all zeros by the sender and ignored by the receiver.\r
95     This field is only present when udCompHdr is present, and is absent when\r
96     the static IQ format and compression method is configured via the M-Plane */\r
97 \r
98     /* TODO: support for Block Floating Point compression */\r
99     /* udCompMeth  0000b = no compression       absent*/\r
100 };\r
101 \r
102 /*\r
103  ******************************************************************************\r
104  * @ingroup xran_up_pkt\r
105  *\r
106  * @description\r
107  *       Structure holds the compression parameters by the compression header.\r
108  *       may not be present by udCompMeth in 6.3.3.13\r
109  *****************************************************************************/\r
110 union compression_params {\r
111     struct block_fl_point {\r
112         uint8_t exponent:4;\r
113         uint8_t reserved:4;\r
114         } blockFlPoint;\r
115     struct block_scaling {\r
116         uint8_t sblockScaler;\r
117         } blockScaling;\r
118     struct u_law {\r
119         uint8_t compShift:4;\r
120         uint8_t compBitWidth:4;\r
121         } uLaw;\r
122 } __rte_packed;\r
123 \r
124 \r
125 /*\r
126  ******************************************************************************\r
127  * @ingroup xran_up_pkt\r
128  *\r
129  * @description\r
130  *       Structure holds an IQ sample pair\r
131  *       U-plane as per 6.3.2   DL/UL Data\r
132  *       Each bit field size is defined with IQ_BITS macro\r
133  *       Currently supported I and Q sizes are 8 and 16 bits\r
134  *****************************************************************************/\r
135 struct rb_map\r
136 {\r
137     int16_t i_sample:IQ_BITS; /**< This parameter is the In-phase sample value */\r
138     int16_t q_sample:IQ_BITS; /**< This parameter is the Quadrature sample value */\r
139 } __rte_packed;\r
140 \r
141 /**\r
142  ******************************************************************************\r
143  * @ingroup xran_common_pkt\r
144  *\r
145  * @description\r
146  *       Structure holds complete xran u-plane packet header\r
147  *       3.1.1  Ethernet Encapsulation\r
148  *****************************************************************************/\r
149 struct xran_up_pkt_hdr\r
150 {\r
151     struct xran_ecpri_hdr ecpri_hdr; /**< eCPRI Transport Header */\r
152     struct radio_app_common_hdr app_hdr; /**< eCPRI Transport Header */\r
153     struct data_section_hdr data_sec_hdr;\r
154 } __rte_packed;\r
155 \r
156 \r
157 /**\r
158  ******************************************************************************\r
159  * @ingroup xran_common_pkt\r
160  *\r
161  * @description\r
162  *       Structure holds complete ethernet and xran u-plane packet header\r
163  *       3.1.1  Ethernet Encapsulation\r
164  *****************************************************************************/\r
165 struct eth_xran_up_pkt_hdr\r
166 {\r
167     struct ether_hdr eth_hdr;\r
168     struct xran_up_pkt_hdr xran_hdr;\r
169 }__rte_packed;\r
170 \r
171 #ifdef __cplusplus\r
172 }\r
173 #endif\r
174 \r
175 #endif\r