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
59 MAC_GEN_FULL_PBCH_PAYLD, /* MAC generated the full PBCH Payload */
60 PHY_GEN_TIMING_PBCH_BIT, /* PHY generates the timing PBCH bits */
61 PHY_GEN_FULL_PBCH_PAYLD /* PHY generates full PBCH payload */
73 RESTRICTED_SET_TYPE_A,
119 typedef struct carrierCfg
122 U16 bw; /* DL/UL bandwidth */
123 U32 freq; /* Absolute frequency of DL/UL point A in KHz */
124 U16 k0[NUM_NUMEROLOGY]; /* K0 for DL/UL */
125 U16 gridSize[NUM_NUMEROLOGY]; /* DL/UL Grid size for each numerologies */
126 U16 numAnt; /* Number of Tx/Rx antennas */
129 typedef struct ssbCfg
131 uint32_t ssbPbchPwr; /* SSB block power */
132 BchPduOpt bchPayloadFlag; /* Options for generation of payload */
133 uint8_t scsCmn; /* subcarrier spacing for common */
134 uint16_t ssbOffsetPointA; /* SSB subcarrier offset from point A */
136 SSBPeriod ssbPeriod; /* SSB Periodicity in msec */
137 uint8_t ssbScOffset; /* Subcarrier Offset */
138 uint8_t mibPdu[3]; /* MIB payload */
139 uint32_t ssbMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */
140 uint8_t beamId[NUM_SSB];
141 Bool multCarrBand; /* Multiple carriers in a band */
142 Bool multCellCarr; /* Multiple cells in single carrier */
145 typedef struct fdmInfo
147 U16 rootSeqIdx; /* Root sequence index */
148 U8 numRootSeq; /* Number of root sequences required for FD */
149 U16 k1; /* Frequency Offset for each FD */
150 U8 zeroCorrZoneCfg; /* Zero correlation zone cofig */
151 U8 numUnusedRootSeq; /* Number of unused root sequence */
152 U8 *unsuedRootSeq; /* Unused root sequence per FD */
155 typedef struct prachCfg
158 uint8_t prachCfgIdx; /* PRACH Cfg Index */
159 PrachSeqLen prachSeqLen; /* RACH Sequence length: Long/short */
160 uint8_t prachSubcSpacing; /* Subcarrier spacing of RACH */
161 RstSetCfg prachRstSetCfg; /* PRACH restricted set config */
162 uint16_t msg1FreqStart; /* Msg1-FrequencyStart */
163 uint8_t msg1Fdm; /* PRACH FDM (1,2,4,8) */
164 PrachFdmInfo fdm[8]; /* FDM info */
165 uint8_t ssbPerRach; /* SSB per RACH occassion */
166 Bool prachMultCarrBand; /* Multiple carriers in Band */
167 uint8_t prachRestrictedSet; /* Support for PRACH restricted set */
168 uint8_t raContResTmr; /* RA Contention Resoultion Timer */
169 uint8_t rsrpThreshSsb; /* RSRP Threshold SSB */
170 uint8_t raRspWindow; /* RA Response Window */
173 typedef struct tddCfg
176 DlUlTxPeriodicity tddPeriod; /* DL UL Transmission periodicity */
177 SlotConfig slotCfg[MAXIMUM_TDD_PERIODICITY][MAX_SYMB_PER_SLOT];
180 typedef struct sib1CellCfg
184 uint16_t sib1NewTxPeriod;
185 uint16_t sib1RepetitionPeriod;
186 uint8_t coresetZeroIndex; /* derived from 4 LSB of pdcchSib1 present in MIB */
187 uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
191 typedef struct bwpParams
196 uint8_t cyclicPrefix;
199 typedef struct candidatesInfo
208 typedef struct searchSpaceCfg
210 uint8_t searchSpaceId;
212 uint16_t monitoringSlot;
214 uint16_t monitoringSymbol;
215 CandidatesInfo candidate;
218 typedef struct pdcchConfigCommon
220 SearchSpaceCfg raSearchSpace;
223 typedef struct pdschConfigCommon
228 uint8_t lengthSymbol;
231 typedef struct puschConfigCommon
233 /* PUSCH-TimeDomainResourceAllocation info */
237 uint8_t lengthSymbol;
240 typedef struct bwpDlConfig
243 PdcchConfigCommon pdcchCommon;
244 PdschConfigCommon pdschCommon;
247 typedef struct bwpUlConfig
250 // rach config common sent in PrachCfg
251 // pucch info not required
252 PuschConfigCommon puschCommon;
255 typedef struct macCellCfg
258 U16 cellId; /* Cell Id */
259 U8 numTlv; /* Number of configuration TLVs */
260 U8 carrierId; /* Carrired Index */
261 U16 phyCellId; /* Physical cell id */
262 DuplexMode dupType; /* Duplex type: TDD/FDD */
263 CarrierCfg dlCarrCfg; /* DL Carrier configuration */
264 CarrierCfg ulCarrCfg; /* UL Carrier configuration */
265 Bool freqShft; /* Indicates presence of 7.5kHz frequency shift */
266 SsbCfg ssbCfg; /* SSB configuration */
267 PrachCfg prachCfg; /* PRACH Configuration */
268 TDDCfg tddCfg; /* TDD periodicity and slot configuration */
269 RSSIMeasUnit rssiUnit; /* RSSI measurement unit */
271 BwpDlConfig initialDlBwp;
272 BwpUlConfig initialUlBwp;
275 typedef struct macCellCfgCfm
281 typedef struct slotInfo
288 typedef struct macCellStartInfo
293 typedef struct macCellStopInfo
298 /* Functions for slot Ind from MAC to DU APP*/
299 typedef uint16_t (*DuMacSlotInd) ARGS((
301 SlotInfo *slotInfo ));
303 extern uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo );
304 extern uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
305 extern uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo);
307 /* Functions for stop Ind from MAC to DU APP*/
308 typedef uint16_t (*DuMacStopInd) ARGS((
310 MacCellStopInfo *cellId ));
312 extern uint16_t packMacStopInd(Pst *pst, MacCellStopInfo *cellId);
313 extern uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
314 extern uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellId);
316 /* Functions for mac cell start req */
317 typedef uint16_t (*DuMacCellStartReq) ARGS((
319 MacCellStartInfo *cellStartInfo ));
321 extern uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
322 extern uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf);
323 extern uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
325 /* Functions for mac cell stop request */
326 typedef uint16_t (*DuMacCellStopReq) ARGS((
328 MacCellStopInfo *cellStopInfo ));
330 extern uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo);
331 extern uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf);
332 extern uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo);
334 /* Function pointers for packing macCellCfg Request and Confirm */
335 typedef int (*packMacCellCfgReq) ARGS((
337 MacCellCfg *macCellCfg ));
339 typedef int (*packMacCellCfgConfirm) ARGS((
341 MacCellCfgCfm *macCellCfgCfm ));
343 typedef int (*DuMacCellCfgReq) ARGS((
345 MacCellCfg *macCellCfg));
347 typedef int (*DuMacCellCfgCfm) ARGS((
349 MacCellCfgCfm *macCellCfgCfm ));
351 extern int packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
352 extern int MacHdlCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
353 extern void cmUnpackLwLcMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf);
354 extern int unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf);
355 extern int duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
356 uint8_t sendStopIndMacToDuApp();
359 /**********************************************************************
361 **********************************************************************/