1 /******************************************************************************
3 * Copyright (c) 2019 Intel.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 *******************************************************************************/
21 * @brief This file provides the definitions for Control Plane Messages APIs.
24 * @ingroup group_lte_source_xran
25 * @author Intel Corporation
29 #ifndef _XRAN_CP_API_H_
30 #define _XRAN_CP_API_H_
32 #include "xran_fh_lls_cu.h"
33 #include "xran_pkt_cp.h"
36 * For errors and exceptions, all values will be negative */
39 XRAN_ERRCODE_INVALIDPARAM,
40 XRAN_ERRCODE_OUTOFMEMORY,
41 XRAN_ERRCODE_FAILTOSEND,
42 XRAN_ERRCODE_INVALIDPACKET,
46 /** Control Plane section types, defined in 5.4 Table 5.1 */
47 enum xran_cp_sectiontype {
48 XRAN_CP_SECTIONTYPE_0 = 0, /**< Unused RB or Symbols in DL or UL, not supported */
49 XRAN_CP_SECTIONTYPE_1 = 1, /**< Most DL/UL Radio Channels */
50 XRAN_CP_SECTIONTYPE_3 = 3, /**< PRACH and Mixed-numerology Channels */
51 XRAN_CP_SECTIONTYPE_5 = 5, /**< UE scheduling information, not supported */
52 XRAN_CP_SECTIONTYPE_6 = 6, /**< Channel Information, not supported */
53 XRAN_CP_SECTIONTYPE_7 = 7, /**< LAA, not supported */
54 XRAN_CP_SECTIONTYPE_MAX
57 /** Filter index, defined in 5.4.4.3 */
58 enum xran_cp_filterindex {
59 XRAN_FILTERINDEX_STANDARD = 0, /**< UL filter for standard channel */
60 XRAN_FILTERINDEX_PRACH_012 = 1, /**< UL filter for PRACH preamble format 0, 1, 2 */
61 XRAN_FILTERINDEX_PRACH_3 = 2, /**< UL filter for PRACH preamble format 3 */
62 XRAN_FILTERINDEX_PRACH_ABC = 3, /**< UL filter for PRACH preamble format A1~3, B1~4, C0, C2 */
63 XRAN_FILTERINDEX_NPRACH = 4, /**< UL filter for NPRACH */
67 /** Maximum Slot Index, defined in 5.4.4.6 */
68 #define XRAN_SLOTID_MAX 16
70 /** FFT size in frame structure, defined in 5.4.4.13 Table 5.9 */
71 enum xran_cp_fftsize {
72 XRAN_FFTSIZE_128 = 7, /* 128 */
73 XRAN_FFTSIZE_256 = 8, /* 256 */
74 XRAN_FFTSIZE_512 = 9, /* 512 */
75 XRAN_FFTSIZE_1024 = 10, /* 1024 */
76 XRAN_FFTSIZE_2048 = 11, /* 2048 */
77 XRAN_FFTSIZE_4096 = 12, /* 4096 */
78 XRAN_FFTSIZE_1536 = 13, /* 1536 */
82 /** Sub-carrier spacing, defined in 5.4.4.13 Table 5.10 */
83 enum xran_cp_subcarrierspacing { /*3GPP u, SCS, Nslot, Slot len */
84 XRAN_SCS_15KHZ = 0, /* 0, 15kHz, 1, 1ms */
85 XRAN_SCS_30KHZ = 1, /* 1, 30kHz, 2, 500us */
86 XRAN_SCS_60KHZ = 2, /* 2, 60kHz, 4, 250us */
87 XRAN_SCS_120KHZ = 3, /* 3, 120kHz, 8, 125us */
88 XRAN_SCS_240KHZ = 4, /* 4, 240kHz, 16, 62.5us */
89 XRAN_SCS_1P25KHZ = 12, /* NA, 1.25kHz, 1, 1ms */
90 XRAN_SCS_3P75KHZ = 13, /* NA, 3.75kHz, 1, 1ms */
91 XRAN_SCS_5KHZ = 14, /* NA, 5kHz, 1, 1ms */
92 XRAN_SCS_7P5KHZ = 15, /* NA, 7.5kHz, 1, 1ms */
96 /** Resource block indicator, defined in 5.4.5.2 */
97 enum xran_cp_rbindicator {
98 XRAN_RBIND_EVERY = 0, /**< every RB used */
99 XRAN_RBIND_EVERYOTHER = 1, /**< every other RB used */
103 /** Symbol number increment command, defined in 5.4.5.3 */
104 enum xran_cp_symbolnuminc {
105 XRAN_SYMBOLNUMBER_NOTINC = 0, /**< do not increment the current symbol number */
106 XRAN_SYMBOLNUMBER_INC = 1, /**< increment the current symbol number and use that */
107 XRAN_SYMBOLNUMBER_INC_MAX
110 /** Minimum number of symbols, defined in 5.4.5.7 */
111 #define XRAN_SYMBOLNUMBER_MIN 1
112 /** Maximum number of symbols, defined in 5.4.5.7 */
113 #define XRAN_SYMBOLNUMBER_MAX 14
115 /* LAA message type 5.4.5.14 Table 5.11, not supported */
116 #define XRAN_LAAMSGTYPE_LBT_PDSCH_REQ 0
117 #define XRAN_LAAMSGTYPE_LBT_DRS_REQ 1
118 #define XRAN_LAAMSGTYPE_LBT_PDSCH_RSP 2
119 #define XRAN_LAAMSGTYPE_LBT_DRS_RSP 3
120 #define XRAN_LAAMSGTYPE_LBT_BUFFER_ERROR 4
121 #define XRAN_LAAMSGTYPE_LBT_CWCONFIG_REQ 5
122 #define XRAN_LAAMSGTYPE_LBT_CWCONFIG_RSP 6
124 #define XRAN_LBTMODE_FULL 0
125 #define XRAN_LBTMODE_PARTIAL25 1
126 #define XRAN_LBTMODE_PARTIAL34 2
127 #define XRAN_LBTMODE_FULLSTOP 3
130 * This structure contains the information to generate the section body of C-Plane message */
131 struct xran_section_info {
132 /* section type bit- */
133 /* 0 1 3 5 6 7 length */
134 uint16_t id; /* X X X X X 12bits */
135 uint8_t rb; /* X X X X X 1bit */
136 uint8_t symInc; /* X X X X X 1bit */
137 uint16_t startPrbc; /* X X X X X 10bits */
138 uint8_t numPrbc; /* X X X X X 8bits */
139 uint8_t numSymbol; /* X X X X 4bits */
140 uint16_t reMask; /* X X X X 12bits */
141 uint16_t beamId; /* X X 15bits */
142 uint16_t ueId; /* X X 15bits */
143 uint16_t regFactor; /* X 16bits */
144 int32_t freqOffset; /* X 24bits */
145 uint8_t ef; /* X X X X 1bit */
147 uint8_t type; /* type of this section */
152 * This structure contains the information to generate the section header of C-Plane message */
153 struct xran_cp_header_params {
160 /* section type bit- */
161 /* 0 1 3 5 6 7 length */
162 uint8_t fftSize; /* X X 4bits */
163 uint8_t scs; /* X X 4bits */
164 uint8_t iqWidth; /* X X X 4bits */
165 uint8_t compMeth; /* X X X 4bits */
166 uint8_t numUEs; /* X 8bits */
167 uint16_t timeOffset; /* X X 16bits */
168 uint16_t cpLength; /* X X 16bits */
172 * This structure to hold the information to generate the sections of C-Plane message */
173 struct xran_section_gen_info {
174 struct xran_section_info info; /**< The information for section */
177 /**< Extension or type 6/7 data size, not supported */
179 /*(< The pointer to the extension or type 6/7 data, not supported */
183 * This structure to hold the information to generate a C-Plane message */
184 struct xran_cp_gen_params {
185 uint8_t dir; /**< UL or DL */
186 uint8_t sectionType; /**< each section must have same type with this */
187 uint16_t numSections; /**< the number of sections to generate */
189 struct xran_cp_header_params hdr;
190 /**< The information for C-Plane message header */
191 struct xran_section_gen_info *sections;
192 /**< Array of the section information */
196 uint16_t xran_get_cplength(int cpLength, int uval);
197 int32_t xran_get_freqoffset(int freqOffset, int scs);
199 int xran_prepare_ctrl_pkt(struct rte_mbuf *mbuf,
200 struct xran_cp_gen_params *params,
201 uint8_t CC_ID, uint8_t Ant_ID,
204 int xran_cp_init_sectiondb(void *pHandle);
205 int xran_cp_free_sectiondb(void *pHandle);
206 int xran_cp_add_section_info(void *pHandle,
207 uint8_t dir, uint8_t cc_id, uint8_t ruport_id,
208 uint8_t subframe_id, uint8_t slot_id,
209 struct xran_section_info *info);
210 struct xran_section_info *xran_cp_find_section_info(void *pHandle,
211 uint8_t dir, uint8_t cc_id, uint8_t ruport_id,
212 uint8_t subframe_id, uint8_t slot_id,
213 uint16_t section_id);
214 struct xran_section_info *xran_cp_iterate_section_info(void *pHandle,
215 uint8_t dir, uint8_t cc_id, uint8_t ruport_id,
216 uint8_t subframe_id, uint8_t slot_id, uint32_t *next);
217 int xran_cp_getsize_section_info(void *pHandle, uint8_t dir, uint8_t cc_id, uint8_t ruport_id);
218 int xran_cp_reset_section_info(void *pHandle, uint8_t dir, uint8_t cc_id, uint8_t ruport_id);
220 #endif /* _XRAN_CP_API_H_ */