1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
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. #
16 ################################################################################
17 *******************************************************************************/
19 /* Defines APIs exchanged between du_app and cl module of MAC */
23 #define NUM_NUMEROLOGY 5 /* Number of numerology */
24 #define MAXIMUM_TDD_PERIODICITY 5
25 #define MAX_SYMB_PER_SLOT 14
27 #define NUM_SSB 1 /* max value is 64 */
28 #define SSB_MASK_SIZE 1 /* SSB mask size is 32bit for sub6 */
29 #define SIB1_NEW_TX_PERIOD 160
30 #define SIB1_REPETITION_PERIOD 20
31 #define CORESET_0_INDEX 0
32 #define CORESET_1_INDEX 1
33 #define CORESET_2_INDEX 2
34 #define CORESET_3_INDEX 3
35 #define CORESET_4_INDEX 4
36 #define SEARCHSPACE_0_INDEX 0
37 #define SEARCHSPACE_1_INDEX 1
38 #define SEARCHSPACE_2_INDEX 2
39 #define SEARCHSPACE_3_INDEX 3
40 #define SEARCHSPACE_4_INDEX 4
41 #define SS_MONITORING_SLOT_SL1 0 /* all slots */
42 #define SS_MONITORING_SYMBOL 0x2000; /* symbol-0, set 14th bit */
45 /* Macros for coupling */
51 #define EVENT_MAC_CELL_CONFIG_REQ 200
52 #define EVENT_MAC_CELL_CONFIG_CFM 201
53 #define EVENT_MAC_CELL_START_REQ 202
54 #define EVENT_MAC_CELL_STOP_REQ 203
55 #define EVENT_MAC_SLOT_IND 204
56 #define EVENT_MAC_STOP_IND 205
57 #define EVENT_MAC_UL_CCCH_IND 206
58 #define EVENT_MAC_DL_CCCH_IND 207
68 MAC_GEN_FULL_PBCH_PAYLD, /* MAC generated the full PBCH Payload */
69 PHY_GEN_TIMING_PBCH_BIT, /* PHY generates the timing PBCH bits */
70 PHY_GEN_FULL_PBCH_PAYLD /* PHY generates full PBCH payload */
82 RESTRICTED_SET_TYPE_A,
134 typedef struct carrierCfg
137 U16 bw; /* DL/UL bandwidth */
138 U32 freq; /* Absolute frequency of DL/UL point A in KHz */
139 U16 k0[NUM_NUMEROLOGY]; /* K0 for DL/UL */
140 U16 gridSize[NUM_NUMEROLOGY]; /* DL/UL Grid size for each numerologies */
141 U16 numAnt; /* Number of Tx/Rx antennas */
144 typedef struct ssbCfg
146 uint32_t ssbPbchPwr; /* SSB block power */
147 BchPduOpt bchPayloadFlag; /* Options for generation of payload */
148 uint8_t scsCmn; /* subcarrier spacing for common */
149 uint16_t ssbOffsetPointA; /* SSB subcarrier offset from point A */
151 SSBPeriod ssbPeriod; /* SSB Periodicity in msec */
152 uint8_t ssbScOffset; /* Subcarrier Offset */
153 uint8_t mibPdu[3]; /* MIB payload */
154 uint32_t ssbMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */
155 uint8_t beamId[NUM_SSB];
156 Bool multCarrBand; /* Multiple carriers in a band */
157 Bool multCellCarr; /* Multiple cells in single carrier */
160 typedef struct fdmInfo
162 U16 rootSeqIdx; /* Root sequence index */
163 U8 numRootSeq; /* Number of root sequences required for FD */
164 U16 k1; /* Frequency Offset for each FD */
165 U8 zeroCorrZoneCfg; /* Zero correlation zone cofig */
166 U8 numUnusedRootSeq; /* Number of unused root sequence */
167 U8 *unsuedRootSeq; /* Unused root sequence per FD */
170 typedef struct prachCfg
173 uint8_t prachCfgIdx; /* PRACH Cfg Index */
174 PrachSeqLen prachSeqLen; /* RACH Sequence length: Long/short */
175 uint8_t prachSubcSpacing; /* Subcarrier spacing of RACH */
176 RstSetCfg prachRstSetCfg; /* PRACH restricted set config */
177 uint16_t msg1FreqStart; /* Msg1-FrequencyStart */
178 uint8_t msg1Fdm; /* PRACH FDM (1,2,4,8) */
179 uint8_t rootSeqLen; /* Root sequence length */
180 PrachFdmInfo fdm[8]; /* FDM info */
181 uint8_t ssbPerRach; /* SSB per RACH occassion */
182 Bool prachMultCarrBand; /* Multiple carriers in Band */
183 uint8_t prachRestrictedSet; /* Support for PRACH restricted set */
184 uint8_t raContResTmr; /* RA Contention Resoultion Timer */
185 uint8_t rsrpThreshSsb; /* RSRP Threshold SSB */
186 uint8_t raRspWindow; /* RA Response Window */
189 typedef struct tddCfg
192 DlUlTxPeriodicity tddPeriod; /* DL UL Transmission periodicity */
193 SlotConfig slotCfg[MAXIMUM_TDD_PERIODICITY][MAX_SYMB_PER_SLOT];
196 typedef struct sib1CellCfg
200 uint16_t sib1NewTxPeriod;
201 uint16_t sib1RepetitionPeriod;
202 uint8_t coresetZeroIndex; /* derived from 4 LSB of pdcchSib1 present in MIB */
203 uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
207 typedef struct bwpParams
212 uint8_t cyclicPrefix;
215 typedef struct candidatesInfo
224 typedef struct searchSpaceCfg
226 uint8_t searchSpaceId;
228 uint16_t monitoringSlot;
230 uint16_t monitoringSymbol;
231 CandidatesInfo candidate;
234 typedef struct pdcchConfigCommon
236 /* only one search space is configured during SIB1 */
237 SearchSpaceCfg commonSearchSpace;
238 uint8_t raSearchSpaceId;
241 typedef struct pdschConfigCommon
246 uint8_t lengthSymbol;
249 typedef struct puschConfigCommon
251 /* PUSCH-TimeDomainResourceAllocation info */
255 uint8_t lengthSymbol;
258 typedef struct bwpDlConfig
261 PdcchConfigCommon pdcchCommon;
262 PdschConfigCommon pdschCommon;
265 typedef struct bwpUlConfig
268 // rach config common sent in PrachCfg
269 // pucch info not required
270 PuschConfigCommon puschCommon;
273 typedef struct macCellCfg
275 U16 transId; /* Trans Id */
276 U16 cellId; /* Cell Id */
277 U8 numTlv; /* Number of configuration TLVs */
278 U8 carrierId; /* Carrired Index */
279 U16 phyCellId; /* Physical cell id */
280 DuplexMode dupType; /* Duplex type: TDD/FDD */
281 CarrierCfg dlCarrCfg; /* DL Carrier configuration */
282 CarrierCfg ulCarrCfg; /* UL Carrier configuration */
283 Bool freqShft; /* Indicates presence of 7.5kHz frequency shift */
284 SsbCfg ssbCfg; /* SSB configuration */
285 PrachCfg prachCfg; /* PRACH Configuration */
286 TDDCfg tddCfg; /* TDD periodicity and slot configuration */
287 RSSIMeasUnit rssiUnit; /* RSSI measurement unit */
288 Sib1CellCfg sib1Cfg; /* SIB1 config */
289 BwpDlConfig initialDlBwp; /* Initial DL BWP */
290 BwpUlConfig initialUlBwp; /* Initial UL BWP */
291 uint8_t dmrsTypeAPos; /* DMRS Type A position */
294 typedef struct macCellCfgCfm
300 typedef struct slotInfo
307 typedef struct macCellStartInfo
312 typedef struct macCellStopInfo
317 typedef struct ulCcchInd
324 typedef struct dlCcchInd
328 DlCcchMsgType msgType;
333 /* Functions for slot Ind from MAC to DU APP*/
334 typedef uint16_t (*DuMacSlotInd) ARGS((
336 SlotInfo *slotInfo ));
338 /* Functions for stop Ind from MAC to DU APP*/
339 typedef uint16_t (*DuMacStopInd) ARGS((
341 MacCellStopInfo *cellId ));
343 /* Functions for mac cell start req */
344 typedef uint16_t (*DuMacCellStartReq) ARGS((
346 MacCellStartInfo *cellStartInfo ));
348 /* Functions for mac cell stop request */
349 typedef uint16_t (*DuMacCellStopReq) ARGS((
351 MacCellStopInfo *cellStopInfo ));
353 /* Function pointers for packing macCellCfg Request and Confirm */
354 typedef int (*packMacCellCfgReq) ARGS((
356 MacCellCfg *macCellCfg ));
358 typedef int (*packMacCellCfgConfirm) ARGS((
360 MacCellCfgCfm *macCellCfgCfm ));
362 typedef int (*DuMacCellCfgReq) ARGS((
364 MacCellCfg *macCellCfg));
366 typedef int (*DuMacCellCfgCfm) ARGS((
368 MacCellCfgCfm *macCellCfgCfm ));
370 /* Functions for UL CCCH Ind from MAC to DU APP*/
371 typedef uint16_t (*DuMacUlCcchInd) ARGS((
373 UlCcchIndInfo *ulCcchIndInfo ));
375 /* Functions for DL CCCH Ind from DU APP to MAC*/
376 typedef uint16_t (*DuMacDlCcchInd) ARGS((
378 DlCcchIndInfo *dlCcchIndInfo ));
380 extern uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo );
381 extern uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
382 extern uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo);
383 extern uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
384 extern uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf);
385 extern uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
386 extern uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo);
387 extern uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf);
388 extern uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo);
389 extern int packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
390 extern int MacHdlCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
391 extern void cmUnpackLwLcMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf);
392 extern int unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf);
393 extern int duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
394 extern uint16_t packMacStopInd(Pst *pst, MacCellStopInfo *cellId);
395 extern uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
396 extern uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellId);
397 extern uint16_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
398 extern uint16_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf);
399 extern uint16_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
400 extern uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
401 extern uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf);
402 extern uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
403 uint8_t sendStopIndMacToDuApp();
406 /**********************************************************************
408 **********************************************************************/