1 /******************************************************************************
3 * Copyright (c) 2020 ICT/CAS.
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
9 * https://www.o-ran.org/software
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.
17 *******************************************************************************/
25 #include "vos_common.h"
28 #include "plat_alarm.h"
30 #include "gnbCommon.h"
32 #include "omCuupApi.h"
33 extern UCHAR cuupUnSocketPath[];
34 INT32 cuupGetSetUpPara(INT32 argc, INT8 **argv)
38 struct option long_options[] =
40 {"startup-item", required_argument, 0, 'i' },
41 {"version", no_argument, 0, 'v' },
42 {"help", no_argument, 0, 'h' },
49 int c = getopt_long(argc, argv, "i:vh", long_options, &option_index);
58 pInt = (UCHAR *)cuupUnSocketPath;
71 sscanf(optarg, "%s", pInt);
72 VOS_Printf("unSocketPath: %s\n", cuupUnSocketPath);
79 void cuupAppSigHandler(int sig)
81 VOS_Printf("\r\nReceive signal:%d\r\n",sig);
85 if(shm_unlink(CUUP_SHM_FILE) < 0)
87 VOS_Printf("Du_shm Delete CUUP_SHM_FILE shared memory failed !\n ");
93 else if(SIGINT == sig)
96 else if(SIGABRT == sig)
98 if(shm_unlink(CUUP_SHM_FILE) < 0)
100 VOS_Printf("Du_shm Delete CUUP_SHM_FILE shared memory failed !\n ");
107 INT32 cuupAppregisterSignal()
111 if ( Product_Signal( SIGSEGV, 0,cuupAppSigHandler ) == VOS_ERROR )
113 /*commomctrl_om_init_fail_rsp(0);*/
117 if ( Product_Signal( SIGINT, 0,cuupAppSigHandler ) == VOS_ERROR )
124 if ( Product_Signal( SIGABRT,0,cuupAppSigHandler ) == VOS_ERROR )
126 /*commomctrl_om_init_fail_rsp(0);*/
136 return value: VOS_OK,VOS_ERROR
138 INT32 main(int argc,INT8 **argv)
142 CHECK_FUNCTION_RET(cuupGetSetUpPara(argc,argv));
144 /*init cucp global var*/
145 CHECK_FUNCTION_RET(cuupAppGlobalVarInit());
148 CHECK_FUNCTION_RET(cuupAppPlatformInit(argv));
151 CHECK_FUNCTION_RET(cuupAppregisterSignal());
152 /*VOS_TaskInfoAttach 必须在main函数里调用*/
154 /*omadp vos task create*/
155 CHECK_FUNCTION_RET(cuupAppOmadpModuleInit());