common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / positioning_hal / src / LineSensDrv / LineSensDrv_Thread.cpp
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /**
17 * @file LineSensDrv_Thread.cpp
18 */
19
20 /*---------------------------------------------------------------------------*/
21 // Include files
22
23 #include "LineSensDrv_Thread.h"
24 #include <native_service/frameworkunified_types.h>
25 #include <native_service/frameworkunified_framework_if.h>
26 #include "positioning_def.h"
27 #include "positioning_common.h"
28 /*---------------------------------------------------------------------------*/
29 // Global variable
30
31 static u_int8   g_sys_recv_flg = 0;         // For debugging
32 char g_threadname[] = "POS_Sens";
33 uint8_t g_uc_vehicle_reverse = 0;
34 uint8_t g_uc_reverse_state = 0;
35 static BOOL g_line_sens_thread_stop = FALSE;
36
37 #define POS_REV_STATE_PROCESSING 0
38 #define POS_REV_STATE_IDLE 1
39
40 /*******************************************************************************
41  * MODULE   : LineSensDrv_Thread
42  * ABSTRACT : LineSensor driver thread main process
43  * FUNCTION : Main processing
44  * ARGUMENT : lpvPara  :
45  * NOTE     :
46  * RETURN   :
47  ******************************************************************************/
48 EFrameworkunifiedStatus LineSensDrvThread(HANDLE h_app) {
49   int32           l_ret      = RET_LSDRV_SUCCESS;
50   EFrameworkunifiedStatus l_status = eFrameworkunifiedStatusOK;
51
52
53   (void)PosSetupThread(h_app, ETID_POS_SENS);
54
55   /* Execute the initialization processes */
56   l_ret = LineSensDrvMainThreadInit(h_app);
57   if (RET_LSDRV_SUCCESS != l_ret) {
58     l_status = eFrameworkunifiedStatusFail;
59   }
60
61   return l_status;
62 }
63
64 /*******************************************************************************
65  * MODULE    : LineSensDrv_MainThread_Init
66  * ABSTRACT  : Thread initialization process
67  * FUNCTION  : Initialize thread
68  * ARGUMENT  : None
69  * NOTE      :
70  * RETURN    : RET_LSDRV_SUCCESS:Success in initialization
71  *         RET_LSDRV_ERROR  :Initialization failed
72  ******************************************************************************/
73 int32 LineSensDrvMainThreadInit(HANDLE h_app) {
74   int32   l_ret  = RET_LSDRV_SUCCESS;
75   BOOL    b_ret  = TRUE;
76
77   /****** Global variable initialization **********/
78   LineSensDrvParamInit();
79
80   /****** LineSensDrvApi initialization **********/
81   b_ret = LineSensDrvApiInitialize();
82
83   if (TRUE != b_ret) {
84     l_ret = RET_LSDRV_ERROR;
85   }
86
87   return l_ret;
88 }
89
90 /*******************************************************************************
91  * MODULE    : LineSensDrv_Param_Init
92  * ABSTRACT  : Global variable initialization processing
93  * FUNCTION  : Initialize global variables
94  * ARGUMENT  : None
95  * NOTE      :
96  * RETURN    : None
97  ******************************************************************************/
98 void LineSensDrvParamInit(void) {
99   LineSensDrvSpeedKmphDataInit();   // Data table initialization process for vehicle speed calculation
100 }
101
102 /**
103  * @brief
104  *   Pos_Sens thread stop processing
105  */
106 void LineSensDrvThreadStopProcess(void) {
107   g_line_sens_thread_stop = TRUE;
108
109   if (POS_REV_STATE_IDLE == g_uc_reverse_state) {
110     PosTeardownThread(ETID_POS_SENS);
111   }
112
113   return;
114 }
115
116 /**
117  * @brief
118  *   Get initial sensor data reception flag
119  */
120 u_int8 LineSensDrvGetSysRecvFlag(void) {
121   return g_sys_recv_flg;
122 }
123
124 /*---------------------------------------------------------------------------*/
125 /*EOF*/