Merge "MAC Clean-up [Issue-ID: ODUHIGH-212]"
[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_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
27 #define EVENT_UE_CREATE_REQ_TO_SCH   8
28 #define EVENT_UE_CREATE_RSP_TO_MAC   9
29 #define EVENT_SLOT_IND_TO_SCH        10
30
31 /*macros*/
32 #define NO_SSB 0
33 #define SSB_TRANSMISSION 1
34 #define SSB_REPEAT 2
35 #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
36 #define SCH_SSB_MASK_SIZE   1
37
38 #define NO_SIB1 0
39 #define SIB1_TRANSMISSION 1
40 #define SIB1_REPITITION 2
41
42 #define MAX_NUM_PRG     1 /* max value should be later 275 */
43 #define MAX_DIG_BF_INTERFACES 0 /* max value should be later 255 */
44 #define MAX_CODEWORDS  1  /* max should be 2 */
45 #define SCH_HARQ_PROC_ID 1 /* harq proc id */
46 #define SCH_ALLOC_TYPE_1 1 /*sch res alloc type */
47
48 /* Datatype in UL SCH Info */
49 #define SCH_DATATYPE_PUSCH 1
50 #define SCH_DATATYPE_PUSCH_UCI 2
51 #define SCH_DATATYPE_UCI 4
52 #define SCH_DATATYPE_SRS 8
53 #define SCH_DATATYPE_PRACH 16
54
55 #define MAX_NUMBER_OF_CRC_IND_BITS 1
56 #define MAX_NUM_LOGICAL_CHANNELS   11
57 /* can we have a common numslot numscs between mac sch */
58 #define MAX_SLOTS 10
59 #define MAX_SFN   1024
60 #define MAX_NUM_SR_CFG_PER_CELL_GRP 8   /* Max number of scheduling request config per cell group */
61 #define MAX_NUM_TAGS 4                  /* Max number of timing advance groups */
62 #define MAX_NUM_BWP  4                  /* Max number of BWP per serving cell */
63 #define MAX_NUM_CRSET  3                /* Max number of control resource set in add/modify/release list */
64 #define MAX_NUM_SEARCH_SPC  10          /* Max number of search space in add/modify/release list */
65 #define FREQ_DOM_RSRC_SIZE  6           /* i.e. 6 bytes because Size of frequency domain resource is 45 bits */
66 #define MONITORING_SYMB_WITHIN_SLOT_SIZE 2  /* i.e. 2 bytes because size of monitoring symbols within slot is 14 bits */
67 #define MAX_NUM_DL_ALLOC 16             /* Max number of pdsch time domain downlink allocation */
68 #define MAX_NUM_UL_ALLOC 16             /* Max number of pusch time domain uplink allocation */
69
70 #define SD_SIZE   3
71 #define CCCH_LCID  0
72
73 #define ADD_DELTA_TO_TIME(crntTime, toFill, incr)          \
74 {                                                          \
75    if ((crntTime.slot + incr) > (MAX_SLOTS - 1))           \
76    {                                                       \
77       toFill.sfn = (crntTime.sfn + 1);                     \
78    }                                                       \
79    else                                                    \
80    {                                                       \
81       toFill.sfn = crntTime.sfn;                           \
82    }                                                       \
83    toFill.slot = (crntTime.slot + incr) % MAX_SLOTS;       \
84    if (toFill.sfn >= MAX_SFN)                              \
85    {                                                       \
86       toFill.sfn%=MAX_SFN;                                 \
87    }                                                       \
88 }
89
90 /*structures*/
91 typedef enum
92 {
93    UNSPECIFIED_CAUSE,
94    INVALID_PARAM_VALUE,
95    RESOURCE_UNAVAILABLE,
96    SYSTEM_ERROR
97 }SchFailureCause;
98
99 typedef enum
100 {
101    SR_PROHIBIT_MS1,
102    SR_PROHIBIT_MS2,
103    SR_PROHIBIT_MS4,
104    SR_PROHIBIT_MS8,
105    SR_PROHIBIT_MS16,
106    SR_PROHIBIT_MS32,
107    SR_PROHIBIT_MS64,
108    SR_PROHIBIT_MS128
109 }SchSrProhibitTimer;
110
111 typedef enum
112 {
113    SR_TRANS_MAX_N4,
114    SR_TRANS_MAX_N8,
115    SR_TRANS_MAX_N16,
116    SR_TRANS_MAX_N32,
117    SR_TRANS_MAX_N64,
118    SR_TRANS_MAX_SPARE3,
119    SR_TRANS_MAX_SPARE2,
120    SR_TRANS_MAX_SPARE1
121 }SchSrTransMax;
122
123 typedef enum
124 {
125    TIME_ALIGNMENT_TIMER_MS500,
126    TIME_ALIGNMENT_TIMER_MS750,
127    TIME_ALIGNMENT_TIMER_MS1280,
128    TIME_ALIGNMENT_TIMER_MS1920,
129    TIME_ALIGNMENT_TIMER_MS2560,
130    TIME_ALIGNMENT_TIMER_MS5120,
131    TIME_ALIGNMENT_TIMER_MS10240,
132    TIME_ALIGNMENT_TIMER_INFINITE
133 }SchTimeAlignmentTimer;
134
135 typedef enum
136 {
137    PHR_PERIODIC_TIMER_SF10,
138    PHR_PERIODIC_TIMER_SF20,
139    PHR_PERIODIC_TIMER_SF50,
140    PHR_PERIODIC_TIMER_SF100,
141    PHR_PERIODIC_TIMER_SF200,
142    PHR_PERIODIC_TIMER_SF500,
143    PHR_PERIODIC_TIMER_SF1000,
144    PHR_PERIODIC_TIMER_INFINITE
145 }SchPhrPeriodicTimer;
146
147 typedef enum
148 {
149    PHR_PROHIBIT_TIMER_SF0,
150    PHR_PROHIBIT_TIMER_SF10,
151    PHR_PROHIBIT_TIMER_SF20,
152    PHR_PROHIBIT_TIMER_SF50,
153    PHR_PROHIBIT_TIMER_SF100,
154    PHR_PROHIBIT_TIMER_SF200,
155    PHR_PROHIBIT_TIMER_SF500,
156    PHR_PROHIBIT_TIMER_SF1000
157 }SchPhrProhibitTimer;
158
159 typedef enum
160 {
161    PHR_TX_PWR_FACTOR_CHANGE_DB1,
162    PHR_TX_PWR_FACTOR_CHANGE_DB3,
163    PHR_TX_PWR_FACTOR_CHANGE_DB6,
164    PHR_TX_PWR_FACTOR_CHANGE_INFINITE
165 }SchPhrTxPwrFactorChange;
166
167 typedef enum
168 {
169    PHR_MODE_REAL,
170    PHR_MODE_VIRTUAL
171 }SchPhrModeOtherCG;
172
173 typedef enum
174 {
175    HARQ_ACK_CODEBOOK_SEMISTATIC,
176    HARQ_ACK_CODEBOOK_DYNAMIC
177 }SchPdschHarqAckCodebook;
178
179 typedef enum
180 {
181    NUM_HARQ_PROC_FOR_PDSCH_N2,
182    NUM_HARQ_PROC_FOR_PDSCH_N4,
183    NUM_HARQ_PROC_FOR_PDSCH_N6,
184    NUM_HARQ_PROC_FOR_PDSCH_N10,
185    NUM_HARQ_PROC_FOR_PDSCH_N16
186 }SchNumHarqProcForPdsch;
187
188 typedef enum
189 {
190    MAX_CODE_BLOCK_GROUP_PER_TB_N2,
191    MAX_CODE_BLOCK_GROUP_PER_TB_N4,
192    MAX_CODE_BLOCK_GROUP_PER_TB_N6,
193    MAX_CODE_BLOCK_GROUP_PER_TB_N8
194 }SchMaxCodeBlkGrpPerTB;
195
196 typedef enum
197 {
198    PDSCH_X_OVERHEAD_XOH_6,
199    PDSCH_X_OVERHEAD_XOH_12,
200    PDSCH_X_OVERHEAD_XOH_18
201 }SchPdschXOverhead;
202
203 typedef enum
204 {
205    DMRS_ADDITIONAL_POS0,
206    DMRS_ADDITIONAL_POS1,
207    DMRS_ADDITIONAL_POS3
208 }SchDmrsAdditionPosition;
209
210 typedef enum
211 {
212    RESOURCE_ALLOCTION_TYPE_0,
213    RESOURCE_ALLOCTION_TYPE_1,
214    RESOURCE_ALLOCTION_DYN_SWITCH
215 }SchResourceAllocType;
216
217 typedef enum
218 {
219    TIME_DOMAIN_RSRC_ALLOC_MAPPING_TYPE_A,
220    TIME_DOMAIN_RSRC_ALLOC_MAPPING_TYPE_B
221 }SchTimeDomRsrcAllocMappingType;
222
223 typedef enum
224 {
225    ENABLED_TRANSFORM_PRECODER,
226    DISABLED_TRANSFORM_PRECODER
227 }SchTransformPrecoder;
228
229 typedef enum
230 {
231    INTERLEAVED_CCE_REG_MAPPING,
232    NONINTERLEAVED_CCE_REG_MAPPING
233 }SchREGMappingType;
234
235 typedef enum
236 {
237    SLOT_PERIODICITY_AND_OFFSET_SL_1,
238    SLOT_PERIODICITY_AND_OFFSET_SL_2,
239    SLOT_PERIODICITY_AND_OFFSET_SL_4,
240    SLOT_PERIODICITY_AND_OFFSET_SL_5,
241    SLOT_PERIODICITY_AND_OFFSET_SL_8,
242    SLOT_PERIODICITY_AND_OFFSET_SL_10,
243    SLOT_PERIODICITY_AND_OFFSET_SL_16,
244    SLOT_PERIODICITY_AND_OFFSET_SL_20,
245    SLOT_PERIODICITY_AND_OFFSET_SL_40,
246    SLOT_PERIODICITY_AND_OFFSET_SL_80,
247    SLOT_PERIODICITY_AND_OFFSET_SL_160,
248    SLOT_PERIODICITY_AND_OFFSET_SL_320,
249    SLOT_PERIODICITY_AND_OFFSET_SL_640,
250    SLOT_PERIODICITY_AND_OFFSET_SL_1280,
251    SLOT_PERIODICITY_AND_OFFSET_SL_2560
252 }SchMSlotPeriodAndOffset;
253
254 typedef enum
255 {
256    SAME_AS_REG_BUNDLE,
257    ALL_CONTIGUOUS_RB
258 }SchPrecoderGranul;
259
260 typedef enum
261 {
262    SEARCH_SPACE_TYPE_COMMON,
263    SEARCH_SPACE_TYPE_UE_SPECIFIC
264 }SchSearchSpaceType;
265
266 typedef enum
267 {
268    AGGREGATION_LEVEL_N0,
269    AGGREGATION_LEVEL_N1,
270    AGGREGATION_LEVEL_N2,
271    AGGREGATION_LEVEL_N3,
272    AGGREGATION_LEVEL_N4,
273    AGGREGATION_LEVEL_N5,
274    AGGREGATION_LEVEL_N6,
275    AGGREGATION_LEVEL_N8
276 }SchAggrLevel;
277
278 typedef enum
279 {
280    RBG_SIZE_CONFIG_1,
281    RBG_SIZE_CONFIG_2
282 }SchRBGSize;
283
284 typedef enum
285 {
286    CODE_WORDS_SCHED_BY_DCI_N1,
287    CODE_WORDS_SCHED_BY_DCI_N2
288 }SchCodeWordsSchedByDci;
289
290 typedef enum
291 {
292    STATIC_BUNDLING_TYPE,
293    DYNAMIC_BUNDLING_TYPE
294 }SchBundlingType;
295
296 typedef enum
297 {
298    DUPLEX_MODE_FDD,
299    DUPLEX_MODE_TDD
300 }SchDuplexMode;
301
302 typedef enum
303 {
304    SSB_PRDCTY_MS5,
305    SSB_PRDCTY_MS10,
306    SSB_PRDCTY_MS20,
307    SSB_PRDCTY_MS40,
308    SSB_PRDCTY_MS80,
309    SSB_PRDCTY_MS160
310 }SchSSBPeriod;
311
312 typedef enum
313 {
314    RSP_OK,
315    RSP_NOK
316 }SchMacRsp;
317
318 typedef struct timeDomainAlloc
319 {
320    uint16_t startSymb;
321    uint16_t numSymb;
322 }TimeDomainAlloc;
323
324 typedef struct freqDomainAlloc
325 {
326    uint16_t startPrb;
327    uint16_t numPrb;
328 }FreqDomainAlloc;
329
330
331 typedef struct
332 {
333    uint32_t    ssbPbchPwr;       /* SSB block power */
334    uint8_t     scsCommon;           /* subcarrier spacing for common [0-3]*/
335    uint8_t     ssbOffsetPointA;  /* SSB sub carrier offset from point A */
336    SchSSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
337    uint8_t     ssbSubcOffset;    /* Subcarrier Offset(Kssb) */
338    uint32_t    nSSBMask[SCH_SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
339 }SchSsbCfg;
340
341 typedef struct bwpCfg
342 {
343    uint8_t         subcarrierSpacing;
344    uint8_t         cyclicPrefix;
345    FreqDomainAlloc freqAlloc;   
346 }BwpCfg;
347
348 typedef struct prg
349 {
350    uint16_t pmIdx;
351    uint16_t beamIdx[MAX_DIG_BF_INTERFACES];
352 } Prg;
353
354 typedef struct beamformingInfo
355 {
356    uint16_t numPrgs;
357    uint16_t prgSize;
358    uint8_t  digBfInterfaces;
359    Prg  prg[MAX_NUM_PRG];
360 } BeamformingInfo;
361
362 /* SIB1 PDSCH structures */
363
364 typedef struct codewordinfo
365 {
366    uint16_t targetCodeRate;
367    uint8_t  qamModOrder;
368    uint8_t  mcsIndex;
369    uint8_t  mcsTable;
370    uint8_t  rvIndex;
371    uint32_t tbSize;
372 } CodewordInfo;
373
374 typedef struct dmrsInfo
375 {
376    uint16_t dlDmrsSymbPos;
377    uint8_t  dmrsConfigType;
378    uint16_t dlDmrsScramblingId;
379    uint8_t  scid;
380    uint8_t  numDmrsCdmGrpsNoData;
381    uint16_t dmrsPorts;
382    uint8_t mappingType;
383    uint8_t nrOfDmrsSymbols;
384    uint8_t dmrsAddPos;
385 } DmrsInfo;
386
387 typedef struct pdschFreqAlloc
388 {
389    uint8_t  resourceAllocType;
390    /* since we are using type-1, hence rbBitmap excluded */
391    FreqDomainAlloc freqAlloc;
392    uint8_t  vrbPrbMapping;
393 } PdschFreqAlloc;
394
395 typedef struct pdschTimeAlloc
396 {
397    uint8_t         rowIndex;
398    TimeDomainAlloc timeAlloc;
399 } PdschTimeAlloc;
400
401 typedef struct txPowerPdschInfo
402 {
403    uint8_t powerControlOffset;
404    uint8_t powerControlOffsetSS;
405 } TxPowerPdschInfo;
406
407 typedef struct pdschCfg
408 {
409    uint16_t         pduBitmap;
410    uint16_t         rnti;
411    uint16_t         pduIndex;
412    uint8_t          numCodewords;
413    CodewordInfo     codeword[MAX_CODEWORDS];
414    uint16_t         dataScramblingId;
415    uint8_t          numLayers;
416    uint8_t          transmissionScheme;
417    uint8_t          refPoint;
418    DmrsInfo         dmrs;
419    PdschFreqAlloc   pdschFreqAlloc;
420    PdschTimeAlloc   pdschTimeAlloc;
421    BeamformingInfo  beamPdschInfo;
422    TxPowerPdschInfo txPdschPower;
423 } PdschCfg;
424 /* SIB1 PDSCH structures end */
425
426 /* SIB1 interface structure */
427
428 typedef struct coresetCfg
429 {
430    uint8_t coreSet0Size;
431    uint8_t startSymbolIndex;
432    uint8_t durationSymbols;
433    uint8_t freqDomainResource[6];
434    uint8_t cceRegMappingType;
435    uint8_t regBundleSize;
436    uint8_t interleaverSize;
437    uint8_t coreSetType;
438    uint16_t shiftIndex;
439    uint8_t precoderGranularity;
440    uint8_t cceIndex;
441    uint8_t aggregationLevel;
442 } CoresetCfg;
443
444 typedef struct txPowerPdcchInfo
445 {
446    uint8_t powerValue;
447    uint8_t powerControlOffsetSS;
448 } TxPowerPdcchInfo;
449
450 typedef struct dlDCI
451 {
452    uint16_t rnti;
453    uint16_t scramblingId;
454    uint16_t scramblingRnti;
455    uint8_t cceIndex;
456    uint8_t aggregLevel;
457    BeamformingInfo beamPdcchInfo;
458    TxPowerPdcchInfo txPdcchPower;
459    PdschCfg     *pdschCfg;
460 } DlDCI;
461
462 typedef struct pdcchCfg
463 {
464    /* coreset-0 configuration */
465    CoresetCfg coreset0Cfg;
466
467    uint16_t numDlDci;
468    DlDCI    dci; /* as of now its only one DCI, later it will be numDlCi */
469 } PdcchCfg;
470 /* end of SIB1 PDCCH structures */
471
472 typedef struct
473 {
474    /* parameters recieved from DU-APP */
475    uint16_t sib1PduLen;
476    uint16_t sib1NewTxPeriod;
477    uint16_t sib1RepetitionPeriod;
478    uint8_t  coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
479    uint8_t  searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
480    uint16_t sib1Mcs;
481
482    /* parameters derived in scheduler */
483    uint8_t n0;
484    BwpCfg bwp;
485    PdcchCfg sib1PdcchCfg;
486    PdschCfg sib1PdschCfg;
487 }SchSib1Cfg;
488
489 typedef struct schRachCfg
490 {
491    uint8_t      prachCfgIdx;       /* PRACH config idx */
492    uint8_t      prachSubcSpacing;  /* Subcarrier spacing of RACH */
493    uint16_t     msg1FreqStart;     /* Msg1-FrequencyStart */
494    uint8_t      msg1Fdm;           /* PRACH FDM (1,2,4,8) */
495    uint8_t      rootSeqLen;        /* root sequence length */
496    uint16_t     rootSeqIdx;        /* Root sequence index */
497    uint8_t      numRootSeq;        /* Number of root sequences required for FD */
498    uint16_t     k1;                /* Frequency Offset for each FD */
499    uint8_t      ssbPerRach;        /* SSB per RACH occassion */
500    uint8_t      prachMultCarrBand; /* Presence of Multiple carriers in Band */
501    uint8_t      raContResTmr;      /* RA Contention Resoultion Timer */
502    uint8_t      rsrpThreshSsb;     /* RSRP Threshold SSB */
503    uint8_t      raRspWindow;       /* RA Response Window */
504 }SchRachCfg;
505
506 typedef struct schBwpParams
507 {
508    FreqDomainAlloc freqAlloc;
509    uint8_t         scs;
510    uint8_t         cyclicPrefix;
511 }SchBwpParams;
512
513 typedef struct schCandidatesInfo
514 {
515    uint8_t aggLevel1;
516    uint8_t aggLevel2;
517    uint8_t aggLevel4;
518    uint8_t aggLevel8;
519    uint8_t aggLevel16;
520 }SchCandidatesInfo;
521
522 typedef struct schSearchSpaceCfg
523 {
524    uint8_t searchSpaceId;
525    uint8_t coresetId;
526    uint16_t monitoringSlot;
527    uint16_t duration;
528    uint16_t monitoringSymbol;
529    SchCandidatesInfo candidate;
530 }SchSearchSpaceCfg;
531
532 typedef struct schPdcchCfgCmn
533 {
534    SchSearchSpaceCfg commonSearchSpace;
535    uint8_t raSearchSpaceId;
536 }SchPdcchCfgCmn;
537
538 typedef struct schPdschCfgCmn
539 {
540    uint8_t k0;
541    uint8_t mappingType;
542    uint8_t startSymbol;
543    uint8_t lengthSymbol;
544 }SchPdschCfgCmn;
545
546 typedef struct schPucchCfgCmn
547 {
548    uint8_t pucchResourceCommon;
549    uint8_t pucchGroupHopping;
550 }SchPucchCfgCmn;
551
552 typedef struct schPuschCfgCmn
553 {
554    uint8_t k2;
555    uint8_t mappingType;
556    uint8_t startSymbol;
557    uint8_t lengthSymbol;
558 }SchPuschCfgCmn;
559
560 typedef struct schBwpDlCfg
561 {
562    SchBwpParams   bwp;
563    SchPdcchCfgCmn pdcchCommon;
564    SchPdschCfgCmn pdschCommon;
565 }SchBwpDlCfg;
566
567 typedef struct schBwpUlCfg
568 {
569    SchBwpParams   bwp;
570    SchPucchCfgCmn pucchCommon;
571    SchPuschCfgCmn puschCommon;
572 }SchBwpUlCfg;
573
574 typedef struct schCellCfg
575 {
576    uint16_t    cellId;           /* Cell Id */
577    uint16_t    phyCellId;        /* Physical cell id */
578    uint8_t     bandwidth;        /* Supported B/W */
579    SchDuplexMode  dupMode;          /* Duplex type: TDD/FDD */
580    SchSsbCfg   ssbSchCfg;        /* SSB config */
581    SchSib1Cfg  sib1SchCfg;       /* SIB1 config */
582    SchRachCfg  schRachCfg;       /* PRACH config */
583    SchBwpDlCfg schInitialDlBwp;  /* Initial DL BWP */
584    SchBwpUlCfg schInitialUlBwp;  /* Initial UL BWP */
585    uint8_t     puschMu;          /* PUSCH MU */
586 }SchCellCfg;
587
588 typedef struct schCellCfgCfm
589 {
590    U16         cellId;     /* Cell Id */
591    SchMacRsp   rsp;   
592 }SchCellCfgCfm;
593
594 typedef struct ssbInfo
595 {
596    uint8_t         ssbIdx;          /* SSB Index */
597    TimeDomainAlloc tdAlloc; /* Time domain allocation */
598    FreqDomainAlloc fdAlloc; /* Freq domain allocation */
599 }SsbInfo;
600
601 typedef struct sib1AllocInfo
602 {
603    BwpCfg bwp;
604    PdcchCfg sib1PdcchCfg;
605    PdschCfg sib1PdschCfg;
606 } Sib1AllocInfo;
607
608 typedef struct prachSchInfo
609 {
610    uint8_t  numPrachOcas;   /* Num Prach Ocassions */
611    uint8_t  prachFormat;    /* PRACH Format */
612    uint8_t  numRa;          /* Freq domain ocassion */
613    uint8_t  prachStartSymb; /* Freq domain ocassion */
614 }PrachSchInfo;
615
616 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
617 typedef struct dlBrdcstAlloc
618 {
619    /* Ssb transmission is determined as follows:
620     * 0 : No tranamission
621     * 1 : SSB Transmission
622     * 2 : SSB Repetition */
623    uint8_t ssbTrans;
624    uint8_t ssbIdxSupported;
625    SsbInfo ssbInfo[MAX_SSB_IDX];
626    /* Sib1 transmission is determined as follows:
627     * 0 : No tranamission
628     * 1 : SIB1 Transmission
629     * 2 : SIB1 Repetition */
630    U8 sib1Trans;
631    Sib1AllocInfo sib1Alloc;
632 }DlBrdcstAlloc;
633
634 typedef struct rarInfo
635 {
636    uint16_t        raRnti;
637    uint8_t         RAPID;
638    uint16_t        ta;
639    FreqDomainAlloc msg3FreqAlloc;
640    uint16_t        tcrnti;
641    uint8_t         rarPdu[8];
642    uint8_t         rarPduLen;
643 }RarInfo;
644
645 typedef struct rarAlloc
646 {
647    RarInfo rarInfo;
648    BwpCfg  bwp;
649    PdcchCfg rarPdcchCfg;
650    PdschCfg rarPdschCfg;
651 }RarAlloc;
652
653 typedef struct msg4Info
654 {
655    uint16_t crnti;
656    uint8_t  ndi;
657    uint8_t  harqProcNum;
658    uint8_t  dlAssignIdx;
659    uint8_t  pucchTpc;
660    uint8_t  pucchResInd;
661    uint8_t  harqFeedbackInd;
662    uint8_t  dciFormatId;
663    uint8_t  *msg4Pdu;
664    uint16_t  msg4PduLen;
665 }Msg4Info;
666
667 typedef struct msg4Alloc
668 {
669    Msg4Info msg4Info;
670    BwpCfg bwp;
671    PdcchCfg msg4PdcchCfg;
672    PdschCfg msg4PdschCfg;
673 }Msg4Alloc;
674
675 typedef struct schSlotValue
676 {
677    SlotIndInfo currentTime;
678    SlotIndInfo broadcastTime;
679    SlotIndInfo rarTime;
680    SlotIndInfo msg4Time;
681    SlotIndInfo dlMsgTime;
682 }SchSlotValue;
683
684 typedef struct dlSchedInfo
685 {
686    uint16_t cellId;  /* Cell Id */
687    SchSlotValue schSlotValue;
688
689    /* Allocation for broadcast messages */
690    bool isBroadcastPres;
691    DlBrdcstAlloc brdcstAlloc;
692
693    /* Allocation for RAR message */
694    //uint8_t isRarPres;
695    RarAlloc *rarAlloc;
696
697    /* Allocation from MSG4 */
698    Msg4Alloc *msg4Alloc;
699 }DlSchedInfo;
700
701 typedef struct tbInfo
702 {
703    uint8_t  mcs;    /* MCS */
704    uint8_t  ndi;    /* NDI */
705    uint8_t  rv;     /* Redundancy Version */
706    uint16_t tbSize; /* TB Size */
707 }TbInfo;
708
709 typedef struct schPuschInfo
710 {
711    uint8_t          harqProcId;   /* HARQ Process ID */
712    uint8_t          resAllocType; /* Resource allocation type */
713    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
714    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
715    TbInfo           tbInfo;       /* TB info */
716    uint8_t          dmrsMappingType;
717    uint8_t          nrOfDmrsSymbols;
718    uint8_t          dmrsAddPos;
719 }SchPuschInfo;
720
721 typedef struct schPucchInfo
722 {
723    uint16_t         rnti;
724    uint8_t          pucchFormat;
725    FreqDomainAlloc  fdAlloc;      /* Freq domain allocation */
726    TimeDomainAlloc  tdAlloc;      /* Time domain allocation */
727    uint8_t          srFlag;
728    uint8_t          harqFlag;
729    uint8_t          numHarqBits;
730    uint8_t          uciFlag;
731    uint8_t          numUciBits;
732 }SchPucchInfo;
733
734 typedef struct ulSchedInfo
735 {
736    uint16_t      cellId;         /* Cell Id */
737    uint16_t      crnti;          /* CRNI */
738    SlotIndInfo   slotIndInfo;    /* Slot Info: sfn, slot number */
739    uint8_t       dataType;       /* Type of info being scheduled */
740    PrachSchInfo  prachSchInfo;   /* Prach scheduling info */
741    SchPuschInfo  schPuschInfo;   /* Pusch scheduling info */
742    SchPucchInfo  schPucchInfo;   /* Pusch scheduling info */
743 }UlSchedInfo;
744
745 typedef struct rachIndInfo
746 {
747    uint16_t    cellId;
748    uint16_t    crnti;
749    SlotIndInfo timingInfo;
750    uint8_t     slotIdx;
751    uint8_t     symbolIdx;
752    uint8_t     freqIdx;
753    uint8_t     preambleIdx;
754    uint16_t    timingAdv;
755 }RachIndInfo;
756
757
758 typedef struct crcIndInfo
759 {
760    uint16_t    cellId;
761    uint16_t    crnti;
762    SlotIndInfo timingInfo;
763    uint16_t    numCrcInd;
764    uint8_t     crcInd[MAX_NUMBER_OF_CRC_IND_BITS];
765 }CrcIndInfo;
766
767 typedef struct boInfo
768 {
769    uint8_t   lcId;
770    uint32_t  dataVolume;
771 }BOInfo;
772
773 typedef struct dlRlcBOInfo
774 {
775    uint16_t    cellId;
776    uint16_t    crnti;
777    uint16_t    numLc;
778    BOInfo      boInfo[MAX_NUM_LOGICAL_CHANNELS];
779 }DlRlcBOInfo;
780
781 /* Info of Scheduling Request to Add/Modify */
782 typedef struct schSchedReqInfo
783 {
784    uint8_t              schedReqId;
785    SchSrProhibitTimer   srProhibitTmr;
786    SchSrTransMax        srTransMax;
787 }SchSchedReqInfo;
788
789 /* Scheduling Request Configuration */
790 typedef struct schSchedReqCfg
791 {
792    uint8_t          addModListCount;
793    SchSchedReqInfo  addModList[MAX_NUM_SR_CFG_PER_CELL_GRP];   /* List of Scheduling req to be added/modified */
794    uint8_t          relListCount;
795    uint8_t          relList[MAX_NUM_SR_CFG_PER_CELL_GRP];      /* list of scheduling request Id to be deleted */
796 }SchSchedReqCfg;
797
798 /* Info of Tag to Add/Modify */
799 typedef struct schTagInfo
800 {
801    uint8_t       tagId;
802    SchTimeAlignmentTimer  timeAlignmentTmr;
803 }SchTagInfo;
804
805 /* Timing Advance Group Configuration */
806 typedef struct schTagCfg
807 {
808    uint8_t      addModListCount;
809    SchTagInfo   addModList[MAX_NUM_TAGS];    /* List of Tag to Add/Modify */
810    uint8_t      relListCount;
811    uint8_t      relList[MAX_NUM_TAGS];       /* list of Tag Id to release */
812 }SchTagCfg;
813
814 /* Configuration for Power headroom reporting */
815 typedef struct schPhrCfg
816 {
817    SchPhrPeriodicTimer       periodicTmr;
818    SchPhrProhibitTimer       prohibitTmr;
819    SchPhrTxPwrFactorChange   txpowerFactorChange;
820    bool                      multiplePhr;
821    bool                      dummy;
822    bool                      type2OtherCell;
823    SchPhrModeOtherCG         modeOtherCG;
824 }SchPhrCfg;
825
826 /* MAC cell Group configuration */
827 typedef struct schMacCellGrpCfg
828 {
829    SchSchedReqCfg   schedReqCfg;
830    SchTagCfg        tagCfg;
831    SchPhrCfg        phrCfg;             /* To be used only if phrCfgSetupPres is true */      
832 }SchMacCellGrpCfg;
833
834 /* Physical Cell Group Configuration */
835 typedef struct schPhyCellGrpCfg
836 {
837    SchPdschHarqAckCodebook    pdschHarqAckCodebook;
838    int8_t     pNrFr1;
839 }SchPhyCellGrpCfg;
840
841 /* Control resource set info */
842 typedef struct schControlRsrcSet
843 {
844    uint8_t             cRSetId;                /* Control resource set id */
845    uint8_t             freqDomainRsrc[FREQ_DOM_RSRC_SIZE];  /* Frequency domain resource */
846    uint8_t             duration;
847    SchREGMappingType   cceRegMappingType;
848    SchPrecoderGranul   precoderGranularity;
849    uint16_t            dmrsScramblingId;
850 }SchControlRsrcSet;
851
852 /* Search Space info */
853 typedef struct schSearchSpace
854 {
855    uint8_t                  searchSpaceId;
856    uint8_t                  cRSetId;
857    SchMSlotPeriodAndOffset  mSlotPeriodicityAndOffset;
858    uint8_t                  mSymbolsWithinSlot[MONITORING_SYMB_WITHIN_SLOT_SIZE];
859    SchAggrLevel             numCandidatesAggLevel1;      /* Number of candidates for aggregation level 1 */
860    SchAggrLevel             numCandidatesAggLevel2;      /* Number of candidates for aggregation level 2 */
861    SchAggrLevel             numCandidatesAggLevel4;      /* Number of candidates for aggregation level 4 */
862    SchAggrLevel             numCandidatesAggLevel8;      /* Number of candidates for aggregation level 8 */
863    SchAggrLevel             numCandidatesAggLevel16;     /* Number of candidates for aggregation level 16 */
864    SchSearchSpaceType       searchSpaceType;
865    uint8_t                  ueSpecificDciFormat;
866 }SchSearchSpace;
867
868 /* PDCCH cofniguration */
869 typedef struct schPdcchConfig
870 {
871    uint8_t           numCRsetToAddMod;
872    SchControlRsrcSet  cRSetToAddModList[MAX_NUM_CRSET];           /* List of control resource set to add/modify */
873    uint8_t           numCRsetToRel;
874    uint8_t           cRSetToRelList[MAX_NUM_CRSET];              /* List of control resource set to release */
875    uint8_t           numSearchSpcToAddMod;
876    SchSearchSpace    searchSpcToAddModList[MAX_NUM_SEARCH_SPC];  /* List of search space to add/modify */
877    uint8_t           numSearchSpcToRel;
878    uint8_t           searchSpcToRelList[MAX_NUM_SEARCH_SPC];     /* List of search space to release */
879 }SchPdcchConfig;
880
881 /* PDSCH time domain resource allocation */
882 typedef struct schPdschTimeDomRsrcAlloc
883 {
884    SchTimeDomRsrcAllocMappingType    mappingType;
885    uint8_t    startSymbol;
886    uint8_t    symbolLength;
887 }SchPdschTimeDomRsrcAlloc;
888
889 /* DMRS downlink configuration */
890 typedef struct schDmrsDlCfg
891 {
892    SchDmrsAdditionPosition   addPos;       /* DMRS additional position */
893 }SchDmrsDlCfg;
894
895 /* PDSCH Configuration */
896 typedef struct schPdschConfig
897 {
898    SchDmrsDlCfg               dmrsDlCfgForPdschMapTypeA;
899    SchResourceAllocType       resourceAllocType;
900    uint8_t                    numTimeDomRsrcAlloc;
901    SchPdschTimeDomRsrcAlloc   timeDomRsrcAllociList[MAX_NUM_DL_ALLOC]; /* PDSCH time domain DL resource allocation list */
902    SchRBGSize                 rbgSize;
903    SchCodeWordsSchedByDci     numCodeWordsSchByDci;                    /* Number of code words scheduled by DCI */
904    SchBundlingType            bundlingType;
905 }SchPdschConfig;
906
907 /* Initial Downlink BWP */
908 typedef struct schInitalDlBwp
909 {
910    bool             pdcchCfgPres;
911    SchPdcchConfig   pdcchCfg;
912    bool             pdschCfgPres;
913    SchPdschConfig   pdschCfg;
914 }SchInitalDlBwp;
915
916 /* BWP Downlink common */
917 typedef struct schBwpDlCommon
918 {
919 }SchBwpDlCommon;
920
921 /* Downlink BWP information */
922 typedef struct schDlBwpInfo
923 {
924    uint8_t          bwpId;
925 }SchDlBwpInfo;
926
927 /* PDCCH Serving Cell configuration */
928 typedef struct schPdschServCellCfg
929 {
930    uint8_t                  *maxMimoLayers;           
931    SchNumHarqProcForPdsch   numHarqProcForPdsch;
932    SchMaxCodeBlkGrpPerTB    *maxCodeBlkGrpPerTb;
933    bool                     *codeBlkGrpFlushInd;
934    SchPdschXOverhead        *xOverhead;
935 }SchPdschServCellCfg;
936
937 /* PUCCH Configuration */
938 typedef struct schPucchCfg
939 {
940    /* TODO : Not used currently */ 
941 }SchPucchCfg;
942
943 /* Transform precoding disabled */
944 typedef struct schTransPrecodDisabled
945 {
946    uint16_t   scramblingId0;
947 }SchTransPrecodDisabled;
948
949 /* DMRS Uplink configuration */
950 typedef struct SchDmrsUlCfg
951 {
952    SchDmrsAdditionPosition    addPos;               /* DMRS additional position */
953    SchTransPrecodDisabled     transPrecodDisabled;  /* Transform precoding disabled */
954 }SchDmrsUlCfg;
955
956 /* PUSCH Time Domain Resource Allocation */
957 typedef struct schPuschTimeDomRsrcAlloc
958 {
959    uint8_t   k2;
960    SchTimeDomRsrcAllocMappingType   mappingType;
961    uint8_t   startSymbol;
962    uint8_t   symbolLength;
963 }SchPuschTimeDomRsrcAlloc;
964
965 /* PUSCH Configuration */
966 typedef struct schPuschCfg
967 {
968    SchDmrsUlCfg               dmrsUlCfgForPuschMapTypeA;
969    SchResourceAllocType       resourceAllocType;
970    uint8_t                    numTimeDomRsrcAlloc;
971    SchPuschTimeDomRsrcAlloc   timeDomRsrcAllocList[MAX_NUM_UL_ALLOC]; /* PUSCH time domain UL resource allocation list */
972    SchTransformPrecoder       transformPrecoder;
973 }SchPuschCfg;
974
975 /* Initial Uplink BWP */
976 typedef struct schInitialUlBwp
977 {
978    bool          pucchCfgPres;
979    SchPucchCfg   pucchCfg;
980    bool          puschCfgPres;
981    SchPuschCfg   puschCfg;
982 }SchInitialUlBwp;
983
984 /* Uplink BWP information */
985 typedef struct schUlBwpInfo
986 {
987    uint8_t        bwpId;
988 }SchUlBwpInfo;
989
990 /* Serving cell configuration */
991 typedef struct schServCellCfgInfo
992 {
993    SchInitalDlBwp        initDlBwp;
994    uint8_t               numDlBwpToAdd;
995    SchDlBwpInfo          DlBwpToAddList[MAX_NUM_BWP];
996    uint8_t               firstActvDlBwpId;
997    uint8_t               defaultDlBwpId;
998    uint8_t               *bwpInactivityTmr;
999    SchPdschServCellCfg   pdschServCellCfg;
1000    SchInitialUlBwp       initUlBwp;
1001    uint8_t               numUlBwpToAdd;
1002    SchUlBwpInfo          UlBwpToAddList[MAX_NUM_BWP];
1003    uint8_t               firstActvUlBwpId;
1004 }SchServCellCfgInfo;
1005
1006 typedef struct schNonDynFiveQi
1007 {
1008    uint16_t   fiveQi;
1009    uint8_t    priorLevel;
1010    uint16_t   avgWindow;
1011    uint16_t   maxDataBurstVol;
1012 }SchNonDynFiveQi;
1013
1014 typedef struct schDynFiveQi
1015 {
1016    uint8_t    priorLevel;
1017    uint16_t   packetDelayBudget;
1018    uint8_t    packetErrRateScalar;
1019    uint8_t    packetErrRateExp;
1020    uint16_t   fiveQi;
1021    uint8_t    delayCritical;
1022    uint16_t   avgWindow;
1023    uint16_t   maxDataBurstVol;
1024 }SchDynFiveQi;
1025
1026 typedef struct schNgRanAllocAndRetPri
1027 {
1028    uint8_t priorityLevel;
1029    uint8_t preEmptionCap;
1030    uint8_t preEmptionVul;
1031 }SchNgRanAllocAndRetPri;
1032
1033 typedef struct schGrbQosFlowInfo
1034 {
1035    uint32_t maxFlowBitRateDl;
1036    uint32_t maxFlowBitRateUl;
1037    uint32_t guarFlowBitRateDl;
1038    uint32_t guarFlowBitRateUl;
1039 }SchGrbQosFlowInfo;
1040
1041 /* DRB QoS */
1042 typedef struct schDrbQos
1043 {
1044    uint8_t  fiveQiType;   /* Dynamic or non-dynamic */ 
1045    union
1046    {
1047       SchNonDynFiveQi   nonDyn5Qi;
1048       SchDynFiveQi      dyn5Qi;
1049    }u;
1050    SchNgRanAllocAndRetPri  ngRanRetPri;
1051    SchGrbQosFlowInfo       grbQosFlowInfo;
1052    uint16_t                pduSessionId;
1053    uint32_t                ulPduSessAggMaxBitRate;   /* UL PDU Session Aggregate max bit rate */
1054 }SchDrbQosInfo;
1055
1056 typedef struct schSnssai
1057 {
1058    uint8_t   sst;
1059    uint8_t   sd[SD_SIZE];
1060 }SchSnssai;
1061
1062 /* Special cell configuration */
1063 typedef struct schSpCellCfg
1064 {
1065    uint8_t           servCellIdx;
1066    SchServCellCfgInfo   servCellCfg;
1067 }SchSpCellCfg;
1068
1069 /* Uplink logical channel configuration */
1070 typedef struct SchUlLcCfg
1071 {
1072    uint8_t priority;
1073    uint8_t lcGroup;
1074    uint8_t schReqId;
1075    uint8_t pbr;        // prioritisedBitRate
1076    uint8_t bsd;        // bucketSizeDuration
1077 }SchUlLcCfg;
1078
1079 /* Downlink logical channel configuration */
1080 typedef struct schDlLcCfg
1081 {
1082    uint8_t lcp;      // logical Channel Prioritization
1083 }SchDlLcCfg;
1084
1085 /* Logical Channel configuration */
1086 typedef struct schLcCfg
1087 {
1088    uint8_t        lcId;
1089    SchDrbQosInfo  *drbQos;
1090    SchSnssai      *snssai;
1091    SchDlLcCfg     dlLcCfg;
1092    SchUlLcCfg     *ulLcCfg;
1093 }SchLcCfg;
1094
1095 /* Aggregate max bit rate */
1096 typedef struct aggrMaxBitRate
1097 {
1098    uint32_t   ulBitRate;
1099    uint32_t   dlBitRate;
1100 }SchAggrMaxBitRate;
1101
1102 /* UE configuration */
1103 typedef struct schUeCfg
1104 {
1105    uint16_t        cellId;
1106    uint16_t        crnti;
1107    SchMacCellGrpCfg   macCellGrpCfg;
1108    SchPhyCellGrpCfg   phyCellGrpCfg;
1109    SchSpCellCfg       spCellCfg;
1110    SchAggrMaxBitRate  *aggrMaxBitRate;
1111    uint8_t            numLc;
1112    SchLcCfg           lcCfgList[MAX_NUM_LOGICAL_CHANNELS];
1113 }SchUeCfg;
1114
1115 typedef struct schUeCfgRsp
1116 {
1117    uint16_t   ueIdx;
1118    uint16_t   cellId;
1119    uint16_t   crnti;
1120    SchMacRsp  rsp;
1121    SchFailureCause cause;
1122 }SchUeCfgRsp;
1123
1124 /* function pointers */
1125
1126 typedef uint8_t (*SchCellCfgCfmFunc)    ARGS((
1127          Pst            *pst,           /* Post Structure */                         
1128          SchCellCfgCfm  *schCellCfgCfm  /* Cell Cfg Cfm */
1129          ));
1130
1131 typedef uint8_t (*SchCellCfgFunc)    ARGS((
1132          Pst         *pst,           /* Post Structure */                         
1133          SchCellCfg  *schCellCfg     /* Cell Cfg  */
1134          ));
1135
1136 typedef uint8_t (*SchMacDlAllocFunc)     ARGS((                     
1137          Pst            *pst,          /* Post Structure */                         
1138          DlSchedInfo    *dlSchedInfo   /* dl allocation Info */                      
1139          ));
1140
1141 typedef uint8_t (*SchMacUlSchInfoFunc)     ARGS((                     
1142          Pst         *pst,           /* Post Structure */                         
1143          UlSchedInfo *ulSchedInfo    /* UL Alloc Sch  Info */                      
1144          ));
1145
1146 typedef uint8_t (*MacSchRachIndFunc) ARGS((
1147          Pst         *pst,         /* Post structure */
1148          RachIndInfo *rachInd));    /* Rach Indication Info */
1149
1150 typedef uint8_t (*MacSchCrcIndFunc) ARGS(( 
1151          Pst         *pst,         /* Post structure */
1152          CrcIndInfo  *crcInd));     /* CRC Info */
1153
1154 typedef uint8_t (*MacSchDlRlcBoInfoFunc) ARGS((
1155          Pst         *pst,         /* Post structure */
1156          DlRlcBOInfo *dlBoInfo));   /* DL BO Info */
1157
1158 typedef uint8_t (*MacSchUeCreateReqFunc) ARGS((
1159          Pst         *pst,           /* Post structure */
1160          SchUeCfg    *ueCfgToSch));   /* Scheduler UE Cfg */
1161
1162 typedef uint8_t (*SchUeCfgRspFunc) ARGS((
1163          Pst         *pst,           /* Post structure */
1164          SchUeCfgRsp *cfgRsp));       /* Scheduler UE Cfg response */
1165
1166 typedef uint8_t (*MacSchSlotIndFunc) ARGS((
1167          Pst         *pst,          /* Post structure */
1168          SlotIndInfo *slotInd));    /* Slot Info */
1169
1170 /* function declarations */
1171 uint8_t packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
1172 uint8_t packSchMacDlAlloc(Pst *pst, DlSchedInfo  *dlSchedInfo);
1173 uint8_t packSchMacUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
1174 uint8_t packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
1175 uint8_t packSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
1176 uint8_t MacProcDlAlloc(Pst *pst, DlSchedInfo *dlSchedInfo);
1177 uint8_t MacProcSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
1178 uint8_t MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
1179 uint8_t SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
1180 uint8_t schActvInit(Ent entity, Inst instId, Region region, Reason reason);
1181 uint8_t SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
1182 uint8_t MacProcUlSchInfo(Pst *pst, UlSchedInfo *ulSchedInfo);
1183 uint8_t packMacSchRachInd(Pst *pst, RachIndInfo *rachInd);
1184 uint8_t macSchRachInd(Pst *pst, RachIndInfo *rachInd);
1185 uint8_t packMacSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
1186 uint8_t macSchCrcInd(Pst *pst, CrcIndInfo *crcInd);
1187 uint8_t packMacSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
1188 uint8_t macSchDlRlcBoInfo(Pst *pst, DlRlcBOInfo *dlBoInfo);
1189 uint8_t packMacSchUeCreateReq(Pst *pst, SchUeCfg *ueCfgToSch);
1190 uint8_t macSchUeCreateReq(Pst *pst, SchUeCfg *ueCfgToSch);
1191 uint8_t packSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
1192 uint8_t MacProcSchUeCfgRsp(Pst *pst, SchUeCfgRsp *cfgRsp);
1193 uint8_t macSchSlotInd ARGS((Pst * pst, SlotIndInfo * slotInd));
1194 uint8_t packMacSchSlotInd(Pst * pst, SlotIndInfo * slotInd);
1195 uint8_t unpackMacSchSlotInd(MacSchSlotIndFunc func, Pst *pst, Buffer  *mBuf);
1196
1197 /**********************************************************************
1198   End of file
1199  **********************************************************************/
1200