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; \
82 typedef struct timeDomainAlloc
88 typedef struct freqDomainAlloc
97 uint32_t ssbPbchPwr; /* SSB block power */
98 uint8_t scsCommon; /* subcarrier spacing for common [0-3]*/
99 uint8_t ssbOffsetPointA; /* SSB sub carrier offset from point A */
100 SSBPeriod ssbPeriod; /* SSB Periodicity in msec */
101 uint8_t ssbSubcOffset; /* Subcarrier Offset(Kssb) */
102 uint32_t nSSBMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */
105 typedef struct bwpCfg
107 uint8_t subcarrierSpacing;
108 uint8_t cyclicPrefix;
109 FreqDomainAlloc freqAlloc;
115 uint16_t beamIdx[MAX_DIG_BF_INTERFACES];
118 typedef struct beamformingInfo
122 uint8_t digBfInterfaces;
123 Prg prg[MAX_NUM_PRG];
126 /* SIB1 PDSCH structures */
128 typedef struct codewordinfo
130 uint16_t targetCodeRate;
138 typedef struct dmrsInfo
140 uint16_t dlDmrsSymbPos;
141 uint8_t dmrsConfigType;
142 uint16_t dlDmrsScramblingId;
144 uint8_t numDmrsCdmGrpsNoData;
148 typedef struct pdschFreqAlloc
150 uint8_t resourceAllocType;
151 /* since we are using type-1, hence rbBitmap excluded */
152 FreqDomainAlloc freqAlloc;
153 uint8_t vrbPrbMapping;
156 typedef struct pdschTimeAlloc
159 TimeDomainAlloc timeAlloc;
162 typedef struct txPowerPdschInfo
164 uint8_t powerControlOffset;
165 uint8_t powerControlOffsetSS;
168 typedef struct pdschCfg
173 uint8_t numCodewords;
174 CodewordInfo codeword[MAX_CODEWORDS];
175 uint16_t dataScramblingId;
177 uint8_t transmissionScheme;
180 PdschFreqAlloc pdschFreqAlloc;
181 PdschTimeAlloc pdschTimeAlloc;
182 BeamformingInfo beamPdschInfo;
183 TxPowerPdschInfo txPdschPower;
185 /* SIB1 PDSCH structures end */
187 /* SIB1 interface structure */
189 typedef struct coresetCfg
191 uint8_t coreSet0Size;
192 uint8_t startSymbolIndex;
193 uint8_t durationSymbols;
194 uint8_t freqDomainResource[6];
195 uint8_t cceRegMappingType;
196 uint8_t regBundleSize;
197 uint8_t interleaverSize;
200 uint8_t precoderGranularity;
202 uint8_t aggregationLevel;
205 typedef struct txPowerPdcchInfo
208 uint8_t powerControlOffsetSS;
214 uint16_t scramblingId;
215 uint16_t scramblingRnti;
218 BeamformingInfo beamPdcchInfo;
219 TxPowerPdcchInfo txPdcchPower;
223 typedef struct pdcchCfg
225 /* coreset-0 configuration */
226 CoresetCfg coreset0Cfg;
229 DlDCI dci; /* as of now its only one DCI, later it will be numDlCi */
231 /* end of SIB1 PDCCH structures */
235 /* parameters recieved from DU-APP */
237 uint16_t sib1NewTxPeriod;
238 uint16_t sib1RepetitionPeriod;
239 uint8_t coresetZeroIndex; /* derived from 4 LSB of pdcchSib1 present in MIB */
240 uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
243 /* parameters derived in scheduler */
246 PdcchCfg sib1PdcchCfg;
247 PdschCfg sib1PdschCfg;
250 typedef struct schRachCfg
252 uint8_t prachCfgIdx; /* PRACH config idx */
253 uint8_t prachSubcSpacing; /* Subcarrier spacing of RACH */
254 uint16_t msg1FreqStart; /* Msg1-FrequencyStart */
255 uint8_t msg1Fdm; /* PRACH FDM (1,2,4,8) */
256 uint8_t rootSeqLen; /* root sequence length */
257 uint16_t rootSeqIdx; /* Root sequence index */
258 uint8_t numRootSeq; /* Number of root sequences required for FD */
259 uint16_t k1; /* Frequency Offset for each FD */
260 uint8_t ssbPerRach; /* SSB per RACH occassion */
261 uint8_t prachMultCarrBand; /* Presence of Multiple carriers in Band */
262 uint8_t raContResTmr; /* RA Contention Resoultion Timer */
263 uint8_t rsrpThreshSsb; /* RSRP Threshold SSB */
264 uint8_t raRspWindow; /* RA Response Window */
267 typedef struct schBwpParams
269 FreqDomainAlloc freqAlloc;
271 uint8_t cyclicPrefix;
274 typedef struct schCandidatesInfo
283 typedef struct schSearchSpaceCfg
285 uint8_t searchSpaceId;
287 uint16_t monitoringSlot;
289 uint16_t monitoringSymbol;
290 SchCandidatesInfo candidate;
293 typedef struct schPdcchCfgCmn
295 SchSearchSpaceCfg commonSearchSpace;
296 uint8_t raSearchSpaceId;
299 typedef struct schPdschCfgCmn
304 uint8_t lengthSymbol;
307 typedef struct schPucchCfgCmn
309 uint8_t pucchResourceCommon;
310 uint8_t pucchGroupHopping;
313 typedef struct schPuschCfgCmn
318 uint8_t lengthSymbol;
321 typedef struct schBwpDlCfg
324 SchPdcchCfgCmn pdcchCommon;
325 SchPdschCfgCmn pdschCommon;
328 typedef struct schBwpUlCfg
331 SchPucchCfgCmn pucchCommon;
332 SchPuschCfgCmn puschCommon;
335 typedef struct schCellCfg
337 uint16_t cellId; /* Cell Id */
338 uint16_t phyCellId; /* Physical cell id */
339 uint8_t bandwidth; /* Supported B/W */
340 DuplexMode dupMode; /* Duplex type: TDD/FDD */
341 SchSsbCfg ssbSchCfg; /* SSB config */
342 SchSib1Cfg sib1SchCfg; /* SIB1 config */
343 SchRachCfg schRachCfg; /* PRACH config */
344 SchBwpDlCfg schInitialDlBwp; /* Initial DL BWP */
345 SchBwpUlCfg schInitialUlBwp; /* Initial UL BWP */
346 uint8_t puschMu; /* PUSCH MU */
349 typedef struct schCellCfgCfm
351 U16 cellId; /* Cell Id */
355 typedef struct ssbInfo
357 uint8_t ssbIdx; /* SSB Index */
358 TimeDomainAlloc tdAlloc; /* Time domain allocation */
359 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
362 typedef struct sib1AllocInfo
365 PdcchCfg sib1PdcchCfg;
366 PdschCfg sib1PdschCfg;
369 typedef struct prachSchInfo
371 uint8_t numPrachOcas; /* Num Prach Ocassions */
372 uint8_t prachFormat; /* PRACH Format */
373 uint8_t numRa; /* Freq domain ocassion */
374 uint8_t prachStartSymb; /* Freq domain ocassion */
377 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
378 typedef struct dlBrdcstAlloc
380 /* Ssb transmission is determined as follows:
381 * 0 : No tranamission
382 * 1 : SSB Transmission
383 * 2 : SSB Repetition */
385 uint8_t ssbIdxSupported;
386 SsbInfo ssbInfo[MAX_SSB_IDX];
387 /* Sib1 transmission is determined as follows:
388 * 0 : No tranamission
389 * 1 : SIB1 Transmission
390 * 2 : SIB1 Repetition */
392 Sib1AllocInfo sib1Alloc;
395 typedef struct rarInfo
400 FreqDomainAlloc msg3FreqAlloc;
406 typedef struct rarAlloc
410 PdcchCfg rarPdcchCfg;
411 PdschCfg rarPdschCfg;
414 typedef struct msg4Info
422 uint8_t harqFeedbackInd;
428 typedef struct msg4Alloc
432 PdcchCfg msg4PdcchCfg;
433 PdschCfg msg4PdschCfg;
436 typedef struct schSlotValue
438 SlotIndInfo currentTime;
439 SlotIndInfo broadcastTime;
441 SlotIndInfo msg4Time;
442 SlotIndInfo dlMsgTime;
445 typedef struct dlSchedInfo
447 uint16_t cellId; /* Cell Id */
448 SchSlotValue schSlotValue;
450 /* Allocation for broadcast messages */
451 bool isBroadcastPres;
452 DlBrdcstAlloc brdcstAlloc;
454 /* Allocation for RAR message */
458 /* Allocation from MSG4 */
459 Msg4Alloc *msg4Alloc;
462 typedef struct tbInfo
464 uint8_t mcs; /* MCS */
465 uint8_t ndi; /* NDI */
466 uint8_t rv; /* Redundancy Version */
467 uint16_t tbSize; /* TB Size */
470 typedef struct schPuschInfo
472 uint8_t harqProcId; /* HARQ Process ID */
473 uint8_t resAllocType; /* Resource allocation type */
474 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
475 TimeDomainAlloc tdAlloc; /* Time domain allocation */
476 TbInfo tbInfo; /* TB info */
479 typedef struct schPucchInfo
483 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
484 TimeDomainAlloc tdAlloc; /* Time domain allocation */
492 typedef struct ulSchedInfo
494 uint16_t cellId; /* Cell Id */
495 uint16_t crnti; /* CRNI */
496 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
497 uint8_t dataType; /* Type of info being scheduled */
498 PrachSchInfo prachSchInfo; /* Prach scheduling info */
499 SchPuschInfo schPuschInfo; /* Pusch scheduling info */
500 SchPucchInfo schPucchInfo; /* Pusch scheduling info */
503 typedef struct rachIndInfo
507 SlotIndInfo timingInfo;
516 typedef struct crcIndInfo
520 SlotIndInfo timingInfo;
522 uint8_t crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
525 typedef struct boInfo
531 typedef struct dlRlcBOInfo
536 BOInfo boInfo[MAX_NUM_LOGICAL_CHANNELS];
540 /* function pointers */
542 typedef int (*SchCellCfgCfmFunc) ARGS((
543 Pst *pst, /* Post Structure */
544 SchCellCfgCfm *schCellCfgCfm /* Cell Cfg Cfm */
547 typedef int (*SchCellCfgFunc) ARGS((
548 Pst *pst, /* Post Structure */
549 SchCellCfg *schCellCfg /* Cell Cfg */
552 typedef int (*SchMacDlAllocFunc) ARGS((
553 Pst *pst, /* Post Structure */
554 DlSchedInfo *dlSchedInfo /* dl allocation Info */
557 typedef int (*SchMacUlSchInfoFunc) ARGS((
558 Pst *pst, /* Post Structure */
559 UlSchedInfo *ulSchedInfo /* UL Alloc Sch Info */
562 /* function declarations */
563 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
564 int packSchMacDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
565 int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
566 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
567 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
569 EXTERN int MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
570 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
571 EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
572 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
573 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
574 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
575 EXTERN int MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
576 typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
577 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
578 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
579 typedef int (*MacSchCrcIndFunc)(Pst *pst, CrcIndInfo *crcInd);
580 int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
581 int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
582 typedef uint8_t (*MacSchDlRlcBoInfoFunc)(Pst *pst, DlRlcBOInfo *dlBoInfo);
583 uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
584 uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
587 /**********************************************************************
589 **********************************************************************/