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
29 #define MAC_SCH_LC_SELECTOR 0
30 #define MAC_SCH_TC_SELECTOR 1
31 #define MAC_SCH_LWLC_SELECTOR 2
35 #define SSB_TRANSMISSION 1
37 #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
40 #define SIB1_TRANSMISSION 1
41 #define SIB1_REPITITION 2
43 #define MAX_NUM_PRG 1 /* max value should be later 275 */
44 #define MAX_DIG_BF_INTERFACES 0 /* max value should be later 255 */
45 #define MAX_CODEWORDS 1 /* max should be 2 */
46 #define SCH_HARQ_PROC_ID 1 /* harq proc id */
47 #define SCH_ALLOC_TYPE_1 1 /*sch res alloc type */
49 /* Datatype in UL SCH Info */
50 #define SCH_DATATYPE_PUSCH 1
51 #define SCH_DATATYPE_PUSCH_UCI 2
52 #define SCH_DATATYPE_UCI 4
53 #define SCH_DATATYPE_SRS 8
54 #define SCH_DATATYPE_PRACH 16
56 #define MAX_NUMBER_OF_CRC_IND_BITS 1
57 #define MAX_NUM_LOGICAL_CHANNELS 11
58 /* can we have a common numslot numscs between mac sch */
62 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr) \
63 if ((crntTime.slot + incr) > (MAX_SLOTS - 1)) \
64 toFill.sfn = (crntTime.sfn + 1); \
66 toFill.sfn = crntTime.sfn; \
67 toFill.slot = (crntTime.slot + incr) % MAX_SLOTS; \
68 if (toFill.sfn >= MAX_SFN) \
70 toFill.sfn%=MAX_SFN; \
84 uint32_t ssbPbchPwr; /* SSB block power */
85 uint8_t scsCommon; /* subcarrier spacing for common [0-3]*/
86 uint8_t ssbOffsetPointA; /* SSB sub carrier offset from point A */
87 SSBPeriod ssbPeriod; /* SSB Periodicity in msec */
88 uint8_t ssbSubcOffset; /* Subcarrier Offset(Kssb) */
89 uint32_t nSSBMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */
94 uint8_t subcarrierSpacing;
103 uint16_t beamIdx[MAX_DIG_BF_INTERFACES];
106 typedef struct beamformingInfo
110 uint8_t digBfInterfaces;
111 Prg prg[MAX_NUM_PRG];
114 /* SIB1 PDSCH structures */
116 typedef struct codewordinfo
118 uint16_t targetCodeRate;
126 typedef struct dmrsInfo
128 uint16_t dlDmrsSymbPos;
129 uint8_t dmrsConfigType;
130 uint16_t dlDmrsScramblingId;
132 uint8_t numDmrsCdmGrpsNoData;
136 typedef struct pdschFreqAlloc
138 uint8_t resourceAlloc;
139 /* since we are using type-1, hence rbBitmap excluded */
142 uint8_t vrbPrbMapping;
145 typedef struct pdschTimeAlloc
148 uint8_t startSymbolIndex;
152 typedef struct txPowerPdschInfo
154 uint8_t powerControlOffset;
155 uint8_t powerControlOffsetSS;
158 typedef struct pdschCfg
163 uint8_t numCodewords;
164 CodewordInfo codeword[MAX_CODEWORDS];
165 uint16_t dataScramblingId;
167 uint8_t transmissionScheme;
170 PdschFreqAlloc freqAlloc;
171 PdschTimeAlloc timeAlloc;
172 BeamformingInfo beamPdschInfo;
173 TxPowerPdschInfo txPdschPower;
175 /* SIB1 PDSCH structures end */
177 /* SIB1 interface structure */
179 typedef struct coresetCfg
181 uint8_t coreSet0Size;
182 uint8_t startSymbolIndex;
183 uint8_t durationSymbols;
184 uint8_t freqDomainResource[6];
185 uint8_t cceRegMappingType;
186 uint8_t regBundleSize;
187 uint8_t interleaverSize;
190 uint8_t precoderGranularity;
192 uint8_t aggregationLevel;
195 typedef struct txPowerPdcchInfo
198 uint8_t powerControlOffsetSS;
204 uint16_t scramblingId;
205 uint16_t scramblingRnti;
208 BeamformingInfo beamPdcchInfo;
209 TxPowerPdcchInfo txPdcchPower;
213 typedef struct pdcchCfg
215 /* coreset-0 configuration */
216 CoresetCfg coreset0Cfg;
219 DlDCI dci; /* as of now its only one DCI, later it will be numDlCi */
221 /* end of SIB1 PDCCH structures */
225 /* parameters recieved from DU-APP */
227 uint16_t sib1NewTxPeriod;
228 uint16_t sib1RepetitionPeriod;
229 uint8_t coresetZeroIndex; /* derived from 4 LSB of pdcchSib1 present in MIB */
230 uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
233 /* parameters derived in scheduler */
236 PdcchCfg sib1PdcchCfg;
237 PdschCfg sib1PdschCfg;
240 typedef struct schRachCfg
242 uint8_t prachCfgIdx; /* PRACH config idx */
243 uint8_t prachSubcSpacing; /* Subcarrier spacing of RACH */
244 uint16_t msg1FreqStart; /* Msg1-FrequencyStart */
245 uint8_t msg1Fdm; /* PRACH FDM (1,2,4,8) */
246 uint16_t rootSeqIdx; /* Root sequence index */
247 uint8_t numRootSeq; /* Number of root sequences required for FD */
248 uint16_t k1; /* Frequency Offset for each FD */
249 uint8_t ssbPerRach; /* SSB per RACH occassion */
250 uint8_t prachMultCarrBand; /* Presence of Multiple carriers in Band */
251 uint8_t raContResTmr; /* RA Contention Resoultion Timer */
252 uint8_t rsrpThreshSsb; /* RSRP Threshold SSB */
253 uint8_t raRspWindow; /* RA Response Window */
256 typedef struct schBwpParams
261 uint8_t cyclicPrefix;
264 typedef struct schCandidatesInfo
273 typedef struct schSearchSpaceCfg
275 uint8_t searchSpaceId;
277 uint16_t monitoringSlot;
279 uint16_t monitoringSymbol;
280 SchCandidatesInfo candidate;
283 typedef struct schPdcchCfgCmn
285 SchSearchSpaceCfg commonSearchSpace;
286 uint8_t raSearchSpaceId;
289 typedef struct schPdschCfgCmn
294 uint8_t lengthSymbol;
297 typedef struct schPuschCfgCmn
302 uint8_t lengthSymbol;
305 typedef struct schBwpDlCfg
308 SchPdcchCfgCmn pdcchCommon;
309 SchPdschCfgCmn pdschCommon;
312 typedef struct schBwpUlCfg
315 SchPuschCfgCmn puschCommon;
318 typedef struct schCellCfg
320 uint16_t cellId; /* Cell Id */
321 uint16_t phyCellId; /* Physical cell id */
322 uint8_t bandwidth; /* Supported B/W */
323 DuplexMode dupMode; /* Duplex type: TDD/FDD */
324 SchSsbCfg ssbSchCfg; /* SSB config */
325 SchSib1Cfg sib1SchCfg; /* SIB1 config */
326 SchRachCfg schRachCfg; /* PRACH config */
327 SchBwpDlCfg schInitialDlBwp; /* Initial DL BWP */
328 SchBwpUlCfg schInitialUlBwp; /* Initial UL BWP */
329 uint8_t puschMu; /* PUSCH MU */
332 typedef struct schCellCfgCfm
334 U16 cellId; /* Cell Id */
338 typedef struct timeDomainAlloc
344 typedef struct freqDomainAlloc
350 typedef struct ssbInfo
352 uint8_t ssbIdx; /* SSB Index */
353 TimeDomainAlloc tdAlloc; /* Time domain allocation */
354 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
357 typedef struct sib1AllocInfo
360 PdcchCfg sib1PdcchCfg;
361 PdschCfg sib1PdschCfg;
364 typedef struct prachSchInfo
366 uint8_t numPrachOcas; /* Num Prach Ocassions */
367 uint8_t prachFormat; /* PRACH Format */
368 uint8_t numRa; /* Freq domain ocassion */
369 uint8_t prachStartSymb; /* Freq domain ocassion */
372 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
373 typedef struct dlBrdcstAlloc
375 /* Ssb transmission is determined as follows:
376 * 0 : No tranamission
377 * 1 : SSB Transmission
378 * 2 : SSB Repetition */
380 uint8_t ssbIdxSupported;
381 SsbInfo ssbInfo[MAX_SSB_IDX];
382 /* Sib1 transmission is determined as follows:
383 * 0 : No tranamission
384 * 1 : SIB1 Transmission
385 * 2 : SIB1 Repetition */
387 Sib1AllocInfo sib1Alloc;
390 typedef struct rarInfo
395 uint16_t msg3StartRb;
402 typedef struct rarAlloc
406 PdcchCfg rarPdcchCfg;
407 PdschCfg rarPdschCfg;
410 typedef struct msg4Info
417 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 */
476 typedef struct ulSchedInfo
478 uint16_t cellId; /* Cell Id */
479 uint16_t crnti; /* CRNI */
480 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
481 uint8_t dataType; /* Type of info being scheduled */
482 PrachSchInfo prachSchInfo; /* Prach scheduling info */
483 SchPuschInfo schPuschInfo; /* Pusch scheduling info */
486 typedef struct rachIndInfo
490 SlotIndInfo timingInfo;
499 typedef struct crcIndInfo
503 SlotIndInfo timingInfo;
505 uint8_t crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
508 typedef struct boInfo
514 typedef struct dlRlcBOInfo
519 BOInfo boInfo[MAX_NUM_LOGICAL_CHANNELS];
523 /* function pointers */
525 typedef int (*SchCellCfgCfmFunc) ARGS((
526 Pst *pst, /* Post Structure */
527 SchCellCfgCfm *schCellCfgCfm /* Cell Cfg Cfm */
530 typedef int (*SchCellCfgFunc) ARGS((
531 Pst *pst, /* Post Structure */
532 SchCellCfg *schCellCfg /* Cell Cfg */
535 typedef int (*SchMacDlAllocFunc) ARGS((
536 Pst *pst, /* Post Structure */
537 DlSchedInfo *dlSchedInfo /* dl allocation Info */
540 typedef int (*SchMacUlSchInfoFunc) ARGS((
541 Pst *pst, /* Post Structure */
542 UlSchedInfo *ulSchedInfo /* UL Alloc Sch Info */
545 /* function declarations */
546 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
547 int packSchMacDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
548 int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
549 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
550 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
552 EXTERN int MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
553 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
554 EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
555 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
556 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
557 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
558 EXTERN int MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
559 typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
560 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
561 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
562 typedef int (*MacSchCrcIndFunc)(Pst *pst, CrcIndInfo *crcInd);
563 int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
564 int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
565 typedef uint8_t (*MacSchDlRlcBoInfoFunc)(Pst *pst, DlRlcBOInfo *dlBoInfo);
566 uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
567 uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
570 /**********************************************************************
572 **********************************************************************/