2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 /*******************************************************************************
18 * File name :VehicleSens_Did_GyroX_l.cpp
19 * System name :_CWORD107_
20 * Subsystem name :Vehicle sensor process
21 * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_X)
22 * Module configuration :VehicleSensInitGyroXl() Vehicle Sensor GYRO Initialization Functions
23 * :VehicleSensSetGyroXl() Vehicle Sensor GYRO SET Functions
24 * :VehicleSensGetGyroXl() Vehicle Sensor GYRO GET Functions
25 ******************************************************************************/
27 #include <vehicle_service/positioning_base_library.h>
28 #include "VehicleSens_DataMaster.h"
30 /*************************************************/
32 /*************************************************/
33 static VEHICLESENS_DATA_MASTER gstGyroX_l; // NOLINT(readability/nolint)
35 /*******************************************************************************
36 * MODULE : VehicleSensInitGyroXl
37 * ABSTRACT : Vehicle Sensor GYRO_X Initialization Functions
38 * FUNCTION : GYRO data master initialization process
42 ******************************************************************************/
43 void VehicleSensInitGyroXl(void) {
44 memset(&gstGyroX_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
45 gstGyroX_l.ul_did = POSHAL_DID_GYRO_X;
46 gstGyroX_l.us_size = VEHICLE_DSIZE_GYRO_X;
47 gstGyroX_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
50 /*******************************************************************************
51 * MODULE : VehicleSensSetGyroXl
52 * ABSTRACT : Vehicle Sensor GYRO_X SET Functions
53 * FUNCTION : Update the GYRO data master
54 * ARGUMENT : *pst_data : Pointer to the message data received by the direct line
56 * RETURN : VEHICLESENS_EQ : No data change
57 * VEHICLESENS_NEQ : Data change
58 ******************************************************************************/
59 u_int8 VehicleSensSetGyroXl(const LSDRV_LSDATA *pst_data) {
61 VEHICLESENS_DATA_MASTER *pst_master;
63 pst_master = &gstGyroX_l;
65 /* Compare data master and received data */
66 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
68 /* Received data is set in the data master. */
69 pst_master->ul_did = pst_data->ul_did;
70 pst_master->us_size = pst_data->uc_size;
71 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
72 pst_master->uc_snscnt = pst_data->uc_sns_cnt;
73 (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
74 (const void *)(pst_data->uc_data), (size_t)pst_data->uc_size);
79 /*******************************************************************************
80 * MODULE : VehicleSensSetGyroXlG
81 * ABSTRACT : Vehicle Sensor GYRO_X SET Functions
82 * FUNCTION : Update the GYRO data master
83 * ARGUMENT : *pst_data : Pointer to the message data received by the direct line
85 * RETURN : VEHICLESENS_EQ : No data change
86 * VEHICLESENS_NEQ : Data change
87 ******************************************************************************/
88 u_int8 VehicleSensSetGyroXlG(const LSDRV_LSDATA_G *pst_data) {
90 VEHICLESENS_DATA_MASTER *pst_master;
92 pst_master = &gstGyroX_l;
94 /* Compare data master and received data */
95 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
97 /* Received data is set in the data master. */
98 pst_master->ul_did = pst_data->ul_did;
99 pst_master->us_size = pst_data->uc_size;
100 pst_master->uc_rcvflag = VEHICLE_RCVFLAG_ON;
101 pst_master->uc_snscnt = pst_data->uc_sns_cnt;
102 (void)memcpy(reinterpret_cast<void *>(pst_master->uc_data),
103 (const void *)(pst_data->uc_data), (size_t)(pst_data->uc_size));
108 /*******************************************************************************
109 * MODULE : VehicleSensGetGyroXl
110 * ABSTRACT : Vehicle Sensor GYRO_X GET Functions
111 * FUNCTION : Provide a GYRO data master
112 * ARGUMENT : *pst_data : Pointer to the data master acquisition destination
115 ******************************************************************************/
116 void VehicleSensGetGyroXl(VEHICLESENS_DATA_MASTER *pst_data) {
117 const VEHICLESENS_DATA_MASTER *pst_master;
119 pst_master = &gstGyroX_l;
121 /* Store the data master in the specified destination. */
122 pst_data->ul_did = pst_master->ul_did;
123 pst_data->us_size = pst_master->us_size;
124 pst_data->uc_rcvflag = pst_master->uc_rcvflag;
125 pst_data->uc_snscnt = pst_master->uc_snscnt;
126 (void)memcpy(reinterpret_cast<void *>(pst_data->uc_data),
127 (const void *)(pst_master->uc_data), (size_t)(pst_master->us_size));