[Epic-ID: ODUHIGH-488][Task-ID: ODUHIGH-491] WG8 Alignment [UL Scheduling Information]
[o-du/l2.git] / src / cm / mac_sch_interface.h
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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  *******************************************************************************/
18
19 /* events */
20 #define EVENT_SCH_GEN_CFG            1
21 #define EVENT_SCH_CELL_CFG           2
22 #define EVENT_SCH_CELL_CFG_CFM       3
23 #define EVENT_DL_SCH_INFO            4 
24 #define EVENT_UL_SCH_INFO            5 
25 #define EVENT_RACH_IND_TO_SCH        6
26 #define EVENT_CRC_IND_TO_SCH         7
27 #define EVENT_DL_RLC_BO_INFO_TO_SCH  8
28 #define EVENT_ADD_UE_CONFIG_REQ_TO_SCH   9
29 #define EVENT_UE_CONFIG_RSP_TO_MAC   10
30 #define EVENT_SLOT_IND_TO_SCH        11
31 #define EVENT_SHORT_BSR              12
32 #define EVENT_UCI_IND_TO_SCH         13
33 #define EVENT_MODIFY_UE_CONFIG_REQ_TO_SCH 14
34 #define EVENT_UE_RECONFIG_RSP_TO_MAC 15
35 #define EVENT_UE_DELETE_REQ_TO_SCH   16
36 #define EVENT_UE_DELETE_RSP_TO_MAC   17
37 #define EVENT_CELL_DELETE_REQ_TO_SCH 18
38 #define EVENT_CELL_DELETE_RSP_TO_MAC 19
39 #define EVENT_LONG_BSR               20
40 #define EVENT_SLICE_CFG_REQ_TO_SCH   21
41 #define EVENT_SLICE_CFG_RSP_TO_MAC   22
42 #define EVENT_SLICE_RECFG_REQ_TO_SCH 23
43 #define EVENT_SLICE_RECFG_RSP_TO_MAC 24
44 #define EVENT_RACH_RESOURCE_REQUEST_TO_SCH  25
45 #define EVENT_RACH_RESOURCE_RESPONSE_TO_MAC 26
46 #define EVENT_RACH_RESOURCE_RELEASE_TO_SCH  27
47 #define EVENT_PAGING_IND_TO_SCH      28
48 #define EVENT_DL_PAGING_ALLOC        29
49 #define EVENT_DL_REL_HQ_PROC         30 
50 #define EVENT_DL_HARQ_IND_TO_SCH     31
51 /*macros*/
52 #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
53 #define SCH_SSB_MASK_SIZE   1
54
55 #define MAX_NUM_PRG     1 /* max value should be later 275 */
56 #define MAX_DIG_BF_INTERFACES 0 /* max value should be later 255 */
57 #define MAX_CODEWORDS  1  /* max should be 2 */
58 #define SCH_HARQ_PROC_ID 1 /* harq proc id */
59 #define SCH_ALLOC_TYPE_1 1 /*sch res alloc type */
60
61 /* Datatype in UL SCH Info */
62 #define SCH_DATATYPE_PUSCH 1
63 #define SCH_DATATYPE_PUSCH_UCI 2
64 #define SCH_DATATYPE_UCI 4
65 #define SCH_DATATYPE_SRS 8
66 #define SCH_DATATYPE_PRACH 16
67
68 #define MAX_NUMBER_OF_CRC_IND_BITS 1
69 #define MAX_NUMBER_OF_UCI_IND_BITS 1
70 #define MAX_SR_BITS_IN_BYTES       1
71 #define MAX_HARQ_BITS_IN_BYTES     1
72 #define MAX_NUM_LOGICAL_CHANNEL_GROUPS 8
73 #define MAX_NUM_SR_CFG_PER_CELL_GRP 8   /* Max number of scheduling request config per cell group */
74 #define MAX_NUM_TAGS 4                  /* Max number of timing advance groups */
75 #define MAX_NUM_BWP  4                  /* Max number of BWP per serving cell */
76 #define MAX_NUM_CRSET  3                /* Max number of control resource set in add/modify/release list */
77 #define MAX_NUM_SEARCH_SPC  10          /* Max number of search space in add/modify/release list */
78 #define FREQ_DOM_RSRC_SIZE  6           /* i.e. 6 bytes because Size of frequency domain resource is 45 bits */
79 #define MONITORING_SYMB_WITHIN_SLOT_SIZE 2  /* i.e. 2 bytes because size of monitoring symbols within slot is 14 bits */
80 #define MAX_NUM_DL_ALLOC 16             /* Max number of pdsch time domain downlink allocation */
81 #define MAX_NUM_UL_ALLOC 16             /* Max number of pusch time domain uplink allocation */
82
83 /* PUCCH Configuration Macro */
84 #define MAX_NUM_PUCCH_RESRC 128
85 #define MAX_NUM_PUCCH_RESRC_SET 4
86 #define MAX_NUM_PUCCH_PER_RESRC_SET 32
87 #define MAX_NUM_SPATIAL_RELATIONS 8
88 #define MAX_NUM_PUCCH_P0_PER_SET 8
89 #define MAX_NUM_PATH_LOSS_REF_RS 4
90 #define MAX_NUM_DL_DATA_TO_UL_ACK 15
91 #define QPSK_MODULATION 2
92
93 #define RAR_PAYLOAD_SIZE 10             /* As per spec 38.321, sections 6.1.5 and 6.2.3, RAR PDU is 8 bytes long and 2 bytes of padding */
94 #define TX_PAYLOAD_HDR_LEN 32           /* Intel L1 requires adding a 32 byte header to transmitted payload */
95 #define UL_TX_BUFFER_SIZE 5
96
97 #define MAX_NUM_CONFIG_SLOTS 160  /*Max number of slots as per the numerology*/
98 #define MAX_NUM_K0_IDX 16 /* Max number of pdsch time domain downlink allocation */
99 #define MAX_NUM_K1_IDX 8  /* As per spec 38.213 section 9.2.3 Max number of PDSCH-to-HARQ resource indication */
100 #define MIN_NUM_K1_IDX 4  /* Min K1 values */
101 #define MAX_NUM_K2_IDX 16 /* PUSCH time domain UL resource allocation list */
102 #define DEFAULT_K0_VALUE 0 /* As per 38.331, PDSCH-TimeDomainResourceAllocation field descriptions */
103 /* As per 38.331, PUSCH-TimeDomainResourceAllocationList field descriptions */
104 #define DEFAULT_K2_VALUE_FOR_SCS15  1 
105 #define DEFAULT_K2_VALUE_FOR_SCS30  1 
106 #define DEFAULT_K2_VALUE_FOR_SCS60  2
107 #define DEFAULT_K2_VALUE_FOR_SCS120 3 
108
109 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr, numOfSlot)          \
110 {                                                          \
111    if ((crntTime.slot + incr) > (numOfSlot - 1))           \
112    {                                                       \
113       toFill.sfn = (crntTime.sfn + 1);                     \
114    }                                                       \
115    else                                                    \
116    {                                                       \
117       toFill.sfn = crntTime.sfn;                           \
118    }                                                       \
119    toFill.slot = (crntTime.slot + incr) % numOfSlot;       \
120    if (toFill.sfn >= MAX_SFN)                              \
121    {                                                       \
122       toFill.sfn%=MAX_SFN;                                 \
123    }                                                       \
124 }
125
126 typedef enum
127 {
128    PRB_RSRC,
129    DRB_RSRC,
130    RRC_CONNECTED_USERS_RSRC
131 }SchResourceType;
132
133 typedef enum
134 {
135    SLICE_FOUND,
136    SLICE_NOT_FOUND
137 }RspCause;
138
139 typedef enum
140 {
141    NO_TRANSMISSION,
142    NEW_TRANSMISSION,
143    REPEATITION 
144 }PduTxOccsaion;
145
146 typedef enum
147 {
148    UNSPECIFIED_CAUSE,
149    INVALID_PARAM_VALUE,
150    RESOURCE_UNAVAILABLE,
151    SYSTEM_ERROR
152 }SchFailureCause;
153
154 typedef enum
155 {
156    SR_PROHIBIT_MS1,
157    SR_PROHIBIT_MS2,
158    SR_PROHIBIT_MS4,
159    SR_PROHIBIT_MS8,
160    SR_PROHIBIT_MS16,
161    SR_PROHIBIT_MS32,
162    SR_PROHIBIT_MS64,
163    SR_PROHIBIT_MS128
164 }SchSrProhibitTimer;
165
166 typedef enum
167 {
168    NOT_APPLICABLE,
169    INVALID_CELLID,
170    INVALID_UEID
171 }ErrorCause;
172
173 typedef enum
174 {
175    SR_TRANS_MAX_N4,
176    SR_TRANS_MAX_N8,
177    SR_TRANS_MAX_N16,
178    SR_TRANS_MAX_N32,
179    SR_TRANS_MAX_N64,
180    SR_TRANS_MAX_SPARE3,
181    SR_TRANS_MAX_SPARE2,
182    SR_TRANS_MAX_SPARE1
183 }SchSrTransMax;
184
185 typedef enum
186 {
187    TIME_ALIGNMENT_TIMER_MS500,
188    TIME_ALIGNMENT_TIMER_MS750,
189    TIME_ALIGNMENT_TIMER_MS1280,
190    TIME_ALIGNMENT_TIMER_MS1920,
191    TIME_ALIGNMENT_TIMER_MS2560,
192    TIME_ALIGNMENT_TIMER_MS5120,
193    TIME_ALIGNMENT_TIMER_MS10240,
194    TIME_ALIGNMENT_TIMER_INFINITE
195 }SchTimeAlignmentTimer;
196
197 typedef enum
198 {
199    PHR_PERIODIC_TIMER_SF10,
200    PHR_PERIODIC_TIMER_SF20,
201    PHR_PERIODIC_TIMER_SF50,
202    PHR_PERIODIC_TIMER_SF100,
203    PHR_PERIODIC_TIMER_SF200,
204    PHR_PERIODIC_TIMER_SF500,
205    PHR_PERIODIC_TIMER_SF1000,
206    PHR_PERIODIC_TIMER_INFINITE
207 }SchPhrPeriodicTimer;
208
209 typedef enum
210 {
211    PHR_PROHIBIT_TIMER_SF0,
212    PHR_PROHIBIT_TIMER_SF10,
213    PHR_PROHIBIT_TIMER_SF20,
214    PHR_PROHIBIT_TIMER_SF50,
215    PHR_PROHIBIT_TIMER_SF100,
216    PHR_PROHIBIT_TIMER_SF200,
217    PHR_PROHIBIT_TIMER_SF500,
218    PHR_PROHIBIT_TIMER_SF1000
219 }SchPhrProhibitTimer;
220
221 typedef enum
222 {
223    PHR_TX_PWR_FACTOR_CHANGE_DB1,
224    PHR_TX_PWR_FACTOR_CHANGE_DB3,
225    PHR_TX_PWR_FACTOR_CHANGE_DB6,
226    PHR_TX_PWR_FACTOR_CHANGE_INFINITE
227 }SchPhrTxPwrFactorChange;
228
229 typedef enum
230 {
231    PHR_MODE_REAL,
232    PHR_MODE_VIRTUAL
233 }SchPhrModeOtherCG;
234
235 typedef enum
236 {
237    HARQ_ACK_CODEBOOK_SEMISTATIC,
238    HARQ_ACK_CODEBOOK_DYNAMIC
239 }SchPdschHarqAckCodebook;
240
241 typedef enum
242 {
243    NUM_HARQ_PROC_FOR_PDSCH_N2,
244    NUM_HARQ_PROC_FOR_PDSCH_N4,
245    NUM_HARQ_PROC_FOR_PDSCH_N6,
246    NUM_HARQ_PROC_FOR_PDSCH_N10,
247    NUM_HARQ_PROC_FOR_PDSCH_N16
248 }SchNumHarqProcForPdsch;
249
250 typedef enum
251 {
252    MAX_CODE_BLOCK_GROUP_PER_TB_N2,
253    MAX_CODE_BLOCK_GROUP_PER_TB_N4,
254    MAX_CODE_BLOCK_GROUP_PER_TB_N6,
255    MAX_CODE_BLOCK_GROUP_PER_TB_N8
256 }SchMaxCodeBlkGrpPerTB;
257
258 typedef enum
259 {
260    PDSCH_X_OVERHEAD_XOH_6,
261    PDSCH_X_OVERHEAD_XOH_12,
262    PDSCH_X_OVERHEAD_XOH_18
263 }SchPdschXOverhead;
264
265 typedef enum
266 {
267    DMRS_ADDITIONAL_POS0,
268    DMRS_ADDITIONAL_POS1,
269    DMRS_ADDITIONAL_POS3
270 }SchDmrsAdditionPosition;
271
272 typedef enum
273 {
274    RESOURCE_ALLOCTION_TYPE_0,
275    RESOURCE_ALLOCTION_TYPE_1,
276    RESOURCE_ALLOCTION_DYN_SWITCH
277 }SchResourceAllocType;
278
279 typedef enum
280 {
281    TIME_DOMAIN_RSRC_ALLOC_MAPPING_TYPE_A,
282    TIME_DOMAIN_RSRC_ALLOC_MAPPING_TYPE_B
283 }SchTimeDomRsrcAllocMappingType;
284
285 typedef enum
286 {
287    ENABLED_TRANSFORM_PRECODER,
288    DISABLED_TRANSFORM_PRECODER
289 }SchTransformPrecoder;
290
291 typedef enum
292 {
293    INTERLEAVED_CCE_REG_MAPPING = 1,
294    NONINTERLEAVED_CCE_REG_MAPPING
295 }SchREGMappingType;
296
297 typedef enum
298 {
299    SLOT_PERIODICITY_AND_OFFSET_SL_1 = 1,
300    SLOT_PERIODICITY_AND_OFFSET_SL_2,
301    SLOT_PERIODICITY_AND_OFFSET_SL_4,
302    SLOT_PERIODICITY_AND_OFFSET_SL_5,
303    SLOT_PERIODICITY_AND_OFFSET_SL_8,
304    SLOT_PERIODICITY_AND_OFFSET_SL_10,
305    SLOT_PERIODICITY_AND_OFFSET_SL_16,
306    SLOT_PERIODICITY_AND_OFFSET_SL_20,
307    SLOT_PERIODICITY_AND_OFFSET_SL_40,
308    SLOT_PERIODICITY_AND_OFFSET_SL_80,
309    SLOT_PERIODICITY_AND_OFFSET_SL_160,
310    SLOT_PERIODICITY_AND_OFFSET_SL_320,
311    SLOT_PERIODICITY_AND_OFFSET_SL_640,
312    SLOT_PERIODICITY_AND_OFFSET_SL_1280,
313    SLOT_PERIODICITY_AND_OFFSET_SL_2560
314 }SchMSlotPeriodAndOffset;
315
316 typedef enum
317 {
318    SAME_AS_REG_BUNDLE,
319    ALL_CONTIGUOUS_RB
320 }SchPrecoderGranul;
321
322 typedef enum
323 {
324    SEARCH_SPACE_TYPE_COMMON = 1,
325    SEARCH_SPACE_TYPE_UE_SPECIFIC
326 }SchSearchSpaceType;
327
328 typedef enum
329 {
330    SCH_QOS_NON_DYNAMIC = 1,
331    SCH_QOS_DYNAMIC
332 }SchQosType;
333
334 typedef enum
335 {
336    AGGREGATION_LEVEL_N0,
337    AGGREGATION_LEVEL_N1,
338    AGGREGATION_LEVEL_N2,
339    AGGREGATION_LEVEL_N3,
340    AGGREGATION_LEVEL_N4,
341    AGGREGATION_LEVEL_N5,
342    AGGREGATION_LEVEL_N6,
343    AGGREGATION_LEVEL_N8
344 }SchAggrLevel;
345
346 typedef enum
347 {
348    RBG_SIZE_CONFIG_1,
349    RBG_SIZE_CONFIG_2
350 }SchRBGSize;
351
352 typedef enum
353 {
354    CODE_WORDS_SCHED_BY_DCI_N1,
355    CODE_WORDS_SCHED_BY_DCI_N2
356 }SchCodeWordsSchedByDci;
357
358 typedef enum
359 {
360    STATIC_BUNDLING_TYPE = 1,
361    DYNAMIC_BUNDLING_TYPE
362 }SchBundlingType;
363
364 typedef enum
365 {
366    SCH_SET1_SIZE_N4,
367    SCH_SET1_SIZE_WIDEBAND,
368    SCH_SET1_SIZE_N2_WIDEBAND,
369    SCH_SET1_SIZE_N4_WIDEBAND
370 }SchBundlingSizeSet1;
371
372 typedef enum
373 {
374    SCH_SET2_SIZE_N4,
375    SCH_SET2_SIZE_WIDEBAND
376 }SchBundlingSizeSet2;
377
378 typedef enum
379 {
380    DUPLEX_MODE_FDD,
381    DUPLEX_MODE_TDD
382 }SchDuplexMode;
383
384 typedef enum
385 {
386    SSB_PRDCTY_MS5,
387    SSB_PRDCTY_MS10,
388    SSB_PRDCTY_MS20,
389    SSB_PRDCTY_MS40,
390    SSB_PRDCTY_MS80,
391    SSB_PRDCTY_MS160
392 }SchSSBPeriod;
393
394 typedef enum
395 {
396    RSP_OK,
397    RSP_NOK
398 }SchMacRsp;
399
400 typedef enum
401 {
402    SHORT_BSR,
403    LONG_BSR,
404    SHORT_TRUNCATED_BSR,
405    LONG_TRUNCATED_BSR
406 }BsrType;
407
408 typedef enum
409 {
410    FORMAT0_0,
411    FORMAT0_1,
412    FORMAT1_0,
413    FORMAT1_1
414 }FormatType;
415
416 typedef enum
417 {
418    SCH_MCS_TABLE_QAM_64,
419    SCH_MCS_TABLE_QAM_256,
420    SCH_MCS_TABLE_QAM_64_LOW_SE
421 }SchMcsTable;
422
423 typedef enum
424 {
425    NONE,
426    PDCCH_PDU,
427    PDSCH_PDU,
428    BOTH
429 }DlPduType;
430
431 typedef enum
432 {
433    DATA_TRANSMISSION_ALLOWED,
434    STOP_DATA_TRANSMISSION,
435    RESTART_DATA_TRANSMISSION
436 }SchDataTransmission;
437
438 /*structures*/
439 typedef struct timeDomainAlloc
440 {
441    uint16_t startSymb;
442    uint16_t numSymb;
443 }TimeDomainAlloc;
444
445 typedef struct resAllocType0 
446 {
447    uint8_t rbBitmap[36];
448 }ResAllocType0;
449
450 typedef struct resAllocType1 
451 {
452    uint16_t startPrb;
453    uint16_t numPrb;
454 }ResAllocType1;
455
456 typedef struct
457 {
458    uint32_t    ssbPbchPwr;       /* SSB block power */
459    uint8_t     scsCommon;           /* subcarrier spacing for common [0-3]*/
460    uint8_t     ssbOffsetPointA;  /* SSB sub carrier offset from point A */
461    SchSSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
462    uint8_t     ssbSubcOffset;    /* Subcarrier Offset(Kssb) */
463    uint32_t    nSSBMask[SCH_SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
464    
465    /*Ref:Spec 38.331 "ssb-PositionsInBurst", Value 0 in Bitmap => corresponding SS/PBCH block is not transmitted
466     *value 1 => corresponding SS/PBCH block is transmitted*/
467    uint8_t     totNumSsb;       /*S = Total Number of Actual SSB transmitted*/
468 }SchSsbCfg;
469
470 typedef struct bwpCfg
471 {
472    uint8_t         subcarrierSpacing;
473    uint8_t         cyclicPrefix;
474    ResAllocType1   freqAlloc;   
475 }BwpCfg;
476
477 typedef struct prg
478 {
479    uint16_t pmIdx;
480    uint16_t beamIdx[MAX_DIG_BF_INTERFACES];
481 } Prg;
482
483 typedef struct beamformingInfo
484 {
485    uint16_t numPrgs;
486    uint16_t prgSize;
487    uint8_t  digBfInterfaces;
488    Prg  prg[MAX_NUM_PRG];
489 } BeamformingInfo;
490
491 /* SIB1 PDSCH structures */
492
493 typedef struct codewordinfo
494 {
495    uint16_t targetCodeRate;
496    uint8_t  qamModOrder;
497    uint8_t  mcsIndex;
498    uint8_t  mcsTable;
499    uint8_t  rvIndex;
500    uint32_t tbSize;
501 } CodewordInfo;
502
503 typedef struct dmrsInfo
504 {
505    uint16_t dlDmrsSymbPos;
506    uint8_t  dmrsConfigType;
507    uint16_t dlDmrsScramblingId;
508    uint8_t  scid;
509    uint8_t  numDmrsCdmGrpsNoData;
510    uint16_t dmrsPorts;
511    uint8_t mappingType;
512    uint8_t nrOfDmrsSymbols;
513    uint8_t dmrsAddPos;
514 } DmrsInfo;
515
516 typedef struct pdschFreqAlloc
517 {
518    uint8_t  resourceAllocType;
519    /* since we are using type-1, rbBitmap excluded */
520    ResAllocType1 freqAlloc;
521    uint8_t  vrbPrbMapping;
522 } PdschFreqAlloc;
523
524 typedef struct pdschTimeAlloc
525 {
526    uint8_t         rowIndex;
527    TimeDomainAlloc timeAlloc;
528 } PdschTimeAlloc;
529
530 typedef struct txPowerPdschInfo
531 {
532    uint8_t powerControlOffset;
533    uint8_t powerControlOffsetSS;
534 } TxPowerPdschInfo;
535
536 typedef struct pdschCfg
537 {
538    uint16_t         pduBitmap;
539    uint16_t         rnti;
540    uint16_t         pduIndex;
541    uint8_t          numCodewords;
542    CodewordInfo     codeword[MAX_CODEWORDS];
543    uint16_t         dataScramblingId;
544    uint8_t          numLayers;
545    uint8_t          transmissionScheme;
546    uint8_t          refPoint;
547    DmrsInfo         dmrs;
548    PdschFreqAlloc   pdschFreqAlloc;
549    PdschTimeAlloc   pdschTimeAlloc;
550    BeamformingInfo  beamPdschInfo;
551    TxPowerPdschInfo txPdschPower;
552 } PdschCfg;
553 /* SIB1 PDSCH structures end */
554
555 /* SIB1 interface structure */
556
557 typedef struct coresetCfg
558 {
559    uint8_t coreSetSize;
560    uint8_t startSymbolIndex;
561    uint8_t durationSymbols;
562    uint8_t freqDomainResource[6];
563    uint8_t cceRegMappingType;
564    uint8_t regBundleSize;
565    uint8_t interleaverSize;
566    uint8_t coreSetType;
567    uint16_t shiftIndex;
568    uint8_t precoderGranularity;
569    uint8_t cceIndex;
570    uint8_t aggregationLevel;
571 } CoresetCfg;
572
573 typedef struct txPowerPdcchInfo
574 {
575    uint8_t powerValue;
576    uint8_t powerControlOffsetSS;
577 } TxPowerPdcchInfo;
578
579 typedef struct dlDCI
580 {
581    uint16_t rnti;
582    uint16_t scramblingId;
583    uint16_t scramblingRnti;
584    uint8_t cceIndex;
585    uint8_t aggregLevel;
586    BeamformingInfo beamPdcchInfo;
587    TxPowerPdcchInfo txPdcchPower;
588    PdschCfg     *pdschCfg;
589 } DlDCI;
590
591 typedef struct pdcchCfg
592 {
593    /* coreset-0 configuration */
594    CoresetCfg coresetCfg;
595
596    uint16_t numDlDci;
597    DlDCI    dci; /* as of now its only one DCI, later it will be numDlCi */
598 } PdcchCfg;
599 /* end of SIB1 PDCCH structures */
600
601 typedef struct pageCfg
602 {
603    uint8_t  numPO;                    /*Derived from Ns*/
604    bool     poPresent;                /*FirstPDCCH-MonitoringPO is present or not*/
605    uint16_t pagingOcc[MAX_PO_PER_PF]; /*FirstPDCCH-Monitoring Paging Occasion*/
606 }PageCfg;
607
608 typedef struct
609 {
610    /* parameters recieved from DU-APP */
611    uint16_t sib1PduLen;
612    uint16_t sib1RepetitionPeriod;
613    uint8_t  coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
614    uint8_t  searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
615    uint16_t sib1Mcs;
616
617    /* parameters derived in scheduler */
618    uint8_t   n0;
619    BwpCfg    bwp;
620    PdcchCfg  sib1PdcchCfg;
621    PdschCfg  sib1PdschCfg;
622    PageCfg   pageCfg;         /*Config of Paging*/
623 }SchSib1Cfg;
624
625 typedef struct schRachCfg
626 {
627    uint8_t      prachCfgIdx;       /* PRACH config idx */
628    uint8_t      prachSubcSpacing;  /* Subcarrier spacing of RACH */
629    uint16_t     msg1FreqStart;     /* Msg1-FrequencyStart */
630    uint8_t      msg1Fdm;           /* PRACH FDM (1,2,4,8) */
631    uint8_t      rootSeqLen;        /* root sequence length */
632    uint16_t     rootSeqIdx;        /* Root sequence index */
633    uint8_t      numRootSeq;        /* Number of root sequences required for FD */
634    uint16_t     k1;                /* Frequency Offset for each FD */
635    uint8_t      totalNumRaPreamble; /* Total number of RA preambles */
636    uint8_t      ssbPerRach;        /* SSB per RACH occassion */
637    uint8_t      numCbPreamblePerSsb; /* Number of CB preamble per SSB */
638    uint8_t      prachMultCarrBand; /* Presence of Multiple carriers in Band */
639    uint8_t      raContResTmr;      /* RA Contention Resoultion Timer */
640    uint8_t      rsrpThreshSsb;     /* RSRP Threshold SSB */
641    uint8_t      raRspWindow;       /* RA Response Window */
642    uint8_t      maxMsg3Tx;         /* MAximum num of msg3 tx*/
643 }SchRachCfg;
644
645 typedef struct schBwpParams
646 {
647    ResAllocType1   freqAlloc;
648    uint8_t         scs;
649    uint8_t         cyclicPrefix;
650 }SchBwpParams;
651
652 typedef struct schCandidatesInfo
653 {
654    uint8_t aggLevel1;
655    uint8_t aggLevel2;
656    uint8_t aggLevel4;
657    uint8_t aggLevel8;
658    uint8_t aggLevel16;
659 }SchCandidatesInfo;
660
661 typedef struct schSearchSpaceCfg
662 {
663    uint8_t  searchSpaceId;
664    uint8_t  coresetId;
665    uint8_t  freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
666    uint16_t monitoringSlot;
667    uint16_t duration;
668    uint16_t monitoringSymbol;
669    SchCandidatesInfo candidate;
670 }SchSearchSpaceCfg;
671
672 typedef struct schPdcchCfgCmn
673 {
674    SchSearchSpaceCfg commonSearchSpace;
675    uint8_t raSearchSpaceId;
676 }SchPdcchCfgCmn;
677
678 typedef struct schPdschCfgCmnTimeDomRsrcAlloc
679 {
680    uint8_t k0;
681    uint8_t mappingType;
682    uint8_t startSymbol;
683    uint8_t lengthSymbol;
684 }SchPdschCfgCmnTimeDomRsrcAlloc;
685
686 typedef struct schPdschCfgCmn
687 {
688    uint8_t   numTimeDomAlloc;
689    SchPdschCfgCmnTimeDomRsrcAlloc timeDomRsrcAllocList[MAX_NUM_DL_ALLOC];
690 }SchPdschCfgCmn;
691
692 typedef struct schPucchCfgCmn
693 {
694    uint8_t pucchResourceCommon;
695    uint8_t pucchGroupHopping;
696 }SchPucchCfgCmn;
697
698 /* PUSCH Time Domain Resource Allocation */
699 typedef struct schPuschTimeDomRsrcAlloc
700 {
701    uint8_t   k2;
702    SchTimeDomRsrcAllocMappingType   mappingType;
703    uint8_t   startSymbol;
704    uint8_t   symbolLength;
705 }SchPuschTimeDomRsrcAlloc;
706
707 typedef struct schPuschCfgCmn
708 {
709    uint8_t                    numTimeDomRsrcAlloc;
710    SchPuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
711 }SchPuschCfgCmn;
712
713 typedef struct schK1TimingInfo
714 {
715    uint8_t numK1;
716    uint8_t k1Indexes[MAX_NUM_K1_IDX];
717 }SchK1TimingInfo;
718
719 typedef struct schK0TimingInfo
720 {
721    uint8_t k0Index;
722    SchK1TimingInfo k1TimingInfo;
723 }SchK0TimingInfo;
724
725 typedef struct schK0K1TimingInfo
726 {
727    uint8_t numK0;
728    SchK0TimingInfo k0Indexes[MAX_NUM_K0_IDX];
729 }SchK0K1TimingInfo;
730
731 typedef struct schK0K1TimingInfoTbl
732 {
733    uint16_t tblSize;
734    SchK0K1TimingInfo k0k1TimingInfo[MAX_NUM_CONFIG_SLOTS];
735 }SchK0K1TimingInfoTbl;
736
737 typedef struct schBwpDlCfg
738 {
739    SchBwpParams   bwp;
740    SchPdcchCfgCmn pdcchCommon;
741    SchPdschCfgCmn pdschCommon;
742    SchK0K1TimingInfoTbl k0K1InfoTbl;
743 }SchBwpDlCfg;
744
745 typedef struct schK2TimingInfo
746 {
747    uint8_t numK2; 
748    uint8_t k2Indexes[MAX_NUM_K2_IDX]; 
749 }SchK2TimingInfo;
750
751 typedef struct schK2TimingInfoTbl
752 {
753    uint16_t tblSize; 
754    SchK2TimingInfo k2TimingInfo[MAX_NUM_CONFIG_SLOTS]; 
755 }SchK2TimingInfoTbl;
756
757 typedef struct schBwpUlCfg
758 {
759    SchBwpParams   bwp;
760    SchPucchCfgCmn pucchCommon;
761    SchPuschCfgCmn puschCommon;
762    SchK2TimingInfoTbl msg3K2InfoTbl;
763    SchK2TimingInfoTbl k2InfoTbl;
764 }SchBwpUlCfg;
765
766 typedef struct schPlmnInfoList
767 {
768    Plmn           plmn;
769    uint8_t        numSliceSupport; /* Total slice supporting */
770    Snssai         **snssai;         /* List of supporting snssai*/
771 }SchPlmnInfoList;
772
773 typedef struct schHqCfgParam
774 {
775    uint8_t maxDlDataHqTx;
776    uint8_t maxMsg4HqTx;
777    uint8_t maxUlDataHqTx;
778 }SchHqCfg;
779
780 #ifdef NR_DRX
781 /* The following list of structures is taken from the DRX-Config section of specification 33.331. */
782
783 typedef struct schDrxOnDurationTimer
784 {
785    bool     onDurationTimerValInMs;
786    union
787    {
788       uint8_t  subMilliSeconds;
789       uint16_t milliSeconds;
790    }onDurationtimerValue;
791 }SchDrxOnDurationTimer;
792
793 typedef struct schDrxLongCycleStartOffset
794 {
795    uint16_t drxLongCycleStartOffsetChoice;
796    uint16_t drxLongCycleStartOffsetVal;
797 }SchDrxLongCycleStartOffset;
798
799 typedef struct schShortDrx
800 {
801    uint16_t   drxShortCycle;
802    uint8_t    drxShortCycleTimer;
803 }SchShortDrx;
804
805 typedef struct schDrxCfg
806 {
807    SchDrxOnDurationTimer       drxOnDurationTimer;
808    uint16_t                    drxInactivityTimer;
809    uint8_t                     drxHarqRttTimerDl;
810    uint8_t                     drxHarqRttTimerUl;
811    uint16_t                    drxRetransmissionTimerDl;
812    uint16_t                    drxRetransmissionTimerUl;
813    SchDrxLongCycleStartOffset  drxLongCycleStartOffset;
814    bool                        shortDrxPres;
815    SchShortDrx                 shortDrx;
816    uint8_t                     drxSlotOffset;
817 }SchDrxCfg;
818 #endif
819
820 typedef struct schCellCfg
821 {
822    uint16_t       cellId;           /* Cell Id */
823    uint16_t       phyCellId;        /* Physical cell id */
824    uint8_t        numerology;       /* Supported numerology */
825    SchDuplexMode  dupMode;          /* Duplex type: TDD/FDD */
826    uint8_t        bandwidth;        /* Supported B/W */
827    uint32_t       dlFreq;           /* DL Frequency */
828    uint32_t       ulFreq;           /* UL Frequency */
829    SchSsbCfg      ssbSchCfg;        /* SSB config */
830    SchSib1Cfg     sib1SchCfg;       /* SIB1 config */
831    SchRachCfg     schRachCfg;       /* PRACH config */
832    SchBwpDlCfg    schInitialDlBwp;  /* Initial DL BWP */
833    SchBwpUlCfg    schInitialUlBwp;  /* Initial UL BWP */
834    SchPlmnInfoList plmnInfoList;     /* Consits of PlmnId and Snssai list */
835    SchHqCfg       schHqCfg;
836 #ifdef NR_TDD
837    TDDCfg         tddCfg;           /* TDD Cfg */ 
838 #endif 
839 }SchCellCfg;
840
841 typedef struct schCellCfgCfm
842 {
843    uint16_t         cellId;     /* Cell Id */
844    SchMacRsp        rsp;   
845    SchFailureCause  cause;
846 }SchCellCfgCfm;
847
848 typedef struct ssbInfo
849 {
850    uint8_t         ssbIdx;          /* SSB Index */
851    TimeDomainAlloc tdAlloc; /* Time domain allocation */
852    ResAllocType1   fdAlloc; /* Freq domain allocation */
853 }SsbInfo;
854
855 typedef struct sib1AllocInfo
856 {
857    BwpCfg bwp;
858    PdcchCfg sib1PdcchCfg;
859    PdschCfg sib1PdschCfg;
860 } Sib1AllocInfo;
861
862 typedef struct prachSchInfo
863 {
864    uint8_t  numPrachOcas;   /* Num Prach Ocassions */
865    uint8_t  prachFormat;    /* PRACH Format */
866    uint8_t  numRa;          /* Freq domain ocassion */
867    uint8_t  prachStartSymb; /* Freq domain ocassion */
868 }SchPrachInfo;
869
870 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
871 typedef struct dlBrdcstAlloc
872 {
873    /* Ssb transmission is determined as follows:
874     * 0 : No tranamission
875     * 1 : SSB Transmission
876     * 2 : SSB Repetition */
877    uint8_t ssbTrans;
878    uint8_t ssbIdxSupported;
879    SsbInfo ssbInfo[MAX_SSB_IDX];
880    /* Sib1 transmission is determined as follows:
881     * 0 : No tranamission
882     * 1 : SIB1 Transmission
883     * 2 : SIB1 Repetition */
884    uint8_t sib1Trans;
885    Sib1AllocInfo sib1Alloc;
886 }DlBrdcstAlloc;
887
888 typedef struct msg3UlGrant
889 {
890    uint8_t         freqHopFlag;
891    uint16_t        bwpSize;
892    ResAllocType1   msg3FreqAlloc;
893    uint8_t         k2Index;
894    uint8_t         mcs;
895    uint8_t         tpc;
896    uint8_t         csiReq;
897 }Msg3UlGrant;
898
899 typedef struct rarInfo
900 {
901    uint16_t        raRnti;
902    uint8_t         RAPID;
903    uint16_t        ta;
904    Msg3UlGrant     ulGrant;
905    uint16_t        tcrnti;
906    uint8_t         rarPdu[RAR_PAYLOAD_SIZE];
907    uint8_t         rarPduLen;
908 }RarInfo;
909
910 typedef struct rarAlloc
911 {
912    DlPduType  pduPres;
913    uint8_t    pdschSlot;
914    RarInfo rarInfo;
915    BwpCfg  bwp;
916    PdcchCfg rarPdcchCfg;
917    PdschCfg rarPdschCfg;
918 }RarAlloc;
919
920 typedef struct dlMsgInfo
921 {
922    uint16_t crnti;
923    uint8_t  ndi;
924    uint8_t  harqProcNum;
925    uint8_t  dlAssignIdx;
926    uint8_t  pucchTpc;
927    uint8_t  pucchResInd;
928    uint8_t  harqFeedbackInd;
929    uint8_t  dciFormatId;
930    bool     isMsg4Pdu;
931    uint16_t  dlMsgPduLen;
932    uint8_t  *dlMsgPdu;
933 }DlMsgInfo;
934
935 typedef struct lcSchInfo
936 {
937    uint8_t   lcId;
938    uint32_t  schBytes; /* Number of scheduled bytes */
939 }LcSchInfo;
940
941 typedef struct dlMsgSchedInfo
942 {
943    bool       isRetx;
944    uint8_t    numLc;
945    LcSchInfo  lcSchInfo[MAX_NUM_LC]; /* Scheduled LC info */
946    BwpCfg     bwp;
947    PdcchCfg   dlMsgPdcchCfg;
948    PdschCfg   dlMsgPdschCfg;
949    DlPduType  pduPres;
950    uint8_t    pdschSlot;
951    DlMsgInfo  dlMsgInfo;
952 }DlMsgSchInfo;
953
954 typedef struct dlMsgAlloc
955 {
956    uint16_t     crnti;
957    uint8_t      numSchedInfo;
958    DlMsgSchInfo dlMsgSchedInfo[2];
959 }DlMsgAlloc;
960
961 typedef struct schSlotValue
962 {
963    SlotTimingInfo currentTime;
964    SlotTimingInfo broadcastTime;
965    SlotTimingInfo rarTime;
966    SlotTimingInfo dlMsgTime;
967    SlotTimingInfo ulDciTime;
968 }SchSlotValue;
969
970 typedef struct format0_0
971 {
972    uint8_t         resourceAllocType;
973    /* since we are using type-1, hence rbBitmap excluded */
974    ResAllocType1   freqAlloc;
975    TimeDomainAlloc timeAlloc;
976    uint16_t        rowIndex;
977    uint8_t         mcs;
978    uint8_t         harqProcId;   /* HARQ Process ID */
979    bool            puschHopFlag;
980    bool            freqHopFlag;
981    uint8_t         ndi;    /* NDI */
982    uint8_t         rv;     /* Redundancy Version */
983    uint8_t         tpcCmd;
984    bool            sUlCfgd;
985 }Format0_0;
986
987 typedef struct format0_1
988 {
989 /* TBD */
990
991 }Format0_1;
992
993 typedef struct format1_0
994 {
995 /* TBD */
996
997 }Format1_0;
998
999 typedef struct format1_1
1000 {
1001 /* TBD */
1002 }Format1_1;
1003
1004 typedef struct dciInfo
1005 {
1006    uint16_t      cellId;   
1007    uint16_t      crnti;          /* CRNI */
1008    SlotTimingInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
1009    BwpCfg        bwpCfg;         /* BWP Cfg */
1010    CoresetCfg    coresetCfg;     /* Coreset1 Cfg */
1011    FormatType    formatType;     /* DCI Format */
1012    union
1013    {
1014       Format0_0  format0_0;      /* Format 0_0 */
1015       Format0_1  format0_1;      /* Format 0_1 */
1016       Format1_0  format1_0;      /* Format 1_0 */
1017       Format1_1  format1_1;      /* Format 1_1 */
1018    }format;
1019    DlDCI    dciInfo;
1020 }DciInfo;
1021
1022
1023 typedef struct dlSchedInfo
1024 {
1025    uint16_t cellId;  /* Cell Id */
1026    SchSlotValue schSlotValue;
1027
1028    /* Allocation for broadcast messages */
1029    bool isBroadcastPres;
1030    DlBrdcstAlloc brdcstAlloc;
1031
1032    /* Allocation for RAR message */
1033    RarAlloc *rarAlloc[MAX_NUM_UE];
1034
1035    /* UL grant in response to BSR */
1036    DciInfo    *ulGrant;
1037
1038    /* Allocation from dedicated DL msg */
1039    DlMsgAlloc *dlMsgAlloc[MAX_NUM_UE];
1040
1041 }DlSchedInfo;
1042
1043 typedef struct dlPageAlloc
1044 {
1045    uint16_t       cellId;
1046    SlotTimingInfo dlPageTime;
1047    uint8_t        ssbIdx;
1048    bool           shortMsgInd;
1049    uint8_t        shortMsg;
1050    BwpCfg         bwp;
1051    PdcchCfg       pagePdcchCfg;
1052    PdschCfg       pagePdschCfg;
1053    uint16_t       dlPagePduLen;
1054    uint8_t        *dlPagePdu;
1055 }DlPageAlloc;
1056
1057 typedef struct tbInfo
1058 {
1059    uint8_t      mcs;       /* MCS */
1060    uint8_t      ndi;       /* NDI */
1061    uint8_t      rv;        /* Redundancy Version */
1062    uint16_t     tbSize;    /* TB Size */
1063    uint8_t      qamOrder;  /* Modulation Order */
1064    SchMcsTable  mcsTable;  /* MCS Table */
1065 }TbInfo;
1066
1067 typedef struct freqDomainAlloc
1068 {
1069    uint8_t          resAllocType; /* Resource allocation type */
1070    union
1071    {
1072       ResAllocType0    type0;
1073       ResAllocType1    type1;
1074    }resAlloc;
1075 }FreqDomainAlloc;
1076
1077 typedef struct schPuschInfo
1078 {
1079    uint8_t          harqProcId;   /* HARQ Process ID */
1080    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
1081    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
1082    TbInfo           tbInfo;       /* TB info */
1083 #ifdef INTEL_FAPI    
1084    uint8_t          dmrsMappingType;
1085    uint8_t          nrOfDmrsSymbols;
1086    uint8_t          dmrsAddPos;
1087 #endif
1088 }SchPuschInfo;
1089
1090 typedef struct harqInfo
1091 {
1092    uint16_t    harqAckBitLength;
1093    uint8_t     betaOffsetHarqAck;
1094 }HarqInfo;
1095
1096 typedef struct csiInfo
1097 {
1098    uint16_t csiBits;
1099    uint8_t  betaOffsetCsi;
1100 }CsiInfo;
1101
1102 typedef struct harqAckInfo
1103 {
1104    uint16_t    harqBitLength;
1105 }HarqFdbkInfo;
1106
1107 typedef struct csiPartInfo
1108 {
1109    uint16_t csiBits;
1110 }csiFdbkInfo;
1111
1112 typedef struct schPucchFormatCfg
1113 {
1114    uint8_t interSlotFreqHop;
1115    uint8_t addDmrs;
1116    uint8_t maxCodeRate;
1117    uint8_t numSlots;
1118    bool    pi2BPSK;
1119    bool    harqAckCSI;
1120 }SchPucchFormatCfg;
1121
1122 typedef struct schPucchInfo
1123 {
1124    FreqDomainAlloc  fdAlloc;      
1125    TimeDomainAlloc  tdAlloc;      
1126    uint8_t          srFlag;
1127    HarqFdbkInfo     harqInfo;
1128    csiFdbkInfo      csiInfo;
1129    BeamformingInfo  beamPucchInfo;
1130    uint8_t          pucchFormat;
1131    uint8_t          intraFreqHop;
1132    uint16_t         secondPrbHop;
1133    uint8_t          initialCyclicShift;
1134    uint8_t          occLen;
1135    uint8_t          occIdx;
1136    uint8_t          timeDomOCC;
1137    uint8_t          addDmrs;
1138    bool             pi2BPSK;
1139 }SchPucchInfo;
1140
1141 typedef struct schPuschUci
1142 {
1143    uint8_t          harqProcId;   /* HARQ Process ID */
1144    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
1145    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
1146    TbInfo           tbInfo;       /* TB information */
1147    HarqInfo         harqInfo;    /* Harq Information */
1148    CsiInfo          csiInfo;    /* Csi information*/
1149 }SchPuschUci;
1150
1151 typedef struct ulSchedInfo
1152 {
1153    uint16_t         cellId;         /* Cell Id */
1154    uint16_t         crnti;          /* CRNI */
1155    SlotTimingInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
1156    uint8_t          dataType;       /* Type of info being scheduled */
1157    SchPrachInfo     prachSchInfo;   /* Prach scheduling info */
1158    SchPuschInfo     schPuschInfo;   /* Pusch scheduling info */
1159    SchPuschUci      schPuschUci;    /* Pusch Uci */
1160    SchPucchInfo     schPucchInfo;   /* Pucch and Uci scheduling info */
1161 }UlSchedInfo;
1162
1163 typedef struct rachIndInfo
1164 {
1165    uint16_t    cellId;
1166    uint16_t    crnti;
1167    SlotTimingInfo timingInfo;
1168    uint8_t     slotIdx;
1169    uint8_t     symbolIdx;
1170    uint8_t     freqIdx;
1171    uint8_t     preambleIdx;
1172    uint16_t    timingAdv;
1173 }RachIndInfo;
1174
1175
1176 typedef struct crcIndInfo
1177 {
1178    uint16_t    cellId;
1179    uint16_t    crnti;
1180    SlotTimingInfo timingInfo;
1181    uint16_t    numCrcInd;
1182    uint8_t     crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
1183 }CrcIndInfo;
1184
1185 typedef struct boInfo
1186 {
1187    uint8_t   lcId;
1188    uint32_t  dataVolume;
1189 }BOInfo;
1190
1191 typedef struct dlRlcBOInfo
1192 {
1193    uint16_t    cellId;
1194    uint16_t    crnti;
1195    uint8_t     lcId;
1196    uint32_t    dataVolume;
1197 }DlRlcBoInfo;
1198
1199 /* Info of Scheduling Request to Add/Modify */
1200 typedef struct schSchedReqInfo
1201 {
1202    uint8_t              schedReqId;
1203    SchSrProhibitTimer   srProhibitTmr;
1204    SchSrTransMax        srTransMax;
1205 }SchSchedReqInfo;
1206
1207 /* Scheduling Request Configuration */
1208 typedef struct schSchedReqCfg
1209 {
1210    uint8_t          addModListCount;
1211    SchSchedReqInfo  addModList[MAX_NUM_SR_CFG_PER_CELL_GRP];   /* List of Scheduling req to be added/modified */
1212    uint8_t          relListCount;
1213    uint8_t          relList[MAX_NUM_SR_CFG_PER_CELL_GRP];      /* list of scheduling request Id to be deleted */
1214 }SchSchedReqCfg;
1215
1216 /* Info of Tag to Add/Modify */
1217 typedef struct schTagInfo
1218 {
1219    uint8_t       tagId;
1220    SchTimeAlignmentTimer  timeAlignmentTmr;
1221 }SchTagInfo;
1222
1223 /* Timing Advance Group Configuration */
1224 typedef struct schTagCfg
1225 {
1226    uint8_t      addModListCount;
1227    SchTagInfo   addModList[MAX_NUM_TAGS];    /* List of Tag to Add/Modify */
1228    uint8_t      relListCount;
1229    uint8_t      relList[MAX_NUM_TAGS];       /* list of Tag Id to release */
1230 }SchTagCfg;
1231
1232 /* Configuration for Power headroom reporting */
1233 typedef struct schPhrCfg
1234 {
1235    SchPhrPeriodicTimer       periodicTmr;
1236    SchPhrProhibitTimer       prohibitTmr;
1237    SchPhrTxPwrFactorChange   txpowerFactorChange;
1238    bool                      multiplePhr;
1239    bool                      dummy;
1240    bool                      type2OtherCell;
1241    SchPhrModeOtherCG         modeOtherCG;
1242 }SchPhrCfg;
1243
1244 /* MAC cell Group configuration */
1245 typedef struct schMacCellGrpCfg
1246 {
1247    SchSchedReqCfg   schedReqCfg;
1248    SchTagCfg        tagCfg;
1249    SchPhrCfg        phrCfg;             /* To be used only if phrCfgSetupPres is true */      
1250 #ifdef NR_DRX
1251    bool             drxCfgPresent;
1252    SchDrxCfg        drxCfg;          /* Drx configuration */
1253 #endif
1254 }SchMacCellGrpCfg;
1255
1256 /* Physical Cell Group Configuration */
1257 typedef struct schPhyCellGrpCfg
1258 {
1259    SchPdschHarqAckCodebook    pdschHarqAckCodebook;
1260    int8_t     pNrFr1;
1261 }SchPhyCellGrpCfg;
1262
1263 /* Control resource set info */
1264 typedef struct schControlRsrcSet
1265 {
1266    uint8_t             cRSetId;                /* Control resource set id */
1267    uint8_t             freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
1268    uint8_t             duration;
1269    SchREGMappingType   cceRegMappingType;
1270    SchPrecoderGranul   precoderGranularity;
1271    uint16_t            dmrsScramblingId;
1272 }SchControlRsrcSet;
1273
1274 /* Search Space info */
1275 typedef struct schSearchSpace
1276 {
1277    uint8_t                  searchSpaceId;
1278    uint8_t                  cRSetId;
1279    SchMSlotPeriodAndOffset  mSlotPeriodicityAndOffset;
1280    uint8_t                  mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE];
1281    SchAggrLevel             numCandidatesAggLevel1;      /* Number of candidates for aggregation level 1 */
1282    SchAggrLevel             numCandidatesAggLevel2;      /* Number of candidates for aggregation level 2 */
1283    SchAggrLevel             numCandidatesAggLevel4;      /* Number of candidates for aggregation level 4 */
1284    SchAggrLevel             numCandidatesAggLevel8;      /* Number of candidates for aggregation level 8 */
1285    SchAggrLevel             numCandidatesAggLevel16;     /* Number of candidates for aggregation level 16 */
1286    SchSearchSpaceType       searchSpaceType;
1287    uint8_t                  ueSpecificDciFormat;
1288 }SchSearchSpace;
1289
1290 /* PDCCH cofniguration */
1291 typedef struct schPdcchConfig
1292 {
1293    uint8_t           numCRsetToAddMod;
1294    SchControlRsrcSet  cRSetToAddModList[MAX_NUM_CRSET];           /* List of control resource set to add/modify */
1295    uint8_t           numCRsetToRel;
1296    uint8_t           cRSetToRelList[MAX_NUM_CRSET];              /* List of control resource set to release */
1297    uint8_t           numSearchSpcToAddMod;
1298    SchSearchSpace    searchSpcToAddModList[MAX_NUM_SEARCH_SPC];  /* List of search space to add/modify */
1299    uint8_t           numSearchSpcToRel;
1300    uint8_t           searchSpcToRelList[MAX_NUM_SEARCH_SPC];     /* List of search space to release */
1301 }SchPdcchConfig;
1302
1303 /* PDSCH time domain resource allocation */
1304 typedef struct schPdschTimeDomRsrcAlloc
1305 {
1306    uint8_t    *k0;
1307    SchTimeDomRsrcAllocMappingType    mappingType;
1308    uint8_t    startSymbol;
1309    uint8_t    symbolLength;
1310 }SchPdschTimeDomRsrcAlloc;
1311
1312
1313 typedef struct schPdschBundling
1314 {
1315    struct schStaticBundling
1316    {
1317      SchBundlingSizeSet2 size;
1318    }SchStaticBundling;
1319    struct schDynamicBundling
1320    {
1321      SchBundlingSizeSet1 sizeSet1;
1322      SchBundlingSizeSet2 sizeSet2;
1323    }SchDynamicBundling;
1324 }SchPdschBundling;
1325
1326 /* DMRS downlink configuration */
1327 typedef struct schDmrsDlCfg
1328 {
1329    SchDmrsAdditionPosition   addPos;       /* DMRS additional position */
1330 }SchDmrsDlCfg;
1331
1332 /* PDSCH Configuration */
1333 typedef struct schPdschConfig
1334 {
1335    SchDmrsDlCfg               dmrsDlCfgForPdschMapTypeA;
1336    SchResourceAllocType       resourceAllocType;
1337    uint8_t                    numTimeDomRsrcAlloc;
1338    SchPdschTimeDomRsrcAlloc   timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */
1339    SchRBGSize                 rbgSize;
1340    SchCodeWordsSchedByDci     numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
1341    SchBundlingType            bundlingType;
1342    SchPdschBundling           bundlingInfo;
1343 }SchPdschConfig;
1344
1345 /* Initial Downlink BWP */
1346 typedef struct schInitalDlBwp
1347 {
1348    bool             pdcchCfgPres;
1349    SchPdcchConfig   pdcchCfg;
1350    bool             pdschCfgPres;
1351    SchPdschConfig   pdschCfg;
1352    bool             k0K1TblPrsnt;
1353    SchK0K1TimingInfoTbl k0K1InfoTbl;
1354 }SchInitalDlBwp;
1355
1356 /* BWP Downlink common */
1357 typedef struct schBwpDlCommon
1358 {
1359 }SchBwpDlCommon;
1360
1361 /* Downlink BWP information */
1362 typedef struct schDlBwpInfo
1363 {
1364    uint8_t          bwpId;
1365 }SchDlBwpInfo;
1366
1367 /* PDCCH Serving Cell configuration */
1368 typedef struct schPdschServCellCfg
1369 {
1370    uint8_t                  *maxMimoLayers;           
1371    SchNumHarqProcForPdsch   numHarqProcForPdsch;
1372    SchMaxCodeBlkGrpPerTB    *maxCodeBlkGrpPerTb;
1373    bool                     *codeBlkGrpFlushInd;
1374    SchPdschXOverhead        *xOverhead;
1375 }SchPdschServCellCfg;
1376
1377 /* PUCCH Configuration */
1378 typedef struct schPucchResrcSetInfo
1379 {
1380    uint8_t resrcSetId;
1381    uint8_t resrcListCount;
1382    uint8_t resrcList[MAX_NUM_PUCCH_PER_RESRC_SET];
1383    uint8_t maxPayLoadSize;
1384 }SchPucchResrcSetInfo;
1385
1386 typedef struct schPucchResrcSetCfg
1387 {
1388    uint8_t resrcSetToAddModListCount;
1389    SchPucchResrcSetInfo resrcSetToAddModList[MAX_NUM_PUCCH_RESRC_SET];
1390    uint8_t resrcSetToRelListCount;
1391    uint8_t resrcSetToRelList[MAX_NUM_PUCCH_RESRC];
1392 }SchPucchResrcSetCfg;
1393
1394 typedef struct schPucchFormat0
1395 {
1396    uint8_t initialCyclicShift;
1397    uint8_t numSymbols;
1398    uint8_t startSymbolIdx;
1399 }SchPucchFormat0;
1400
1401 typedef struct schPucchFormat1
1402 {
1403    uint8_t initialCyclicShift;
1404    uint8_t numSymbols;
1405    uint8_t startSymbolIdx;
1406    uint8_t timeDomOCC;
1407 }SchPucchFormat1;
1408
1409 typedef struct schPucchFormat2_3
1410 {
1411    uint8_t numPrbs;
1412    uint8_t numSymbols;
1413    uint8_t startSymbolIdx;
1414 }SchPucchFormat2_3;
1415
1416 typedef struct schPucchFormat4
1417 {
1418    uint8_t numSymbols;
1419    uint8_t occLen;
1420    uint8_t occIdx;
1421    uint8_t startSymbolIdx;
1422 }SchPucchFormat4;
1423
1424 typedef struct schPucchResrcInfo
1425 {
1426    uint8_t  resrcId;
1427    uint16_t startPrb;
1428    uint8_t  intraFreqHop;
1429    uint16_t secondPrbHop;
1430    uint8_t  pucchFormat;
1431    union{
1432       SchPucchFormat0   *format0; 
1433       SchPucchFormat1   *format1;
1434       SchPucchFormat2_3 *format2;
1435       SchPucchFormat2_3 *format3;
1436       SchPucchFormat4   *format4;
1437    }SchPucchFormat;
1438 }SchPucchResrcInfo;
1439
1440 typedef struct schPucchResrcCfg
1441 {
1442    uint8_t resrcToAddModListCount;
1443    SchPucchResrcInfo resrcToAddModList[MAX_NUM_PUCCH_RESRC];
1444    uint8_t resrcToRelListCount;
1445    uint8_t resrcToRelList[MAX_NUM_PUCCH_RESRC];
1446 }SchPucchResrcCfg;
1447
1448
1449 typedef struct schSchedReqResrcInfo
1450 {
1451    uint8_t resrcId;
1452    uint8_t requestId;
1453    uint8_t periodicity;
1454    uint16_t offset;
1455    uint8_t resrc;
1456 }SchSchedReqResrcInfo;
1457
1458 typedef struct schPucchSchedReqCfg
1459 {
1460    uint8_t           schedAddModListCount;
1461    SchSchedReqResrcInfo schedAddModList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1462    uint8_t           schedRelListCount;
1463    uint8_t           schedRelList[MAX_NUM_SR_CFG_PER_CELL_GRP];
1464 }SchPucchSchedReqCfg;
1465
1466 typedef struct schSpatialRelationInfo
1467 {
1468    uint8_t spatialRelationId;
1469    uint8_t servCellIdx;
1470    uint8_t pathLossRefRSId;
1471    uint8_t p0PucchId;
1472    uint8_t closeLoopIdx;
1473 }SchSpatialRelationInfo;
1474
1475 typedef struct schPucchSpatialCfg
1476 {
1477    uint8_t spatialAddModListCount;
1478    SchSpatialRelationInfo spatialAddModList[MAX_NUM_SPATIAL_RELATIONS];
1479    uint8_t spatialRelListCount;
1480    uint8_t spatialRelList[MAX_NUM_SPATIAL_RELATIONS];
1481 }SchPucchSpatialCfg;
1482
1483 typedef struct schP0PucchCfg
1484 {
1485    uint8_t p0PucchId;
1486    int     p0PucchVal;
1487 }SchP0PucchCfg;
1488
1489 typedef struct schPathLossRefRSCfg
1490 {
1491    uint8_t pathLossRefRSId;
1492 }SchPathLossRefRSCfg;
1493
1494 typedef struct schPucchMultiCsiCfg
1495 {
1496    uint8_t  multiCsiResrcListCount;
1497    uint8_t  multiCsiResrcList[MAX_NUM_PUCCH_RESRC-1];
1498 }SchPucchMultiCsiCfg;
1499
1500 typedef struct schPucchDlDataToUlAck
1501 {
1502    uint8_t  dlDataToUlAckListCount;
1503    uint8_t  dlDataToUlAckList[MAX_NUM_DL_DATA_TO_UL_ACK];
1504 }SchPucchDlDataToUlAck;
1505
1506 typedef struct schPucchPowerControl
1507 {
1508    int deltaF_Format0;
1509    int deltaF_Format1;
1510    int deltaF_Format2;
1511    int deltaF_Format3;
1512    int deltaF_Format4;
1513    uint8_t p0SetCount;
1514    SchP0PucchCfg p0Set[MAX_NUM_PUCCH_P0_PER_SET];
1515    uint8_t pathLossRefRSListCount;
1516    SchPathLossRefRSCfg pathLossRefRSList[MAX_NUM_PATH_LOSS_REF_RS];
1517 }SchPucchPowerControl;
1518
1519 typedef struct schPucchCfg
1520 {
1521    SchPucchResrcSetCfg   *resrcSet;
1522    SchPucchResrcCfg      *resrc;
1523    SchPucchFormatCfg     *format1; 
1524    SchPucchFormatCfg     *format2; 
1525    SchPucchFormatCfg     *format3; 
1526    SchPucchFormatCfg     *format4;
1527    SchPucchSchedReqCfg   *schedReq;
1528    SchPucchMultiCsiCfg   *multiCsiCfg;
1529    SchPucchSpatialCfg    *spatialInfo;
1530    SchPucchDlDataToUlAck *dlDataToUlAck;
1531    SchPucchPowerControl  *powerControl;
1532 }SchPucchCfg;
1533
1534 /* Transform precoding disabled */
1535 typedef struct schTransPrecodDisabled
1536 {
1537    uint16_t   scramblingId0;
1538 }SchTransPrecodDisabled;
1539
1540 /* DMRS Uplink configuration */
1541 typedef struct SchDmrsUlCfg
1542 {
1543    SchDmrsAdditionPosition    addPos;               /* DMRS additional position */
1544    SchTransPrecodDisabled     transPrecodDisabled;  /* Transform precoding disabled */
1545 }SchDmrsUlCfg;
1546
1547 /* PUSCH Configuration */
1548 typedef struct schPuschCfg
1549 {
1550    uint8_t                    dataScramblingId;
1551    SchDmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
1552    SchResourceAllocType       resourceAllocType;
1553    uint8_t                    numTimeDomRsrcAlloc;
1554    SchPuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
1555    SchTransformPrecoder       transformPrecoder;
1556 }SchPuschCfg;
1557
1558 /* Initial Uplink BWP */
1559 typedef struct schInitialUlBwp
1560 {
1561    bool          pucchCfgPres;
1562    SchPucchCfg   pucchCfg;
1563    bool          puschCfgPres;
1564    SchPuschCfg   puschCfg;
1565    bool          k2TblPrsnt;
1566    SchK2TimingInfoTbl k2InfoTbl;
1567 }SchInitialUlBwp;
1568
1569 /* Uplink BWP information */
1570 typedef struct schUlBwpInfo
1571 {
1572    uint8_t        bwpId;
1573 }SchUlBwpInfo;
1574
1575 /* Serving cell configuration */
1576 typedef struct schServCellRecfgInfo
1577 {
1578    SchInitalDlBwp        initDlBwp;
1579    uint8_t               numDlBwpToAddOrMod;
1580    SchDlBwpInfo          dlBwpToAddOrModList[MAX_NUM_BWP];
1581    uint8_t               numDlBwpToRel;
1582    SchDlBwpInfo          dlBwpToRelList[MAX_NUM_BWP];
1583    uint8_t               firstActvDlBwpId;
1584    uint8_t               defaultDlBwpId;
1585    uint8_t               *bwpInactivityTmr;
1586    SchPdschServCellCfg   pdschServCellCfg;
1587    SchInitialUlBwp       initUlBwp;
1588    uint8_t               numUlBwpToAddOrMod;
1589    SchUlBwpInfo          ulBwpToAddOrModList[MAX_NUM_BWP];
1590    uint8_t               numUlBwpToRel;
1591    SchUlBwpInfo          ulBwpToRelList[MAX_NUM_BWP];
1592    uint8_t               firstActvUlBwpId;
1593 }SchServCellRecfgInfo;
1594
1595 /* Serving cell configuration */
1596 typedef struct schServCellCfgInfo
1597 {
1598    SchInitalDlBwp        initDlBwp;
1599    uint8_t               numDlBwpToAdd;
1600    SchDlBwpInfo          dlBwpToAddList[MAX_NUM_BWP];
1601    uint8_t               firstActvDlBwpId;
1602    uint8_t               defaultDlBwpId;
1603    uint8_t               *bwpInactivityTmr;
1604    SchPdschServCellCfg   pdschServCellCfg;
1605    SchInitialUlBwp       initUlBwp;
1606    uint8_t               numUlBwpToAdd;
1607    SchUlBwpInfo          ulBwpToAddList[MAX_NUM_BWP];
1608    uint8_t               firstActvUlBwpId;
1609 }SchServCellCfgInfo;
1610
1611 typedef struct schNonDynFiveQi
1612 {
1613    uint16_t   fiveQi;
1614    uint8_t    priorLevel;
1615    uint16_t   avgWindow;
1616    uint16_t   maxDataBurstVol;
1617 }SchNonDynFiveQi;
1618
1619 typedef struct schDynFiveQi
1620 {
1621    uint8_t    priorLevel;
1622    uint16_t   packetDelayBudget;
1623    uint8_t    packetErrRateScalar;
1624    uint8_t    packetErrRateExp;
1625    uint16_t   fiveQi;
1626    uint8_t    delayCritical;
1627    uint16_t   avgWindow;
1628    uint16_t   maxDataBurstVol;
1629 }SchDynFiveQi;
1630
1631 typedef struct schNgRanAllocAndRetPri
1632 {
1633    uint8_t priorityLevel;
1634    uint8_t preEmptionCap;
1635    uint8_t preEmptionVul;
1636 }SchNgRanAllocAndRetPri;
1637
1638 typedef struct schGrbQosFlowInfo
1639 {
1640    uint32_t maxFlowBitRateDl;
1641    uint32_t maxFlowBitRateUl;
1642    uint32_t guarFlowBitRateDl;
1643    uint32_t guarFlowBitRateUl;
1644 }SchGrbQosFlowInfo;
1645
1646 /* DRB QoS */
1647 typedef struct schDrbQos
1648 {
1649    SchQosType  fiveQiType;   /* Dynamic or non-dynamic */ 
1650    union
1651    {
1652       SchNonDynFiveQi   nonDyn5Qi;
1653       SchDynFiveQi      dyn5Qi;
1654    }u;
1655    SchNgRanAllocAndRetPri  ngRanRetPri;
1656    SchGrbQosFlowInfo       grbQosFlowInfo;
1657    uint16_t                pduSessionId;
1658    uint32_t                ulPduSessAggMaxBitRate;   /* UL PDU Session Aggregate max bit rate */
1659 }SchDrbQosInfo;
1660
1661 /* Special cell configuration */
1662 typedef struct schSpCellCfg
1663 {
1664    uint8_t           servCellIdx;
1665    SchServCellCfgInfo   servCellCfg;
1666 }SchSpCellCfg;
1667
1668 /* Special cell Reconfiguration */
1669 typedef struct schSpCellRecfg
1670 {
1671    uint8_t           servCellIdx;
1672    SchServCellRecfgInfo   servCellRecfg;
1673 }SchSpCellRecfg;
1674
1675 /* Uplink logical channel configuration */
1676 typedef struct SchUlLcCfg
1677 {
1678    uint8_t priority;
1679    uint8_t lcGroup;
1680    uint8_t schReqId;
1681    uint8_t pbr;        // prioritisedBitRate
1682    uint8_t bsd;        // bucketSizeDuration
1683 }SchUlLcCfg;
1684
1685 /* Downlink logical channel configuration */
1686 typedef struct schDlLcCfg
1687 {
1688    uint8_t lcp;      // logical Channel Prioritization
1689 }SchDlLcCfg;
1690
1691 /* Logical Channel configuration */
1692 typedef struct schLcCfg
1693 {
1694    uint8_t        lcId;
1695    Snssai         *snssai;
1696    SchDrbQosInfo  *drbQos;
1697    SchDlLcCfg     dlLcCfg;
1698    SchUlLcCfg     ulLcCfg;
1699 }SchLcCfg;
1700
1701 /* Aggregate max bit rate */
1702 typedef struct schAmbrCfg
1703 {
1704    uint32_t   ulBr;   /* Ul BitRate */
1705 }SchAmbrCfg;
1706
1707 typedef struct schModulationInfo
1708 {
1709    uint8_t      modOrder;
1710    uint8_t      mcsIndex;
1711    SchMcsTable  mcsTable;
1712 }SchModulationInfo;
1713
1714 /* UE configuration */
1715 typedef struct schUeCfgReq
1716 {
1717    uint16_t        cellId;
1718    uint8_t         ueId;
1719    uint8_t         beamIdx; 
1720    uint16_t        crnti;
1721    bool macCellGrpCfgPres;
1722    SchMacCellGrpCfg   macCellGrpCfg;
1723    bool phyCellGrpCfgPres;
1724    SchPhyCellGrpCfg   phyCellGrpCfg;
1725    bool spCellCfgPres;
1726    SchSpCellCfg       spCellCfg;
1727    SchAmbrCfg         *ambrCfg;
1728    SchModulationInfo  dlModInfo;
1729    SchModulationInfo  ulModInfo;
1730    uint8_t            numLcsToAdd;
1731    SchLcCfg           schLcCfg[MAX_NUM_LC];
1732 }SchUeCfgReq;
1733
1734 /* UE Re-configuration */
1735 typedef struct schUeRecfgReq
1736 {
1737    uint16_t         cellId;
1738    uint8_t          ueId;
1739    uint8_t          beamIdx;
1740    uint16_t         crnti;
1741    bool             macCellGrpRecfgPres;
1742    SchMacCellGrpCfg macCellGrpRecfg;
1743    bool             phyCellGrpRecfgPres;
1744    SchPhyCellGrpCfg phyCellGrpRecfg;
1745    bool             spCellRecfgPres;
1746    SchSpCellRecfg   spCellRecfg;
1747    SchAmbrCfg       *ambrRecfg;
1748    SchModulationInfo  dlModInfo;
1749    SchModulationInfo  ulModInfo;
1750    uint8_t            numLcsToAdd;
1751    SchLcCfg           schLcCfgAdd[MAX_NUM_LC];
1752    uint8_t            numLcsToDel;
1753    uint8_t            lcIdToDel[MAX_NUM_LC];
1754    uint8_t            numLcsToMod;
1755    SchLcCfg           schLcCfgMod[MAX_NUM_LC];
1756    SchDataTransmission dataTransmissionInfo;
1757 #ifdef NR_DRX   
1758    bool     drxConfigIndicatorRelease;
1759 #endif
1760 }SchUeRecfgReq;
1761
1762 typedef struct schUeCfgRsp
1763 {
1764    uint16_t   cellId;
1765    uint8_t    beamIdx;
1766    uint16_t   ueId;
1767    uint16_t   crnti;
1768    SchMacRsp  rsp;
1769    SchFailureCause cause;
1770 }SchUeCfgRsp;
1771
1772 /*As per WG8, UE ReCFG and UECFG have same structure definition*/
1773 typedef struct schUeCfgRsp SchUeRecfgRsp;
1774
1775 typedef struct schRachRsrcReq
1776 {
1777    SlotTimingInfo slotInd;
1778    uint16_t       cellId;
1779    uint16_t       crnti;
1780    uint8_t        numSsb;
1781    uint8_t        ssbIdx[MAX_NUM_SSB];
1782 }SchRachRsrcReq;
1783
1784 typedef struct schCfraSsbResource
1785 {
1786    uint8_t  ssbIdx;
1787    uint8_t  raPreambleIdx;
1788 }SchCfraSsbResource;
1789
1790 typedef struct schCfraRsrc
1791 {
1792    uint8_t   numSsb;
1793    SchCfraSsbResource ssbResource[MAX_NUM_SSB];
1794 }SchCfraResource;
1795
1796 typedef struct schRachRsrcRsp
1797 {
1798    uint16_t   cellId;
1799    uint16_t   crnti;
1800    SchMacRsp  result;
1801    SchCfraResource  cfraResource;
1802 }SchRachRsrcRsp;
1803
1804 typedef struct schRachRsrcRel
1805 {
1806    SlotTimingInfo slotInd;
1807    uint16_t   cellId;
1808    uint16_t   crnti;
1809    SchCfraResource  cfraResource;
1810 }SchRachRsrcRel;
1811
1812 typedef struct schUeDelete
1813 {
1814    uint16_t   cellId;
1815    uint16_t   crnti;
1816 }SchUeDelete;
1817
1818 typedef struct schUeDeleteRsp
1819 {
1820    uint16_t   cellId;
1821    uint16_t   crnti;
1822    SchMacRsp  rsp;
1823    ErrorCause cause;
1824 }SchUeDeleteRsp;
1825
1826 typedef struct schCellDeleteReq 
1827 {
1828    uint16_t   cellId;
1829 }SchCellDeleteReq;
1830
1831
1832 typedef struct schCellDeleteRsp
1833 {
1834    uint16_t        cellId;
1835    SchMacRsp       rsp;
1836    SchFailureCause cause;
1837 }SchCellDeleteRsp;
1838
1839 typedef struct dataVolInfo
1840 {
1841    uint8_t  lcgId;
1842    uint32_t dataVol;
1843 }DataVolInfo;
1844
1845 typedef struct ulBufferStatusRptInd
1846 {
1847    uint16_t    cellId;
1848    uint16_t    crnti;
1849    BsrType     bsrType;
1850    uint8_t     numLcg;
1851    DataVolInfo dataVolInfo[MAX_NUM_LOGICAL_CHANNEL_GROUPS];
1852 }UlBufferStatusRptInd;
1853
1854 typedef struct srUciIndInfo
1855 {
1856    uint16_t    cellId;
1857    uint16_t    crnti;
1858    SlotTimingInfo slotInd;
1859    uint8_t     numSrBits;
1860    uint8_t     srPayload[MAX_SR_BITS_IN_BYTES];
1861 }SrUciIndInfo;
1862
1863 typedef struct dlHarqInd
1864 {
1865    uint16_t    cellId;
1866    uint16_t    crnti;
1867    SlotTimingInfo slotInd;
1868    uint8_t     numHarq;
1869    uint8_t     harqPayload[MAX_HARQ_BITS_IN_BYTES];
1870 }DlHarqInd;
1871
1872 typedef struct schRrmPolicyRatio
1873 {
1874    uint8_t maxRatio;
1875    uint8_t minRatio;
1876    uint8_t dedicatedRatio;
1877 }SchRrmPolicyRatio;
1878
1879 typedef struct schRrmPolicyOfSlice
1880 {
1881    Snssai  snssai;
1882    SchRrmPolicyRatio rrmPolicyRatioInfo;
1883 }SchRrmPolicyOfSlice;
1884
1885 typedef struct schSliceCfgReq
1886 {
1887    uint8_t  numOfConfiguredSlice;
1888    SchRrmPolicyOfSlice **listOfSlices;
1889 }SchSliceCfgReq;
1890
1891 typedef struct sliceRsp
1892 {
1893    Snssai     snssai;
1894    SchMacRsp  rsp;
1895    RspCause   cause;
1896 }SliceRsp;
1897
1898 typedef struct schSliceCfgRsp
1899 {
1900    uint8_t    numSliceCfgRsp;
1901    SliceRsp   **listOfSliceCfgRsp;
1902 }SchSliceCfgRsp;
1903
1904 /*As per ORAN-WG8, Slice Cfg and Recfg are same structures*/
1905 typedef struct schSliceCfgReq SchSliceRecfgReq;
1906 typedef struct schSliceCfgRsp SchSliceRecfgRsp;
1907
1908 typedef struct schPageInd
1909 {
1910    uint16_t  cellId;
1911    uint16_t  pf;
1912    uint8_t   i_s;
1913    uint16_t  pduLen;
1914    uint8_t  *pagePdu;
1915 }SchPageInd;
1916
1917 typedef struct schUeHqInfo
1918 {
1919    uint16_t  crnti;
1920    uint8_t   hqProcId;
1921 }SchUeHqInfo;
1922
1923 typedef struct schRlsHqInfo
1924 {
1925    uint16_t     cellId;
1926    uint8_t      numUes;
1927    SchUeHqInfo  *ueHqInfo;
1928 }SchRlsHqInfo;
1929
1930 /* function pointers */
1931 typedef uint8_t (*SchCellCfgCfmFunc)    ARGS((
1932          Pst            *pst,           /* Post Structure */                         
1933          SchCellCfgCfm  *schCellCfgCfm  /* Cell Cfg Cfm */
1934          ));
1935
1936 typedef uint8_t (*SchCellCfgFunc)    ARGS((
1937          Pst         *pst,           /* Post Structure */                         
1938          SchCellCfg  *schCellCfg     /* Cell Cfg  */
1939          ));
1940
1941 typedef uint8_t (*SchMacDlAllocFunc)     ARGS((                     
1942          Pst            *pst,          /* Post Structure */                         
1943          DlSchedInfo    *dlSchedInfo   /* dl allocation Info */                      
1944          ));
1945
1946 typedef uint8_t (*SchMacDlPageAllocFunc)     ARGS(( 
1947          Pst            *pst,          /* Post Structure */
1948          DlPageAlloc *dlPageAlloc      /* dl Page allocation Info */
1949          ));
1950
1951 typedef uint8_t (*SchMacUlSchInfoFunc)     ARGS((                     
1952          Pst         *pst,           /* Post Structure */                         
1953          UlSchedInfo *ulSchedInfo    /* UL Alloc Sch  Info */                      
1954          ));
1955
1956 typedef uint8_t (*MacSchRachIndFunc) ARGS((
1957          Pst         *pst,         /* Post structure */
1958          RachIndInfo *rachInd));    /* Rach Indication Info */
1959
1960 typedef uint8_t (*MacSchCrcIndFunc) ARGS(( 
1961          Pst         *pst,         /* Post structure */
1962          CrcIndInfo  *crcInd));     /* CRC Info */
1963
1964 typedef uint8_t (*MacSchDlRlcBoInfoFunc) ARGS((
1965          Pst         *pst,         /* Post structure */
1966          DlRlcBoInfo *dlBoInfo));   /* DL BO Info */
1967
1968 typedef uint8_t (*MacSchAddUeConfigReqFunc) ARGS((
1969          Pst         *pst,           /* Post structure */
1970          SchUeCfgReq    *ueCfgToSch));   /* Scheduler UE Cfg */
1971
1972 typedef uint8_t (*SchUeCfgRspFunc) ARGS((
1973          Pst         *pst,           /* Post structure */
1974          SchUeCfgRsp *cfgRsp));       /* Scheduler UE Cfg response */
1975
1976 typedef uint8_t (*MacSchSlotIndFunc) ARGS((
1977          Pst         *pst,          /* Post structure */
1978          SlotTimingInfo *slotInd));    /* Slot Info */
1979
1980 typedef uint8_t (*MacSchBsrFunc)       ARGS((
1981    Pst                  *pst,
1982    UlBufferStatusRptInd *bsrInd
1983 ));
1984
1985 typedef uint8_t (*MacSchDlHarqIndFunc) ARGS((
1986          Pst         *pst,         /* Post structure */
1987          DlHarqInd  *dlHarqInd));  /* Dl HARQ IND Info */
1988
1989 typedef uint8_t (*MacSchSrUciIndFunc) ARGS(( 
1990          Pst         *pst,         /* Post structure */
1991          SrUciIndInfo  *uciInd));    /* UCI IND Info */
1992
1993 typedef uint8_t (*MacSchModUeConfigReqFunc) ARGS((
1994          Pst         *pst,           /* Post structure */
1995          SchUeRecfgReq    *ueRecfgToSch));   /* Scheduler UE Recfg */
1996
1997 typedef uint8_t (*SchUeRecfgRspFunc) ARGS((
1998          Pst         *pst,           /* Post structure */
1999          SchUeRecfgRsp *recfgRsp));       /* Scheduler UE Cfg response */
2000
2001 typedef uint8_t (*MacSchRachRsrcReqFunc) ARGS((
2002     Pst         *pst,                    /* Post structure */
2003     SchRachRsrcReq *schRachRsrcReq));    /* RACH resource request to SCH */
2004
2005 typedef uint8_t (*SchRachRsrcRspFunc) ARGS((
2006    Pst            *pst,                 /* Post structure */
2007    SchRachRsrcRsp *schRachRsrcRsp));    /* RACH resource request to MAC */
2008
2009 typedef uint8_t (*MacSchRachRsrcRelFunc) ARGS((
2010    Pst         *pst,                    /* Post structure */
2011    SchRachRsrcRel *schRachRsrcRel));    /* RACH resource release to SCH */
2012
2013 typedef uint8_t (*MacSchUeDeleteReqFunc) ARGS((
2014    Pst         *pst,           /* Post structure */
2015    SchUeDelete *schUeDel)); /*Scheduler UE Del*/
2016
2017 typedef uint8_t (*SchUeDeleteRspFunc) ARGS((
2018    Pst          *pst,           /* Post structure */
2019    SchUeDeleteRsp *delRsp));       /* Scheduler UE delete response */
2020
2021 typedef uint8_t (*MacSchCellDeleteReqFunc) ARGS((
2022    Pst         *pst,           /* Post structure */
2023    SchCellDeleteReq *schCellDelete)); /*Scheduler UE Del*/
2024
2025 typedef uint8_t (*SchCellDeleteRspFunc) ARGS((
2026    Pst          *pst,           /* Post structure */
2027    SchCellDeleteRsp *schCellDeleteRsp));       /* Scheduler UE delete response */
2028
2029 typedef uint8_t (*MacSchSliceCfgReqFunc) ARGS((
2030    Pst          *pst,           /* Post structure */
2031    SchSliceCfgReq *schSliceCfgReq));  /* Scheduler Slice Cfg Req */
2032
2033 typedef uint8_t (*SchSliceCfgRspFunc)    ARGS((
2034          Pst            *pst,            /* Post Structure */                         
2035          SchSliceCfgRsp  *schSliceCfgRsp /* Cell Cfg Cfm */
2036          ));
2037
2038 typedef uint8_t (*MacSchSliceRecfgReqFunc) ARGS((
2039    Pst          *pst,           /* Post structure */
2040    SchSliceRecfgReq *schSliceRecfgReq));  /* Scheduler Slice Recfg Req */
2041
2042 typedef uint8_t (*SchSliceRecfgRspFunc)    ARGS((
2043          Pst            *pst,            /* Post Structure */                         
2044          SchSliceRecfgRsp  *schSliceRecfgRsp /* Cell Recfg Cfm */
2045          ));
2046
2047 typedef uint8_t (*MacSchPagingIndFunc) ARGS((
2048    Pst         *pst,           /* Post structure */
2049    SchPageInd *schPagingInd)); /* Paging Indication */
2050
2051 typedef uint8_t (*SchMacDlReleaseHarqFunc) ARGS((
2052    Pst         *pst,           /* Post structure */
2053    SchRlsHqInfo *rlsHqInfo)); /* Release Harq proc */
2054
2055 /* function declarations */
2056 uint8_t packMacSchSlotInd(Pst *pst, SlotTimingInfo *slotInd);
2057 uint8_t packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo);
2058 uint8_t packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
2059 uint8_t packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
2060 uint8_t packSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
2061 uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
2062 uint8_t MacProcSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
2063 uint8_t MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
2064 uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
2065 uint8_t schActvInit(Ent entity, Inst instId, Region region, Reason reason);
2066 uint8_t MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
2067 uint8_t packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
2068 uint8_t MacSchRachInd(Pst *pst, RachIndInfo *rachInd);
2069 uint8_t packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
2070 uint8_t MacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
2071 uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo);
2072 uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo);
2073 uint8_t packMacSchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfgToSch);
2074 uint8_t MacSchAddUeConfigReq(Pst *pst, SchUeCfgReq *ueCfgToSch);
2075 uint8_t packSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
2076 uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
2077 uint8_t packSchUeRecfgRsp(Pst *pst, SchUeRecfgRsp *cfgRsp);
2078 uint8_t MacProcSchUeRecfgRsp(Pst *pst, SchUeRecfgRsp *reCfgRsp);
2079 uint8_t MacSchSlotInd ARGS((Pst * pst, SlotTimingInfo * slotInd));
2080 uint8_t packMacSchSlotInd(Pst * pst, SlotTimingInfo * slotInd);
2081 uint8_t unpackMacSchSlotInd(MacSchSlotIndFunc func, Pst *pst, Buffer  *mBuf);
2082 uint8_t packMacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd);
2083 uint8_t MacSchBsr(Pst *pst, UlBufferStatusRptInd *bsrInd);
2084 uint8_t packMacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd);
2085 uint8_t packMacSchDlHarqInd(Pst *pst, DlHarqInd *dlHarqInd);
2086 uint8_t MacSchDlHarqInd(Pst *pst, DlHarqInd *dlHarqInd);
2087 uint8_t MacSchSrUciInd(Pst *pst, SrUciIndInfo *uciInd);
2088 uint8_t packMacSchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfgToSch);
2089 uint8_t MacSchModUeConfigReq(Pst *pst, SchUeRecfgReq *ueRecfgToSch);
2090 uint8_t packSchUeReconfigRsp(Pst *pst, SchUeRecfgRsp *recfgRsp);
2091 uint8_t MacProcSchUeReconfigRsp(Pst *pst, SchUeRecfgRsp *recfgRsp);
2092 uint8_t packMacSchRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq);
2093 uint8_t MacSchRachRsrcReq(Pst *pst, SchRachRsrcReq *schRachRsrcReq);
2094 uint8_t packSchRachRsrcRsp(Pst *pst, SchRachRsrcRsp *schRachRsrcRsp);
2095 uint8_t MacProcSchRachRsrcRsp(Pst *pst, SchRachRsrcRsp *schRachRsrcRsp);
2096 uint8_t packMacSchRachRsrcRel(Pst *pst, SchRachRsrcRel *schRachRsrcRel);
2097 uint8_t MacSchRachRsrcRel(Pst *pst, SchRachRsrcRel *schRachRsrcRel);
2098 uint8_t packMacSchUeDeleteReq(Pst *pst,  SchUeDelete *schUeDel);
2099 uint8_t MacSchUeDeleteReq(Pst *pst, SchUeDelete  *ueDelete);
2100 uint8_t packSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp  *delRsp);
2101 uint8_t MacProcSchUeDeleteRsp(Pst *pst, SchUeDeleteRsp *schUeDelRsp);
2102 uint8_t packMacSchCellDeleteReq(Pst *pst,  SchCellDeleteReq *schCellDelete);
2103 uint8_t MacSchCellDeleteReq(Pst *pst, SchCellDeleteReq  *schCellDelete);
2104 uint8_t packSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp  *schCellDeleteRsp);
2105 uint8_t MacProcSchCellDeleteRsp(Pst *pst, SchCellDeleteRsp *schCellDeleteRsp);
2106 uint8_t packMacSchSliceCfgReq(Pst *pst, SchSliceCfgReq *cfgReq);
2107 uint8_t MacSchSliceCfgReq(Pst *pst, SchSliceCfgReq *schSliceCfgReq);
2108 uint8_t packSchSliceCfgRsp(Pst *pst, SchSliceCfgRsp *cfgRsp);
2109 uint8_t MacProcSchSliceCfgRsp(Pst *pst, SchSliceCfgRsp *cfgRsp);
2110 uint8_t packMacSchSliceRecfgReq(Pst *pst, SchSliceRecfgReq *recfgReq);
2111 uint8_t MacSchSliceRecfgReq(Pst *pst, SchSliceRecfgReq *schSliceRecfgReq);
2112 uint8_t packSchSliceRecfgRsp(Pst *pst, SchSliceRecfgRsp *schSliceRecfgRsp);
2113 uint8_t MacProcSchSliceRecfgRsp(Pst *pst, SchSliceRecfgRsp *sliceRecfgrsp);
2114 uint8_t packMacSchPagingInd(Pst *pst,  SchPageInd *pageInd);
2115 uint8_t MacSchPagingInd(Pst *pst,  SchPageInd *pageInd);
2116 uint8_t packSchMacDlPageAlloc(Pst *pst, DlPageAlloc *dlPageAlloc);
2117 uint8_t MacProcDlPageAlloc(Pst *pst, DlPageAlloc *dlPageAlloc);
2118 uint8_t packSchMacDlReleaseHarq(Pst *pst, SchRlsHqInfo *rlsHqInfo);
2119 uint8_t MacSchReleaseDlHarqProc(Pst *pst, SchRlsHqInfo *rlsHqInfo);
2120 /**********************************************************************
2121   End of file
2122  **********************************************************************/
2123