Modify licenses
[scp/ocu/5gnr.git] / Include / gnbCommon.h
1 /******************************************************************************
2 *
3 *   Copyright (c) 2020 ICT/CAS.
4 *
5 *   Licensed under the O-RAN Software License, Version 1.0 (the "Software 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 *       https://www.o-ran.org/software
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 #ifndef _GNB_COMMON_H_
20 #define _GNB_COMMON_H_
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 #include "vos_common.h"
26 #include "vos_sockMgr.h"
27 #include <netinet/in.h>
28 #include "gnbServiceType.h"
29 #include "vos_lib.h"
30
31
32 extern struct timeval procStart, procEnd;
33
34 #define MARK_START_TIME()  do{\
35     gettimeofday(&procStart,0);\
36 }while(0)
37
38 #define CU_CALC_ELAPSED_TIME(S)  do{\
39         INT32 diff;   \
40         gettimeofday(&procEnd,0);\
41         diff = ( procEnd.tv_sec*1000000L + procEnd.tv_usec )            \
42         - ( procStart.tv_sec*1000000L + procStart.tv_usec );    \
43         vos_info_print("Msg %s spend time = %ld us\n",S ,diff);\
44 }while(0)
45
46
47 #define GNB_OK          0
48 #define GNB_ERROR       1
49
50 #define TRUE            1
51 #define FALSE           0
52
53 /***********************************************************************************************************
54 ************************************************define type in DU ****************************************
55 ************************************************************************************************************/
56
57
58 /***********************************************************************************************************
59 ************************************************** macro define ******************************************
60 ************************************************************************************************************/
61
62
63 /** @brief max logical channel id */
64 #define MAX_LCH_ID                     (MAX_LCH_NUM - 1)
65
66 #define MAX_LEN_AMF_NAME                       150
67 #define MAX_GNB_DU_NAME                        150
68 #define MAX_GNB_CU_NAME                        150
69 #define MAX_GNB_DU_NUM                         2
70
71
72 #define MAX_TASK_NUM                 60
73 #define MAX_TASK_NAME_LEN            256
74 #define MAX_QUEUE_NUM                20
75 #define MAX_QUEUE_MSG_NUM            256
76 #define MAX_IP_ADDR_STRING_LEN       256
77 #define MAX_IP_ADDR_NUM              COMM_SCTP_ADDR_MAX
78
79 #define MAX_LOCK_NUM                 20
80 #define MAX_SEMA_NUM                 20
81 #define MAX_TIMER_NUM                100
82
83 #define MAX_SI_NUM                   32
84 #define MAX_SI_MESSAGE               32
85 #define MAX_SIB                      32
86 #define MAX_SIB_LEN                  300
87
88 #define RRC_SI_DATA             4
89 #define MAX_TX_PDU_NUM          256//1024
90 #define MAX_MULTI_BANDS         8
91 #define MAX_NR_NS_PMAX          8
92 #define MAX_ACCESS_CAT          64
93 #define MAX_BARRING_SET         8
94 #define MAX_PLMN                12
95 #define MAXCELLINTRA            16      //Maximum number of intra-Freq cells listed in SIB3
96 #define MAXCELLBLACK            16      //Maximum number of NR blacklisted cell ranges in SIB3, SIB4
97 /** @brief max cell bands num */
98 #define MAX_NR_CELL_BANDS              16//32
99 /** @brief F1 max cell num */
100 #define F1_MAX_CELL_NUM                MAX_CELL_NUM
101
102
103 #define COMMON_LOG_LEVEL (0)
104 #define MAJOR_LOG_LEVEL (1)
105
106 /*module msg marco define*/
107 #define MSG_HEAD_LEN (20)
108 #define MSG_TOTAL_LEN (8096)
109 #define MSG_MAX_BUFFER_LEN (MSG_TOTAL_LEN-MSG_HEAD_LEN)
110
111 #define MAX_MODULE_NAME_LEN (256)
112
113 /*MAX IPV6 ADDR LEN*/
114 #define MAX_IPV6ADDR_LEN (16)
115
116 #define MAX_ENTITY_MANAGE_MSG_NUM 100
117 #define CHECK_FUNCTION_RET(ret) \
118         do { \
119             if (VOS_OK != (ret)) { \
120                 return VOS_ERROR; \
121             } \
122         } while(0)
123
124 extern UINT32 f1apGetModuleId();
125
126 #define DUCP_MODULE_ID  ducpGetModuleId()
127 #define F1AP_MODULE_ID  f1apGetModuleId()
128
129
130
131 #define MAX_SCS                 5
132 #define MAX_LENGTH_NGAP_RAN_NAME        150
133
134
135
136 /***********************************************************************************************************
137 ********************************************* enum define*************************************************
138 ************************************************************************************************************/
139
140 /* IP Type */
141 typedef enum ipAddrType
142 {
143     IPv4,
144     IPv6,
145     IPTypeMax,
146 }IpAddrType_e;
147
148 typedef enum
149 {
150     SOCKET_SCTP,
151     SOCKET_UDP,
152     SOCKET_TCP,
153     SOCKET_UNIX_UDP,
154     SOCKET_UNIX_TCP,
155 }SOCKET_TYPE;
156
157 /** log level */
158 typedef enum gnbLogLevel
159 {
160         LOG_CRIT = 1,        ///<  critical conditions
161         LOG_ERR,             ///<  error conditions
162         LOG_WARNING,         ///<  warning conditions
163         LOG_INFO,            ///<  informational
164         LOG_DEBUG,           ///<  debug info
165 } gnbLogLevel_e;
166
167
168 /***********************************************************************************************************
169 ****************************************************define typ *********************************************
170 ************************************************************************************************************/
171 typedef VOID (*FUNCPTR)(void *args);
172 typedef INT32 (*VOS_TASK_INIT_FUNCPTR)();
173 typedef VOID (*VOS_TASK_FUNCPTR)(ULONG ulArg1, ULONG ulArg2,ULONG ulArg3, ULONG ulArg4,ULONG ulArg5, ULONG ulArg6,ULONG ulArg7, ULONG ulArg8,ULONG ulArg9, ULONG ulArg10);
174
175 typedef INT32 (*USER_TASK_INIT_FUNCPTR)();
176 typedef LONG  (*USER_TASK_FUNCPTR)(ULONG aulMsg[VOS_QUEUE_MSG_SIZE]);
177
178
179 typedef INT32 (*HOST_TASK_FUNCPTR)(ULONG aulMsg[VOS_QUEUE_MSG_SIZE]);
180 typedef INT32 (*HOST_TASK_INIT_FUNCPTR)(void);
181
182
183 /***********************************************************************************************************
184 ************************************************task info strcut *******************************************
185 ************************************************************************************************************/
186
187 /* IPV4 Address */
188 typedef struct
189 {
190    UINT16  port;
191    UINT32  address;
192 } Ipv4Addr_t;
193
194 /* IPV6 Address */
195 typedef struct cmInetIpv6Addr
196 {
197    UINT16  port;
198    UINT8   IpAddr6[MAX_IPV6ADDR_LEN];
199 } Ipv6Addr_t;
200
201
202 /* IP Address */
203 typedef struct ipAddress
204 {
205     IpAddrType_e       ipType; /* type of transport address */
206     union
207     {
208        Ipv4Addr_t  ipv4Addr; /* IPv4 transport address */
209        Ipv6Addr_t  ipv6Addr; /* IPv6 transport address */
210     }u;
211 } IpAddress_t;
212
213 /* Ran name, a string */
214 typedef struct  ngapRanName
215 {
216     char                    ranName[MAX_LENGTH_NGAP_RAN_NAME];
217 }NgapRanName_t;
218
219 /* user task info */
220 typedef struct
221 {
222     UINT32  userTaskId;
223     UINT32  hostTaskId;
224     UINT8   userTaskName[MAX_TASK_NAME_LEN];
225     UINT32  userTaskPriority;
226     FUNCPTR userTaskEntry;
227 } UserTaskInfo_t;
228
229 /* Host task info */
230 typedef struct
231 {
232     UINT32  hostTaskId;
233     UINT32  procId;
234     UINT8   hostTaskName[MAX_TASK_NAME_LEN];
235     UINT32  hostTaskpriority;
236     FUNCPTR hostTaskEntry;
237 } HostTaskInfo_t;
238
239 /* user task table info */
240 typedef struct
241 {
242     UINT32                  userTaskId;
243     UINT32                  hostTaskId;
244     CHAR                    userTaskName[MAX_TASK_NAME_LEN];/*线程名称*/
245     ULONG                   userModuleID;
246     UINT32                  userTaskPriority;/*优先级*/
247     USER_TASK_INIT_FUNCPTR  userTaskInitPtr;
248     USER_TASK_FUNCPTR       userTaskEntry;/*线程执行函数*/
249 } UserTaskTable_t;
250
251 /* Host task table info */
252
253 typedef struct
254 {
255     UINT32   hostTaskId;
256     CHAR     hostTaskName[MAX_TASK_NAME_LEN];/*线程名称*/
257     UINT32   priority;/*优先级*/
258     LONG     cpuSize;
259     LONG     cpus[8];
260 } HostTaskTable_t;
261
262 /* vos task info */
263 typedef struct
264 {
265     UINT8                   vosTaskId;
266     CHAR                    vosTaskName[MAX_TASK_NAME_LEN];/*线程名称*/
267     CHAR                    vosMoudleName[MAX_MODULE_NAME_LEN];
268     UINT8                   vosTaskpriority;/*优先级*/
269     VOS_TASK_INIT_FUNCPTR   vosTaskInitPtr;
270     VOS_TASK_FUNCPTR        vosTaskEntry;/*线程执行函数*/
271 } VosTaskTable_t;
272
273 typedef struct
274 {
275     UINT8         vosTaskId;
276     vos_module_t  vosModule;
277     VOS_HANDLE    taskHandle;
278 }MoudleInfo_t;
279
280 typedef struct
281 {
282     UCHAR                  ipAddrStr[MAX_IP_ADDR_STRING_LEN];
283     UINT32                 port;
284 }IpAddrStr_t;
285
286 typedef struct
287 {
288     LONG                   Count;//最大个数为COMM_SCTP_ADDR_MAX
289     IpAddrStr_t            ipList[MAX_IP_ADDR_NUM];
290 }SockAddrStr_t;
291
292 typedef struct
293 {
294     UINT32             vosTaskId;
295     SockAddrStr_t      ipAddrStr;
296
297     SockAddrStr_t      clientAddrInfo;
298 }TaskSockAddrInfo_t;
299
300 typedef struct
301 {
302     UINT32             vosTaskId;
303     CHAR               vosTaskName[MAX_TASK_NAME_LEN];
304     SockAddrStr_t      sockAddrInfo;
305     SockAddrStr_t      clientSockAddrInfo;
306     UINT32             sockType;
307     vos_sock_para_t    comPara;
308     vos_sock_info_t    comOpInfo;
309 }CommPara_t;
310
311 typedef struct
312 {
313     UINT8              isUsed;
314     vos_sock_info_t    opInfo;
315 }E1UpClientSockInfo_t;
316
317
318
319
320 typedef struct
321 {
322
323 }UdpSocketMsg_t;
324 typedef struct
325 {
326
327 }TcpSocketMsg_t;
328
329 typedef struct
330 {
331     UINT32          connectId;/*SOCKET INDEX*/
332     UINT32          fd;/*用于收消息的fd*/
333     vos_sockaddr_t  fromAddr;/*用于消息来源地址*/
334     struct sctp_sndrcvinfo sri;/*收到的SCTP消息信息*/
335     LONG            msg_flags;/*链路信息*/
336     UINT32          assocState;/*链路状态*/
337
338 }SctpSocketMsg_t;
339
340 typedef struct
341 {
342
343 }UnixUdpSocketMsg_t;
344
345 typedef struct
346 {
347
348 }UnixTcpSocketMsg_t;
349
350 /*
351 SOCKET msg
352 */
353 typedef struct
354 {
355     UINT32 socketMsgType;
356     union
357     {
358         UdpSocketMsg_t      udpMsg;
359         TcpSocketMsg_t      tcpMsg;
360         SctpSocketMsg_t     sctpMsg;
361         UnixUdpSocketMsg_t  unixUdpSocketMsg;
362         UnixTcpSocketMsg_t  unixTcpSocketMsg;
363     }u;
364 }SocketMsg_t;
365
366 typedef struct
367 {
368     UINT32 associationId;
369     vos_sock_info_t op;/*发送时索引到该字段*/
370     ULONG  usedFlag;
371 }SockInfoMng_t;
372
373
374
375 /*
376 1.非SOCKET msg 格式化为接口数据
377 2.SOCKET msg格式化为:SocketMsg_t数据+接口数据
378 */
379 typedef struct
380 {
381     UINT32   srcModuleId;
382     UINT32   dstModuleId;
383     UINT32   msgSap;
384     UINT32   msgCode;
385     UINT32   msgLen;
386     UINT8    msgBuf[MSG_MAX_BUFFER_LEN];
387 } ModuleMsg_t;
388
389
390
391 /** 采用非VOS通信方式的模块需要提供的额外参数 */
392 typedef struct
393 {
394     module_comm_type_t type;                ///< 通信方式
395     union{
396         vos_sockaddr_t addr;                ///< socket 通信
397         sctp_para_t    sctp;                ///< sctp   通信
398     }u;
399     receive_handler  recv_handle;           ///< 接收函数
400     LONG             maxClient;             ///< tcp server 允许的连接数
401     BOOL             soloMode;              ///< 如果为真,则单独创建接收线程;如果为假,则由 VOS socket代理任务负责接收
402     LONG             fdIdx;                 ///< 无需关心
403 }CommunicatePara_t;
404
405
406 /***********************************************************************************************************
407 *********************************************protocol info strcut ******************************************
408 ************************************************************************************************************/
409
410 /*********************************** Mib_t ***************************************/
411 typedef enum mibSubCarrierSpacingCommon
412 {
413     MIB_subCarrierSpacingCommon_scs15or60   = 0,
414     MIB_subCarrierSpacingCommon_scs30or120  = 1
415 } MibSubCarrierSpacingCommon_e;
416
417 typedef enum mibDmrsTypeaPosition
418 {
419     MIB_dmrs_TypeA_Position_pos2    = 0,
420     MIB_dmrs_TypeA_Position_pos3    = 1
421 } MibDmrsTypeaPosition_e;
422
423 typedef enum mibCellBarred
424 {
425     MIB_cellBarred_barred   = 0,
426     MIB_cellBarred_notBarred    = 1
427 } MibCellBarred_e;
428
429 typedef enum mibIntraFreqReselection
430 {
431     MIB_intraFreqReselection_allowed    = 0,
432     MIB_intraFreqReselection_notAllowed = 1
433 } MibIntraFreqReselection_e;
434
435 typedef enum
436 {
437     mibCellBarredBarred = 0,
438     mibCellBarredNotBarred = 1
439 } CellBarred_e;
440
441 typedef enum
442 {
443     mibIntraFreqReselectionAllowed = 0,
444     mibIntraFreqReselectionNotAllowed = 1
445 } IntraFreqReselection_e;
446
447 typedef struct PDCCHConfigSIB1
448 {
449     UINT8          controlResourceSetZero;
450     UINT8          searchSpaceZero;
451
452 }PDCCHConfigSIB1_t;
453
454 typedef struct mib
455 {
456     UINT8                               systemFrameNumber;
457     MibSubCarrierSpacingCommon_e        subCarrierSpacingCommon;
458     UINT8                               ssbSubcarrierOffset;
459     MibDmrsTypeaPosition_e              dmrsTypeaPosition;
460     UINT8                               searchSpaceZero;
461     UINT8                               controlResourceSetZero;
462     CellBarred_e                        cellBarred;
463     IntraFreqReselection_e              intraFreqReselection;
464
465 }Mib_t;
466
467 typedef struct macCellCfgPara_s
468 {
469         UINT32  nSSBAbsFre;//
470         UINT16  PCI;//
471 }macCellCfgPara_t;
472
473 /*********************************** SIB1_t ***************************************/
474 typedef enum connEstFailureControlCount
475 {
476     NR_ConnEstFailureControl__connEstFailCount_n1  = 0,
477     NR_ConnEstFailureControl__connEstFailCount_n2  = 1,
478     NR_ConnEstFailureControl__connEstFailCount_n3  = 2,
479     NR_ConnEstFailureControl__connEstFailCount_n4  = 3
480 } ConnEstFailureControlCount_e;
481
482 typedef enum connEstFailureControlOffsetValidity
483 {
484     NR_ConnEstFailureControl__connEstFailOffsetValidity_s30    = 0,
485     NR_ConnEstFailureControl__connEstFailOffsetValidity_s60    = 1,
486     NR_ConnEstFailureControl__connEstFailOffsetValidity_s120   = 2,
487     NR_ConnEstFailureControl__connEstFailOffsetValidity_s240   = 3,
488     NR_ConnEstFailureControl__connEstFailOffsetValidity_s300   = 4,
489     NR_ConnEstFailureControl__connEstFailOffsetValidity_s420   = 5,
490     NR_ConnEstFailureControl__connEstFailOffsetValidity_s600   = 6,
491     NR_ConnEstFailureControl__connEstFailOffsetValidity_s900   = 7
492 } ConnEstFailureControlOffsetValidity_e;
493
494 #define     CONN_EST_FAILOFFSET               (1<<0)
495 typedef struct connEstFailCtrl
496 {
497     UINT16                                   bitMask;
498         ConnEstFailureControlCount_e                     connEstFailCount;
499         ConnEstFailureControlOffsetValidity_e    connEstFailOffsetValidity;
500         UINT8                                                                    connEstFailOffset;         /*option*/
501 } ConnEstFailCtrl_t;
502
503 typedef enum timerT300
504 {
505     NR_UE_TimersAndConstants__t300_ms100   = 0,
506     NR_UE_TimersAndConstants__t300_ms200   = 1,
507     NR_UE_TimersAndConstants__t300_ms300   = 2,
508     NR_UE_TimersAndConstants__t300_ms400   = 3,
509     NR_UE_TimersAndConstants__t300_ms600   = 4,
510     NR_UE_TimersAndConstants__t300_ms1000  = 5,
511     NR_UE_TimersAndConstants__t300_ms1500  = 6,
512     NR_UE_TimersAndConstants__t300_ms2000  = 7
513 } TimerT300_e;
514
515 typedef enum timerT301
516 {
517     NR_UE_TimersAndConstants__t301_ms100   = 0,
518     NR_UE_TimersAndConstants__t301_ms200   = 1,
519     NR_UE_TimersAndConstants__t301_ms300   = 2,
520     NR_UE_TimersAndConstants__t301_ms400   = 3,
521     NR_UE_TimersAndConstants__t301_ms600   = 4,
522     NR_UE_TimersAndConstants__t301_ms1000  = 5,
523     NR_UE_TimersAndConstants__t301_ms1500  = 6,
524     NR_UE_TimersAndConstants__t301_ms2000  = 7
525 } TimerT301_e;
526
527 typedef enum timerT310
528 {
529     NR_UE_TimersAndConstants__t310_ms0     = 0,
530     NR_UE_TimersAndConstants__t310_ms50    = 1,
531     NR_UE_TimersAndConstants__t310_ms100   = 2,
532     NR_UE_TimersAndConstants__t310_ms200   = 3,
533     NR_UE_TimersAndConstants__t310_ms500   = 4,
534     NR_UE_TimersAndConstants__t310_ms1000  = 5,
535     NR_UE_TimersAndConstants__t310_ms2000  = 6
536 } TimerT310_e;
537
538 typedef enum timerN310
539 {
540     NR_UE_TimersAndConstants__n310_n1  = 0,
541     NR_UE_TimersAndConstants__n310_n2  = 1,
542     NR_UE_TimersAndConstants__n310_n3  = 2,
543     NR_UE_TimersAndConstants__n310_n4  = 3,
544     NR_UE_TimersAndConstants__n310_n6  = 4,
545     NR_UE_TimersAndConstants__n310_n8  = 5,
546     NR_UE_TimersAndConstants__n310_n10 = 6,
547     NR_UE_TimersAndConstants__n310_n20 = 7
548 } TimerN310_e;
549
550 typedef enum timerT311
551 {
552     NR_UE_TimersAndConstants__t311_ms1000  = 0,
553     NR_UE_TimersAndConstants__t311_ms3000  = 1,
554     NR_UE_TimersAndConstants__t311_ms5000  = 2,
555     NR_UE_TimersAndConstants__t311_ms10000 = 3,
556     NR_UE_TimersAndConstants__t311_ms15000 = 4,
557     NR_UE_TimersAndConstants__t311_ms20000 = 5,
558     NR_UE_TimersAndConstants__t311_ms30000 = 6
559 } TimerT311_e;
560
561 typedef enum timerN311
562 {
563     NR_UE_TimersAndConstants__n311_n1  = 0,
564     NR_UE_TimersAndConstants__n311_n2  = 1,
565     NR_UE_TimersAndConstants__n311_n3  = 2,
566     NR_UE_TimersAndConstants__n311_n4  = 3,
567     NR_UE_TimersAndConstants__n311_n5  = 4,
568     NR_UE_TimersAndConstants__n311_n6  = 5,
569     NR_UE_TimersAndConstants__n311_n8  = 6,
570     NR_UE_TimersAndConstants__n311_n10 = 7
571 } TimerN311_e;
572
573 typedef enum timerT319
574 {
575     NR_UE_TimersAndConstants__t319_ms100   = 0,
576     NR_UE_TimersAndConstants__t319_ms200   = 1,
577     NR_UE_TimersAndConstants__t319_ms300   = 2,
578     NR_UE_TimersAndConstants__t319_ms400   = 3,
579     NR_UE_TimersAndConstants__t319_ms600   = 4,
580     NR_UE_TimersAndConstants__t319_ms1000  = 5,
581     NR_UE_TimersAndConstants__t319_ms1500  = 6,
582     NR_UE_TimersAndConstants__t319_ms2000  = 7
583 } TimerT319_e;
584
585 typedef struct ueTimersAndConstants {
586     TimerT300_e  t300;
587     TimerT301_e  t301;
588     TimerT310_e  t310;
589     TimerN310_e  n310;
590     TimerT311_e  t311;
591     TimerN311_e  n311;
592     TimerT319_e  t319;
593 } UETimersAndConstants_t;
594
595
596
597
598
599 #define      CELL_RESERVED_FOR_OTHERUSE     (1<<0)
600 typedef struct  cellAccessInfo
601 {
602     UINT16                  bitMask;
603     UINT16                  plmnInfoNum;
604     PlmnInformation_t       plmnInfo[MAX_PLMN];
605     BOOL                    cellReservedForOtherUse;    /*option*/
606
607 } CellAccessInfo_t;
608
609 #define    RA_ASSOCIATION_PERIOD_INDEX         (1<<0)
610 #define    RA_SSB_OCCASION_MASK_INDEX          (1<<1)
611 typedef struct  siReqRes
612 {
613     UINT16                  bitMask;
614     UINT8                   raPreambleStartIndex;
615     UINT8                   raAssociationPeriodIndex;   /*option*/
616     UINT8                   raSsbOccasionMaskIndex;     /*option*/
617
618 } SiReqRes_t;
619
620 #define    PRACH_CONFIGURATION_INDEX         (1<<0)
621 #define    MSG1_FDM                          (1<<1)
622 #define    MSG1_FREQUENCYSTART               (1<<2)
623 #define    ZERO_COR_RELATION_ZONECONFIG      (1<<3)
624 #define    PREAMBLE_RECEIVED_TARGETPOWER     (1<<4)
625 #define    PREAMBLE_TRANS_MAX                (1<<5)
626 #define    POWER_RAMPING_STEP                (1<<6)
627 #define    RA_RESPONSE_WINDOW                (1<<7)
628
629 #define    SI_REQUEST_PERIOD                 (1<<8)
630 typedef struct  siRequestConfig
631 {
632     UINT16                  bitMask;
633     UINT8                   prach_ConfigurationIndex;       /*option*/
634     UINT8                   msg1_FDM;                       /*option*/
635     UINT16                  msg1_FrequencyStart;            /*option*/
636     UINT8                   zeroCorrelationZoneConfig;      /*option*/
637     INT16                   preambleReceivedTargetPower;    /*option*/
638     UINT8                   preambleTransMax;               /*option*/
639     UINT8                   powerRampingStep;               /*option*/
640     UINT8                   raResponseWindow;               /*option*/
641     UINT8                   ssbPerRachOccasion;
642     UINT8                   siRequestPeriod;                /*option*/
643     UINT16                  siRequestResourcesNum;
644     SiReqRes_t              siRequestResources[MAX_SI_MESSAGE];
645 } SiRequestConfig_t;
646
647 typedef enum schInfoSiPeriod
648 {
649     NR_SchedulingInfo__si_Periodicity_rf8  = 0,
650     NR_SchedulingInfo__si_Periodicity_rf16 = 1,
651     NR_SchedulingInfo__si_Periodicity_rf32 = 2,
652     NR_SchedulingInfo__si_Periodicity_rf64 = 3,
653     NR_SchedulingInfo__si_Periodicity_rf128    = 4,
654     NR_SchedulingInfo__si_Periodicity_rf256    = 5,
655     NR_SchedulingInfo__si_Periodicity_rf512    = 6
656 } SchInfoSiPeriod_e;
657
658 typedef enum sibType
659 {
660     NR_SIB_TypeInfo__type_sibType2 = 0,
661     NR_SIB_TypeInfo__type_sibType3 = 1,
662     NR_SIB_TypeInfo__type_sibType4 = 2,
663     NR_SIB_TypeInfo__type_sibType5 = 3,
664     NR_SIB_TypeInfo__type_sibType6 = 4,
665     NR_SIB_TypeInfo__type_sibType7 = 5,
666     NR_SIB_TypeInfo__type_sibType8 = 6,
667     NR_SIB_TypeInfo__type_sibType9 = 7
668 } SibType_e;
669
670 typedef enum sibAreaScope
671 {
672     NR_SIB_TypeInfo__areaScope_true    = 0
673 } SibAreaScope_e;
674
675 #define         VALUE_TAG       (1<<0)
676 #define         AREA_SCOPE      (1<<1)
677
678 typedef struct sibTypeInfo
679 {
680     UINT16              bitMask;
681     SibType_e           type;
682     UINT8               valueTag;       /*option*/
683     SibAreaScope_e      areaScope;      /*option*/
684 } SibTypeInfo_t;
685
686 typedef struct  siSchInfo
687 {
688
689     BOOL                    siBroadcastStatus;
690     SchInfoSiPeriod_e       siPeriodicity;
691     UINT16                  sibMappingNum;
692     SibTypeInfo_t           sibMapping[MAX_SIB];
693
694 } SiSchInfo_t;
695
696 typedef enum nrControlResourceSet_cce_REG_MappingType_PR
697 {
698         NrControlResourceSet_cce_REG_MappingType_PR_NOTHING,    /* No components present */
699         NrControlResourceSet_cce_REG_MappingType_PR_interleaved,
700         NrControlResourceSet_cce_REG_MappingType_PR_nonInterleaved
701 } NrControlResourceSet_cce_REG_MappingType_PR;
702
703 #define MAC_TCI_STATEID      64
704 #define NrControlResourceSetShiftIndexChosen      0x1
705 #define NrControlResourceSetTciPresentInDciChosen 0x2
706 #define NrControlResourceSetDmrsScramblingIDChosen 0x4
707 typedef struct  nrControlResourceSet
708 {
709     UINT16                 bitmask;
710     long                   controlResourceSetId;
711     UINT64                   frequencyDomainResources;
712         long                   duration;
713         NrControlResourceSet_cce_REG_MappingType_PR present;
714         union ControlResourceSet_cce_REG_MappingType_u
715         {
716                 struct ControlResourceSet_cce_REG_MappingType_interleaved
717                 {
718                         long     reg_BundleSize;
719                         long     interleaverSize;
720                         long     shiftIndex;        /* OPTIONAL */
721                 } nrInterleaved;
722                 int      nonInterleaved;
723         } choice;
724         long                   precoderGranularity;
725         UINT8                  tciPdcchToAddListNum;
726         long                   tciStateIdAddList[MAC_TCI_STATEID];
727         UINT8                  tciPdcchToReleaseListNum;
728         long                   tciStateIdReleaseList[MAC_TCI_STATEID];
729         long                   tci_PresentInDCI;                /* OPTIONAL */
730         long                   pdcch_DMRS_ScramblingID;         /* OPTIONAL */
731 } NrControlResourceSet_t;
732
733 typedef struct nrofCandidates
734 {
735     long     aggregationLevel1;
736     long     aggregationLevel2;
737     long     aggregationLevel4;
738     long     aggregationLevel8;
739     long     aggregationLevel16;
740 } NrofCandidates_t;
741
742 typedef enum nrSearchSpace_searchSpaceType_PR {
743         NrSearchSpace_searchSpaceType_PR_NOTHING,       /* No components present */
744         NrSearchSpace_searchSpaceType_PR_common,
745         NrSearchSpace_searchSpaceType_PR_ue_Specific
746 } NrSearchSpace_searchSpaceType_PR;
747
748 #define NrSearchSpaceTypeCommonDciFormat0_0_AndFormat1_0_Presence       1
749 #define NrSearchSpaceTypeCommonDci_Format2_0_Presence   2
750 #define NrSearchSpaceTypeCommonDci_Format2_1_Presence   4
751 #define NrSearchSpaceTypeCommonDci_Format2_2_Presence   8
752 #define NrSearchSpaceTypeCommonDci_Format2_3_Presence   16
753 typedef struct nrSearchSpaceType
754 {
755     NrSearchSpace_searchSpaceType_PR present;
756     union SearchSpace_searchSpaceType_u
757     {
758         struct SearchSpace_searchSpaceType_common
759         {
760                         UINT16                                                   bitMask;
761                         struct SearchSpace_searchSpaceType_common_dci_Format0_0_AndFormat1_0
762                         {
763                         } dci_Format0_0_AndFormat1_0;//option
764
765             struct SearchSpace_searchSpaceType_common_dci_Format2_0
766             {
767 #define NrSearchSpaceTypeAggLevel1Chosen  1
768 #define NrSearchSpaceTypeAggLevel2Chosen  2
769 #define NrSearchSpaceTypeAggLevel4Chosen  4
770 #define NrSearchSpaceTypeAggLevel8Chosen  8
771 #define NrSearchSpaceTypeAggLevel16Chosen 16
772
773                                 UINT8   bitMask;
774                 long    aggregationLevel1;  /* OPTIONAL */
775                 long    aggregationLevel2;  /* OPTIONAL */
776                 long    aggregationLevel4;  /* OPTIONAL */
777                 long    aggregationLevel8;  /* OPTIONAL */
778                 long    aggregationLevel16; /* OPTIONAL */
779             } dci_Format2_0;//optional
780
781                         struct SearchSpace_searchSpaceType_common_dci_Format2_1
782                         {
783                         } dci_Format2_1;//optional
784
785                         struct SearchSpace_searchSpaceType_common_dci_Format2_2
786                         {
787                         } dci_Format2_2;//optional
788
789             struct NrSearchSpace_searchSpaceType_common_dci_Format2_3
790             {
791 #define NrSearchSpaceTypeDciFormat2_3Dummy1Chosen     1
792                                 UINT8   bitMask;
793                 long     dummy1; /* OPTIONAL */
794                 long     dummy2;
795             } dci_Format2_3;//optional
796         } common;
797      struct SearchSpace_searchSpaceType_specific
798      {
799         long     dci_Formats;
800      }specific;
801
802     } choice;
803 }NrSearchSpaceType_t;
804
805 typedef enum nrSearchSpaceMonitoringSlotPeriodicityAndOffset_PR
806 {
807         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_NOTHING,    /* No components present */
808         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl1,
809         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl2,
810         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl4,
811         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl5,
812         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl8,
813         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl10,
814         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl16,
815         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl20,
816         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl40,
817         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl80,
818         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl160,
819         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl320,
820         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl640,
821         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl1280,
822         NrSearchSpace_monitoringSlotPeriodicityAndOffset_PR_sl2560
823 } NrSearchSpaceMonitoringSlotPeriodicityAndOffset_PR;
824
825 #define NrSearchSpaceControlResIdChosen             0x1
826 #define NrSearchSpaceMonSlotPeriodAndOddsetChosen   0x2
827 #define NrSearchSpaceDurationChosen                 0x4
828 #define MONITORING_SYMBOLS_WITHIN_SLOT                 0x08
829 typedef struct  nrSearchSpace
830 {
831     UINT16                 bitmask;
832         long                       searchSpaceId;
833         long                   controlResourceSetId;    /* OPTIONAL */
834
835         struct SearchSpaceMonitoringSlotPeriodicityAndOffset
836         {
837                 NrSearchSpaceMonitoringSlotPeriodicityAndOffset_PR present;
838                 union SearchSpaceMonitoringSlotPeriodicityAndOffset_u
839                 {
840                         int          sl1;
841                         long     sl2;
842                         long     sl4;
843                         long     sl5;
844                         long     sl8;
845                         long     sl10;
846                         long     sl16;
847                         long     sl20;
848                         long     sl40;
849                         long     sl80;
850                         long     sl160;
851                         long     sl320;
852                         long     sl640;
853                         long     sl1280;
854                         long     sl2560;
855                 } choice;
856         } monitoringSlotPeriodicityAndOffset;/* OPTIONAL */
857
858         long                   duration;        /* OPTIONAL */
859         UINT16                 monitoringSymbolsWithinSlot;     /* OPTIONAL */
860         NrofCandidates_t       nrofCandidates;
861         NrSearchSpaceType_t    searchSpaceType;
862 } NrSearchSpace_t;
863
864 #define MAX_SEARCHSPACE_NUM   4
865
866 #define PdcchCfgCommonCtrlResSetZeroChosen    1
867 #define PdcchCfgCommonCtrlResSetChosen        2
868 #define PdcchCfgCommonSearchSpaceZeroChosen   4
869 #define PdcchCfgCommonSearchSpaceSIB1Chosen   8
870 #define PdcchCfgCommonSearchSpaceOtherSysInfoChosen   16
871 #define PdcchCfgCommonPagingSearchSpaceChosen 32
872 #define PdcchCfgCommonRaSearchSpaceChosen     64
873
874 typedef struct PDCCHCfgCommon
875 {
876
877     UINT16                 bitmask;
878     long                   controlResourceSetZero;                  /* OPTIONAL */
879     NrControlResourceSet_t commonControlResourceSet;            /* OPTIONAL */
880     long                   searchSpaceZero;                         /* OPTIONAL */
881     UINT8                  searchSpaceNum;
882     NrSearchSpace_t        searchSpace[MAX_SEARCHSPACE_NUM];
883
884         long                   searchSpaceSIB1;                     /* OPTIONAL */
885         long                   searchSpaceOtherSystemInformation;       /* OPTIONAL */
886         long                   pagingSearchSpace;                       /* OPTIONAL */
887         long                   raSearchSpace;                       /* OPTIONAL */
888 }Pdcch_Cfg_Common_t;
889
890 typedef enum setup_Release_PDCCH_PR
891 {
892         Setup_Release_PDCCH_PR_NOTHING, /* No components present */
893         Setup_Release_PDCCH_PR_release,
894         Setup_Release_PDCCH_PR_setup
895
896 }Setup_Release_PDCCH_PR;
897 typedef struct  pdcchCfgCommon
898 {
899     Setup_Release_PDCCH_PR present;
900     union Setup_Release_PDCCH_PR_u {
901             UINT32 release;
902             Pdcch_Cfg_Common_t setup;
903
904     }choice;
905
906 } PdcchCfgCommon_t;
907
908 /* PUCCH-ConfigCommon */
909 #define PucchCfgCommonResourceCommonChosen    1
910 #define PucchCfgCommonHoppingIdChosen         2
911 #define PucchCfgCommonP0NominalChosen         4
912 typedef struct nrPucch_ConfigCommon
913 {
914     UINT16                 bitmask;
915     long                       pucchResourceCommon;     /* OPTIONAL */
916     long                       pucchGroupHopping;
917     long                       hoppingId;       /* OPTIONAL */
918     long                       p0Nominal;       /* OPTIONAL */
919 }NrPucch_ConfigCommon_t;
920
921 typedef enum nrPucchCfgCommon_PR
922 {
923         NrPucchCfgCommon_PR_NOTHING,    /* No components present */
924         NrPucchCfgCommon_PR_release,
925         NrPucchCfgCommon_PR_setup
926 }NrPucchCfgCommon_PR;
927
928 typedef struct nrPucchCfgCommon
929 {
930
931         NrPucchCfgCommon_PR present;
932         union NrPucchCfgCommon_u {
933                 int      release;
934                 NrPucch_ConfigCommon_t   setup;
935         } choice;
936
937 } NrPucchCfgCommon_t;
938
939 #define PdschTimeDomainAllockOChosen    1
940 typedef struct  pdschTimeDomainAlloc
941 {
942     UINT16                 bitmask;
943         long                   k0;      /* OPTIONAL */
944         long                   mappingType;
945         long                   startSymbolAndLength;
946 } PdschTimeDomainAlloc_t;
947
948 #define PuschTimeDomainAllock2Chosen    1
949 typedef struct  puschTimeDomainAlloc
950 {
951     UINT16                 bitmask;
952         long                   k2;      /* OPTIONAL */
953         long                   mappingType;
954         long                   startSymbolAndLength;
955 } PuschTimeDomainAlloc_t;
956
957
958 #define MAX_TIME_DOMAIN_NUM    16
959 #define PdschTimeDomainAllocationChose   (1 << 0)
960 typedef struct  pdsch_Cfg_Common_t
961 {
962       UINT16                 bitmask;
963       UINT8                  timeDomainNum;
964       PdschTimeDomainAlloc_t pdschTimeDomainAllocation[MAX_TIME_DOMAIN_NUM];  /* OPTIONAL */
965 } Pdsch_Cfg_Common_t;
966
967 typedef enum setup_Release_PDSCH_PR
968 {
969         Setup_Release_PDSCH_PR_NOTHING, /* No components present */
970         Setup_Release_PDSCH_PR_release,
971         Setup_Release_PDSCH_PR_setup
972 }Setup_Release_PDSCH_PR;
973
974 typedef struct  pdschCfgCommon
975 {
976     Setup_Release_PDSCH_PR present;
977     union Setup_Release_PDSCH_PR_u {
978             UINT32 release;
979             Pdsch_Cfg_Common_t setup;
980
981     }choice;
982
983 } PdschCfgCommon_t;
984
985 typedef struct  nrBWP
986 {
987     UINT16      locationAndBandwidth;
988     UINT8       subcarrierSpacing;
989     /*UINT8     cyclicPrefix;      extension*/
990 } NrBWP_t;
991
992 #define NrBwpDownLinkCommonPdcchCfgChosen  0x1
993 #define NrBwpDownLinkCommonPdschCfgChosen  0x2
994 typedef struct  nrBwpDownLinkCommon
995 {
996     UINT16                 bitmask;
997     NrBWP_t                bwp;
998     PdcchCfgCommon_t       pdcchCfgCommon;      /* OPTIONAL */
999     PdschCfgCommon_t       pdschCfgCommon;      /* OPTIONAL */
1000 } NrBwpDownLinkCommon_t;
1001
1002 #define      ADDITIONAL_PMAX     (1<<0)
1003 typedef struct  pmaxValue
1004 {
1005     UINT16                  bitMask;
1006     INT8                    additionalPmax;             /*option*/
1007     UINT16                  additionalSpectrumEmission;
1008 } PmaxValue_t;
1009
1010 #define     FREQ_BAND_INDICATOR_NR         (1<<0)
1011 #define     PMAX_LIST                      (1<<1)
1012 typedef struct  nrMultiBand
1013 {
1014     UINT16                  bitMask;
1015     UINT16                  freqBandIndicatorNR;        /*option*/
1016     UINT16                  pmaxListNum;
1017     PmaxValue_t             pmaxList[MAX_NR_NS_PMAX];   /*option*/
1018 } NrMultiBand_t;
1019
1020 typedef struct  specificCarrier
1021 {
1022     UINT16                     offsetToCarrier;
1023     UINT8                      subcarrierSpacing;
1024     UINT16                     carrierBandwidth;
1025     /*UINT16                   txDirectCurrentLocation_v1530;  extension*/
1026
1027 } SpecificCarrier_t;
1028
1029 #define     ABSOLUTE_FREQUENCY_POINTA     (1<<0)
1030 #define     PMAX                          (1<<1)
1031
1032 typedef struct  freqInfoUlSib
1033 {
1034     UINT16                  bitMask;
1035     UINT16                  nrMulBandNum;
1036     NrMultiBand_t           nrMulBand[MAX_MULTI_BANDS];
1037     UINT32                  absoluteFrequencyPointA;        /*option*/
1038     UINT16                  speCarrierNum;
1039     SpecificCarrier_t           speCarrier[MAX_SCS];
1040         INT8                                    pMax;                           /*option*/
1041         /*UINT8                                 frequencyShift7p5khz;           extension*/
1042 } FreqInfoUlSib_t;
1043
1044 /* RACH-ConfigGeneric */
1045 typedef struct nrRachCfgGeneric_t
1046 {
1047         long     prach_ConfigurationIndex;
1048         long     msg1_FDM;
1049         long     msg1_FrequencyStart;
1050         long     zeroCorrelationZoneConfig;
1051         long     preambleReceivedTargetPower;
1052         long     preambleTransMax;
1053         long     powerRampingStep;
1054         long     ra_ResponseWindow;
1055 } NrRachCfgGeneric_t;
1056
1057 typedef enum nrRachCfgCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB
1058 {
1059         NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING,       /* No components present */
1060         NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth,
1061         NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth,
1062         NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf,
1063         NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one,
1064         NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two,
1065         NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four,
1066         NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight,
1067         NrRACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen
1068 } NrRachCfgCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_e;
1069 typedef enum nrRachCfgCommonPrachRootSequenceIndex
1070 {
1071         NrRACH_ConfigCommon_prach_RootSequenceIndex_PR_NOTHING, /* No components present */
1072         NrRACH_ConfigCommon_prach_RootSequenceIndex_PR_l839,
1073         NrRACH_ConfigCommon_prach_RootSequenceIndex_PR_l139
1074 } NrRachCfgCommonPrachRootSequenceIndex_e;
1075
1076 #define NrRachCfgCommonTotalNumberOfRaChosen        (1<<0)
1077 #define NrRachCfgCommongroupBconfiguredChosen       (1<<1)
1078 #define NrRachCfgCommonRsrpThresholdSSBChosen       (1<<2)
1079 #define NrRachCfgCommonRsrpThresholdSSBSulChosen    (1<<3)
1080 #define NrRachCfgCommonMsg1SubcarrierSpacingChosen  (1<<4)
1081 #define NrRachCfgCommonMsg3TransformPrecoderChosen  (1<<5)
1082 #define NrRachCfgCommonGroupBconfigChosen                       32
1083 typedef struct RACH_Config_Common
1084 {
1085     UINT16                 bitmask;
1086         NrRachCfgGeneric_t         rachCfgGeneric;
1087         long                   totalNumberOfRA_Preambles;       /* OPTIONAL */
1088         struct RACH_ConfigCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB
1089         {
1090                 NrRachCfgCommon_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_e present;
1091                 union ssbPerRachOccAndCBPreamblesPerSSB_u
1092                 {
1093                         long     oneEighth;
1094                         long     oneFourth;
1095                         long     oneHalf;
1096                         long     one;
1097                         long     two;
1098                         long     four;
1099                         long     eight;
1100                         long     sixteen;
1101                 } choice;
1102         } ssbPerRachOccAndCBPreamblesPerSSB;
1103
1104         struct rachCfgCommonGroupBconfigured
1105         {
1106                 long     ra_Msg3SizeGroupA;
1107                 long     messagePowerOffsetGroupB;
1108                 long     numberOfRA_PreamblesGroupA;
1109         } groupBconfigured;/* OPTIONAL */
1110
1111         long            ra_ContentionResolutionTimer;
1112         long            rsrp_ThresholdSSB;      /* OPTIONAL */
1113         long            rsrp_ThresholdSSB_SUL;  /* OPTIONAL */
1114         struct rachCfgCommonPrachRootSequenceIndex
1115         {
1116                 NrRachCfgCommonPrachRootSequenceIndex_e present;
1117                 union rachCfgCommonPrachRootSequenceIndex_u
1118                 {
1119                         long     l839;
1120                         long     l139;
1121                 } choice;
1122         } prachRootSequenceIndex;
1123         long     msg1_SubcarrierSpacing;/* OPTIONAL */
1124         long     restrictedSetConfig;
1125         long     msg3_transformPrecoder;/* OPTIONAL */
1126
1127 }rACH_Config_Common_t;
1128 typedef enum setup_Release_903P7_PR
1129 {
1130         NrRachCfgCommon_PR_NOTHING,     /* No components present */
1131         NrRachCfgCommon_PR_release,
1132         NrRachCfgCommon_PR_setup
1133 }NrRachCfgCommon_PR;
1134
1135 typedef struct nrRachCfgCommon
1136 {
1137         NrRachCfgCommon_PR present;
1138         union NrRachCfgCommon_PR_u {
1139                 int      release;
1140                 rACH_Config_Common_t     setup;
1141         } choice;
1142 } NrRachCfgCommon_t;
1143
1144 /* PUSCH-ConfigCommon */
1145 #define NrPuschCfgCommonGroupHoppingChosen    1
1146 #define NrPuschCfgCommonMsg3DeltaChosen       2
1147 #define NrPuschCfgCommonPoNominalChosen       4
1148 #define NrPuschCfgCommonpuschTimeDomainAllocationChosen       8
1149
1150 typedef struct nrPusch_ConfigCommon
1151 {
1152     UINT16                 bitmask;
1153         long                   groupHoppingEnabledTransformPrecoding;   /* OPTIONAL */
1154     long                       msg3DeltaPreamble;       /* OPTIONAL */
1155         long                   p0NominalWithGrant;      /* OPTIONAL */
1156     UINT8                  timeDomainNum;
1157     PuschTimeDomainAlloc_t puschTimeDomainAllocation[MAX_TIME_DOMAIN_NUM]; /* OPTIONAL */
1158
1159 }NrPusch_ConfigCommon_t;
1160
1161 typedef enum
1162 {
1163         NrPuschCfgCommon_PR_NOTHING,    /* No components present */
1164         NrPuschCfgCommon_PR_release,
1165         NrPuschCfgCommon_PR_setup
1166 }NrPuschCfgCommon_PR;
1167 typedef struct nrPuschCfgCommon
1168 {
1169         NrPuschCfgCommon_PR present;
1170         union NrPuschCfgCommon_u {
1171                 int      release;
1172                 NrPusch_ConfigCommon_t   setup;
1173         } choice;
1174
1175 } NrPuschCfgCommon_t;
1176
1177 #define InitialUlBwpRachCfgChosen     1
1178 #define InitialUlBwpPuschCfgChosen    2
1179 #define InitialUlBwpPucchCfgChosen    4
1180 typedef struct  initialUlBwp
1181 {
1182     UINT16                 bitmask;
1183     NrBWP_t                bwp;
1184     NrRachCfgCommon_t      rachCfgCommon;       /* OPTIONAL */
1185         NrPuschCfgCommon_t         puschCfgCommon;      /* OPTIONAL */
1186         NrPucchCfgCommon_t         pucchCfgCommon;      /* OPTIONAL */
1187 } InitialUlBwp_t;
1188
1189 typedef struct  ulCfgCommonSIB
1190 {
1191     FreqInfoUlSib_t         frequencyInfoUL;
1192     InitialUlBwp_t          initialUplinkBWP;
1193     UINT8                   timeAlignmentTimerCommon;
1194 } UlCfgCommonSIB_t;
1195
1196 typedef struct  freqInfoDlSib
1197 {
1198     UINT16                  frequencyBandListNum;
1199     NrMultiBand_t           frequencyBandList[MAX_MULTI_BANDS];
1200     UINT16                  offsetToPointA;
1201     UINT16                  speCarrierNum;
1202         SpecificCarrier_t               speCarrier[MAX_SCS];
1203 } FreqInfoDlSib_t;
1204
1205 #define  FIRST_PDCCH_MONITORING_OCCASION_OF_PO_T  (1<<0)
1206 typedef enum
1207 {
1208         PagingFrameOffset_PR_NOTHING,   /* No components present */
1209         PagingFrameOffset_PR_oneT,
1210         PagingFrameOffset_PR_halfT,
1211         PagingFrameOffset_PR_quarterT,
1212         PagingFrameOffset_PR_oneEighthT,
1213         PagingFrameOffset_PR_oneSixteenthT,
1214 } PagingFrameOffset_e;
1215
1216 typedef enum
1217 {
1218     PDCCH_Monitoring_PR_NOTHING,   /* No components present */
1219     PDCCH_Monitoring_PR_sCS15KHZoneT,
1220     PDCCH_Monitoring_PR_sCS30KHZoneT_SCS15KHZhalfT,
1221     PDCCH_Monitoring_PR_sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT,
1222     PDCCH_Monitoring_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT,
1223     PDCCH_Monitoring_PR_sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT,
1224     PDCCH_Monitoring_PR_sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT,
1225     PDCCH_Monitoring_PR_sCS120KHZoneEighthT_SCS60KHZoneSixteenthT,
1226     PDCCH_Monitoring_PR_sCS120KHZoneSixteenthT,
1227 } FirstPDCCH_MonitoringOccasionOfPO_e;
1228
1229 #define  MAX_PDCCH_MONITORING_OCCASION   4
1230
1231 typedef struct  sCS15KHZoneT_s
1232 {
1233         UINT16             poNum;
1234         UINT16             firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
1235 }SCS15KHZoneT_t;
1236
1237 typedef struct  sCS30KHZoneT_SCS15KHZhalfT_s
1238 {
1239
1240         UINT16             poNum;
1241         UINT16             firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
1242
1243 }sCS30KHZoneT_SCS15KHZhalfT_t;
1244
1245 typedef struct  sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_s
1246 {
1247         UINT16             poNum;
1248         UINT16             firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
1249
1250 }sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_t;
1251
1252 typedef struct  sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_s
1253 {
1254         UINT16             poNum;
1255         UINT16             firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
1256
1257 }sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_t;
1258
1259 typedef struct  sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_s
1260 {
1261         UINT16             poNum;
1262         UINT16             firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
1263
1264 }sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_t;
1265
1266 typedef struct  sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_s
1267 {
1268         UINT16             poNum;
1269         UINT16             firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
1270
1271 }sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_t;
1272
1273 typedef struct  sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_s
1274 {
1275         UINT16             poNum;
1276         UINT16             firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
1277
1278 }sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_t;
1279
1280 typedef struct  sCS120KHZoneSixteenthT_s
1281 {
1282         UINT16             poNum;
1283         UINT16             firstMonitorOccasionOfPO[MAX_PDCCH_MONITORING_OCCASION];
1284
1285 }sCS120KHZoneSixteenthT_t;
1286
1287 #define FirstPDCCH_MonitoringOccasionOfpoChosen  (1 << 0)
1288 typedef struct  pcchConfig
1289 {
1290     UINT16         bitMask;
1291     UINT8          defaultPagingCycle;
1292
1293     struct PagingFrameOffset
1294     {   PagingFrameOffset_e                present;
1295         union PagingFrame {
1296         INT32          oneT;
1297         UINT8          halfT;
1298         UINT8          quarterT;
1299         UINT8          oneEighthT;
1300         UINT8          oneSixteenthT;
1301         }choice;
1302     }pagingFrameOffset_t;
1303     UINT8          ns;
1304     struct FirstPDCCH_MonitoringOccasionOfPO
1305     {   FirstPDCCH_MonitoringOccasionOfPO_e                present;
1306         union PDCCH_MonitoringOccasion {
1307
1308                         SCS15KHZoneT_t  SCS15KHZoneT;
1309                         sCS30KHZoneT_SCS15KHZhalfT_t sCS30KHZoneT_SCS15KHZhalfT;
1310                         sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT_t   sCS60KHZoneT_SCS30KHZhalfT_SCS15KHZquarterT;
1311                         sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT_t       sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT;
1312                         sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT_t      sCS120KHZhalfT_SCS60KHZquarterT_SCS30KHZoneEighthT_SCS15KHZoneSixteenthT;
1313                         sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT_t sCS120KHZquarterT_SCS60KHZoneEighthT_SCS30KHZoneSixteenthT;
1314                         sCS120KHZoneEighthT_SCS60KHZoneSixteenthT_t sCS120KHZoneEighthT_SCS60KHZoneSixteenthT;
1315                         sCS120KHZoneSixteenthT_t sCS120KHZoneSixteenthT;
1316         }choice;
1317     }firstPDCCH_MonitoringOccasionOfPO_t;    /*option*/
1318
1319 } PcchConfig_t;
1320
1321 typedef struct  dlCfgCommonSIB
1322 {
1323     FreqInfoDlSib_t          frequencyInfoDL;
1324     NrBwpDownLinkCommon_t    initialDownlinkBWP;
1325     UINT8                    modificationPeriodCoeff;
1326         PcchConfig_t                     pcchConfig;
1327 } DlCfgCommonSIB_t;
1328
1329 typedef struct  tddUlDlPattern
1330 {
1331     UINT8       dlULTransmissionPeriodicity;
1332     UINT16      nrofDownlinkSlots;
1333     UINT8       nrofDownlinkSymbols;
1334     UINT16      nrofUplinkSlots;
1335     UINT8       nrofUplinkSymbols;
1336     /*UINT8     dlULTransmissionPeriodicity_v1530;     extension*/
1337 } TddUlDlPattern_t;
1338
1339
1340 typedef struct  tddUlDlCfgCom
1341 {
1342     UINT8                    referenceSubcarrierSpacing;
1343     TddUlDlPattern_t         pattern1;
1344         /*TddUlDlPattern_t               pattern2;                                      extension*/
1345 } TddUlDlCfgCom_t;
1346
1347
1348 #define        UPLINK_CONFIG_COMMON         (1<<0)
1349 #define        SUPPLEMENTARY_UPLINK         (1<<1)
1350 #define        NTIMING_ADVANCE_OFFSET       (1<<2)
1351 #define        GROUP_PRESENCE               (1<<3)
1352 #define        TDD_ULDL_CFG_COMMON          (1<<4)
1353 typedef struct  servingCellCfg
1354 {
1355     UINT16                   bitMask;
1356     DlCfgCommonSIB_t         downlinkConfigCommon;
1357     UlCfgCommonSIB_t         uplinkConfigCommon;        /*option*/
1358     UlCfgCommonSIB_t         supplementaryUplink;       /*option*/
1359         UINT8                                    nTimingAdvanceOffset;      /*option*/
1360     UINT8                    inOneGroup;
1361     UINT8                    groupPresence;             /*option*/
1362     UINT8                    ssbPeriodServingCell;
1363     TddUlDlCfgCom_t          tddUlDlCfgCommon;          /*option*/
1364     INT8                     ssPBCHBlockPower;
1365 } ServingCellCfg_t;
1366
1367 typedef struct  uACBarringPerCat
1368 {
1369     UINT8                       accessCategory;
1370     UINT8                       uacBarringInfoSetIndex;
1371 } UACBarringPerCat_t;
1372
1373 #define UAC_AC_BARRING_LIST_TYPE  (1 << 0)
1374
1375 typedef enum UacAcBarringListType_PR {
1376         UacImplicitACBarringList_UacExplicitAcBarringListType_PR_NOTHING,       /* No components present */
1377         UacImplicitACBarringList_UacExplicitAcBarringListType_PR_UacImplicitACBarringList,
1378         UacImplicitACBarringList_UacExplicitAcBarringListType_PR_UacExplicitAcBarringList
1379 } UacImplicitACBarringList_UacExplicitAcBarringList_PR;
1380
1381
1382 typedef struct  uACBarringPerPLMN
1383 {
1384     UINT16                     bitMask;
1385     UINT8                      plmnIdentityIndex;
1386     UINT16                     BarringListNum;
1387     UacImplicitACBarringList_UacExplicitAcBarringList_PR  present;
1388     union UacAcBarringListType_u {
1389     UINT8                      uacImplicitACBarringList[MAX_ACCESS_CAT - 1];
1390     UACBarringPerCat_t         uacExplicitAcBarringList[MAX_ACCESS_CAT - 1];
1391     }choice;                                    /*option*/
1392 } UACBarringPerPLMN_t;
1393
1394 /***
1395 typedef struct  uACBarringPerPLMN
1396 {
1397     UINT8                      plmnIdentityIndex;
1398     UINT8                      present;
1399     UINT8                      uacImplicitACBarringList[MAX_ACCESS_CAT - 1];
1400     UACBarringPerCat_t         uacExplicitAcBarringList[MAX_ACCESS_CAT - 1];
1401
1402 } UACBarringPerPLMN_t;
1403
1404
1405 ***/
1406
1407
1408 typedef struct  uACBarringInfoSet
1409 {
1410     UINT8                   uacBarringFactor;
1411     UINT8                   uacBarringTime;
1412     UINT8                   uacBarringForAccessIdentity;
1413 } UACBarringInfoSet_t;
1414
1415 #define UAC_BARRING_FOR_COMMON                     (1 << 0)
1416 #define UAC_BARRING_PER_PLMN_LIST                  (1 << 1)
1417 #define UAC_INDIVIDUAL_PLMN_LIST                   (1 << 2)
1418 #define UAC_ACT1_ESCLECT_ASSISTANCE_INFO   (1 << 3)
1419
1420 typedef enum uac_AccessCategory1_SelectionAssistanceInfo_PR
1421 {
1422         uac_AccessCategory1_SelectionAssistanceInfo_nonthing,//guotingting
1423         uac_AccessCategory1_SelectionAssistanceInfo_plmnCommon,
1424     uac_AccessCategory1_SelectionAssistanceInfo_individualPLMNList
1425 } Uac_AccessCategory1_SelectionAssistanceInfo_PR;
1426
1427
1428 typedef struct  sib1UacBarringInfo
1429 {
1430     UINT16                  bitMask;
1431     UINT16                  uac_BarringForCommonNUM;
1432     UACBarringPerCat_t      uac_BarringForCommon[MAX_ACCESS_CAT - 1]; /*option*/
1433     UINT16                  uacBarringPerPLMNListNUM;
1434     UACBarringPerPLMN_t     uacBarringPerPLMNList[MAX_PLMN];          /*option*/
1435     UINT16                  uacBarringInfoSetListNUM;
1436     UACBarringInfoSet_t     uacBarringInfoSetList[MAX_BARRING_SET];
1437     Uac_AccessCategory1_SelectionAssistanceInfo_PR    present;
1438     UINT16                  individualPLMNListNUM;
1439     union uac_AccessCategory1_SelectionAssistanceInfo
1440     {
1441         UINT8                   plmnCommon;
1442         UINT8                   individualPLMNList[MAX_PLMN];
1443
1444     }choice;                                                         /*option*/
1445
1446 } Sib1UacBarringInfo_t;
1447
1448
1449
1450 #define Q_RXLEVMIN_OFFSETD        (1 << 0)
1451 #define Q_RXLEVMIN_SUL            (1 << 1)
1452 #define Q_QUAL_MIN                (1 << 2)
1453 #define Q_QUALMIN_OFFSET          (1 << 3)
1454 #define CONN_EST_FAILURE_CTRL     (1 << 4)
1455 #define SI_SCHE_LIST_PRESENCE     (1 << 5)
1456 #define SI_SCHEDUL_INFO           (1 << 6)
1457 #define SI_REQ_CFG                (1 << 7)
1458 #define SI_REQ_CFGSUL             (1 << 8)
1459 #define SYSTEM_INFORMATION_AREAID (1 << 9)
1460 #define SERVING_CELL_CFGCOMMON    (1 << 10)
1461 #define IMS_EMERGENCY_SUPPORT     (1 << 11)
1462 #define E_CALL_OVERIMS_SUPPORT    (1 << 12)
1463 #define UE_TIMERS_ANDCONSTS       (1 << 13)
1464 #define SIB1_UAC_BARINFO          (1 << 14)
1465 #define USEFULL_RESUMEID          (1 << 15)
1466
1467
1468 typedef struct sib1
1469 {
1470     UINT16                              bitMask;
1471     INT8                                qRxLevMin;
1472     UINT8                               qRxLevMinOffsetd;               /*option*/
1473     INT8                                qRxLevMinSUL;                   /*option*/
1474     INT8                                qQualMin;                       /*option*/
1475     UINT8                               qQualMinOffset;                 /*option*/
1476         CellAccessInfo_t                                        cellAccessRelateInfo;
1477         ConnEstFailCtrl_t                                       connEstFailureCtrl;             /*option*/
1478     UINT8                               siWindowLen;
1479         UINT16                                                          siNum;
1480     SiSchInfo_t                         siSchedulInfo[MAX_SI_MESSAGE];  /*option*/
1481     SiRequestConfig_t                   siReqCfg;                       /*option*/
1482     SiRequestConfig_t                   siReqCfgSul;                    /*option*/
1483     UINT32                              systemInformationAreaID;        /*option*/
1484         ServingCellCfg_t                                        servingCellCfgCommon;           /*option*/
1485     BOOL                                ims_EmergencySupport;           /*option*/
1486     BOOL                                eCallOverIMS_Support;           /*option*/
1487     UETimersAndConstants_t              ueTimersAndConsts;              /*option*/
1488     Sib1UacBarringInfo_t                sib1UacBarInfo;                 /*option*/
1489     BOOL                                useFullResumeID;                /*option*/
1490 }Sib1_t;
1491
1492 /**********************        Sib2_t       ************************/
1493 typedef enum cmSib2QHyst
1494 {
1495         qHystdB0        = 0,
1496         qHystdB1        = 1,
1497         qHystdB2        = 2,
1498         qHystdB3        = 3,
1499         qHystdB4        = 4,
1500         qHystdB5        = 5,
1501         qHystdB6        = 6,
1502         qHystdB8        = 7,
1503         qHystdB10       = 8,
1504         qHystdB12       = 9,
1505         qHystdB14       = 10,
1506         qHystdB16       = 11,
1507         qHystdB18       = 12,
1508         qHystdB20       = 13,
1509         qHystdB22       = 14,
1510         qHystdB24       = 15
1511 }CmSib2QHyst_e;
1512
1513
1514 typedef enum cmSib2SfMedium
1515 {
1516         qHystSFdBMedium0        = 0,
1517         qHystSFdBMedium2        = 1,
1518         qHystSFdBMedium4        = 2,
1519         qHystSFdBMedium6        = 3
1520 }CmSib2SfMedium_e;
1521
1522 typedef enum cmSib2SfHigh
1523 {
1524         qHystSFdBHigh0          = 0,
1525         qHystSFdBHigh2          = 1,
1526         qHystSFdBHigh4          = 2,
1527         qHystSFdBHigh6          = 3
1528 }CmSib2SfHigh_e;
1529
1530 typedef struct cmSib2QHystSf
1531 {
1532         CmSib2SfMedium_e        sfMedium;
1533         CmSib2SfHigh_e          sfHigh;
1534 }CmSib2QHystSf_t;
1535
1536
1537 typedef enum cmSib2TEvaluation
1538 {
1539         tEvaluationS30          = 0,
1540         tEvaluationS60          = 1,
1541         tEvaluationS120         = 2,
1542         tEvaluationS180         = 3,
1543         tEvaluationS240         = 4,
1544         tEvaluationSpare3       = 5,
1545         tEvaluationSpare2       = 6,
1546         tEvaluationSpare1       = 7
1547 }CmSib2TEvaluation_e;
1548
1549 typedef enum cmSib2THystNormal
1550 {
1551         tHystNormalS30          = 0,
1552         tHystNormalS60          = 1,
1553         tHystNormalS120         = 2,
1554         tHystNormalS180         = 3,
1555         tHystNormalS240         = 4,
1556         tHystNormalSpare3       = 5,
1557         tHystNormalSpare2       = 6,
1558         tHystNormalSpare1       = 7
1559 }CmSib2THystNormal_e;
1560
1561
1562 typedef struct cmSib2MobilityStateParameters
1563 {
1564         CmSib2TEvaluation_e  tEvaluation;
1565         CmSib2THystNormal_e  tHystNormal;
1566         UINT8                            nCellChangeMedium;      /*1-16*/
1567         UINT8                            nCellChangeHigh;                /*1-16*/
1568 }CmSib2MobilityStateParameters_t;
1569
1570
1571 typedef struct cmSib2SpeedStateReselectionPars
1572 {
1573         CmSib2MobilityStateParameters_t         mobilityStateParameters;
1574         CmSib2QHystSf_t                                         qHystSF;
1575 }CmSib2SpeedStateReselectionPars_t;
1576
1577 #define THRESHOLD_RSRP_PRESENT                 (1 << 0)
1578 #define THRESHOLD_PSRQ_PRESENT                     (1 << 1)
1579 #define THRESHOLD_SINR_PRESENT                     (1 << 2)
1580 typedef struct cmSib2ThresholdNr
1581 {
1582         UINT16          bitMask;
1583         UINT8           thresholdRSRP;                  /*0-127 OPTIONAL*/
1584         UINT8           thresholdRSRQ;                  /*0-127 OPTIONAL*/
1585         UINT8           thresholdSINR;                  /*0-127 OPTIONAL*/
1586 }CmSib2ThresholdNr_t;
1587
1588 typedef enum cmSib2QOffsetRange
1589 {
1590         sib2qOffsetRangeMinus24  = 0,
1591         sib2qOffsetRangeMinus22  = 1,
1592         sib2qOffsetRangeMinus20  = 2,
1593         sib2qOffsetRangeMinus18  = 3,
1594         sib2qOffsetRangeMinus16  = 4,
1595         sib2qOffsetRangeMinus14  = 5,
1596         sib2qOffsetRangeMinus12  = 6,
1597         sib2qOffsetRangeMinus10  = 7,
1598         sib2qOffsetRangeMinus8   = 8,
1599         sib2qOffsetRangeMinus6   = 9,
1600         sib2qOffsetRangeMinus5   = 10,
1601         sib2qOffsetRangeMinus4   = 11,
1602         sib2qOffsetRangeMinus3   = 12,
1603         sib2qOffsetRangeMinus2   = 13,
1604         sib2qOffsetRangeMinus1   = 14,
1605         sib2qOffsetRangePlus0    = 15,
1606         sib2qOffsetRangePlus1    = 16,
1607         sib2qOffsetRangePlus2    = 17,
1608         sib2qOffsetRangePlus3    = 18,
1609         sib2qOffsetRangePlus4    = 19,
1610         sib2qOffsetRangePlus5    = 20,
1611         sib2qOffsetRangePlus6    = 21,
1612         sib2qOffsetRangePlus8    = 22,
1613         sib2qOffsetRangePlus10   = 23,
1614         sib2qOffsetRangePlus12   = 24,
1615         sib2qOffsetRangePlus14   = 25,
1616         sib2qOffsetRangePlus16   = 26,
1617         sib2qOffsetRangePlus18   = 27,
1618         sib2qOffsetRangePlus20   = 28,
1619     sib2qOffsetRangePlus22   = 29,
1620         sib2qOffsetRangePlus24   = 30,
1621
1622 }CmSib2QOffsetRange_e;
1623
1624 #define NROF_SS_BLOCKS_TO_AVERAGE_PRESENT                 (1 << 0)
1625 #define ABS_THRESH_SS_BLOCKS_CONSOLIDATION_PRESENT        (1 << 1)
1626 #define RANGE_TO_BEST_CELL_PRESENT                                (1 << 2)
1627 #define SPEED_STATE_RESELECTION_PARS_PRESENT              (1 << 3)
1628 typedef struct cmSib2CellReselectionInfoCommon
1629 {
1630         UINT16                                                          bitMask;
1631         UINT8                                                           nrofSsBlocksToAverage;               /*2-16 OPTIONAL*/
1632         CmSib2ThresholdNr_t                             absThreshSsBlocksConsolidation;          /*OPTIONAL*/
1633         CmSib2QOffsetRange_e                            rangeToBestCell;                                         /*OPTIONAL*/
1634         CmSib2QHyst_e                                           qHyst;
1635         CmSib2SpeedStateReselectionPars_t   speedStateReselectionPars;
1636 } CmSib2CellReselectionInfoCommon_t;
1637
1638 typedef enum cmSib2CellReselectionSubPriority
1639 {
1640         cellReselectionSubPriorityoDot2 = 0,
1641         cellReselectionSubPriorityoDot4 = 1,
1642         cellReselectionSubPriorityoDot6 = 2,
1643         cellReselectionSubPriorityoDot8 = 3
1644 }CmSib2CellReselectionSubPriority_e;
1645
1646 #define CM_SIB2_RESELECT_SERV_FREQ_SNON_INTRA_SEARCH_P        (1 << 0)
1647 #define CM_SIB2_RESELECT_SERV_FREQ_SNON_INTRA_SEARCH_Q        (1 << 1)
1648 #define CM_SIB2_RESELECT_SERV_FREQ_THRESH_SERV_LOWQ           (1 << 2)
1649 #define CM_SIB2_RESELECT_SERV_FREQ_SUB_PRIORITY                   (1 << 3)
1650 typedef struct cmSib2CellReselectionServingFreqInfo
1651 {
1652         UINT16                     bitMask;
1653         UINT8                      sNonIntraSearchP;             //0-31
1654         UINT8              sNonIntraSearchQ;             //0-31
1655         UINT8                      threshServingLowP;            //0-31
1656         UINT8                      threshServingLowQ;            //0-31
1657         UINT8                      cellReselectionPriority;  //0-7
1658         CmSib2CellReselectionSubPriority_e cellReselectionSubPriority;
1659 } CmSib2CellReselectionServingFreqInfo_t;
1660
1661
1662 typedef struct cmSib2SsRssiMeasurement
1663 {
1664         UINT8           measurementSlots[10];                   //BIT STRING SIZE(1-80)
1665         UINT8           endSymbol;                              //0-3
1666 } CmSib2SsRssiMeasurement_t;
1667
1668
1669 typedef struct cmSib2NrNsPmaxValue
1670 {
1671         INT8            additionalPmax;                           /*-30~30   OPTIONAL*/
1672         UINT8           additionalSpectrumEmission;   /*0-7*/
1673 } CmSib2NrNsPmaxValue_t;
1674
1675
1676 typedef struct cmSib2NrNsPmaxList
1677 {
1678         CmSib2NrNsPmaxValue_t nRNsPmaxList[MAX_NR_NS_PMAX];
1679 } CmSib2NrNsPmaxList_t;
1680
1681
1682 typedef struct cmSib2NrMultiBandInfo
1683 {
1684         UINT16                                  freqBandIndicatorNR;            //1-1024
1685         CmSib2NrNsPmaxList_t    nRNsPmaxList;
1686 } CmSib2NrMultiBandInfo_t;
1687
1688
1689 typedef struct cmSib2MultiFrequencyBandListNrSib
1690 {
1691         CmSib2NrMultiBandInfo_t multiFrequencyBandListNrSib[MAX_MULTI_BANDS];
1692
1693 } CmSib2MultiFrequencyBandListNrSib_t;
1694
1695
1696 typedef enum cmSib2Duration
1697 {
1698         durationSf1 = 0,
1699         durationSf2 = 1,
1700         durationSf3 = 2,
1701         durationSf4 = 3,
1702         durationSf5 = 4,
1703 }CmSib2Duration_e;
1704
1705 typedef enum cmSib2SsMtcPresent
1706 {
1707         CM_SIB2_SSB_MTC_NOTHING = 0,
1708         CM_SIB2_SSB_MTC_SF5     = 1,
1709         CM_SIB2_SSB_MTC_SF10    = 2,
1710         CM_SIB2_SSB_MTC_SF20    = 3,
1711         CM_SIB2_SSB_MTC_SF40    = 4,
1712         CM_SIB2_SSB_MTC_SF80    = 5,
1713         CM_SIB2_SSB_MTC_SF160   = 6,
1714 }CmSib2SsMtcPresent_e;
1715
1716 typedef struct cmSib2SsbMtc  //choice sf5-sf160
1717 {
1718         CmSib2SsMtcPresent_e present;
1719         UINT8 sf5;   //0-4
1720         UINT8 sf10;      //0-9
1721         UINT8 sf20;      //0-19
1722         UINT8 sf40;      //0-39
1723         UINT8 sf80;      //0-79
1724         UINT8 sf160; //0-159
1725         CmSib2Duration_e duration;
1726
1727 } CmSib2SsbMtc_t;
1728
1729 typedef enum cmSib2SsbToMeasurePresent
1730 {
1731         CM_SIB2_SSB_TO_MEASURE_NOTHING  = 0,
1732         CM_SIB2_SSB_TO_MEASURE_SHORT_BITMAP     = 1,
1733         CM_SIB2_SSB_TO_MEASURE_MEDIUM_BITMAP    = 2,
1734         CM_SIB2_SSB_TO_MEASURE_LONG_BITMAP      = 3,
1735 }CmSib2SsbToMeasurePresent_e;
1736
1737 typedef struct cmSib2SsbToMeasure
1738 {
1739         CmSib2SsbToMeasurePresent_e     present;
1740         UINT8   shortBitmap;            //BIT STRING SIZE(4)
1741         UINT8   mediumBitmap;           //BIT STRING SIZE(8)
1742         UINT64  longBitmap;                     //BIT STRING SIZE(64)
1743
1744 } CmSib2SsbToMeasure_t;
1745
1746 #define CM_INTRA_FREQ_CELL_RESELECT_QRX_LEV_MIN_SUL_PRESENT                     (1 << 0)
1747 #define CM_INTRA_FREQ_CELL_RESELECT_QUAL_MIN_PRESENT                                    (1 << 1)
1748 #define CM_INTRA_FREQ_CELL_RESELECT_SINTRA_SEARCH_Q_PRESENT                     (1 << 2)
1749 #define CM_INTRA_FREQ_CELL_RESELECT_FREQUENCY_BAND_LIST_PRESENT                 (1 << 3)
1750 #define CM_INTRA_FREQ_CELL_RESELECT_FREQUENCY_BAND_LIST_SUL_PRESENT         (1 << 4)
1751 #define CM_INTRA_FREQ_CELL_RESELECT_PMAX_PRESENT                                                (1 << 5)
1752 #define CM_INTRA_FREQ_CELL_RESELECT_CM_SIB2_SSB_MTC_PRSENT                              (1 << 6)
1753 #define CM_INTRA_FREQ_CELL_RESELECT_CM_SIB2_SS_RSSI_MEASUREMENT_PRSENT          (1 << 7)
1754 #define CM_INTRA_FREQ_CELL_RESELECT_CM_SIB2_SSB_TO_MEASURE_PRSENT                       (1 << 8)
1755 typedef struct cmSib2IntraFreqCellReselectionInfo
1756 {
1757         UINT16                                                                  bitMask;
1758         INT8                                                                    qRxLevMin;                      //-70~-22
1759         INT8                                                                    qRxLevMinSUL;           //-70~-22
1760         INT8                                                                    qQualMin;                       //-34~-3
1761         UINT8                                                                   sIntraSearchP;          //0-31
1762         UINT8                                                                   sIntraSearchQ;          //0-31
1763         UINT8                                                                   tReselectionNR;         //0-7
1764         CmSib2MultiFrequencyBandListNrSib_t     frequencyBandList;
1765         CmSib2MultiFrequencyBandListNrSib_t     frequencyBandListSUL;
1766         INT8                                                    pMax;                   //-30-33
1767         CmSib2SsbMtc_t                                          smtc;
1768         CmSib2SsRssiMeasurement_t                               ssRssiMeasurement ;
1769         CmSib2SsbToMeasure_t                                    ssbToMeasure;
1770         BOOL                                                    deriveSSBIndexFromCell;
1771 } CmSib2IntraFreqCellReselectionInfo_t;
1772
1773 typedef struct sib2
1774 {
1775         CmSib2CellReselectionInfoCommon_t                cellReselectionCommon;
1776         CmSib2CellReselectionServingFreqInfo_t   cellReselectionServingFreq;
1777         CmSib2IntraFreqCellReselectionInfo_t     intraFreqCellReselection;
1778 }Sib2_t;
1779
1780 /**********************        Sib3_t       ************************/
1781 typedef enum cmSib3QOffsetRange
1782 {
1783         sib3qOffsetRangeMinus24  = 0,
1784         sib3qOffsetRangeMinus22  = 1,
1785         sib3qOffsetRangeMinus20  = 2,
1786         sib3qOffsetRangeMinus18  = 3,
1787         sib3qOffsetRangeMinus16  = 4,
1788         sib3qOffsetRangeMinus14  = 5,
1789         sib3qOffsetRangeMinus12  = 6,
1790         sib3qOffsetRangeMinus10  = 7,
1791         sib3qOffsetRangeMinus8   = 8,
1792         sib3qOffsetRangeMinus6   = 9,
1793         sib3qOffsetRangeMinus5   = 10,
1794         sib3qOffsetRangeMinus4   = 11,
1795         sib3qOffsetRangeMinus3   = 12,
1796         sib3qOffsetRangeMinus2   = 13,
1797         sib3qOffsetRangeMinus1   = 14,
1798         sib3qOffsetRangePlus0    = 15,
1799         sib3qOffsetRangePlus1    = 16,
1800         sib3qOffsetRangePlus2    = 17,
1801         sib3qOffsetRangePlus3    = 18,
1802         sib3qOffsetRangePlus4    = 19,
1803         sib3qOffsetRangePlus5    = 20,
1804         sib3qOffsetRangePlus6    = 21,
1805         sib3qOffsetRangePlus8    = 22,
1806         sib3qOffsetRangePlus10   = 23,
1807         sib3qOffsetRangePlus12   = 24,
1808         sib3qOffsetRangePlus14   = 25,
1809         sib3qOffsetRangePlus16   = 26,
1810         sib3qOffsetRangePlus18   = 27,
1811         sib3qOffsetRangePlus20   = 28,
1812     sib3qOffsetRangePlus22   = 29,
1813         sib3qOffsetRangePlus24   = 30
1814 }CmSib3QOffsetRange_e;
1815
1816 #define CM_INTRA_FREQ_NEIGH_CELL_QRX_LEV_MIN_OFFSET_CELL             (1 << 0)
1817 #define CM_INTRA_FREQ_NEIGH_CELL_QRX_LEV_MIN_OFFSET_SUL_CELL             (1 << 1)
1818 #define CM_INTRA_FREQ_NEIGH_CELL_QUAL_MIN_OFFSET_CELL                    (1 << 2)
1819 typedef struct cmSib3IntraFreqNeighCellInfo
1820 {
1821         UINT32                                  bitMask;
1822         UINT16                                  physCellId;                 //0-1007
1823         CmSib3QOffsetRange_e    qOffsetCell;
1824         UINT8                                   qRxLevMinOffsetCell;    //1-8
1825         UINT8                                   qRxLevMinOffsetCellSUL; //1-8
1826         UINT8                                   qQualMinOffsetCell;             //1-8
1827
1828 } CmSib3IntraFreqNeighCellInfo_t;
1829
1830
1831 typedef struct cmSib3IntraFreqNeighCellList
1832 {
1833         UINT32                                             neighNum;
1834         CmSib3IntraFreqNeighCellInfo_t intraFrequenceNeighCellList[MAXCELLINTRA];
1835
1836 } CmSib3IntraFreqNeighCellList_t;
1837
1838
1839 typedef enum cmSib3Range
1840 {
1841                 rangeN4          = 0,
1842                 rangeN8          = 1,
1843                 rangeN12         = 2,
1844                 rangeN16         = 3,
1845                 rangeN24         = 4,
1846                 rangeN32         = 5,
1847                 rangeN48         = 6,
1848                 rangeN64         = 7,
1849                 rangeN84         = 8,
1850                 rangeN96         = 9,
1851                 rangeN128        = 10,
1852                 rangeN168        = 11,
1853                 rangeN252        = 12,
1854                 rangeN504        = 13,
1855                 rangeN1008       = 14,
1856                 rangeSpare1  = 15,
1857 }CmSib3Range_e;
1858
1859 #define CM_SIB3_PCI_RANGE             (1 << 0)
1860 typedef struct cmSib3PciRange
1861 {
1862         UINT32             bitMask;
1863         UINT16         physCellId; //0-1007
1864         CmSib3Range_e  range;
1865 } CmSib3PciRange_t;
1866
1867
1868 typedef struct cmSib3IntraFreqBlackCellList
1869 {
1870         UINT32                   blackNum;
1871         CmSib3PciRange_t intraFrequenceBlackCellList[MAXCELLBLACK];
1872
1873 } CmSib3IntraFreqBlackCellList_t;
1874
1875 #define CM_SIB3_INTRA_FREQ_NEIGH_CELL_LIST               (1 << 0)
1876 #define CM_SIB3_INTRA_FREQ_BLACK_CELL_LIST               (1 << 1)
1877 typedef struct sib3
1878 {
1879         UINT16                                                  bitMask;
1880         CmSib3IntraFreqNeighCellList_t  intraFreqNeighCell;
1881         CmSib3IntraFreqBlackCellList_t  intraFreqBlackCell;
1882 }Sib3_t;
1883
1884 /**********************     SystemInfo_t    ************************/
1885 typedef struct systemInfo
1886 {
1887                 Sib2_t   siSib2;
1888                 Sib3_t   siSib3;
1889 #if 0
1890                 Sib4_t   siSib4;
1891                 Sib5_t   siSib5;
1892                 Sib6_t   siSib6;
1893                 Sib7_t   siSib7;
1894                 Sib8_t   siSib8;
1895                 Sib9_t   siSib9;
1896 #endif
1897 }SystemInfo_t;
1898
1899 /**********************     SiConfig_t    ************************/
1900 typedef struct siConfig
1901 {
1902         Mib_t                    mibCfg;
1903         Sib1_t                   sib1Cfg;
1904         Sib2_t                   sib2Cfg;
1905         Sib3_t                   sib3Cfg;
1906         SystemInfo_t     si1Cfg;
1907         SystemInfo_t     si2Cfg;
1908         UINT8                    sib1Flag;
1909         UINT8                    siFlag;
1910         UINT8                    pagingFlag;
1911 #if 0
1912         Sib4_t                   sib4Cfg;
1913         Sib5_t                   sib5Cfg;
1914         Sib6_t                   sib6Cfg;
1915         Sib7_t                   sib7Cfg;
1916         Sib8_t                   sib8Cfg;
1917         Sib9_t                   sib9Cfg;
1918         SystemInfo_t     si3;
1919         SystemInfo_t     si4;
1920         SystemInfo_t     si5;
1921         SystemInfo_t     si6;
1922         SystemInfo_t     si7;
1923         SystemInfo_t     si8;
1924 #endif
1925 } SiConfig_t;
1926
1927 typedef struct ngapConfig
1928 {
1929         UINT32                          gNBId;                                                  /* Global Ran Node ID of one gNB */
1930         NgapRanName_t           ranNodeName;                                    /* name of one gNB */
1931         IpAddress_t                     ranNodeIp;                                              /* IP Address of gNB */
1932 } NGAPConfig_t;
1933 /**********************     OamCuCpConfig_t    ************************/
1934 typedef struct
1935 {
1936     UINT64        gnbDuId;
1937     IpAddress_t   gnbDuIp;/* IP Address of DU */
1938     UCHAR         gnbDuName[MAX_GNB_DU_NAME];
1939
1940 }F1apDuInfo_t;
1941
1942 typedef struct f1apConfig
1943 {
1944     UINT32       gNBId;
1945
1946     UINT64        gnbCuId;
1947     IpAddress_t   gnbCuIp;/* IP Address of CU */
1948     UCHAR         gnbCuName[MAX_GNB_CU_NAME];
1949         UINT8             gnbDuNum;
1950         F1apDuInfo_t  gnbDuCfg[MAX_GNB_DU_NUM];
1951 } F1APConfig_t;
1952
1953 /**
1954  * @struct Transmission BandWidth
1955    This structure is the Transmission BandWidth of  Cell Configuration
1956 */
1957 typedef struct transBandWidth
1958 {
1959     long                  nrScs;
1960     long              nrb;
1961 } TransBandWidth_t;
1962
1963 /**
1964  * @struct SULInfo
1965    This structure is the sul Info of  Cell Configuration
1966 */
1967 typedef struct sulInfo
1968 {
1969     UINT32            sulArfcn;
1970     TransBandWidth_t  sulTransBW;
1971 } SulInfo_t;
1972
1973 /**
1974  * @struct FreqBand
1975    This structure is the freq Band of  Cell Configuration
1976 */
1977 typedef struct freqBand
1978 {
1979     UINT32             nrFreqBand;
1980     UINT8              supportedSulBandNum;
1981     UINT32             sulBand[MAX_NR_CELL_BANDS];
1982 } FreqBand_t;
1983
1984 /**
1985  * @struct FreqInfo
1986    This structure is the freq Info of  Cell Configuration
1987 */
1988 #define FreqInfoSulInfoChosen       0x01
1989 typedef struct freqInfo
1990 {
1991     UINT16             bitmask;
1992     UINT32             nrArfcn;
1993     SulInfo_t          sulInfo;
1994     UINT8              freqBandNum;
1995     FreqBand_t         freqBandItem[MAX_NR_CELL_BANDS];
1996 } FreqInfo_t;
1997
1998 /**
1999  * @struct FDDInfo
2000    This structure is the FDD Mode Config Info of  Cell Configuration
2001 */
2002 typedef struct fddInfo
2003 {
2004     FreqInfo_t         ulFreqInfo;
2005     FreqInfo_t         dlFreqInfo;
2006     TransBandWidth_t   ulTransBW;
2007     TransBandWidth_t   dlTransBW;
2008 } FddInfo_t;
2009
2010 /**
2011  * @struct TDDInfo
2012    This structure is the TDD Mode Config Info of  Cell Configuration
2013 */
2014 typedef struct tddInfo
2015 {
2016     FreqInfo_t         nrFreqInfo;
2017     TransBandWidth_t   transBW;
2018 } TddInfo_t;
2019
2020 /**
2021  * @struct oamActCellInfo
2022    This structure is oam send this message  to Du act cell
2023 */
2024 typedef struct oamActCellInfo
2025 {
2026     UINT8              actCellNum;
2027         CmNrCellId                 actCellId[MAX_CELL_NUM];
2028 } OamActCellInfo_t;
2029
2030 /**
2031  * @struct oamActCellRsp
2032    This structure is DU send reponse message  to OAM
2033 */
2034 typedef struct oamActCellRsp
2035 {
2036     UINT8              actResult;       //0: all failed 1: all success 2: some success and some failed
2037     UINT8              actCellNum;
2038         CmNrCellId                 actSuccessCellId[MAX_CELL_NUM];
2039         CmNrCellId                 actFailedCellId[MAX_CELL_NUM];
2040 } OamActCellRsp_t;
2041
2042
2043 /** 从原始消息中获取SOCKET msg */
2044 #define GNB_GET_SOCKET_MSG(src,dst)   VOS_MemCpy((CHAR*)dst,(CHAR*)src,sizeof(vos_sock_info_t))
2045
2046 /** 从原始消息中拷贝消息到dst中 */
2047 #define GNB_GET_DATA(src,dst,len)    if(len > sizeof(vos_sock_info_t)) \
2048                                      {  \
2049                                         VOS_MemCpy((CHAR*)dst,((CHAR*)src+sizeof(vos_sock_info_t)),(len-sizeof(vos_sock_info_t))); \
2050                                      } \
2051                                      else \
2052                                      { \
2053                                         printf("msg len invalid, len = %d \r\n",len);\
2054                                         VOS_ASSERT(0); \
2055                                         return VOS_ERROR;\
2056                                      }
2057 /*获取msgBuf中消息地址*/
2058 #define GNB_GET_MODULE_MSG_DATA_PTR(dataType,pData,buf)   do{ \
2059                                                                                                                                 ULONG ulBufAddr = 0; \
2060                                                                                                                                 VOS_MemCpy((CHAR*)&ulBufAddr,(CHAR*)buf,sizeof(ULONG));\
2061                                                                                                                                 pData =(dataType*)(ULONG*)ulBufAddr; \
2062                                                                                                                           }while(0)
2063 /*设置msgBuf中消息地址*/
2064 #define GNB_SET_MODULE_MSG_DATA_PTR(src,dst)   do{ \
2065                                                                                                           ULONG ulBufAddr = 0; \
2066                                                                                                           ulBufAddr= (ULONG)((ULONG*)src); \
2067                                                                                                           VOS_MemCpy(dst, &ulBufAddr, sizeof(ULONG)); \
2068                                                                                                         }while(0)
2069
2070 /*填充数据地址到msgBuf中*/
2071 #define GNB_SET_MODULE_MSG(msg,pModuleMsg) do{ \
2072                                                                                                   CHAR*  bufPtr = NULL; \
2073                                                                                                   ULONG  ulBufAddr = 0; \
2074                                                                                                   bufPtr = (CHAR*)VOS_Malloc((pModuleMsg)->msgLen,(pModuleMsg)->srcModuleId); \
2075                                                                                                   if(NULL == bufPtr)  \
2076                                                                                                   { \
2077                                                                                                          VOS_ASSERT(0); \
2078                                                                                                          return VOS_ERROR; \
2079                                                                                                   } \
2080                                                                                                   VOS_MemCpy(bufPtr,&msg,sizeof(msg)); \
2081                                                                                                   ulBufAddr= (ULONG)((ULONG*)bufPtr); \
2082                                                                                                   VOS_MemCpy((pModuleMsg)->msgBuf, &ulBufAddr, sizeof(ULONG)); \
2083                                                                                                 }while(0)
2084 #define BUFFER_TO_UINT32(buf, x) \
2085 do {                            \
2086     x = ((uint32_t)((buf)[0]) ) |      \
2087         ((uint32_t)((buf)[1]) << 8) |      \
2088         ((uint32_t)((buf)[2]) << 16)  |      \
2089         ((uint32_t)((buf)[3]) << 24);             \
2090 } while(0)
2091
2092 #define INT32_TO_BUFFER(x, buf) \
2093 do {                            \
2094     (buf)[0] = (x) >> 24;       \
2095     (buf)[1] = (x) >> 16;       \
2096     (buf)[2] = (x) >> 8;        \
2097     (buf)[3] = (x);             \
2098 } while(0)
2099
2100
2101
2102
2103 extern void fillSocketPara(UINT32 sockType,SockAddrStr_t* pSockAddr,SockAddrStr_t* clientSockAddrInfo,vos_sock_para_t *para);
2104 extern INT32 get_file_len(FILE *file_p);
2105 extern INT32 tell_file(FILE *file_p);
2106 extern INT32 getpos_file(FILE *file_p, fpos_t *pos);
2107 extern INT32 putpos_file(FILE *file_p, fpos_t *pos);
2108 extern INT32 seek_file(FILE *file_p, INT32 offset, INT32 whence);
2109 extern INT32 eof_file(FILE *file_p);
2110 extern INT32 error_file(FILE *file_p);
2111 extern FILE *open_file(const char *path, const char *flag);
2112 extern INT32 close_file(FILE *file_p);
2113 extern INT32 read_file(void *buf, INT32 size, INT32 count, FILE *file_p);
2114
2115 extern VOID sctpMsgNotifyProc(vos_sock_info_t* opval,VOID* buffer);
2116
2117 void gnbPrintRrcMsg(int direction, int msgType, UINT8 *buf, INT32 size);
2118
2119 #ifdef __cplusplus
2120 }
2121 #endif
2122
2123 #endif  /* _CU_COMMON_H_*/