513d1df787613ba190fd11836e3062994c1f37b0
[o-du/phy.git] / fhi_lib / lib / api / xran_up_api.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 This file provides the definitions for User Plane Messages APIs.\r
21  *\r
22  * @file xran_up_api.h\r
23  * @ingroup group_lte_source_xran\r
24  * @author Intel Corporation\r
25  *\r
26  **/\r
27 \r
28 #ifndef _XRAN_UP_API_H_\r
29 #define _XRAN_UP_API_H_\r
30 \r
31 #ifdef __cplusplus\r
32 extern "C" {\r
33 #endif\r
34 \r
35 #include <rte_common.h>\r
36 #include <rte_mbuf.h>\r
37 \r
38 #include "xran_pkt.h"\r
39 #include "xran_pkt_up.h"\r
40 \r
41 /*\r
42  * structure used for storing packet parameters needed for generating\r
43  * a data packet\r
44  */\r
45 struct xran_up_pkt_gen_params\r
46 {\r
47     struct radio_app_common_hdr app_params;\r
48     struct data_section_hdr sec_hdr;\r
49     struct data_section_compression_hdr compr_hdr_param;\r
50     union compression_params compr_param;\r
51 };\r
52 \r
53 /*\r
54  * structure used for storing packet parameters needed for generating\r
55  * a data packet without compression\r
56  *   Next fields are omitted:\r
57  *        udCompHdr (not always present)\r
58  *        reserved (not always present)\r
59  *        udCompParam (not always present)\r
60  */\r
61 struct xran_up_pkt_gen_no_compression_params\r
62 {\r
63     struct radio_app_common_hdr app_params;\r
64     struct data_section_hdr sec_hdr;\r
65 };\r
66 \r
67 /**\r
68  * @brief Function extracts IQ samples from received mbuf packet.\r
69  *\r
70  * @param mbuf Packet with received data.\r
71  * @param iq_data_start Address of the first IQ sample in mbuf will be returned\r
72  *                      here\r
73  * @return int Bytes of IQ samples that have been extracted from mbuf.\r
74  */\r
75 int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf,\r
76     void **iq_data_start,\r
77     uint8_t *CC_ID,\r
78     uint8_t *Ant_ID,\r
79     uint8_t *frame_id,\r
80     uint8_t *subframe_id,\r
81     uint8_t *slot_id,\r
82     uint8_t *symb_id,\r
83     struct ecpri_seq_id *seq_id,\r
84     uint16_t *num_prbu,\r
85     uint16_t *start_prbu,\r
86     uint16_t *sym_inc,\r
87     uint16_t *rb,\r
88     uint16_t *sect_id,\r
89     int8_t   expect_comp,\r
90     uint8_t *compMeth,\r
91     uint8_t *iqWidth);\r
92 \r
93 int xran_prepare_iq_symbol_portion(\r
94                         struct rte_mbuf *mbuf,\r
95                         const void *iq_data_start,\r
96                         const enum xran_input_byte_order iq_buf_byte_order,\r
97                         const uint32_t iq_data_num_bytes,\r
98                         struct xran_up_pkt_gen_params *params,\r
99                         uint8_t CC_ID,\r
100                         uint8_t Ant_ID,\r
101                         uint8_t seq_id,\r
102                         uint32_t do_copy);\r
103 \r
104 #ifdef __cplusplus\r
105 }\r
106 #endif\r
107 \r
108 #endif /* _XRAN_UP_API_H_ */\r