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
26 #define MAC_SCH_LC_SELECTOR 0
27 #define MAC_SCH_TC_SELECTOR 1
28 #define MAC_SCH_LWLC_SELECTOR 2
32 #define SSB_TRANSMISSION 1
34 #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
37 #define SIB1_TRANSMISSION 1
38 #define SIB1_REPITITION 2
40 #define MAX_NUM_PRG 1 /* max value should be later 275 */
41 #define MAX_DIG_BF_INTERFACES 0 /* max value should be later 255 */
42 #define MAX_CODEWORDS 1 /* max should be 2 */
43 #define SCH_HARQ_PROC_ID 1 /* harq proc id */
44 #define SCH_ALLOC_TYPE_1 1 /*sch res alloc type */
46 /* Datatype in UL SCH Info */
47 #define SCH_DATATYPE_PUSCH 1
48 #define SCH_DATATYPE_PUSCH_UCI 2
49 #define SCH_DATATYPE_UCI 4
50 #define SCH_DATATYPE_SRS 8
51 #define SCH_DATATYPE_PRACH 16
53 #define MAX_NUMBER_OF_CRC_IND_BITS 1
66 uint32_t ssbPbchPwr; /* SSB block power */
67 uint8_t scsCommon; /* subcarrier spacing for common [0-3]*/
68 uint8_t ssbOffsetPointA; /* SSB sub carrier offset from point A */
69 SSBPeriod ssbPeriod; /* SSB Periodicity in msec */
70 uint8_t ssbSubcOffset; /* Subcarrier Offset(Kssb) */
71 uint32_t nSSBMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */
76 uint8_t subcarrierSpacing;
85 uint16_t beamIdx[MAX_DIG_BF_INTERFACES];
88 typedef struct beamformingInfo
92 uint8_t digBfInterfaces;
96 /* SIB1 PDSCH structures */
98 typedef struct codewordinfo
100 uint16_t targetCodeRate;
108 typedef struct dmrsInfo
110 uint16_t dlDmrsSymbPos;
111 uint8_t dmrsConfigType;
112 uint16_t dlDmrsScramblingId;
114 uint8_t numDmrsCdmGrpsNoData;
118 typedef struct pdschFreqAlloc
120 uint8_t resourceAlloc;
121 /* since we are using type-1, hence rbBitmap excluded */
124 uint8_t vrbPrbMapping;
127 typedef struct pdschTimeAlloc
130 uint8_t startSymbolIndex;
134 typedef struct txPowerPdschInfo
136 uint8_t powerControlOffset;
137 uint8_t powerControlOffsetSS;
140 typedef struct pdschCfg
146 uint8_t numCodewords;
147 CodewordInfo codeword[MAX_CODEWORDS];
148 uint16_t dataScramblingId;
150 uint8_t transmissionScheme;
153 PdschFreqAlloc freqAlloc;
154 PdschTimeAlloc timeAlloc;
155 BeamformingInfo beamPdschInfo;
156 TxPowerPdschInfo txPdschPower;
158 /* SIB1 PDSCH structures end */
160 /* SIB1 interface structure */
162 typedef struct coresetCfg
164 uint8_t coreSet0Size;
165 uint8_t startSymbolIndex;
166 uint8_t durationSymbols;
167 uint8_t freqDomainResource[6];
168 uint8_t cceRegMappingType;
169 uint8_t regBundleSize;
170 uint8_t interleaverSize;
173 uint8_t precoderGranularity;
175 uint8_t aggregationLevel;
178 typedef struct txPowerPdcchInfo
181 uint8_t powerControlOffsetSS;
187 uint16_t scramblingId;
188 uint16_t scramblingRnti;
191 BeamformingInfo beamPdcchInfo;
192 TxPowerPdcchInfo txPdcchPower;
196 typedef struct pdcchCfg
199 /* coreset-0 configuration */
200 CoresetCfg coreset0Cfg;
203 DlDCI dci; /* as of now its only one DCI, later it will be numDlCi */
205 /* end of SIB1 PDCCH structures */
209 /* parameters recieved from DU-APP */
211 uint16_t sib1NewTxPeriod;
212 uint16_t sib1RepetitionPeriod;
213 uint8_t coresetZeroIndex; /* derived from 4 LSB of pdcchSib1 present in MIB */
214 uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
217 /* parameters derived in scheduler */
219 PdcchCfg sib1PdcchCfg;
220 PdschCfg sib1PdschCfg;
223 typedef struct schRachCfg
225 uint8_t prachCfgIdx; /* PRACH config idx */
226 uint8_t prachSubcSpacing; /* Subcarrier spacing of RACH */
227 uint16_t msg1FreqStart; /* Msg1-FrequencyStart */
228 uint8_t msg1Fdm; /* PRACH FDM (1,2,4,8) */
229 uint16_t rootSeqIdx; /* Root sequence index */
230 uint8_t numRootSeq; /* Number of root sequences required for FD */
231 uint16_t k1; /* Frequency Offset for each FD */
232 uint8_t ssbPerRach; /* SSB per RACH occassion */
233 uint8_t prachMultCarrBand; /* Presence of Multiple carriers in Band */
234 uint8_t raContResTmr; /* RA Contention Resoultion Timer */
235 uint8_t rsrpThreshSsb; /* RSRP Threshold SSB */
236 uint8_t raRspWindow; /* RA Response Window */
239 typedef struct schBwpParams
244 uint8_t cyclicPrefix;
247 typedef struct schCandidatesInfo
256 typedef struct schSearchSpaceCfg
258 uint8_t searchSpaceId;
260 uint16_t monitoringSlot;
262 uint16_t monitoringSymbol;
263 SchCandidatesInfo candidate;
266 typedef struct schPdcchCfgCmn
268 SchSearchSpaceCfg raSearchSpace;
271 typedef struct schPdschCfgCmn
276 uint8_t lengthSymbol;
279 typedef struct schPuschCfgCmn
284 uint8_t lengthSymbol;
287 typedef struct schBwpDlCfg
290 SchPdcchCfgCmn pdcchCommon;
291 SchPdschCfgCmn pdschCommon;
294 typedef struct schBwpUlCfg
297 SchPuschCfgCmn puschCommon;
300 typedef struct schCellCfg
302 uint16_t cellId; /* Cell Id */
303 uint16_t phyCellId; /* Physical cell id */
304 uint8_t bandwidth; /* Supported B/W */
305 DuplexMode dupMode; /* Duplex type: TDD/FDD */
306 SchSsbCfg ssbSchCfg; /* SSB config */
307 SchSib1Cfg sib1SchCfg; /* SIB1 config */
308 SchRachCfg schRachCfg; /* PRACH config */
309 SchBwpDlCfg schInitialDlBwp; /* Initial DL BWP */
310 SchBwpUlCfg schInitialUlBwp; /* Initial UL BWP */
311 uint8_t puschMu; /* PUSCH MU */
314 typedef struct schCellCfgCfm
316 U16 cellId; /* Cell Id */
320 typedef struct timeDomainAlloc
326 typedef struct freqDomainAlloc
332 typedef struct ssbInfo
334 uint8_t ssbIdx; /* SSB Index */
335 TimeDomainAlloc tdAlloc; /* Time domain allocation */
336 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
339 typedef struct sib1AllocInfo
341 PdcchCfg sib1PdcchCfg;
342 PdschCfg sib1PdschCfg;
345 typedef struct prachSchInfo
347 uint8_t numPrachOcas; /* Num Prach Ocassions */
348 uint8_t prachFormat; /* PRACH Format */
349 uint8_t numRa; /* Freq domain ocassion */
350 uint8_t prachStartSymb; /* Freq domain ocassion */
353 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
354 typedef struct dlBrdcstAlloc
356 /* Ssb transmission is determined as follows:
357 * 0 : No tranamission
358 * 1 : SSB Transmission
359 * 2 : SSB Repetition */
361 uint8_t ssbIdxSupported;
362 SsbInfo ssbInfo[MAX_SSB_IDX];
363 /* Sib1 transmission is determined as follows:
364 * 0 : No tranamission
365 * 1 : SIB1 Transmission
366 * 2 : SIB1 Repetition */
368 Sib1AllocInfo sib1Alloc;
371 typedef struct rarInfo
376 uint16_t msg3StartRb;
383 typedef struct rarAlloc
386 PdcchCfg rarPdcchCfg;
387 PdschCfg rarPdschCfg;
390 typedef struct dlAlloc
392 uint16_t cellId; /* Cell Id */
393 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
395 /* Allocation for broadcast messages */
396 uint8_t isBroadcastPres;
397 DlBrdcstAlloc brdcstAlloc;
399 /* Allocation for RAR message */
404 typedef struct tbInfo
406 uint8_t mcs; /* MCS */
407 uint8_t ndi; /* NDI */
408 uint8_t rv; /* Redundancy Version */
409 uint16_t tbSize; /* TB Size */
412 typedef struct schPuschInfo
414 uint8_t harqProcId; /* HARQ Process ID */
415 uint8_t resAllocType; /* Resource allocation type */
416 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
417 TimeDomainAlloc tdAlloc; /* Time domain allocation */
418 TbInfo tbInfo; /* TB info */
422 typedef struct ulSchInfo
424 uint16_t cellId; /* Cell Id */
425 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
426 uint8_t dataType; /* Type of info being scheduled */
427 PrachSchInfo prachSchInfo; /* Prach scheduling info */
428 SchPuschInfo schPuschInfo; /* Pusch scheduling info */
431 typedef struct rachIndInfo
435 SlotIndInfo timingInfo;
444 typedef struct crcIndInfo
448 SlotIndInfo timingInfo;
450 uint8_t crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
454 /* function pointers */
456 typedef int (*SchCellCfgCfmFunc) ARGS((
457 Pst *pst, /* Post Structure */
458 SchCellCfgCfm *schCellCfgCfm /* Cell Cfg Cfm */
461 typedef int (*SchCellCfgFunc) ARGS((
462 Pst *pst, /* Post Structure */
463 SchCellCfg *schCellCfg /* Cell Cfg */
466 typedef int (*SchMacDlAllocFunc) ARGS((
467 Pst *pst, /* Post Structure */
468 DlAlloc *dlAlloc /* dl allocation Info */
471 typedef int (*SchMacUlSchInfoFunc) ARGS((
472 Pst *pst, /* Post Structure */
473 UlSchInfo *ulSchInfo /* UL Sch Info */
476 /* function declarations */
477 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
478 int packSchMacDlAlloc(Pst *pst, DlAlloc *dlAlloc);
479 int packSchMacUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
480 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
481 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
483 EXTERN int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc);
484 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
485 EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
486 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
487 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
488 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
489 EXTERN int MacProcUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
490 typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
491 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
492 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
493 typedef int (*MacSchCrcIndFunc)(Pst *pst, CrcIndInfo *crcInd);
494 int packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
495 int macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
497 /**********************************************************************
499 **********************************************************************/