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;
144 typedef struct pdschFreqAlloc
146 uint8_t resourceAllocType;
147 /* since we are using type-1, hence rbBitmap excluded */
148 FreqDomainAlloc freqAlloc;
149 uint8_t vrbPrbMapping;
152 typedef struct pdschTimeAlloc
155 TimeDomainAlloc timeAlloc;
158 typedef struct txPowerPdschInfo
160 uint8_t powerControlOffset;
161 uint8_t powerControlOffsetSS;
164 typedef struct pdschCfg
169 uint8_t numCodewords;
170 CodewordInfo codeword[MAX_CODEWORDS];
171 uint16_t dataScramblingId;
173 uint8_t transmissionScheme;
176 PdschFreqAlloc pdschFreqAlloc;
177 PdschTimeAlloc pdschTimeAlloc;
178 BeamformingInfo beamPdschInfo;
179 TxPowerPdschInfo txPdschPower;
181 /* SIB1 PDSCH structures end */
183 /* SIB1 interface structure */
185 typedef struct coresetCfg
187 uint8_t coreSet0Size;
188 uint8_t startSymbolIndex;
189 uint8_t durationSymbols;
190 uint8_t freqDomainResource[6];
191 uint8_t cceRegMappingType;
192 uint8_t regBundleSize;
193 uint8_t interleaverSize;
196 uint8_t precoderGranularity;
198 uint8_t aggregationLevel;
201 typedef struct txPowerPdcchInfo
204 uint8_t powerControlOffsetSS;
210 uint16_t scramblingId;
211 uint16_t scramblingRnti;
214 BeamformingInfo beamPdcchInfo;
215 TxPowerPdcchInfo txPdcchPower;
219 typedef struct pdcchCfg
221 /* coreset-0 configuration */
222 CoresetCfg coreset0Cfg;
225 DlDCI dci; /* as of now its only one DCI, later it will be numDlCi */
227 /* end of SIB1 PDCCH structures */
231 /* parameters recieved from DU-APP */
233 uint16_t sib1NewTxPeriod;
234 uint16_t sib1RepetitionPeriod;
235 uint8_t coresetZeroIndex; /* derived from 4 LSB of pdcchSib1 present in MIB */
236 uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
239 /* parameters derived in scheduler */
242 PdcchCfg sib1PdcchCfg;
243 PdschCfg sib1PdschCfg;
246 typedef struct schRachCfg
248 uint8_t prachCfgIdx; /* PRACH config idx */
249 uint8_t prachSubcSpacing; /* Subcarrier spacing of RACH */
250 uint16_t msg1FreqStart; /* Msg1-FrequencyStart */
251 uint8_t msg1Fdm; /* PRACH FDM (1,2,4,8) */
252 uint8_t rootSeqLen; /* root sequence length */
253 uint16_t rootSeqIdx; /* Root sequence index */
254 uint8_t numRootSeq; /* Number of root sequences required for FD */
255 uint16_t k1; /* Frequency Offset for each FD */
256 uint8_t ssbPerRach; /* SSB per RACH occassion */
257 uint8_t prachMultCarrBand; /* Presence of Multiple carriers in Band */
258 uint8_t raContResTmr; /* RA Contention Resoultion Timer */
259 uint8_t rsrpThreshSsb; /* RSRP Threshold SSB */
260 uint8_t raRspWindow; /* RA Response Window */
263 typedef struct schBwpParams
265 FreqDomainAlloc freqAlloc;
267 uint8_t cyclicPrefix;
270 typedef struct schCandidatesInfo
279 typedef struct schSearchSpaceCfg
281 uint8_t searchSpaceId;
283 uint16_t monitoringSlot;
285 uint16_t monitoringSymbol;
286 SchCandidatesInfo candidate;
289 typedef struct schPdcchCfgCmn
291 SchSearchSpaceCfg commonSearchSpace;
292 uint8_t raSearchSpaceId;
295 typedef struct schPdschCfgCmn
300 uint8_t lengthSymbol;
303 typedef struct schPucchCfgCmn
305 uint8_t pucchResourceCommon;
306 uint8_t pucchGroupHopping;
309 typedef struct schPuschCfgCmn
314 uint8_t lengthSymbol;
317 typedef struct schBwpDlCfg
320 SchPdcchCfgCmn pdcchCommon;
321 SchPdschCfgCmn pdschCommon;
324 typedef struct schBwpUlCfg
327 SchPucchCfgCmn pucchCommon;
328 SchPuschCfgCmn puschCommon;
331 typedef struct schCellCfg
333 uint16_t cellId; /* Cell Id */
334 uint16_t phyCellId; /* Physical cell id */
335 uint8_t bandwidth; /* Supported B/W */
336 DuplexMode dupMode; /* Duplex type: TDD/FDD */
337 SchSsbCfg ssbSchCfg; /* SSB config */
338 SchSib1Cfg sib1SchCfg; /* SIB1 config */
339 SchRachCfg schRachCfg; /* PRACH config */
340 SchBwpDlCfg schInitialDlBwp; /* Initial DL BWP */
341 SchBwpUlCfg schInitialUlBwp; /* Initial UL BWP */
342 uint8_t puschMu; /* PUSCH MU */
345 typedef struct schCellCfgCfm
347 U16 cellId; /* Cell Id */
351 typedef struct ssbInfo
353 uint8_t ssbIdx; /* SSB Index */
354 TimeDomainAlloc tdAlloc; /* Time domain allocation */
355 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
358 typedef struct sib1AllocInfo
361 PdcchCfg sib1PdcchCfg;
362 PdschCfg sib1PdschCfg;
365 typedef struct prachSchInfo
367 uint8_t numPrachOcas; /* Num Prach Ocassions */
368 uint8_t prachFormat; /* PRACH Format */
369 uint8_t numRa; /* Freq domain ocassion */
370 uint8_t prachStartSymb; /* Freq domain ocassion */
373 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
374 typedef struct dlBrdcstAlloc
376 /* Ssb transmission is determined as follows:
377 * 0 : No tranamission
378 * 1 : SSB Transmission
379 * 2 : SSB Repetition */
381 uint8_t ssbIdxSupported;
382 SsbInfo ssbInfo[MAX_SSB_IDX];
383 /* Sib1 transmission is determined as follows:
384 * 0 : No tranamission
385 * 1 : SIB1 Transmission
386 * 2 : SIB1 Repetition */
388 Sib1AllocInfo sib1Alloc;
391 typedef struct rarInfo
396 FreqDomainAlloc msg3FreqAlloc;
402 typedef struct rarAlloc
406 PdcchCfg rarPdcchCfg;
407 PdschCfg rarPdschCfg;
410 typedef struct msg4Info
418 uint8_t harqFeedbackInd;
424 typedef struct msg4Alloc
428 PdcchCfg msg4PdcchCfg;
429 PdschCfg msg4PdschCfg;
432 typedef struct schSlotValue
434 SlotIndInfo currentTime;
435 SlotIndInfo broadcastTime;
437 SlotIndInfo msg4Time;
438 SlotIndInfo dlMsgTime;
441 typedef struct dlSchedInfo
443 uint16_t cellId; /* Cell Id */
444 SchSlotValue schSlotValue;
446 /* Allocation for broadcast messages */
447 bool isBroadcastPres;
448 DlBrdcstAlloc brdcstAlloc;
450 /* Allocation for RAR message */
454 /* Allocation from MSG4 */
455 Msg4Alloc *msg4Alloc;
458 typedef struct tbInfo
460 uint8_t mcs; /* MCS */
461 uint8_t ndi; /* NDI */
462 uint8_t rv; /* Redundancy Version */
463 uint16_t tbSize; /* TB Size */
466 typedef struct schPuschInfo
468 uint8_t harqProcId; /* HARQ Process ID */
469 uint8_t resAllocType; /* Resource allocation type */
470 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
471 TimeDomainAlloc tdAlloc; /* Time domain allocation */
472 TbInfo tbInfo; /* TB info */
475 typedef struct schPucchInfo
479 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
480 TimeDomainAlloc tdAlloc; /* Time domain allocation */
488 typedef struct ulSchedInfo
490 uint16_t cellId; /* Cell Id */
491 uint16_t crnti; /* CRNI */
492 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
493 uint8_t dataType; /* Type of info being scheduled */
494 PrachSchInfo prachSchInfo; /* Prach scheduling info */
495 SchPuschInfo schPuschInfo; /* Pusch scheduling info */
496 SchPucchInfo schPucchInfo; /* Pusch scheduling info */
499 typedef struct rachIndInfo
503 SlotIndInfo timingInfo;
512 typedef struct crcIndInfo
516 SlotIndInfo timingInfo;
518 uint8_t crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
521 typedef struct boInfo
527 typedef struct dlRlcBOInfo
532 BOInfo boInfo[MAX_NUM_LOGICAL_CHANNELS];
536 /* function pointers */
538 typedef int (*SchCellCfgCfmFunc) ARGS((
539 Pst *pst, /* Post Structure */
540 SchCellCfgCfm *schCellCfgCfm /* Cell Cfg Cfm */
543 typedef int (*SchCellCfgFunc) ARGS((
544 Pst *pst, /* Post Structure */
545 SchCellCfg *schCellCfg /* Cell Cfg */
548 typedef int (*SchMacDlAllocFunc) ARGS((
549 Pst *pst, /* Post Structure */
550 DlSchedInfo *dlSchedInfo /* dl allocation Info */
553 typedef int (*SchMacUlSchInfoFunc) ARGS((
554 Pst *pst, /* Post Structure */
555 UlSchedInfo *ulSchedInfo /* UL Alloc Sch Info */
558 /* function declarations */
559 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
560 int packSchMacDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
561 int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
562 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
563 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
565 EXTERN int MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
566 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
567 EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
568 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
569 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
570 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
571 EXTERN int MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
572 typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
573 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
574 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
575 typedef int (*MacSchCrcIndFunc)(Pst *pst, CrcIndInfo *crcInd);
576 int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
577 int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
578 typedef uint8_t (*MacSchDlRlcBoInfoFunc)(Pst *pst, DlRlcBOInfo *dlBoInfo);
579 uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
580 uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
583 /**********************************************************************
585 **********************************************************************/