common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / vehicleservice / positioning / server / src / Sensor / VehicleSens_Did_GyroZ_l.cpp
1 /*
2  * @copyright Copyright (c) 2019-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 /*******************************************************************************
18  *  File name    :VehicleSens_Did_GyroZ_l.cpp
19  *  Subsystem name  :Vehicle sensor process
20  *  Program name  :Vehicle sensor data master(POSHAL_DID_GYRO_Z)
21  *  Module configuration  :VehicleSensInitGyroZl()    Vehicle Sensor GYRO Initialization Functions
22  *                  :VehicleSensSetGyroZl()    Vehicle Sensor GYRO SET Functions
23  *                  :VehicleSensGetGyroZl()    Vehicle Sensor GYRO GET Functions
24  ******************************************************************************/
25
26 #include "VehicleSens_DataMaster.h"
27
28 /*************************************************/
29 /*           Global variable                      */
30 /*************************************************/
31 static  VEHICLESENS_DATA_MASTER  gstGyroZ_l;    // NOLINT(readability/nolint)
32
33 /*******************************************************************************
34 * MODULE    : VehicleSensInitGyroZl
35 * ABSTRACT  : Vehicle Sensor GYRO_Z Initialization Functions
36 * FUNCTION  : GYRO data master initialization process
37 * ARGUMENT  : void
38 * NOTE      :
39 * RETURN    : void
40 ******************************************************************************/
41 void VehicleSensInitGyroZl(void) {
42     memset(&gstGyroZ_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
43     gstGyroZ_l.ul_did     = POSHAL_DID_GYRO_Z;
44     gstGyroZ_l.us_size    = VEHICLE_DSIZE_GYRO_Z;
45     gstGyroZ_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
46 }
47
48 /*******************************************************************************
49 * MODULE    : VehicleSensSetGyroZl
50 * ABSTRACT  : Vehicle Sensor GYRO_Z SET Functions
51 * FUNCTION  : Update the GYRO data master
52 * ARGUMENT  : *pst_data : Pointer to the message data received by the direct line
53 * NOTE      :
54 * RETURN    : VEHICLESENS_EQ  : No data change
55 *             VEHICLESENS_NEQ  : Data change
56 ******************************************************************************/
57 u_int8 VehicleSensSetGyroZl(const LSDRV_LSDATA *pst_data) {
58     u_int8 uc_ret;
59     VEHICLESENS_DATA_MASTER *pst_master;
60
61     pst_master = &gstGyroZ_l;
62
63     /* Compare data master and received data */
64     uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
65
66     /* Received data is set in the data master. */
67     pst_master->ul_did     = pst_data->ul_did;
68     pst_master->us_size    = pst_data->uc_size;
69     pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
70     pst_master->uc_snscnt  = pst_data->uc_sns_cnt;
71     (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
72         (const void *)(pst_data->uc_data), (size_t)pst_data->uc_size);
73
74     return(uc_ret);
75 }
76
77 /*******************************************************************************
78 * MODULE    : VehicleSensSetGyroZlG
79 * ABSTRACT  : Vehicle Sensor GYRO_Z SET Functions
80 * FUNCTION  : Update the GYRO data master
81 * ARGUMENT  : *pst_data : Pointer to the message data received by the direct line
82 * NOTE      :
83 * RETURN    : VEHICLESENS_EQ  : No data change
84 *             VEHICLESENS_NEQ  : Data change
85 ******************************************************************************/
86 u_int8 VehicleSensSetGyroZlG(const LSDRV_LSDATA_G *pst_data) {
87     u_int8 uc_ret;
88     VEHICLESENS_DATA_MASTER *pst_master;
89
90     pst_master = &gstGyroZ_l;
91
92     /* Compare data master and received data */
93     uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
94
95     /* Received data is set in the data master. */
96     pst_master->ul_did     = pst_data->ul_did;
97     pst_master->us_size    = pst_data->uc_size;
98     pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
99     pst_master->uc_snscnt  = pst_data->uc_sns_cnt;
100     (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
101         (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
102
103     return(uc_ret);
104 }
105
106 /*******************************************************************************
107 * MODULE    : VehicleSensGetGyroZl
108 * ABSTRACT  : Vehicle Sensor GYRO_Z GET Functions
109 * FUNCTION  : Provide a GYRO data master
110 * ARGUMENT  : *pst_data : Pointer to the data master acquisition destination
111 * NOTE      :
112 * RETURN    : void
113 ******************************************************************************/
114 void VehicleSensGetGyroZl(VEHICLESENS_DATA_MASTER *pst_data) {
115     const VEHICLESENS_DATA_MASTER *pst_master;
116
117     pst_master = &gstGyroZ_l;
118
119     /* Store the data master in the specified destination. */
120     pst_data->ul_did     = pst_master->ul_did;
121     pst_data->us_size    = pst_master->us_size;
122     pst_data->uc_rcvflag = pst_master->uc_rcvflag;
123     pst_data->uc_snscnt  = pst_master->uc_snscnt;
124     (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
125         (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));
126 }