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
72 uint32_t ssbPbchPwr; /* SSB block power */
73 uint8_t scsCommon; /* subcarrier spacing for common [0-3]*/
74 uint8_t ssbOffsetPointA; /* SSB sub carrier offset from point A */
75 SSBPeriod ssbPeriod; /* SSB Periodicity in msec */
76 uint8_t ssbSubcOffset; /* Subcarrier Offset(Kssb) */
77 uint32_t nSSBMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */
82 uint8_t subcarrierSpacing;
91 uint16_t beamIdx[MAX_DIG_BF_INTERFACES];
94 typedef struct beamformingInfo
98 uint8_t digBfInterfaces;
102 /* SIB1 PDSCH structures */
104 typedef struct codewordinfo
106 uint16_t targetCodeRate;
114 typedef struct dmrsInfo
116 uint16_t dlDmrsSymbPos;
117 uint8_t dmrsConfigType;
118 uint16_t dlDmrsScramblingId;
120 uint8_t numDmrsCdmGrpsNoData;
124 typedef struct pdschFreqAlloc
126 uint8_t resourceAlloc;
127 /* since we are using type-1, hence rbBitmap excluded */
130 uint8_t vrbPrbMapping;
133 typedef struct pdschTimeAlloc
136 uint8_t startSymbolIndex;
140 typedef struct txPowerPdschInfo
142 uint8_t powerControlOffset;
143 uint8_t powerControlOffsetSS;
146 typedef struct pdschCfg
152 uint8_t numCodewords;
153 CodewordInfo codeword[MAX_CODEWORDS];
154 uint16_t dataScramblingId;
156 uint8_t transmissionScheme;
159 PdschFreqAlloc freqAlloc;
160 PdschTimeAlloc timeAlloc;
161 BeamformingInfo beamPdschInfo;
162 TxPowerPdschInfo txPdschPower;
164 /* SIB1 PDSCH structures end */
166 /* SIB1 interface structure */
168 typedef struct coresetCfg
170 uint8_t coreSet0Size;
171 uint8_t startSymbolIndex;
172 uint8_t durationSymbols;
173 uint8_t freqDomainResource[6];
174 uint8_t cceRegMappingType;
175 uint8_t regBundleSize;
176 uint8_t interleaverSize;
179 uint8_t precoderGranularity;
181 uint8_t aggregationLevel;
184 typedef struct txPowerPdcchInfo
187 uint8_t powerControlOffsetSS;
193 uint16_t scramblingId;
194 uint16_t scramblingRnti;
197 BeamformingInfo beamPdcchInfo;
198 TxPowerPdcchInfo txPdcchPower;
202 typedef struct pdcchCfg
205 /* coreset-0 configuration */
206 CoresetCfg coreset0Cfg;
209 DlDCI dci; /* as of now its only one DCI, later it will be numDlCi */
211 /* end of SIB1 PDCCH structures */
215 /* parameters recieved from DU-APP */
217 uint16_t sib1NewTxPeriod;
218 uint16_t sib1RepetitionPeriod;
219 uint8_t coresetZeroIndex; /* derived from 4 LSB of pdcchSib1 present in MIB */
220 uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
223 /* parameters derived in scheduler */
225 PdcchCfg sib1PdcchCfg;
226 PdschCfg sib1PdschCfg;
229 typedef struct schRachCfg
231 uint8_t prachCfgIdx; /* PRACH config idx */
232 uint8_t prachSubcSpacing; /* Subcarrier spacing of RACH */
233 uint16_t msg1FreqStart; /* Msg1-FrequencyStart */
234 uint8_t msg1Fdm; /* PRACH FDM (1,2,4,8) */
235 uint16_t rootSeqIdx; /* Root sequence index */
236 uint8_t numRootSeq; /* Number of root sequences required for FD */
237 uint16_t k1; /* Frequency Offset for each FD */
238 uint8_t ssbPerRach; /* SSB per RACH occassion */
239 uint8_t prachMultCarrBand; /* Presence of Multiple carriers in Band */
240 uint8_t raContResTmr; /* RA Contention Resoultion Timer */
241 uint8_t rsrpThreshSsb; /* RSRP Threshold SSB */
242 uint8_t raRspWindow; /* RA Response Window */
245 typedef struct schBwpParams
250 uint8_t cyclicPrefix;
253 typedef struct schCandidatesInfo
262 typedef struct schSearchSpaceCfg
264 uint8_t searchSpaceId;
266 uint16_t monitoringSlot;
268 uint16_t monitoringSymbol;
269 SchCandidatesInfo candidate;
272 typedef struct schPdcchCfgCmn
274 SchSearchSpaceCfg raSearchSpace;
277 typedef struct schPdschCfgCmn
282 uint8_t lengthSymbol;
285 typedef struct schPuschCfgCmn
290 uint8_t lengthSymbol;
293 typedef struct schBwpDlCfg
296 SchPdcchCfgCmn pdcchCommon;
297 SchPdschCfgCmn pdschCommon;
300 typedef struct schBwpUlCfg
303 SchPuschCfgCmn puschCommon;
306 typedef struct schCellCfg
308 uint16_t cellId; /* Cell Id */
309 uint16_t phyCellId; /* Physical cell id */
310 uint8_t bandwidth; /* Supported B/W */
311 DuplexMode dupMode; /* Duplex type: TDD/FDD */
312 SchSsbCfg ssbSchCfg; /* SSB config */
313 SchSib1Cfg sib1SchCfg; /* SIB1 config */
314 SchRachCfg schRachCfg; /* PRACH config */
315 SchBwpDlCfg schInitialDlBwp; /* Initial DL BWP */
316 SchBwpUlCfg schInitialUlBwp; /* Initial UL BWP */
317 uint8_t puschMu; /* PUSCH MU */
320 typedef struct schCellCfgCfm
322 U16 cellId; /* Cell Id */
326 typedef struct timeDomainAlloc
332 typedef struct freqDomainAlloc
338 typedef struct ssbInfo
340 uint8_t ssbIdx; /* SSB Index */
341 TimeDomainAlloc tdAlloc; /* Time domain allocation */
342 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
345 typedef struct sib1AllocInfo
347 PdcchCfg sib1PdcchCfg;
348 PdschCfg sib1PdschCfg;
351 typedef struct prachSchInfo
353 uint8_t numPrachOcas; /* Num Prach Ocassions */
354 uint8_t prachFormat; /* PRACH Format */
355 uint8_t numRa; /* Freq domain ocassion */
356 uint8_t prachStartSymb; /* Freq domain ocassion */
359 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
360 typedef struct dlBrdcstAlloc
362 /* Ssb transmission is determined as follows:
363 * 0 : No tranamission
364 * 1 : SSB Transmission
365 * 2 : SSB Repetition */
367 uint8_t ssbIdxSupported;
368 SsbInfo ssbInfo[MAX_SSB_IDX];
369 /* Sib1 transmission is determined as follows:
370 * 0 : No tranamission
371 * 1 : SIB1 Transmission
372 * 2 : SIB1 Repetition */
374 Sib1AllocInfo sib1Alloc;
377 typedef struct rarInfo
382 uint16_t msg3StartRb;
389 typedef struct rarAlloc
392 PdcchCfg rarPdcchCfg;
393 PdschCfg rarPdschCfg;
396 typedef struct msg4Info
403 uint8_t harqFeedbackInd;
410 typedef struct msg4Alloc
413 PdcchCfg msg4PdcchCfg;
414 PdschCfg msg4PdschCfg;
417 typedef struct dlAlloc
419 uint16_t cellId; /* Cell Id */
420 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
422 /* Allocation for broadcast messages */
423 uint8_t isBroadcastPres;
424 DlBrdcstAlloc brdcstAlloc;
426 /* Allocation for RAR message */
430 /* Allocation from MSG4 */
431 Msg4Alloc *msg4Alloc;
434 typedef struct tbInfo
436 uint8_t mcs; /* MCS */
437 uint8_t ndi; /* NDI */
438 uint8_t rv; /* Redundancy Version */
439 uint16_t tbSize; /* TB Size */
442 typedef struct schPuschInfo
444 uint8_t harqProcId; /* HARQ Process ID */
445 uint8_t resAllocType; /* Resource allocation type */
446 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
447 TimeDomainAlloc tdAlloc; /* Time domain allocation */
448 TbInfo tbInfo; /* TB info */
452 typedef struct ulSchInfo
454 uint16_t cellId; /* Cell Id */
455 uint16_t crnti; /* CRNI */
456 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
457 uint8_t dataType; /* Type of info being scheduled */
458 PrachSchInfo prachSchInfo; /* Prach scheduling info */
459 SchPuschInfo schPuschInfo; /* Pusch scheduling info */
462 typedef struct rachIndInfo
466 SlotIndInfo timingInfo;
475 typedef struct crcIndInfo
479 SlotIndInfo timingInfo;
481 uint8_t crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
484 typedef struct boInfo
490 typedef struct dlRlcBOInfo
495 BOInfo boInfo[MAX_NUM_LOGICAL_CHANNELS];
499 /* function pointers */
501 typedef int (*SchCellCfgCfmFunc) ARGS((
502 Pst *pst, /* Post Structure */
503 SchCellCfgCfm *schCellCfgCfm /* Cell Cfg Cfm */
506 typedef int (*SchCellCfgFunc) ARGS((
507 Pst *pst, /* Post Structure */
508 SchCellCfg *schCellCfg /* Cell Cfg */
511 typedef int (*SchMacDlAllocFunc) ARGS((
512 Pst *pst, /* Post Structure */
513 DlAlloc *dlAlloc /* dl allocation Info */
516 typedef int (*SchMacUlSchInfoFunc) ARGS((
517 Pst *pst, /* Post Structure */
518 UlSchInfo *ulSchInfo /* UL Sch Info */
521 /* function declarations */
522 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
523 int packSchMacDlAlloc(Pst *pst, DlAlloc *dlAlloc);
524 int packSchMacUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
525 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
526 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
528 EXTERN int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc);
529 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
530 EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
531 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
532 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
533 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
534 EXTERN int MacProcUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
535 typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
536 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
537 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
538 typedef int (*MacSchCrcIndFunc)(Pst *pst, CrcIndInfo *crcInd);
539 int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
540 int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
541 typedef uint8_t (*MacSchDlRlcBoInfoFunc)(Pst *pst, DlRlcBOInfo *dlBoInfo);
542 uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
543 uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
546 /**********************************************************************
548 **********************************************************************/