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 */
44 /* Datatype in UL SCH Info */
45 #define SCH_DATATYPE_PUSCH 1
46 #define SCH_DATATYPE_PUSCH_UCI 2
47 #define SCH_DATATYPE_UCI 4
48 #define SCH_DATATYPE_SRS 8
49 #define SCH_DATATYPE_PRACH 16
62 uint32_t ssbPbchPwr; /* SSB block power */
63 uint8_t scsCommon; /* subcarrier spacing for common [0-3]*/
64 uint8_t ssbOffsetPointA; /* SSB sub carrier offset from point A */
65 SSBPeriod ssbPeriod; /* SSB Periodicity in msec */
66 uint8_t ssbSubcOffset; /* Subcarrier Offset(Kssb) */
67 uint32_t nSSBMask[SSB_MASK_SIZE]; /* Bitmap for actually transmitted SSB. */
72 uint8_t subcarrierSpacing;
81 uint16_t beamIdx[MAX_DIG_BF_INTERFACES];
84 typedef struct beamformingInfo
88 uint8_t digBfInterfaces;
92 /* SIB1 PDSCH structures */
94 typedef struct codewordinfo
96 uint16_t targetCodeRate;
104 typedef struct dmrsInfo
106 uint16_t dlDmrsSymbPos;
107 uint8_t dmrsConfigType;
108 uint16_t dlDmrsScramblingId;
110 uint8_t numDmrsCdmGrpsNoData;
114 typedef struct pdschFreqAlloc
116 uint8_t resourceAlloc;
117 /* since we are using type-1, hence rbBitmap excluded */
120 uint8_t vrbPrbMapping;
123 typedef struct pdschTimeAlloc
126 uint8_t startSymbolIndex;
130 typedef struct txPowerPdschInfo
132 uint8_t powerControlOffset;
133 uint8_t powerControlOffsetSS;
136 typedef struct pdschCfg
142 uint8_t numCodewords;
143 CodewordInfo codeword[MAX_CODEWORDS];
144 uint16_t dataScramblingId;
146 uint8_t transmissionScheme;
149 PdschFreqAlloc freqAlloc;
150 PdschTimeAlloc timeAlloc;
151 BeamformingInfo beamPdschInfo;
152 TxPowerPdschInfo txPdschPower;
154 /* SIB1 PDSCH structures end */
156 /* SIB1 interface structure */
158 typedef struct coresetCfg
160 uint8_t coreSet0Size;
161 uint8_t startSymbolIndex;
162 uint8_t durationSymbols;
163 uint8_t freqDomainResource[6];
164 uint8_t cceRegMappingType;
165 uint8_t regBundleSize;
166 uint8_t interleaverSize;
169 uint8_t precoderGranularity;
171 uint8_t aggregationLevel;
174 typedef struct txPowerPdcchInfo
177 uint8_t powerControlOffsetSS;
183 uint16_t scramblingId;
184 uint16_t scramblingRnti;
187 BeamformingInfo beamPdcchInfo;
188 TxPowerPdcchInfo txPdcchPower;
192 typedef struct pdcchCfg
195 /* coreset-0 configuration */
196 CoresetCfg coreset0Cfg;
199 DlDCI dci; /* as of now its only one DCI, later it will be numDlCi */
201 /* end of SIB1 PDCCH structures */
205 /* parameters recieved from DU-APP */
207 uint16_t sib1NewTxPeriod;
208 uint16_t sib1RepetitionPeriod;
209 uint8_t coresetZeroIndex; /* derived from 4 LSB of pdcchSib1 present in MIB */
210 uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
213 /* parameters derived in scheduler */
215 PdcchCfg sib1PdcchCfg;
216 PdschCfg sib1PdschCfg;
219 typedef struct schRachCfg
221 uint8_t prachCfgIdx; /* PRACH config idx */
222 uint8_t prachSubcSpacing; /* Subcarrier spacing of RACH */
223 uint16_t msg1FreqStart; /* Msg1-FrequencyStart */
224 uint8_t msg1Fdm; /* PRACH FDM (1,2,4,8) */
225 uint16_t rootSeqIdx; /* Root sequence index */
226 uint8_t numRootSeq; /* Number of root sequences required for FD */
227 uint16_t k1; /* Frequency Offset for each FD */
228 uint8_t ssbPerRach; /* SSB per RACH occassion */
229 uint8_t prachMultCarrBand; /* Presence of Multiple carriers in Band */
230 uint8_t raContResTmr; /* RA Contention Resoultion Timer */
231 uint8_t rsrpThreshSsb; /* RSRP Threshold SSB */
232 uint8_t raRspWindow; /* RA Response Window */
235 typedef struct schBwpParams
240 uint8_t cyclicPrefix;
243 typedef struct schCandidatesInfo
252 typedef struct schSearchSpaceCfg
254 uint8_t searchSpaceId;
256 uint16_t monitoringSlot;
258 uint16_t monitoringSymbol;
259 SchCandidatesInfo candidate;
262 typedef struct schPdcchCfgCmn
264 SchSearchSpaceCfg raSearchSpace;
267 typedef struct schBwpDlCfg
270 SchPdcchCfgCmn pdcchCommon;
273 typedef struct schCellCfg
275 uint16_t cellId; /* Cell Id */
276 uint16_t phyCellId; /* Physical cell id */
277 uint8_t bandwidth; /* Supported B/W */
278 DuplexMode dupMode; /* Duplex type: TDD/FDD */
279 SchSsbCfg ssbSchCfg; /* SSB config */
280 SchSib1Cfg sib1SchCfg; /* SIB1 config */
281 SchRachCfg schRachCfg; /* PRACH config */
282 SchBwpDlCfg schInitialBwp;
285 typedef struct schCellCfgCfm
287 U16 cellId; /* Cell Id */
291 typedef struct timeDomainAlloc
293 uint16_t ssbStartSymbIdx;
294 uint16_t ssbSymbolDuration;
297 typedef struct freqDomainAlloc
299 uint16_t ssbStartPrbIdx;
300 uint16_t ssbPrbDuration;
303 typedef struct ssbInfo
305 uint8_t ssbIdx; /* SSB Index */
306 TimeDomainAlloc tdAlloc; /* Time domain allocation */
307 FreqDomainAlloc fdAlloc; /* Freq domain allocation */
310 typedef struct sib1AllocInfo
312 PdcchCfg sib1PdcchCfg;
313 PdschCfg sib1PdschCfg;
316 typedef struct prachSchInfo
318 uint8_t numPrachOcas; /* Num Prach Ocassions */
319 uint8_t prachFormat; /* PRACH Format */
320 uint8_t numRa; /* Freq domain ocassion */
321 uint8_t prachStartSymb; /* Freq domain ocassion */
324 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
325 typedef struct dlBrdcstAlloc
327 /* Ssb transmission is determined as follows:
328 * 0 : No tranamission
329 * 1 : SSB Transmission
330 * 2 : SSB Repetition */
332 uint8_t ssbIdxSupported;
333 SsbInfo ssbInfo[MAX_SSB_IDX];
334 /* Sib1 transmission is determined as follows:
335 * 0 : No tranamission
336 * 1 : SIB1 Transmission
337 * 2 : SIB1 Repetition */
339 Sib1AllocInfo sib1Alloc;
342 typedef struct rarInfo
347 uint16_t msg3StartRb;
354 typedef struct rarAlloc
357 PdcchCfg rarPdcchCfg;
358 PdschCfg rarPdschCfg;
361 typedef struct dlAlloc
363 uint16_t cellId; /* Cell Id */
364 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
366 /* Allocation for broadcast messages */
367 uint8_t isBroadcastPres;
368 DlBrdcstAlloc brdcstAlloc;
370 /* Allocation for RAR message */
374 typedef struct ulSchInfo
376 uint16_t cellId; /* Cell Id */
377 SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
378 uint8_t dataType; /* Type of info being scheduled */
379 PrachSchInfo prachSchInfo; /* Prach scheduling info */
382 typedef struct rachIndInfo
386 SlotIndInfo timingInfo;
394 /* function pointers */
396 typedef int (*SchCellCfgCfmFunc) ARGS((
397 Pst *pst, /* Post Structure */
398 SchCellCfgCfm *schCellCfgCfm /* Cell Cfg Cfm */
401 typedef int (*SchCellCfgFunc) ARGS((
402 Pst *pst, /* Post Structure */
403 SchCellCfg *schCellCfg /* Cell Cfg */
406 typedef int (*SchMacDlAllocFunc) ARGS((
407 Pst *pst, /* Post Structure */
408 DlAlloc *dlAlloc /* dl allocation Info */
411 typedef int (*SchMacUlSchInfoFunc) ARGS((
412 Pst *pst, /* Post Structure */
413 UlSchInfo *ulSchInfo /* UL Sch Info */
416 /* function declarations */
417 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
418 int packSchMacDlAlloc(Pst *pst, DlAlloc *dlAlloc);
419 int packSchMacUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
420 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
421 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
423 EXTERN int MacProcDlAlloc(Pst *pst, DlAlloc *dlAlloc);
424 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg *schCellCfg);
425 EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm *schCellCfgCfm);
426 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
427 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
428 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
429 EXTERN int MacProcUlSchInfo(Pst *pst, UlSchInfo *ulSchInfo);
430 typedef int (*MacSchRachIndFunc)(Pst *pst, RachIndInfo *rachInd);
431 int packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
432 int macSchRachInd(Pst *pst, RachIndInfo *rachInd);
434 /**********************************************************************
436 **********************************************************************/