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 bwpDlConfig
226 PdcchConfigCommon pdcchCommon;
229 typedef struct macCellCfg
232 U16 cellId; /* Cell Id */
233 U8 numTlv; /* Number of configuration TLVs */
234 U8 carrierId; /* Carrired Index */
235 U16 phyCellId; /* Physical cell id */
236 DuplexMode dupType; /* Duplex type: TDD/FDD */
237 CarrierCfg dlCarrCfg; /* DL Carrier configuration */
238 CarrierCfg ulCarrCfg; /* UL Carrier configuration */
239 Bool freqShft; /* Indicates presence of 7.5kHz frequency shift */
240 SsbCfg ssbCfg; /* SSB configuration */
241 PrachCfg prachCfg; /* PRACH Configuration */
242 TDDCfg tddCfg; /* TDD periodicity and slot configuration */
243 RSSIMeasUnit rssiUnit; /* RSSI measurement unit */
245 BwpDlConfig initialBwp;
248 typedef struct macCellCfgCfm
254 typedef struct slotInfo
261 typedef struct macCellStartInfo
266 typedef struct macCellStopInfo
271 /* Functions for slot Ind from MAC to DU APP*/
272 typedef uint16_t (*DuMacSlotInd) ARGS((
274 SlotInfo *slotInfo ));
276 extern uint16_t packMacSlotInd(Pst *pst, SlotInfo *slotInfo );
277 extern uint16_t unpackMacSlotInd(DuMacSlotInd func, Pst *pst, Buffer *mBuf);
278 extern uint16_t duHandleSlotInd(Pst *pst, SlotInfo *slotInfo);
280 /* Functions for stop Ind from MAC to DU APP*/
281 typedef uint16_t (*DuMacStopInd) ARGS((
283 MacCellStopInfo *cellId ));
285 extern uint16_t packMacStopInd(Pst *pst, MacCellStopInfo *cellId);
286 extern uint16_t unpackMacStopInd(DuMacStopInd func, Pst *pst, Buffer *mBuf);
287 extern uint16_t duHandleStopInd(Pst *pst, MacCellStopInfo *cellId);
289 /* Functions for mac cell start req */
290 typedef uint16_t (*DuMacCellStartReq) ARGS((
292 MacCellStartInfo *cellStartInfo ));
294 extern uint16_t packMacCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
295 extern uint16_t unpackMacCellStartReq(DuMacCellStartReq func, Pst *pst, Buffer *mBuf);
296 extern uint16_t MacHdlCellStartReq(Pst *pst, MacCellStartInfo *cellStartInfo);
298 /* Functions for mac cell stop request */
299 typedef uint16_t (*DuMacCellStopReq) ARGS((
301 MacCellStopInfo *cellStopInfo ));
303 extern uint16_t packMacCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo);
304 extern uint16_t unpackMacCellStopReq(DuMacCellStopReq func, Pst *pst, Buffer *mBuf);
305 extern uint16_t MacHdlCellStopReq(Pst *pst, MacCellStopInfo *cellStopInfo);
307 /* Function pointers for packing macCellCfg Request and Confirm */
308 typedef int (*packMacCellCfgReq) ARGS((
310 MacCellCfg *macCellCfg ));
312 typedef int (*packMacCellCfgConfirm) ARGS((
314 MacCellCfgCfm *macCellCfgCfm ));
316 typedef int (*DuMacCellCfgReq) ARGS((
318 MacCellCfg *macCellCfg));
320 typedef int (*DuMacCellCfgCfm) ARGS((
322 MacCellCfgCfm *macCellCfgCfm ));
324 extern int packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
325 extern int MacHdlCellCfgReq(Pst *pst, MacCellCfg *macCellCfg);
326 extern void cmUnpackLwLcMacCellCfg(DuMacCellCfgReq func, Pst *pst, Buffer *mBuf);
327 extern int unpackMacCellCfgCfm(DuMacCellCfgCfm func, Pst *pst, Buffer *mBuf);
328 extern int duHandleMacCellCfgCfm(Pst *pst, MacCellCfgCfm *macCellCfgCfm);
329 uint8_t sendStopIndMacToDuApp();
332 /**********************************************************************
334 **********************************************************************/