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