2 * @copyright Copyright (c) 2019-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_GyroY_l.cpp
19 * Subsystem name :Vehicle sensor process
20 * Program name :Vehicle sensor data master(POSHAL_DID_GYRO_Y)
21 * Module configuration :VehicleSensInitGyroYl() Vehicle Sensor GYRO Initialization Functions
22 * :VehicleSensSetGyroYl() Vehicle Sensor GYRO SET Functions
23 * :VehicleSensGetGyroYl() Vehicle Sensor GYRO GET Functions
24 ******************************************************************************/
26 #include "VehicleSens_DataMaster.h"
28 /*************************************************/
30 /*************************************************/
31 static VEHICLESENS_DATA_MASTER gstGyroY_l; // NOLINT(readability/nolint)
33 /*******************************************************************************
34 * MODULE : VehicleSensInitGyroYl
35 * ABSTRACT : Vehicle Sensor GYRO_Y Initialization Functions
36 * FUNCTION : GYRO data master initialization process
40 ******************************************************************************/
41 void VehicleSensInitGyroYl(void) {
42 memset(&gstGyroY_l, 0x00, sizeof(VEHICLESENS_DATA_MASTER));
43 gstGyroY_l.ul_did = POSHAL_DID_GYRO_Y;
44 gstGyroY_l.us_size = VEHICLE_DSIZE_GYRO_Y;
45 gstGyroY_l.uc_rcvflag = VEHICLE_RCVFLAG_OFF;
48 /*******************************************************************************
49 * MODULE : VehicleSensSetGyroYl
50 * ABSTRACT : Vehicle Sensor GYRO_Y SET Functions
51 * FUNCTION : Update the GYRO data master
52 * ARGUMENT : *pst_data : Pointer to the message data received by the direct line
54 * RETURN : VEHICLESENS_EQ : No data change
55 * VEHICLESENS_NEQ : Data change
56 ******************************************************************************/
57 u_int8 VehicleSensSetGyroYl(const LSDRV_LSDATA *pst_data) {
59 VEHICLESENS_DATA_MASTER *pst_master;
61 pst_master = &gstGyroY_l;
63 /* Compare data master and received data */
64 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
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);
77 /*******************************************************************************
78 * MODULE : VehicleSensSetGyroYlG
79 * ABSTRACT : Vehicle Sensor GYRO_Y SET Functions
80 * FUNCTION : Update the GYRO data master
81 * ARGUMENT : *pst_data : Pointer to the message data received by the direct line
83 * RETURN : VEHICLESENS_EQ : No data change
84 * VEHICLESENS_NEQ : Data change
85 ******************************************************************************/
86 u_int8 VehicleSensSetGyroYlG(const LSDRV_LSDATA_G *pst_data) {
88 VEHICLESENS_DATA_MASTER *pst_master;
90 pst_master = &gstGyroY_l;
92 /* Compare data master and received data */
93 uc_ret = VehicleSensmemcmp(pst_master->uc_data, pst_data->uc_data, pst_data->uc_size);
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));
106 /*******************************************************************************
107 * MODULE : VehicleSensGetGyroYl
108 * ABSTRACT : Vehicle Sensor GYRO_Y GET Functions
109 * FUNCTION : Provide a GYRO data master
110 * ARGUMENT : *pst_data : Pointer to the data master acquisition destination
113 ******************************************************************************/
114 void VehicleSensGetGyroYl(VEHICLESENS_DATA_MASTER *pst_data) {
115 const VEHICLESENS_DATA_MASTER *pst_master;
117 pst_master = &gstGyroY_l;
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));