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 schPuschCfgCmn
312 uint8_t lengthSymbol;
315 typedef struct schBwpDlCfg
318 SchPdcchCfgCmn pdcchCommon;
319 SchPdschCfgCmn pdschCommon;
322 typedef struct schBwpUlCfg
325 SchPuschCfgCmn puschCommon;
328 typedef struct schCellCfg
330 uint16_t cellId; /* Cell Id */
331 uint16_t phyCellId; /* Physical cell id */
332 uint8_t bandwidth; /* Supported B/W */
333 DuplexMode dupMode; /* Duplex type: TDD/FDD */
334 SchSsbCfg ssbSchCfg; /* SSB config */
335 SchSib1Cfg sib1SchCfg; /* SIB1 config */
336 SchRachCfg schRachCfg; /* PRACH config */
337 SchBwpDlCfg schInitialDlBwp; /* Initial DL BWP */
338 SchBwpUlCfg schInitialUlBwp; /* Initial UL BWP */
339 uint8_t puschMu; /* PUSCH MU */
342 typedef struct schCellCfgCfm
344 U16 cellId; /* Cell Id */
348 typedef struct ssbInfo
350 uint8_t ssbIdx; /* SSB Index */
351 TimeDomainAlloc tdAlloc; /* Time domain allocation */
352 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
355 typedef struct sib1AllocInfo
358 PdcchCfg sib1PdcchCfg;
359 PdschCfg sib1PdschCfg;
362 typedef struct prachSchInfo
364 uint8_t numPrachOcas; /* Num Prach Ocassions */
365 uint8_t prachFormat; /* PRACH Format */
366 uint8_t numRa; /* Freq domain ocassion */
367 uint8_t prachStartSymb; /* Freq domain ocassion */
370 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
371 typedef struct dlBrdcstAlloc
373 /* Ssb transmission is determined as follows:
374 * 0 : No tranamission
375 * 1 : SSB Transmission
376 * 2 : SSB Repetition */
378 uint8_t ssbIdxSupported;
379 SsbInfo ssbInfo[MAX_SSB_IDX];
380 /* Sib1 transmission is determined as follows:
381 * 0 : No tranamission
382 * 1 : SIB1 Transmission
383 * 2 : SIB1 Repetition */
385 Sib1AllocInfo sib1Alloc;
388 typedef struct rarInfo
393 FreqDomainAlloc msg3FreqAlloc;
399 typedef struct rarAlloc
403 PdcchCfg rarPdcchCfg;
404 PdschCfg rarPdschCfg;
407 typedef struct msg4Info
414 uint8_t harqFeedbackInd;
421 typedef struct msg4Alloc
425 PdcchCfg msg4PdcchCfg;
426 PdschCfg msg4PdschCfg;
429 typedef struct schSlotValue
431 SlotIndInfo currentTime;
432 SlotIndInfo broadcastTime;
434 SlotIndInfo msg4Time;
435 SlotIndInfo dlMsgTime;
438 typedef struct dlSchedInfo
440 uint16_t cellId; /* Cell Id */
441 SchSlotValue schSlotValue;
443 /* Allocation for broadcast messages */
444 bool isBroadcastPres;
445 DlBrdcstAlloc brdcstAlloc;
447 /* Allocation for RAR message */
451 /* Allocation from MSG4 */
452 Msg4Alloc *msg4Alloc;
455 typedef struct tbInfo
457 uint8_t mcs; /* MCS */
458 uint8_t ndi; /* NDI */
459 uint8_t rv; /* Redundancy Version */
460 uint16_t tbSize; /* TB Size */
463 typedef struct schPuschInfo
465 uint8_t harqProcId; /* HARQ Process ID */
466 uint8_t resAllocType; /* Resource allocation type */
467 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
468 TimeDomainAlloc tdAlloc; /* Time domain allocation */
469 TbInfo tbInfo; /* TB info */
473 typedef struct ulSchedInfo
475 uint16_t cellId; /* Cell Id */
476 uint16_t crnti; /* CRNI */
477 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
478 uint8_t dataType; /* Type of info being scheduled */
479 PrachSchInfo prachSchInfo; /* Prach scheduling info */
480 SchPuschInfo schPuschInfo; /* Pusch scheduling info */
483 typedef struct rachIndInfo
487 SlotIndInfo timingInfo;
496 typedef struct crcIndInfo
500 SlotIndInfo timingInfo;
502 uint8_t crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
505 typedef struct boInfo
511 typedef struct dlRlcBOInfo
516 BOInfo boInfo[MAX_NUM_LOGICAL_CHANNELS];
520 /* function pointers */
522 typedef int (*SchCellCfgCfmFunc) ARGS((
523 Pst *pst, /* Post Structure */
524 SchCellCfgCfm *schCellCfgCfm /* Cell Cfg Cfm */
527 typedef int (*SchCellCfgFunc) ARGS((
528 Pst *pst, /* Post Structure */
529 SchCellCfg *schCellCfg /* Cell Cfg */
532 typedef int (*SchMacDlAllocFunc) ARGS((
533 Pst *pst, /* Post Structure */
534 DlSchedInfo *dlSchedInfo /* dl allocation Info */
537 typedef int (*SchMacUlSchInfoFunc) ARGS((
538 Pst *pst, /* Post Structure */
539 UlSchedInfo *ulSchedInfo /* UL Alloc Sch Info */
542 /* function declarations */
543 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
544 int packSchMacDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
545 int packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
546 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
547 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
549 EXTERN int MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
550 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
551 EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
552 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
553 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
554 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
555 EXTERN int MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
556 typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
557 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
558 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
559 typedef int (*MacSchCrcIndFunc)(Pst *pst, CrcIndInfo *crcInd);
560 int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
561 int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
562 typedef uint8_t (*MacSchDlRlcBoInfoFunc)(Pst *pst, DlRlcBOInfo *dlBoInfo);
563 uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
564 uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
567 /**********************************************************************
569 **********************************************************************/