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 *******************************************************************************/
20 #define EVENT_SCH_CELL_CFG 1
21 #define EVENT_SCH_CELL_CFG_CFM 2
22 #define EVENT_DL_ALLOC 3
23 #define EVENT_UL_SCH_INFO 4
26 #define MAC_SCH_LC_SELECTOR 0
27 #define MAC_SCH_TC_SELECTOR 1
28 #define MAC_SCH_LWLC_SELECTOR 2
32 #define SSB_TRANSMISSION 1
34 #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
37 #define SIB1_TRANSMISSION 1
38 #define SIB1_REPITITION 2
40 #define MAX_NUM_PRG 1 /* max value should be later 275 */
41 #define MAX_DIG_BF_INTERFACES 0 /* max value should be later 255 */
42 #define MAX_CODEWORDS 1 /* max should be 2 */
44 /* Datatype in UL SCH Info */
45 #define SCH_DATATYPE_PUSCH 1
46 #define SCH_DATATYPE_PUSCH_UCI 2
47 #define SCH_DATATYPE_UCI 4
48 #define SCH_DATATYPE_SRS 8
49 #define SCH_DATATYPE_PRACH 16
51 #define MAX_NUMBER_OF_CRC_IND_BITS 1
64 uint32_t ssbPbchPwr; /* SSB block power */
65 uint8_t scsCommon; /* subcarrier spacing for common [0-3]*/
66 uint8_t ssbOffsetPointA; /* SSB sub carrier offset from point A */
67 SSBPeriod ssbPeriod; /* SSB Periodicity in msec */
68 uint8_t ssbSubcOffset; /* Subcarrier Offset(Kssb) */
69 uint32_t nSSBMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */
74 uint8_t subcarrierSpacing;
83 uint16_t beamIdx[MAX_DIG_BF_INTERFACES];
86 typedef struct beamformingInfo
90 uint8_t digBfInterfaces;
94 /* SIB1 PDSCH structures */
96 typedef struct codewordinfo
98 uint16_t targetCodeRate;
106 typedef struct dmrsInfo
108 uint16_t dlDmrsSymbPos;
109 uint8_t dmrsConfigType;
110 uint16_t dlDmrsScramblingId;
112 uint8_t numDmrsCdmGrpsNoData;
116 typedef struct pdschFreqAlloc
118 uint8_t resourceAlloc;
119 /* since we are using type-1, hence rbBitmap excluded */
122 uint8_t vrbPrbMapping;
125 typedef struct pdschTimeAlloc
128 uint8_t startSymbolIndex;
132 typedef struct txPowerPdschInfo
134 uint8_t powerControlOffset;
135 uint8_t powerControlOffsetSS;
138 typedef struct pdschCfg
144 uint8_t numCodewords;
145 CodewordInfo codeword[MAX_CODEWORDS];
146 uint16_t dataScramblingId;
148 uint8_t transmissionScheme;
151 PdschFreqAlloc freqAlloc;
152 PdschTimeAlloc timeAlloc;
153 BeamformingInfo beamPdschInfo;
154 TxPowerPdschInfo txPdschPower;
156 /* SIB1 PDSCH structures end */
158 /* SIB1 interface structure */
160 typedef struct coresetCfg
162 uint8_t coreSet0Size;
163 uint8_t startSymbolIndex;
164 uint8_t durationSymbols;
165 uint8_t freqDomainResource[6];
166 uint8_t cceRegMappingType;
167 uint8_t regBundleSize;
168 uint8_t interleaverSize;
171 uint8_t precoderGranularity;
173 uint8_t aggregationLevel;
176 typedef struct txPowerPdcchInfo
179 uint8_t powerControlOffsetSS;
185 uint16_t scramblingId;
186 uint16_t scramblingRnti;
189 BeamformingInfo beamPdcchInfo;
190 TxPowerPdcchInfo txPdcchPower;
194 typedef struct pdcchCfg
197 /* coreset-0 configuration */
198 CoresetCfg coreset0Cfg;
201 DlDCI dci; /* as of now its only one DCI, later it will be numDlCi */
203 /* end of SIB1 PDCCH structures */
207 /* parameters recieved from DU-APP */
209 uint16_t sib1NewTxPeriod;
210 uint16_t sib1RepetitionPeriod;
211 uint8_t coresetZeroIndex; /* derived from 4 LSB of pdcchSib1 present in MIB */
212 uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
215 /* parameters derived in scheduler */
217 PdcchCfg sib1PdcchCfg;
218 PdschCfg sib1PdschCfg;
221 typedef struct schRachCfg
223 uint8_t prachCfgIdx; /* PRACH config idx */
224 uint8_t prachSubcSpacing; /* Subcarrier spacing of RACH */
225 uint16_t msg1FreqStart; /* Msg1-FrequencyStart */
226 uint8_t msg1Fdm; /* PRACH FDM (1,2,4,8) */
227 uint16_t rootSeqIdx; /* Root sequence index */
228 uint8_t numRootSeq; /* Number of root sequences required for FD */
229 uint16_t k1; /* Frequency Offset for each FD */
230 uint8_t ssbPerRach; /* SSB per RACH occassion */
231 uint8_t prachMultCarrBand; /* Presence of Multiple carriers in Band */
232 uint8_t raContResTmr; /* RA Contention Resoultion Timer */
233 uint8_t rsrpThreshSsb; /* RSRP Threshold SSB */
234 uint8_t raRspWindow; /* RA Response Window */
237 typedef struct schBwpParams
242 uint8_t cyclicPrefix;
245 typedef struct schCandidatesInfo
254 typedef struct schSearchSpaceCfg
256 uint8_t searchSpaceId;
258 uint16_t monitoringSlot;
260 uint16_t monitoringSymbol;
261 SchCandidatesInfo candidate;
264 typedef struct schPdcchCfgCmn
266 SchSearchSpaceCfg raSearchSpace;
269 typedef struct schBwpDlCfg
272 SchPdcchCfgCmn pdcchCommon;
275 typedef struct schCellCfg
277 uint16_t cellId; /* Cell Id */
278 uint16_t phyCellId; /* Physical cell id */
279 uint8_t bandwidth; /* Supported B/W */
280 DuplexMode dupMode; /* Duplex type: TDD/FDD */
281 SchSsbCfg ssbSchCfg; /* SSB config */
282 SchSib1Cfg sib1SchCfg; /* SIB1 config */
283 SchRachCfg schRachCfg; /* PRACH config */
284 SchBwpDlCfg schInitialBwp;
287 typedef struct schCellCfgCfm
289 U16 cellId; /* Cell Id */
293 typedef struct timeDomainAlloc
295 uint16_t ssbStartSymbIdx;
296 uint16_t ssbSymbolDuration;
299 typedef struct freqDomainAlloc
301 uint16_t ssbStartPrbIdx;
302 uint16_t ssbPrbDuration;
305 typedef struct ssbInfo
307 uint8_t ssbIdx; /* SSB Index */
308 TimeDomainAlloc tdAlloc; /* Time domain allocation */
309 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
312 typedef struct sib1AllocInfo
314 PdcchCfg sib1PdcchCfg;
315 PdschCfg sib1PdschCfg;
318 typedef struct prachSchInfo
320 uint8_t numPrachOcas; /* Num Prach Ocassions */
321 uint8_t prachFormat; /* PRACH Format */
322 uint8_t numRa; /* Freq domain ocassion */
323 uint8_t prachStartSymb; /* Freq domain ocassion */
326 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
327 typedef struct dlBrdcstAlloc
329 /* Ssb transmission is determined as follows:
330 * 0 : No tranamission
331 * 1 : SSB Transmission
332 * 2 : SSB Repetition */
334 uint8_t ssbIdxSupported;
335 SsbInfo ssbInfo[MAX_SSB_IDX];
336 /* Sib1 transmission is determined as follows:
337 * 0 : No tranamission
338 * 1 : SIB1 Transmission
339 * 2 : SIB1 Repetition */
341 Sib1AllocInfo sib1Alloc;
344 typedef struct rarInfo
349 uint16_t msg3StartRb;
356 typedef struct rarAlloc
359 PdcchCfg rarPdcchCfg;
360 PdschCfg rarPdschCfg;
363 typedef struct dlAlloc
365 uint16_t cellId; /* Cell Id */
366 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
368 /* Allocation for broadcast messages */
369 uint8_t isBroadcastPres;
370 DlBrdcstAlloc brdcstAlloc;
372 /* Allocation for RAR message */
376 typedef struct ulSchInfo
378 uint16_t cellId; /* Cell Id */
379 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
380 uint8_t dataType; /* Type of info being scheduled */
381 PrachSchInfo prachSchInfo; /* Prach scheduling info */
384 typedef struct rachIndInfo
388 SlotIndInfo timingInfo;
397 typedef struct crcIndInfo
401 SlotIndInfo timingInfo;
403 uint8_t crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
407 /* function pointers */
409 typedef int (*SchCellCfgCfmFunc) ARGS((
410 Pst *pst, /* Post Structure */
411 SchCellCfgCfm *schCellCfgCfm /* Cell Cfg Cfm */
414 typedef int (*SchCellCfgFunc) ARGS((
415 Pst *pst, /* Post Structure */
416 SchCellCfg *schCellCfg /* Cell Cfg */
419 typedef int (*SchMacDlAllocFunc) ARGS((
420 Pst *pst, /* Post Structure */
421 DlAlloc *dlAlloc /* dl allocation Info */
424 typedef int (*SchMacUlSchInfoFunc) ARGS((
425 Pst *pst, /* Post Structure */
426 UlSchInfo *ulSchInfo /* UL Sch Info */
429 /* function declarations */
430 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
431 int packSchMacDlAlloc(Pst *pst, DlAlloc *dlAlloc);
432 int packSchMacUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
433 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
434 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
436 EXTERN int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc);
437 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
438 EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
439 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
440 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
441 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
442 EXTERN int MacProcUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
443 typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
444 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
445 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
446 typedef int (*MacSchCrcIndFunc)(Pst *pst, CrcIndInfo *crcInd);
447 int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
448 int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
450 /**********************************************************************
452 **********************************************************************/