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
24 #define EVENT_RACH_IND_TO_SCH 5
25 #define EVENT_CRC_IND_TO_SCH 6
26 #define EVENT_DL_RLC_BO_INFO_TO_SCH 7
31 #define SSB_TRANSMISSION 1
33 #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
36 #define SIB1_TRANSMISSION 1
37 #define SIB1_REPITITION 2
39 #define MAX_NUM_PRG 1 /* max value should be later 275 */
40 #define MAX_DIG_BF_INTERFACES 0 /* max value should be later 255 */
41 #define MAX_CODEWORDS 1 /* max should be 2 */
42 #define SCH_HARQ_PROC_ID 1 /* harq proc id */
43 #define SCH_ALLOC_TYPE_1 1 /*sch res alloc type */
45 /* Datatype in UL SCH Info */
46 #define SCH_DATATYPE_PUSCH 1
47 #define SCH_DATATYPE_PUSCH_UCI 2
48 #define SCH_DATATYPE_UCI 4
49 #define SCH_DATATYPE_SRS 8
50 #define SCH_DATATYPE_PRACH 16
52 #define MAX_NUMBER_OF_CRC_IND_BITS 1
53 #define MAX_NUM_LOGICAL_CHANNELS 11
54 /* can we have a common numslot numscs between mac sch */
58 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr) \
59 if ((crntTime.slot + incr) > (MAX_SLOTS - 1)) \
60 toFill.sfn = (crntTime.sfn + 1); \
62 toFill.sfn = crntTime.sfn; \
63 toFill.slot = (crntTime.slot + incr) % MAX_SLOTS; \
64 if (toFill.sfn >= MAX_SFN) \
66 toFill.sfn%=MAX_SFN; \
78 typedef struct timeDomainAlloc
84 typedef struct freqDomainAlloc
93 uint32_t ssbPbchPwr; /* SSB block power */
94 uint8_t scsCommon; /* subcarrier spacing for common [0-3]*/
95 uint8_t ssbOffsetPointA; /* SSB sub carrier offset from point A */
96 SSBPeriod ssbPeriod; /* SSB Periodicity in msec */
97 uint8_t ssbSubcOffset; /* Subcarrier Offset(Kssb) */
98 uint32_t nSSBMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */
101 typedef struct bwpCfg
103 uint8_t subcarrierSpacing;
104 uint8_t cyclicPrefix;
105 FreqDomainAlloc freqAlloc;
111 uint16_t beamIdx[MAX_DIG_BF_INTERFACES];
114 typedef struct beamformingInfo
118 uint8_t digBfInterfaces;
119 Prg prg[MAX_NUM_PRG];
122 /* SIB1 PDSCH structures */
124 typedef struct codewordinfo
126 uint16_t targetCodeRate;
134 typedef struct dmrsInfo
136 uint16_t dlDmrsSymbPos;
137 uint8_t dmrsConfigType;
138 uint16_t dlDmrsScramblingId;
140 uint8_t numDmrsCdmGrpsNoData;
143 uint8_t nrOfDmrsSymbols;
147 typedef struct pdschFreqAlloc
149 uint8_t resourceAllocType;
150 /* since we are using type-1, hence rbBitmap excluded */
151 FreqDomainAlloc freqAlloc;
152 uint8_t vrbPrbMapping;
155 typedef struct pdschTimeAlloc
158 TimeDomainAlloc timeAlloc;
161 typedef struct txPowerPdschInfo
163 uint8_t powerControlOffset;
164 uint8_t powerControlOffsetSS;
167 typedef struct pdschCfg
172 uint8_t numCodewords;
173 CodewordInfo codeword[MAX_CODEWORDS];
174 uint16_t dataScramblingId;
176 uint8_t transmissionScheme;
179 PdschFreqAlloc pdschFreqAlloc;
180 PdschTimeAlloc pdschTimeAlloc;
181 BeamformingInfo beamPdschInfo;
182 TxPowerPdschInfo txPdschPower;
184 /* SIB1 PDSCH structures end */
186 /* SIB1 interface structure */
188 typedef struct coresetCfg
190 uint8_t coreSet0Size;
191 uint8_t startSymbolIndex;
192 uint8_t durationSymbols;
193 uint8_t freqDomainResource[6];
194 uint8_t cceRegMappingType;
195 uint8_t regBundleSize;
196 uint8_t interleaverSize;
199 uint8_t precoderGranularity;
201 uint8_t aggregationLevel;
204 typedef struct txPowerPdcchInfo
207 uint8_t powerControlOffsetSS;
213 uint16_t scramblingId;
214 uint16_t scramblingRnti;
217 BeamformingInfo beamPdcchInfo;
218 TxPowerPdcchInfo txPdcchPower;
222 typedef struct pdcchCfg
224 /* coreset-0 configuration */
225 CoresetCfg coreset0Cfg;
228 DlDCI dci; /* as of now its only one DCI, later it will be numDlCi */
230 /* end of SIB1 PDCCH structures */
234 /* parameters recieved from DU-APP */
236 uint16_t sib1NewTxPeriod;
237 uint16_t sib1RepetitionPeriod;
238 uint8_t coresetZeroIndex; /* derived from 4 LSB of pdcchSib1 present in MIB */
239 uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
242 /* parameters derived in scheduler */
245 PdcchCfg sib1PdcchCfg;
246 PdschCfg sib1PdschCfg;
249 typedef struct schRachCfg
251 uint8_t prachCfgIdx; /* PRACH config idx */
252 uint8_t prachSubcSpacing; /* Subcarrier spacing of RACH */
253 uint16_t msg1FreqStart; /* Msg1-FrequencyStart */
254 uint8_t msg1Fdm; /* PRACH FDM (1,2,4,8) */
255 uint8_t rootSeqLen; /* root sequence length */
256 uint16_t rootSeqIdx; /* Root sequence index */
257 uint8_t numRootSeq; /* Number of root sequences required for FD */
258 uint16_t k1; /* Frequency Offset for each FD */
259 uint8_t ssbPerRach; /* SSB per RACH occassion */
260 uint8_t prachMultCarrBand; /* Presence of Multiple carriers in Band */
261 uint8_t raContResTmr; /* RA Contention Resoultion Timer */
262 uint8_t rsrpThreshSsb; /* RSRP Threshold SSB */
263 uint8_t raRspWindow; /* RA Response Window */
266 typedef struct schBwpParams
268 FreqDomainAlloc freqAlloc;
270 uint8_t cyclicPrefix;
273 typedef struct schCandidatesInfo
282 typedef struct schSearchSpaceCfg
284 uint8_t searchSpaceId;
286 uint16_t monitoringSlot;
288 uint16_t monitoringSymbol;
289 SchCandidatesInfo candidate;
292 typedef struct schPdcchCfgCmn
294 SchSearchSpaceCfg commonSearchSpace;
295 uint8_t raSearchSpaceId;
298 typedef struct schPdschCfgCmn
303 uint8_t lengthSymbol;
306 typedef struct schPucchCfgCmn
308 uint8_t pucchResourceCommon;
309 uint8_t pucchGroupHopping;
312 typedef struct schPuschCfgCmn
317 uint8_t lengthSymbol;
320 typedef struct schBwpDlCfg
323 SchPdcchCfgCmn pdcchCommon;
324 SchPdschCfgCmn pdschCommon;
327 typedef struct schBwpUlCfg
330 SchPucchCfgCmn pucchCommon;
331 SchPuschCfgCmn puschCommon;
334 typedef struct schCellCfg
336 uint16_t cellId; /* Cell Id */
337 uint16_t phyCellId; /* Physical cell id */
338 uint8_t bandwidth; /* Supported B/W */
339 DuplexMode dupMode; /* Duplex type: TDD/FDD */
340 SchSsbCfg ssbSchCfg; /* SSB config */
341 SchSib1Cfg sib1SchCfg; /* SIB1 config */
342 SchRachCfg schRachCfg; /* PRACH config */
343 SchBwpDlCfg schInitialDlBwp; /* Initial DL BWP */
344 SchBwpUlCfg schInitialUlBwp; /* Initial UL BWP */
345 uint8_t puschMu; /* PUSCH MU */
348 typedef struct schCellCfgCfm
350 U16 cellId; /* Cell Id */
354 typedef struct ssbInfo
356 uint8_t ssbIdx; /* SSB Index */
357 TimeDomainAlloc tdAlloc; /* Time domain allocation */
358 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
361 typedef struct sib1AllocInfo
364 PdcchCfg sib1PdcchCfg;
365 PdschCfg sib1PdschCfg;
368 typedef struct prachSchInfo
370 uint8_t numPrachOcas; /* Num Prach Ocassions */
371 uint8_t prachFormat; /* PRACH Format */
372 uint8_t numRa; /* Freq domain ocassion */
373 uint8_t prachStartSymb; /* Freq domain ocassion */
376 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
377 typedef struct dlBrdcstAlloc
379 /* Ssb transmission is determined as follows:
380 * 0 : No tranamission
381 * 1 : SSB Transmission
382 * 2 : SSB Repetition */
384 uint8_t ssbIdxSupported;
385 SsbInfo ssbInfo[MAX_SSB_IDX];
386 /* Sib1 transmission is determined as follows:
387 * 0 : No tranamission
388 * 1 : SIB1 Transmission
389 * 2 : SIB1 Repetition */
391 Sib1AllocInfo sib1Alloc;
394 typedef struct rarInfo
399 FreqDomainAlloc msg3FreqAlloc;
405 typedef struct rarAlloc
409 PdcchCfg rarPdcchCfg;
410 PdschCfg rarPdschCfg;
413 typedef struct msg4Info
421 uint8_t harqFeedbackInd;
427 typedef struct msg4Alloc
431 PdcchCfg msg4PdcchCfg;
432 PdschCfg msg4PdschCfg;
435 typedef struct schSlotValue
437 SlotIndInfo currentTime;
438 SlotIndInfo broadcastTime;
440 SlotIndInfo msg4Time;
441 SlotIndInfo dlMsgTime;
444 typedef struct dlSchedInfo
446 uint16_t cellId; /* Cell Id */
447 SchSlotValue schSlotValue;
449 /* Allocation for broadcast messages */
450 bool isBroadcastPres;
451 DlBrdcstAlloc brdcstAlloc;
453 /* Allocation for RAR message */
457 /* Allocation from MSG4 */
458 Msg4Alloc *msg4Alloc;
461 typedef struct tbInfo
463 uint8_t mcs; /* MCS */
464 uint8_t ndi; /* NDI */
465 uint8_t rv; /* Redundancy Version */
466 uint16_t tbSize; /* TB Size */
469 typedef struct schPuschInfo
471 uint8_t harqProcId; /* HARQ Process ID */
472 uint8_t resAllocType; /* Resource allocation type */
473 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
474 TimeDomainAlloc tdAlloc; /* Time domain allocation */
475 TbInfo tbInfo; /* TB info */
476 uint8_t dmrsMappingType;
477 uint8_t nrOfDmrsSymbols;
481 typedef struct schPucchInfo
485 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
486 TimeDomainAlloc tdAlloc; /* Time domain allocation */
494 typedef struct ulSchedInfo
496 uint16_t cellId; /* Cell Id */
497 uint16_t crnti; /* CRNI */
498 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
499 uint8_t dataType; /* Type of info being scheduled */
500 PrachSchInfo prachSchInfo; /* Prach scheduling info */
501 SchPuschInfo schPuschInfo; /* Pusch scheduling info */
502 SchPucchInfo schPucchInfo; /* Pusch scheduling info */
505 typedef struct rachIndInfo
509 SlotIndInfo timingInfo;
518 typedef struct crcIndInfo
522 SlotIndInfo timingInfo;
524 uint8_t crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
527 typedef struct boInfo
533 typedef struct dlRlcBOInfo
538 BOInfo boInfo[MAX_NUM_LOGICAL_CHANNELS];
542 /* function pointers */
544 typedef int (*SchCellCfgCfmFunc) ARGS((
545 Pst *pst, /* Post Structure */
546 SchCellCfgCfm *schCellCfgCfm /* Cell Cfg Cfm */
549 typedef int (*SchCellCfgFunc) ARGS((
550 Pst *pst, /* Post Structure */
551 SchCellCfg *schCellCfg /* Cell Cfg */
554 typedef int (*SchMacDlAllocFunc) ARGS((
555 Pst *pst, /* Post Structure */
556 DlSchedInfo *dlSchedInfo /* dl allocation Info */
559 typedef int (*SchMacUlSchInfoFunc) ARGS((
560 Pst *pst, /* Post Structure */
561 UlSchedInfo *ulSchedInfo /* UL Alloc Sch Info */
564 /* function declarations */
565 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
566 int packSchMacDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
567 int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
568 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
569 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
571 EXTERN int MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
572 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
573 EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
574 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
575 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
576 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
577 EXTERN int MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
578 typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
579 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
580 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
581 typedef int (*MacSchCrcIndFunc)(Pst *pst, CrcIndInfo *crcInd);
582 int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
583 int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
584 typedef uint8_t (*MacSchDlRlcBoInfoFunc)(Pst *pst, DlRlcBOInfo *dlBoInfo);
585 uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
586 uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
589 /**********************************************************************
591 **********************************************************************/