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 SEARCHSPACE_0_INDEX 0
33 #define SEARCHSPACE_1_INDEX 1
34 #define SS_MONITORING_SLOT_SL1 0 /* all slots */
35 #define SS_MONITORING_SYMBOL 0x2000; /* symbol-0, set 14th bit */
38 /* Macros for coupling */
44 #define EVENT_MAC_CELL_CONFIG_REQ 200
45 #define EVENT_MAC_CELL_CONFIG_CFM 201
46 #define EVENT_MAC_CELL_START_REQ 202
47 #define EVENT_MAC_CELL_STOP_REQ 203
48 #define EVENT_MAC_SLOT_IND 204
49 #define EVENT_MAC_STOP_IND 205
50 #define EVENT_MAC_UL_CCCH_IND 206
51 #define EVENT_MAC_DL_CCCH_IND 207
61 MAC_GEN_FULL_PBCH_PAYLD, /* MAC generated the full PBCH Payload */
62 PHY_GEN_TIMING_PBCH_BIT, /* PHY generates the timing PBCH bits */
63 PHY_GEN_FULL_PBCH_PAYLD /* PHY generates full PBCH payload */
75 RESTRICTED_SET_TYPE_A,
127 typedef struct carrierCfg
130 U16 bw; /* DL/UL bandwidth */
131 U32 freq; /* Absolute frequency of DL/UL point A in KHz */
132 U16 k0[NUM_NUMEROLOGY]; /* K0 for DL/UL */
133 U16 gridSize[NUM_NUMEROLOGY]; /* DL/UL Grid size for each numerologies */
134 U16 numAnt; /* Number of Tx/Rx antennas */
137 typedef struct ssbCfg
139 uint32_t ssbPbchPwr; /* SSB block power */
140 BchPduOpt bchPayloadFlag; /* Options for generation of payload */
141 uint8_t scsCmn; /* subcarrier spacing for common */
142 uint16_t ssbOffsetPointA; /* SSB subcarrier offset from point A */
144 SSBPeriod ssbPeriod; /* SSB Periodicity in msec */
145 uint8_t ssbScOffset; /* Subcarrier Offset */
146 uint8_t mibPdu[3]; /* MIB payload */
147 uint32_t ssbMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */
148 uint8_t beamId[NUM_SSB];
149 Bool multCarrBand; /* Multiple carriers in a band */
150 Bool multCellCarr; /* Multiple cells in single carrier */
153 typedef struct fdmInfo
155 U16 rootSeqIdx; /* Root sequence index */
156 U8 numRootSeq; /* Number of root sequences required for FD */
157 U16 k1; /* Frequency Offset for each FD */
158 U8 zeroCorrZoneCfg; /* Zero correlation zone cofig */
159 U8 numUnusedRootSeq; /* Number of unused root sequence */
160 U8 *unsuedRootSeq; /* Unused root sequence per FD */
163 typedef struct prachCfg
166 uint8_t prachCfgIdx; /* PRACH Cfg Index */
167 PrachSeqLen prachSeqLen; /* RACH Sequence length: Long/short */
168 uint8_t prachSubcSpacing; /* Subcarrier spacing of RACH */
169 RstSetCfg prachRstSetCfg; /* PRACH restricted set config */
170 uint16_t msg1FreqStart; /* Msg1-FrequencyStart */
171 uint8_t msg1Fdm; /* PRACH FDM (1,2,4,8) */
172 PrachFdmInfo fdm[8]; /* FDM info */
173 uint8_t ssbPerRach; /* SSB per RACH occassion */
174 Bool prachMultCarrBand; /* Multiple carriers in Band */
175 uint8_t prachRestrictedSet; /* Support for PRACH restricted set */
176 uint8_t raContResTmr; /* RA Contention Resoultion Timer */
177 uint8_t rsrpThreshSsb; /* RSRP Threshold SSB */
178 uint8_t raRspWindow; /* RA Response Window */
181 typedef struct tddCfg
184 DlUlTxPeriodicity tddPeriod; /* DL UL Transmission periodicity */
185 SlotConfig slotCfg[MAXIMUM_TDD_PERIODICITY][MAX_SYMB_PER_SLOT];
188 typedef struct sib1CellCfg
192 uint16_t sib1NewTxPeriod;
193 uint16_t sib1RepetitionPeriod;
194 uint8_t coresetZeroIndex; /* derived from 4 LSB of pdcchSib1 present in MIB */
195 uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
199 typedef struct bwpParams
204 uint8_t cyclicPrefix;
207 typedef struct candidatesInfo
216 typedef struct searchSpaceCfg
218 uint8_t searchSpaceId;
220 uint16_t monitoringSlot;
222 uint16_t monitoringSymbol;
223 CandidatesInfo candidate;
226 typedef struct pdcchConfigCommon
228 SearchSpaceCfg raSearchSpace;
231 typedef struct pdschConfigCommon
236 uint8_t lengthSymbol;
239 typedef struct puschConfigCommon
241 /* PUSCH-TimeDomainResourceAllocation info */
245 uint8_t lengthSymbol;
248 typedef struct bwpDlConfig
251 PdcchConfigCommon pdcchCommon;
252 PdschConfigCommon pdschCommon;
255 typedef struct bwpUlConfig
258 // rach config common sent in PrachCfg
259 // pucch info not required
260 PuschConfigCommon puschCommon;
263 typedef struct macCellCfg
266 U16 cellId; /* Cell Id */
267 U8 numTlv; /* Number of configuration TLVs */
268 U8 carrierId; /* Carrired Index */
269 U16 phyCellId; /* Physical cell id */
270 DuplexMode dupType; /* Duplex type: TDD/FDD */
271 CarrierCfg dlCarrCfg; /* DL Carrier configuration */
272 CarrierCfg ulCarrCfg; /* UL Carrier configuration */
273 Bool freqShft; /* Indicates presence of 7.5kHz frequency shift */
274 SsbCfg ssbCfg; /* SSB configuration */
275 PrachCfg prachCfg; /* PRACH Configuration */
276 TDDCfg tddCfg; /* TDD periodicity and slot configuration */
277 RSSIMeasUnit rssiUnit; /* RSSI measurement unit */
279 BwpDlConfig initialDlBwp;
280 BwpUlConfig initialUlBwp;
283 typedef struct macCellCfgCfm
289 typedef struct slotInfo
296 typedef struct macCellStartInfo
301 typedef struct macCellStopInfo
306 typedef struct ulCcchInd
313 typedef struct dlCcchInd
317 DlCcchMsgType msgType;
322 /* Functions for slot Ind from MAC to DU APP*/
323 typedef uint16_t (*DuMacSlotInd) ARGS((
325 SlotInfo *slotInfo ));
327 /* Functions for stop Ind from MAC to DU APP*/
328 typedef uint16_t (*DuMacStopInd) ARGS((
330 MacCellStopInfo *cellId ));
332 /* Functions for mac cell start req */
333 typedef uint16_t (*DuMacCellStartReq) ARGS((
335 MacCellStartInfo *cellStartInfo ));
337 /* Functions for mac cell stop request */
338 typedef uint16_t (*DuMacCellStopReq) ARGS((
340 MacCellStopInfo *cellStopInfo ));
342 /* Function pointers for packing macCellCfg Request and Confirm */
343 typedef int (*packMacCellCfgReq) ARGS((
345 MacCellCfg *macCellCfg ));
347 typedef int (*packMacCellCfgConfirm) ARGS((
349 MacCellCfgCfm *macCellCfgCfm ));
351 typedef int (*DuMacCellCfgReq) ARGS((
353 MacCellCfg *macCellCfg));
355 typedef int (*DuMacCellCfgCfm) ARGS((
357 MacCellCfgCfm *macCellCfgCfm ));
359 /* Functions for UL CCCH Ind from MAC to DU APP*/
360 typedef uint16_t (*DuMacUlCcchInd) ARGS((
362 UlCcchIndInfo *ulCcchIndInfo ));
364 /* Functions for DL CCCH Ind from DU APP to MAC*/
365 typedef uint16_t (*DuMacDlCcchInd) ARGS((
367 DlCcchIndInfo *dlCcchIndInfo ));
369 extern uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo );
370 extern uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
371 extern uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo);
372 extern uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
373 extern uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf);
374 extern uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
375 extern uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo);
376 extern uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf);
377 extern uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo);
378 extern int packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
379 extern int MacHdlCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
380 extern void cmUnpackLwLcMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf);
381 extern int unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf);
382 extern int duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
383 extern uint16_t packMacStopInd(Pst *pst, MacCellStopInfo *cellId);
384 extern uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
385 extern uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellId);
386 extern uint16_t packMacUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
387 extern uint16_t unpackMacUlCcchInd(DuMacUlCcchInd func, Pst *pst, Buffer *mBuf);
388 extern uint16_t duHandleUlCcchInd(Pst *pst, UlCcchIndInfo *ulCcchIndInfo);
389 extern uint16_t packMacDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
390 extern uint16_t unpackMacDlCcchInd(DuMacDlCcchInd func, Pst *pst, Buffer *mBuf);
391 extern uint16_t MacHdlDlCcchInd(Pst *pst, DlCcchIndInfo *dlCcchIndInfo);
392 uint8_t sendStopIndMacToDuApp();
395 /**********************************************************************
397 **********************************************************************/