|
@@ -0,0 +1,1464 @@
|
|
|
+/* Generated by DBCC, see <https://github.com/howerj/dbcc> */
|
|
|
+#include "BCAN_dbc.h"
|
|
|
+#include <inttypes.h>
|
|
|
+#include <assert.h>
|
|
|
+
|
|
|
+#define UNUSED(X) ((void)(X))
|
|
|
+
|
|
|
+static inline uint64_t reverse_byte_order(uint64_t x) {
|
|
|
+ x = (x & 0x00000000FFFFFFFF) << 32 | (x & 0xFFFFFFFF00000000) >> 32;
|
|
|
+ x = (x & 0x0000FFFF0000FFFF) << 16 | (x & 0xFFFF0000FFFF0000) >> 16;
|
|
|
+ x = (x & 0x00FF00FF00FF00FF) << 8 | (x & 0xFF00FF00FF00FF00) >> 8;
|
|
|
+ return x;
|
|
|
+}
|
|
|
+
|
|
|
+static inline int print_helper(int r, int print_return_value) {
|
|
|
+ return ((r >= 0) && (print_return_value >= 0)) ? r + print_return_value : -1;
|
|
|
+}
|
|
|
+
|
|
|
+static int pack_can_0x144_ECU_144(can_obj_bcan_dbc_h_t *o, uint64_t *data) {
|
|
|
+ assert(o);
|
|
|
+ assert(data);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = 0;
|
|
|
+ /* ACC_LatAngReq: start-bit 4, length 14, endianess motorola, scaling 0.1, offset -720 */
|
|
|
+ x = ((uint16_t)(o->can_0x144_ECU_144.ACC_LatAngReq)) & 0x3fff;
|
|
|
+ x <<= 47;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_MotorTorqueMaxLimitRequest: start-bit 21, length 11, endianess motorola, scaling 0.02, offset -20.48 */
|
|
|
+ x = ((uint16_t)(o->can_0x144_ECU_144.ACC_MotorTorqueMaxLimitRequest)) & 0x7ff;
|
|
|
+ x <<= 35;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_MotorTorqueMinLimitRequest: start-bit 26, length 11, endianess motorola, scaling 0.02, offset -20.48 */
|
|
|
+ x = ((uint16_t)(o->can_0x144_ECU_144.ACC_MotorTorqueMinLimitRequest)) & 0x7ff;
|
|
|
+ x <<= 24;
|
|
|
+ m |= x;
|
|
|
+ /* ADS_Reqmode: start-bit 7, length 3, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x144_ECU_144.ADS_Reqmode)) & 0x7;
|
|
|
+ x <<= 61;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_ADCReqType: start-bit 47, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x144_ECU_144.ACC_ADCReqType)) & 0x3;
|
|
|
+ x <<= 22;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_LatAngReqActive: start-bit 22, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x144_ECU_144.ACC_LatAngReqActive)) & 0x1;
|
|
|
+ x <<= 46;
|
|
|
+ m |= x;
|
|
|
+ *data = reverse_byte_order(m);
|
|
|
+ o->can_0x144_ECU_144_tx = 1;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int unpack_can_0x144_ECU_144(can_obj_bcan_dbc_h_t *o, uint64_t data, uint8_t dlc, dbcc_time_stamp_t time_stamp) {
|
|
|
+ assert(o);
|
|
|
+ assert(dlc <= 8);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = reverse_byte_order(data);
|
|
|
+ if (dlc < 8)
|
|
|
+ return -1;
|
|
|
+ /* ACC_LatAngReq: start-bit 4, length 14, endianess motorola, scaling 0.1, offset -720 */
|
|
|
+ x = (m >> 47) & 0x3fff;
|
|
|
+ o->can_0x144_ECU_144.ACC_LatAngReq = x;
|
|
|
+ /* ACC_MotorTorqueMaxLimitRequest: start-bit 21, length 11, endianess motorola, scaling 0.02, offset -20.48 */
|
|
|
+ x = (m >> 35) & 0x7ff;
|
|
|
+ o->can_0x144_ECU_144.ACC_MotorTorqueMaxLimitRequest = x;
|
|
|
+ /* ACC_MotorTorqueMinLimitRequest: start-bit 26, length 11, endianess motorola, scaling 0.02, offset -20.48 */
|
|
|
+ x = (m >> 24) & 0x7ff;
|
|
|
+ o->can_0x144_ECU_144.ACC_MotorTorqueMinLimitRequest = x;
|
|
|
+ /* ADS_Reqmode: start-bit 7, length 3, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 61) & 0x7;
|
|
|
+ o->can_0x144_ECU_144.ADS_Reqmode = x;
|
|
|
+ /* ACC_ADCReqType: start-bit 47, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 22) & 0x3;
|
|
|
+ o->can_0x144_ECU_144.ACC_ADCReqType = x;
|
|
|
+ /* ACC_LatAngReqActive: start-bit 22, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 46) & 0x1;
|
|
|
+ o->can_0x144_ECU_144.ACC_LatAngReqActive = x;
|
|
|
+ o->can_0x144_ECU_144_rx = 1;
|
|
|
+ o->can_0x144_ECU_144_time_stamp_rx = time_stamp;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x144_ACC_LatAngReq(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x144_ECU_144.ACC_LatAngReq);
|
|
|
+ rval *= 0.1;
|
|
|
+ rval += -720;
|
|
|
+ if (rval <= 720) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x144_ACC_LatAngReq(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x144_ECU_144.ACC_LatAngReq = 0;
|
|
|
+ if (in > 720)
|
|
|
+ return -1;
|
|
|
+ in += 720;
|
|
|
+ in *= 10;
|
|
|
+ o->can_0x144_ECU_144.ACC_LatAngReq = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x144_ACC_MotorTorqueMaxLimitRequest(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x144_ECU_144.ACC_MotorTorqueMaxLimitRequest);
|
|
|
+ rval *= 0.02;
|
|
|
+ rval += -20.48;
|
|
|
+ if (rval <= 20.44) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x144_ACC_MotorTorqueMaxLimitRequest(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x144_ECU_144.ACC_MotorTorqueMaxLimitRequest = 0;
|
|
|
+ if (in > 20.44)
|
|
|
+ return -1;
|
|
|
+ in += 20.48;
|
|
|
+ in *= 50;
|
|
|
+ o->can_0x144_ECU_144.ACC_MotorTorqueMaxLimitRequest = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x144_ACC_MotorTorqueMinLimitRequest(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x144_ECU_144.ACC_MotorTorqueMinLimitRequest);
|
|
|
+ rval *= 0.02;
|
|
|
+ rval += -20.48;
|
|
|
+ if (rval <= 20.44) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x144_ACC_MotorTorqueMinLimitRequest(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x144_ECU_144.ACC_MotorTorqueMinLimitRequest = 0;
|
|
|
+ if (in > 20.44)
|
|
|
+ return -1;
|
|
|
+ in += 20.48;
|
|
|
+ in *= 50;
|
|
|
+ o->can_0x144_ECU_144.ACC_MotorTorqueMinLimitRequest = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x144_ADS_Reqmode(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x144_ECU_144.ADS_Reqmode);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x144_ADS_Reqmode(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x144_ECU_144.ADS_Reqmode = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x144_ACC_ADCReqType(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x144_ECU_144.ACC_ADCReqType);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x144_ACC_ADCReqType(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x144_ECU_144.ACC_ADCReqType = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x144_ACC_LatAngReqActive(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x144_ECU_144.ACC_LatAngReqActive);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x144_ACC_LatAngReqActive(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x144_ECU_144.ACC_LatAngReqActive = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int print_can_0x144_ECU_144(const can_obj_bcan_dbc_h_t *o, FILE *output) {
|
|
|
+ assert(o);
|
|
|
+ assert(output);
|
|
|
+ int r = 0;
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_LatAngReq = (wire: %.0f)\n", (double)(o->can_0x144_ECU_144.ACC_LatAngReq)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_MotorTorqueMaxLimitRequest = (wire: %.0f)\n", (double)(o->can_0x144_ECU_144.ACC_MotorTorqueMaxLimitRequest)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_MotorTorqueMinLimitRequest = (wire: %.0f)\n", (double)(o->can_0x144_ECU_144.ACC_MotorTorqueMinLimitRequest)));
|
|
|
+ r = print_helper(r, fprintf(output, "ADS_Reqmode = (wire: %.0f)\n", (double)(o->can_0x144_ECU_144.ADS_Reqmode)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_ADCReqType = (wire: %.0f)\n", (double)(o->can_0x144_ECU_144.ACC_ADCReqType)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_LatAngReqActive = (wire: %.0f)\n", (double)(o->can_0x144_ECU_144.ACC_LatAngReqActive)));
|
|
|
+ return r;
|
|
|
+}
|
|
|
+
|
|
|
+static int pack_can_0x147_ADC_147(can_obj_bcan_dbc_h_t *o, uint64_t *data) {
|
|
|
+ assert(o);
|
|
|
+ assert(data);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = 0;
|
|
|
+ /* EpsSasSteerAg: start-bit 9, length 16, endianess motorola, scaling 0.1, offset 0 */
|
|
|
+ x = ((uint16_t)(o->can_0x147_ADC_147.EpsSasSteerAg)) & 0xffff;
|
|
|
+ x <<= 34;
|
|
|
+ m |= x;
|
|
|
+ /* EPS_Pinionang: start-bit 7, length 14, endianess motorola, scaling 0.1, offset -720 */
|
|
|
+ x = ((uint16_t)(o->can_0x147_ADC_147.EPS_Pinionang)) & 0x3fff;
|
|
|
+ x <<= 50;
|
|
|
+ m |= x;
|
|
|
+ /* EspVehSpd: start-bit 41, length 13, endianess motorola, scaling 0.05625, offset 0 */
|
|
|
+ x = ((uint16_t)(o->can_0x147_ADC_147.EspVehSpd)) & 0x1fff;
|
|
|
+ x <<= 5;
|
|
|
+ m |= x;
|
|
|
+ /* EpsSteerAgRate: start-bit 24, length 8, endianess motorola, scaling 4, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x147_ADC_147.EpsSteerAgRate)) & 0xff;
|
|
|
+ x <<= 25;
|
|
|
+ m |= x;
|
|
|
+ /* EPS_ADS_Abortfeedback: start-bit 45, length 4, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x147_ADC_147.EPS_ADS_Abortfeedback)) & 0xf;
|
|
|
+ x <<= 18;
|
|
|
+ m |= x;
|
|
|
+ /* EPS_LatCtrlAvailabilityStatus: start-bit 47, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x147_ADC_147.EPS_LatCtrlAvailabilityStatus)) & 0x3;
|
|
|
+ x <<= 22;
|
|
|
+ m |= x;
|
|
|
+ /* EpsSasSteerAgVld: start-bit 25, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x147_ADC_147.EpsSasSteerAgVld)) & 0x1;
|
|
|
+ x <<= 33;
|
|
|
+ m |= x;
|
|
|
+ /* EPS_LatCtrlActive: start-bit 32, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x147_ADC_147.EPS_LatCtrlActive)) & 0x1;
|
|
|
+ x <<= 24;
|
|
|
+ m |= x;
|
|
|
+ /* EspVehSpdVld: start-bit 60, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x147_ADC_147.EspVehSpdVld)) & 0x1;
|
|
|
+ x <<= 4;
|
|
|
+ m |= x;
|
|
|
+ *data = reverse_byte_order(m);
|
|
|
+ o->can_0x147_ADC_147_tx = 1;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int unpack_can_0x147_ADC_147(can_obj_bcan_dbc_h_t *o, uint64_t data, uint8_t dlc, dbcc_time_stamp_t time_stamp) {
|
|
|
+ assert(o);
|
|
|
+ assert(dlc <= 8);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = reverse_byte_order(data);
|
|
|
+ if (dlc < 8)
|
|
|
+ return -1;
|
|
|
+ /* EpsSasSteerAg: start-bit 9, length 16, endianess motorola, scaling 0.1, offset 0 */
|
|
|
+ x = (m >> 34) & 0xffff;
|
|
|
+ o->can_0x147_ADC_147.EpsSasSteerAg = x;
|
|
|
+ /* EPS_Pinionang: start-bit 7, length 14, endianess motorola, scaling 0.1, offset -720 */
|
|
|
+ x = (m >> 50) & 0x3fff;
|
|
|
+ o->can_0x147_ADC_147.EPS_Pinionang = x;
|
|
|
+ /* EspVehSpd: start-bit 41, length 13, endianess motorola, scaling 0.05625, offset 0 */
|
|
|
+ x = (m >> 5) & 0x1fff;
|
|
|
+ o->can_0x147_ADC_147.EspVehSpd = x;
|
|
|
+ /* EpsSteerAgRate: start-bit 24, length 8, endianess motorola, scaling 4, offset 0 */
|
|
|
+ x = (m >> 25) & 0xff;
|
|
|
+ o->can_0x147_ADC_147.EpsSteerAgRate = x;
|
|
|
+ /* EPS_ADS_Abortfeedback: start-bit 45, length 4, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 18) & 0xf;
|
|
|
+ o->can_0x147_ADC_147.EPS_ADS_Abortfeedback = x;
|
|
|
+ /* EPS_LatCtrlAvailabilityStatus: start-bit 47, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 22) & 0x3;
|
|
|
+ o->can_0x147_ADC_147.EPS_LatCtrlAvailabilityStatus = x;
|
|
|
+ /* EpsSasSteerAgVld: start-bit 25, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 33) & 0x1;
|
|
|
+ o->can_0x147_ADC_147.EpsSasSteerAgVld = x;
|
|
|
+ /* EPS_LatCtrlActive: start-bit 32, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 24) & 0x1;
|
|
|
+ o->can_0x147_ADC_147.EPS_LatCtrlActive = x;
|
|
|
+ /* EspVehSpdVld: start-bit 60, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 4) & 0x1;
|
|
|
+ o->can_0x147_ADC_147.EspVehSpdVld = x;
|
|
|
+ o->can_0x147_ADC_147_rx = 1;
|
|
|
+ o->can_0x147_ADC_147_time_stamp_rx = time_stamp;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x147_EpsSasSteerAg(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x147_ADC_147.EpsSasSteerAg);
|
|
|
+ rval *= 0.1;
|
|
|
+ if ((rval >= -780) && (rval <= 780)) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x147_EpsSasSteerAg(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x147_ADC_147.EpsSasSteerAg = 0;
|
|
|
+ if (in < -780)
|
|
|
+ return -1;
|
|
|
+ if (in > 780)
|
|
|
+ return -1;
|
|
|
+ in *= 10;
|
|
|
+ o->can_0x147_ADC_147.EpsSasSteerAg = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x147_EPS_Pinionang(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x147_ADC_147.EPS_Pinionang);
|
|
|
+ rval *= 0.1;
|
|
|
+ rval += -720;
|
|
|
+ if (rval <= 720) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x147_EPS_Pinionang(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x147_ADC_147.EPS_Pinionang = 0;
|
|
|
+ if (in > 720)
|
|
|
+ return -1;
|
|
|
+ in += 720;
|
|
|
+ in *= 10;
|
|
|
+ o->can_0x147_ADC_147.EPS_Pinionang = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x147_EspVehSpd(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x147_ADC_147.EspVehSpd);
|
|
|
+ rval *= 0.05625;
|
|
|
+ if (rval <= 460.744) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x147_EspVehSpd(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x147_ADC_147.EspVehSpd = 0;
|
|
|
+ if (in > 460.744)
|
|
|
+ return -1;
|
|
|
+ in *= 17.7778;
|
|
|
+ o->can_0x147_ADC_147.EspVehSpd = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x147_EpsSteerAgRate(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x147_ADC_147.EpsSteerAgRate);
|
|
|
+ rval *= 4;
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x147_EpsSteerAgRate(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ in *= 0.25;
|
|
|
+ o->can_0x147_ADC_147.EpsSteerAgRate = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x147_EPS_ADS_Abortfeedback(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x147_ADC_147.EPS_ADS_Abortfeedback);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x147_EPS_ADS_Abortfeedback(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x147_ADC_147.EPS_ADS_Abortfeedback = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x147_EPS_LatCtrlAvailabilityStatus(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x147_ADC_147.EPS_LatCtrlAvailabilityStatus);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x147_EPS_LatCtrlAvailabilityStatus(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x147_ADC_147.EPS_LatCtrlAvailabilityStatus = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x147_EpsSasSteerAgVld(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x147_ADC_147.EpsSasSteerAgVld);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x147_EpsSasSteerAgVld(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x147_ADC_147.EpsSasSteerAgVld = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x147_EPS_LatCtrlActive(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x147_ADC_147.EPS_LatCtrlActive);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x147_EPS_LatCtrlActive(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x147_ADC_147.EPS_LatCtrlActive = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x147_EspVehSpdVld(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x147_ADC_147.EspVehSpdVld);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x147_EspVehSpdVld(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x147_ADC_147.EspVehSpdVld = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int print_can_0x147_ADC_147(const can_obj_bcan_dbc_h_t *o, FILE *output) {
|
|
|
+ assert(o);
|
|
|
+ assert(output);
|
|
|
+ int r = 0;
|
|
|
+ r = print_helper(r, fprintf(output, "EpsSasSteerAg = (wire: %.0f)\n", (double)(o->can_0x147_ADC_147.EpsSasSteerAg)));
|
|
|
+ r = print_helper(r, fprintf(output, "EPS_Pinionang = (wire: %.0f)\n", (double)(o->can_0x147_ADC_147.EPS_Pinionang)));
|
|
|
+ r = print_helper(r, fprintf(output, "EspVehSpd = (wire: %.0f)\n", (double)(o->can_0x147_ADC_147.EspVehSpd)));
|
|
|
+ r = print_helper(r, fprintf(output, "EpsSteerAgRate = (wire: %.0f)\n", (double)(o->can_0x147_ADC_147.EpsSteerAgRate)));
|
|
|
+ r = print_helper(r, fprintf(output, "EPS_ADS_Abortfeedback = (wire: %.0f)\n", (double)(o->can_0x147_ADC_147.EPS_ADS_Abortfeedback)));
|
|
|
+ r = print_helper(r, fprintf(output, "EPS_LatCtrlAvailabilityStatus = (wire: %.0f)\n", (double)(o->can_0x147_ADC_147.EPS_LatCtrlAvailabilityStatus)));
|
|
|
+ r = print_helper(r, fprintf(output, "EpsSasSteerAgVld = (wire: %.0f)\n", (double)(o->can_0x147_ADC_147.EpsSasSteerAgVld)));
|
|
|
+ r = print_helper(r, fprintf(output, "EPS_LatCtrlActive = (wire: %.0f)\n", (double)(o->can_0x147_ADC_147.EPS_LatCtrlActive)));
|
|
|
+ r = print_helper(r, fprintf(output, "EspVehSpdVld = (wire: %.0f)\n", (double)(o->can_0x147_ADC_147.EspVehSpdVld)));
|
|
|
+ return r;
|
|
|
+}
|
|
|
+
|
|
|
+static int pack_can_0x14a_ADC_14A(can_obj_bcan_dbc_h_t *o, uint64_t *data) {
|
|
|
+ assert(o);
|
|
|
+ assert(data);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = 0;
|
|
|
+ /* VcuPtTqLimMax: start-bit 7, length 16, endianess motorola, scaling 1, offset -32768 */
|
|
|
+ x = ((uint16_t)(o->can_0x14a_ADC_14A.VcuPtTqLimMax)) & 0xffff;
|
|
|
+ x <<= 48;
|
|
|
+ m |= x;
|
|
|
+ /* VcuPtTqLimMin: start-bit 23, length 16, endianess motorola, scaling 1, offset -32768 */
|
|
|
+ x = ((uint16_t)(o->can_0x14a_ADC_14A.VcuPtTqLimMin)) & 0xffff;
|
|
|
+ x <<= 32;
|
|
|
+ m |= x;
|
|
|
+ /* VcuPtTqReal: start-bit 39, length 16, endianess motorola, scaling 1, offset -32768 */
|
|
|
+ x = ((uint16_t)(o->can_0x14a_ADC_14A.VcuPtTqReal)) & 0xffff;
|
|
|
+ x <<= 16;
|
|
|
+ m |= x;
|
|
|
+ /* VcuShiftLvlPosn: start-bit 50, length 4, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x14a_ADC_14A.VcuShiftLvlPosn)) & 0xf;
|
|
|
+ x <<= 7;
|
|
|
+ m |= x;
|
|
|
+ /* IBCU_ReduceFuncAvail: start-bit 52, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x14a_ADC_14A.IBCU_ReduceFuncAvail)) & 0x3;
|
|
|
+ x <<= 11;
|
|
|
+ m |= x;
|
|
|
+ /* IBCU_FullFuncAvail: start-bit 54, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x14a_ADC_14A.IBCU_FullFuncAvail)) & 0x3;
|
|
|
+ x <<= 13;
|
|
|
+ m |= x;
|
|
|
+ /* ESP_BrakeForce: start-bit 55, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x14a_ADC_14A.ESP_BrakeForce)) & 0x1;
|
|
|
+ x <<= 15;
|
|
|
+ m |= x;
|
|
|
+ *data = reverse_byte_order(m);
|
|
|
+ o->can_0x14a_ADC_14A_tx = 1;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int unpack_can_0x14a_ADC_14A(can_obj_bcan_dbc_h_t *o, uint64_t data, uint8_t dlc, dbcc_time_stamp_t time_stamp) {
|
|
|
+ assert(o);
|
|
|
+ assert(dlc <= 8);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = reverse_byte_order(data);
|
|
|
+ if (dlc < 8)
|
|
|
+ return -1;
|
|
|
+ /* VcuPtTqLimMax: start-bit 7, length 16, endianess motorola, scaling 1, offset -32768 */
|
|
|
+ x = (m >> 48) & 0xffff;
|
|
|
+ o->can_0x14a_ADC_14A.VcuPtTqLimMax = x;
|
|
|
+ /* VcuPtTqLimMin: start-bit 23, length 16, endianess motorola, scaling 1, offset -32768 */
|
|
|
+ x = (m >> 32) & 0xffff;
|
|
|
+ o->can_0x14a_ADC_14A.VcuPtTqLimMin = x;
|
|
|
+ /* VcuPtTqReal: start-bit 39, length 16, endianess motorola, scaling 1, offset -32768 */
|
|
|
+ x = (m >> 16) & 0xffff;
|
|
|
+ o->can_0x14a_ADC_14A.VcuPtTqReal = x;
|
|
|
+ /* VcuShiftLvlPosn: start-bit 50, length 4, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 7) & 0xf;
|
|
|
+ o->can_0x14a_ADC_14A.VcuShiftLvlPosn = x;
|
|
|
+ /* IBCU_ReduceFuncAvail: start-bit 52, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 11) & 0x3;
|
|
|
+ o->can_0x14a_ADC_14A.IBCU_ReduceFuncAvail = x;
|
|
|
+ /* IBCU_FullFuncAvail: start-bit 54, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 13) & 0x3;
|
|
|
+ o->can_0x14a_ADC_14A.IBCU_FullFuncAvail = x;
|
|
|
+ /* ESP_BrakeForce: start-bit 55, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 15) & 0x1;
|
|
|
+ o->can_0x14a_ADC_14A.ESP_BrakeForce = x;
|
|
|
+ o->can_0x14a_ADC_14A_rx = 1;
|
|
|
+ o->can_0x14a_ADC_14A_time_stamp_rx = time_stamp;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x14a_VcuPtTqLimMax(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x14a_ADC_14A.VcuPtTqLimMax);
|
|
|
+ rval += -32768;
|
|
|
+ if (rval <= 32767) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x14a_VcuPtTqLimMax(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x14a_ADC_14A.VcuPtTqLimMax = 0;
|
|
|
+ if (in > 32767)
|
|
|
+ return -1;
|
|
|
+ in += 32768;
|
|
|
+ o->can_0x14a_ADC_14A.VcuPtTqLimMax = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x14a_VcuPtTqLimMin(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x14a_ADC_14A.VcuPtTqLimMin);
|
|
|
+ rval += -32768;
|
|
|
+ if (rval <= 32767) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x14a_VcuPtTqLimMin(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x14a_ADC_14A.VcuPtTqLimMin = 0;
|
|
|
+ if (in > 32767)
|
|
|
+ return -1;
|
|
|
+ in += 32768;
|
|
|
+ o->can_0x14a_ADC_14A.VcuPtTqLimMin = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x14a_VcuPtTqReal(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x14a_ADC_14A.VcuPtTqReal);
|
|
|
+ rval += -32768;
|
|
|
+ if (rval <= 32767) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x14a_VcuPtTqReal(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x14a_ADC_14A.VcuPtTqReal = 0;
|
|
|
+ if (in > 32767)
|
|
|
+ return -1;
|
|
|
+ in += 32768;
|
|
|
+ o->can_0x14a_ADC_14A.VcuPtTqReal = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x14a_VcuShiftLvlPosn(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x14a_ADC_14A.VcuShiftLvlPosn);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x14a_VcuShiftLvlPosn(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x14a_ADC_14A.VcuShiftLvlPosn = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x14a_IBCU_ReduceFuncAvail(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x14a_ADC_14A.IBCU_ReduceFuncAvail);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x14a_IBCU_ReduceFuncAvail(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x14a_ADC_14A.IBCU_ReduceFuncAvail = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x14a_IBCU_FullFuncAvail(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x14a_ADC_14A.IBCU_FullFuncAvail);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x14a_IBCU_FullFuncAvail(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x14a_ADC_14A.IBCU_FullFuncAvail = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x14a_ESP_BrakeForce(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x14a_ADC_14A.ESP_BrakeForce);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x14a_ESP_BrakeForce(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x14a_ADC_14A.ESP_BrakeForce = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int print_can_0x14a_ADC_14A(const can_obj_bcan_dbc_h_t *o, FILE *output) {
|
|
|
+ assert(o);
|
|
|
+ assert(output);
|
|
|
+ int r = 0;
|
|
|
+ r = print_helper(r, fprintf(output, "VcuPtTqLimMax = (wire: %.0f)\n", (double)(o->can_0x14a_ADC_14A.VcuPtTqLimMax)));
|
|
|
+ r = print_helper(r, fprintf(output, "VcuPtTqLimMin = (wire: %.0f)\n", (double)(o->can_0x14a_ADC_14A.VcuPtTqLimMin)));
|
|
|
+ r = print_helper(r, fprintf(output, "VcuPtTqReal = (wire: %.0f)\n", (double)(o->can_0x14a_ADC_14A.VcuPtTqReal)));
|
|
|
+ r = print_helper(r, fprintf(output, "VcuShiftLvlPosn = (wire: %.0f)\n", (double)(o->can_0x14a_ADC_14A.VcuShiftLvlPosn)));
|
|
|
+ r = print_helper(r, fprintf(output, "IBCU_ReduceFuncAvail = (wire: %.0f)\n", (double)(o->can_0x14a_ADC_14A.IBCU_ReduceFuncAvail)));
|
|
|
+ r = print_helper(r, fprintf(output, "IBCU_FullFuncAvail = (wire: %.0f)\n", (double)(o->can_0x14a_ADC_14A.IBCU_FullFuncAvail)));
|
|
|
+ r = print_helper(r, fprintf(output, "ESP_BrakeForce = (wire: %.0f)\n", (double)(o->can_0x14a_ADC_14A.ESP_BrakeForce)));
|
|
|
+ return r;
|
|
|
+}
|
|
|
+
|
|
|
+static int pack_can_0x24b_ECU_24B(can_obj_bcan_dbc_h_t *o, uint64_t *data) {
|
|
|
+ assert(o);
|
|
|
+ assert(data);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = 0;
|
|
|
+ /* ACC_AEBTargetDeceleration: start-bit 24, length 16, endianess motorola, scaling 0.0005, offset -16 */
|
|
|
+ x = ((uint16_t)(o->can_0x24b_ECU_24B.ACC_AEBTargetDeceleration)) & 0xffff;
|
|
|
+ x <<= 17;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_AccTrqReq: start-bit 7, length 15, endianess motorola, scaling 1, offset -16384 */
|
|
|
+ x = ((uint16_t)(o->can_0x24b_ECU_24B.ACC_AccTrqReq)) & 0x7fff;
|
|
|
+ x <<= 49;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_ACCTargetAcceleration: start-bit 20, length 8, endianess motorola, scaling 0.05, offset -10 */
|
|
|
+ x = ((uint8_t)(o->can_0x24b_ECU_24B.ACC_ACCTargetAcceleration)) & 0xff;
|
|
|
+ x <<= 37;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_ACCMode: start-bit 58, length 3, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x24b_ECU_24B.ACC_ACCMode)) & 0x7;
|
|
|
+ m |= x;
|
|
|
+ /* ADCReqMode: start-bit 50, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x24b_ECU_24B.ADCReqMode)) & 0x3;
|
|
|
+ x <<= 9;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_AccTrqReqActive: start-bit 8, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x24b_ECU_24B.ACC_AccTrqReqActive)) & 0x1;
|
|
|
+ x <<= 48;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_AEBVehilceHoldReq: start-bit 40, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x24b_ECU_24B.ACC_AEBVehilceHoldReq)) & 0x1;
|
|
|
+ x <<= 16;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_AEBActive: start-bit 51, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x24b_ECU_24B.ACC_AEBActive)) & 0x1;
|
|
|
+ x <<= 11;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_Driveoff_Request: start-bit 53, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x24b_ECU_24B.ACC_Driveoff_Request)) & 0x1;
|
|
|
+ x <<= 13;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_DecToStop: start-bit 54, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x24b_ECU_24B.ACC_DecToStop)) & 0x1;
|
|
|
+ x <<= 14;
|
|
|
+ m |= x;
|
|
|
+ /* ACC_CDDActive: start-bit 55, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x24b_ECU_24B.ACC_CDDActive)) & 0x1;
|
|
|
+ x <<= 15;
|
|
|
+ m |= x;
|
|
|
+ *data = reverse_byte_order(m);
|
|
|
+ o->can_0x24b_ECU_24B_tx = 1;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int unpack_can_0x24b_ECU_24B(can_obj_bcan_dbc_h_t *o, uint64_t data, uint8_t dlc, dbcc_time_stamp_t time_stamp) {
|
|
|
+ assert(o);
|
|
|
+ assert(dlc <= 8);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = reverse_byte_order(data);
|
|
|
+ if (dlc < 8)
|
|
|
+ return -1;
|
|
|
+ /* ACC_AEBTargetDeceleration: start-bit 24, length 16, endianess motorola, scaling 0.0005, offset -16 */
|
|
|
+ x = (m >> 17) & 0xffff;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_AEBTargetDeceleration = x;
|
|
|
+ /* ACC_AccTrqReq: start-bit 7, length 15, endianess motorola, scaling 1, offset -16384 */
|
|
|
+ x = (m >> 49) & 0x7fff;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_AccTrqReq = x;
|
|
|
+ /* ACC_ACCTargetAcceleration: start-bit 20, length 8, endianess motorola, scaling 0.05, offset -10 */
|
|
|
+ x = (m >> 37) & 0xff;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_ACCTargetAcceleration = x;
|
|
|
+ /* ACC_ACCMode: start-bit 58, length 3, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = m & 0x7;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_ACCMode = x;
|
|
|
+ /* ADCReqMode: start-bit 50, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 9) & 0x3;
|
|
|
+ o->can_0x24b_ECU_24B.ADCReqMode = x;
|
|
|
+ /* ACC_AccTrqReqActive: start-bit 8, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 48) & 0x1;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_AccTrqReqActive = x;
|
|
|
+ /* ACC_AEBVehilceHoldReq: start-bit 40, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 16) & 0x1;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_AEBVehilceHoldReq = x;
|
|
|
+ /* ACC_AEBActive: start-bit 51, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 11) & 0x1;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_AEBActive = x;
|
|
|
+ /* ACC_Driveoff_Request: start-bit 53, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 13) & 0x1;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_Driveoff_Request = x;
|
|
|
+ /* ACC_DecToStop: start-bit 54, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 14) & 0x1;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_DecToStop = x;
|
|
|
+ /* ACC_CDDActive: start-bit 55, length 1, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 15) & 0x1;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_CDDActive = x;
|
|
|
+ o->can_0x24b_ECU_24B_rx = 1;
|
|
|
+ o->can_0x24b_ECU_24B_time_stamp_rx = time_stamp;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x24b_ACC_AEBTargetDeceleration(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x24b_ECU_24B.ACC_AEBTargetDeceleration);
|
|
|
+ rval *= 0.0005;
|
|
|
+ rval += -16;
|
|
|
+ if (rval <= 16) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x24b_ACC_AEBTargetDeceleration(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x24b_ECU_24B.ACC_AEBTargetDeceleration = 0;
|
|
|
+ if (in > 16)
|
|
|
+ return -1;
|
|
|
+ in += 16;
|
|
|
+ in *= 2000;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_AEBTargetDeceleration = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x24b_ACC_AccTrqReq(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x24b_ECU_24B.ACC_AccTrqReq);
|
|
|
+ rval += -16384;
|
|
|
+ if (rval <= 16383) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x24b_ACC_AccTrqReq(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x24b_ECU_24B.ACC_AccTrqReq = 0;
|
|
|
+ if (in > 16383)
|
|
|
+ return -1;
|
|
|
+ in += 16384;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_AccTrqReq = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x24b_ACC_ACCTargetAcceleration(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x24b_ECU_24B.ACC_ACCTargetAcceleration);
|
|
|
+ rval *= 0.05;
|
|
|
+ rval += -10;
|
|
|
+ if (rval <= 2.75) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x24b_ACC_ACCTargetAcceleration(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x24b_ECU_24B.ACC_ACCTargetAcceleration = 0;
|
|
|
+ if (in > 2.75)
|
|
|
+ return -1;
|
|
|
+ in += 10;
|
|
|
+ in *= 20;
|
|
|
+ o->can_0x24b_ECU_24B.ACC_ACCTargetAcceleration = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x24b_ACC_ACCMode(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x24b_ECU_24B.ACC_ACCMode);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x24b_ACC_ACCMode(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x24b_ECU_24B.ACC_ACCMode = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x24b_ADCReqMode(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x24b_ECU_24B.ADCReqMode);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x24b_ADCReqMode(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x24b_ECU_24B.ADCReqMode = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x24b_ACC_AccTrqReqActive(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x24b_ECU_24B.ACC_AccTrqReqActive);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x24b_ACC_AccTrqReqActive(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x24b_ECU_24B.ACC_AccTrqReqActive = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x24b_ACC_AEBVehilceHoldReq(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x24b_ECU_24B.ACC_AEBVehilceHoldReq);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x24b_ACC_AEBVehilceHoldReq(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x24b_ECU_24B.ACC_AEBVehilceHoldReq = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x24b_ACC_AEBActive(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x24b_ECU_24B.ACC_AEBActive);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x24b_ACC_AEBActive(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x24b_ECU_24B.ACC_AEBActive = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x24b_ACC_Driveoff_Request(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x24b_ECU_24B.ACC_Driveoff_Request);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x24b_ACC_Driveoff_Request(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x24b_ECU_24B.ACC_Driveoff_Request = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x24b_ACC_DecToStop(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x24b_ECU_24B.ACC_DecToStop);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x24b_ACC_DecToStop(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x24b_ECU_24B.ACC_DecToStop = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x24b_ACC_CDDActive(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x24b_ECU_24B.ACC_CDDActive);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x24b_ACC_CDDActive(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x24b_ECU_24B.ACC_CDDActive = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int print_can_0x24b_ECU_24B(const can_obj_bcan_dbc_h_t *o, FILE *output) {
|
|
|
+ assert(o);
|
|
|
+ assert(output);
|
|
|
+ int r = 0;
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_AEBTargetDeceleration = (wire: %.0f)\n", (double)(o->can_0x24b_ECU_24B.ACC_AEBTargetDeceleration)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_AccTrqReq = (wire: %.0f)\n", (double)(o->can_0x24b_ECU_24B.ACC_AccTrqReq)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_ACCTargetAcceleration = (wire: %.0f)\n", (double)(o->can_0x24b_ECU_24B.ACC_ACCTargetAcceleration)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_ACCMode = (wire: %.0f)\n", (double)(o->can_0x24b_ECU_24B.ACC_ACCMode)));
|
|
|
+ r = print_helper(r, fprintf(output, "ADCReqMode = (wire: %.0f)\n", (double)(o->can_0x24b_ECU_24B.ADCReqMode)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_AccTrqReqActive = (wire: %.0f)\n", (double)(o->can_0x24b_ECU_24B.ACC_AccTrqReqActive)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_AEBVehilceHoldReq = (wire: %.0f)\n", (double)(o->can_0x24b_ECU_24B.ACC_AEBVehilceHoldReq)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_AEBActive = (wire: %.0f)\n", (double)(o->can_0x24b_ECU_24B.ACC_AEBActive)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_Driveoff_Request = (wire: %.0f)\n", (double)(o->can_0x24b_ECU_24B.ACC_Driveoff_Request)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_DecToStop = (wire: %.0f)\n", (double)(o->can_0x24b_ECU_24B.ACC_DecToStop)));
|
|
|
+ r = print_helper(r, fprintf(output, "ACC_CDDActive = (wire: %.0f)\n", (double)(o->can_0x24b_ECU_24B.ACC_CDDActive)));
|
|
|
+ return r;
|
|
|
+}
|
|
|
+
|
|
|
+static int pack_can_0x250_ADC_250(can_obj_bcan_dbc_h_t *o, uint64_t *data) {
|
|
|
+ assert(o);
|
|
|
+ assert(data);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = 0;
|
|
|
+ /* ESP_YawRate: start-bit 2, length 14, endianess motorola, scaling 0.01, offset -81.91 */
|
|
|
+ x = ((uint16_t)(o->can_0x250_ADC_250.ESP_YawRate)) & 0x3fff;
|
|
|
+ x <<= 45;
|
|
|
+ m |= x;
|
|
|
+ /* ESP_LongAccel: start-bit 20, length 10, endianess motorola, scaling 0.03125, offset -16 */
|
|
|
+ x = ((uint16_t)(o->can_0x250_ADC_250.ESP_LongAccel)) & 0x3ff;
|
|
|
+ x <<= 35;
|
|
|
+ m |= x;
|
|
|
+ /* ESP_LatAccel: start-bit 24, length 8, endianess motorola, scaling 0.1, offset -12.7 */
|
|
|
+ x = ((uint8_t)(o->can_0x250_ADC_250.ESP_LatAccel)) & 0xff;
|
|
|
+ x <<= 25;
|
|
|
+ m |= x;
|
|
|
+ /* EPS_ADS_ControlFeedback: start-bit 7, length 3, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x250_ADC_250.EPS_ADS_ControlFeedback)) & 0x7;
|
|
|
+ x <<= 61;
|
|
|
+ m |= x;
|
|
|
+ /* ESP_YawRateValid: start-bit 4, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x250_ADC_250.ESP_YawRateValid)) & 0x3;
|
|
|
+ x <<= 59;
|
|
|
+ m |= x;
|
|
|
+ /* ESP_LongAccelValid: start-bit 26, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x250_ADC_250.ESP_LongAccelValid)) & 0x3;
|
|
|
+ x <<= 33;
|
|
|
+ m |= x;
|
|
|
+ /* ESP_LatAccelValid: start-bit 32, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x250_ADC_250.ESP_LatAccelValid)) & 0x3;
|
|
|
+ x <<= 23;
|
|
|
+ m |= x;
|
|
|
+ *data = reverse_byte_order(m);
|
|
|
+ o->can_0x250_ADC_250_tx = 1;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int unpack_can_0x250_ADC_250(can_obj_bcan_dbc_h_t *o, uint64_t data, uint8_t dlc, dbcc_time_stamp_t time_stamp) {
|
|
|
+ assert(o);
|
|
|
+ assert(dlc <= 8);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = reverse_byte_order(data);
|
|
|
+ if (dlc < 8)
|
|
|
+ return -1;
|
|
|
+ /* ESP_YawRate: start-bit 2, length 14, endianess motorola, scaling 0.01, offset -81.91 */
|
|
|
+ x = (m >> 45) & 0x3fff;
|
|
|
+ o->can_0x250_ADC_250.ESP_YawRate = x;
|
|
|
+ /* ESP_LongAccel: start-bit 20, length 10, endianess motorola, scaling 0.03125, offset -16 */
|
|
|
+ x = (m >> 35) & 0x3ff;
|
|
|
+ o->can_0x250_ADC_250.ESP_LongAccel = x;
|
|
|
+ /* ESP_LatAccel: start-bit 24, length 8, endianess motorola, scaling 0.1, offset -12.7 */
|
|
|
+ x = (m >> 25) & 0xff;
|
|
|
+ o->can_0x250_ADC_250.ESP_LatAccel = x;
|
|
|
+ /* EPS_ADS_ControlFeedback: start-bit 7, length 3, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 61) & 0x7;
|
|
|
+ o->can_0x250_ADC_250.EPS_ADS_ControlFeedback = x;
|
|
|
+ /* ESP_YawRateValid: start-bit 4, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 59) & 0x3;
|
|
|
+ o->can_0x250_ADC_250.ESP_YawRateValid = x;
|
|
|
+ /* ESP_LongAccelValid: start-bit 26, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 33) & 0x3;
|
|
|
+ o->can_0x250_ADC_250.ESP_LongAccelValid = x;
|
|
|
+ /* ESP_LatAccelValid: start-bit 32, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 23) & 0x3;
|
|
|
+ o->can_0x250_ADC_250.ESP_LatAccelValid = x;
|
|
|
+ o->can_0x250_ADC_250_rx = 1;
|
|
|
+ o->can_0x250_ADC_250_time_stamp_rx = time_stamp;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x250_ESP_YawRate(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x250_ADC_250.ESP_YawRate);
|
|
|
+ rval *= 0.01;
|
|
|
+ rval += -81.91;
|
|
|
+ if (rval <= 81.92) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x250_ESP_YawRate(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x250_ADC_250.ESP_YawRate = 0;
|
|
|
+ if (in > 81.92)
|
|
|
+ return -1;
|
|
|
+ in += 81.91;
|
|
|
+ in *= 100;
|
|
|
+ o->can_0x250_ADC_250.ESP_YawRate = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x250_ESP_LongAccel(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x250_ADC_250.ESP_LongAccel);
|
|
|
+ rval *= 0.03125;
|
|
|
+ rval += -16;
|
|
|
+ if (rval <= 15.9062) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x250_ESP_LongAccel(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x250_ADC_250.ESP_LongAccel = 0;
|
|
|
+ if (in > 15.9062)
|
|
|
+ return -1;
|
|
|
+ in += 16;
|
|
|
+ in *= 32;
|
|
|
+ o->can_0x250_ADC_250.ESP_LongAccel = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x250_ESP_LatAccel(const can_obj_bcan_dbc_h_t *o, double *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ double rval = (double)(o->can_0x250_ADC_250.ESP_LatAccel);
|
|
|
+ rval *= 0.1;
|
|
|
+ rval += -12.7;
|
|
|
+ if (rval <= 12.7) {
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+ } else {
|
|
|
+ *out = (double)0;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x250_ESP_LatAccel(can_obj_bcan_dbc_h_t *o, double in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x250_ADC_250.ESP_LatAccel = 0;
|
|
|
+ if (in > 12.7)
|
|
|
+ return -1;
|
|
|
+ in += 12.7;
|
|
|
+ in *= 10;
|
|
|
+ o->can_0x250_ADC_250.ESP_LatAccel = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x250_EPS_ADS_ControlFeedback(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x250_ADC_250.EPS_ADS_ControlFeedback);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x250_EPS_ADS_ControlFeedback(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x250_ADC_250.EPS_ADS_ControlFeedback = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x250_ESP_YawRateValid(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x250_ADC_250.ESP_YawRateValid);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x250_ESP_YawRateValid(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x250_ADC_250.ESP_YawRateValid = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x250_ESP_LongAccelValid(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x250_ADC_250.ESP_LongAccelValid);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x250_ESP_LongAccelValid(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x250_ADC_250.ESP_LongAccelValid = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x250_ESP_LatAccelValid(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x250_ADC_250.ESP_LatAccelValid);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x250_ESP_LatAccelValid(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x250_ADC_250.ESP_LatAccelValid = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int print_can_0x250_ADC_250(const can_obj_bcan_dbc_h_t *o, FILE *output) {
|
|
|
+ assert(o);
|
|
|
+ assert(output);
|
|
|
+ int r = 0;
|
|
|
+ r = print_helper(r, fprintf(output, "ESP_YawRate = (wire: %.0f)\n", (double)(o->can_0x250_ADC_250.ESP_YawRate)));
|
|
|
+ r = print_helper(r, fprintf(output, "ESP_LongAccel = (wire: %.0f)\n", (double)(o->can_0x250_ADC_250.ESP_LongAccel)));
|
|
|
+ r = print_helper(r, fprintf(output, "ESP_LatAccel = (wire: %.0f)\n", (double)(o->can_0x250_ADC_250.ESP_LatAccel)));
|
|
|
+ r = print_helper(r, fprintf(output, "EPS_ADS_ControlFeedback = (wire: %.0f)\n", (double)(o->can_0x250_ADC_250.EPS_ADS_ControlFeedback)));
|
|
|
+ r = print_helper(r, fprintf(output, "ESP_YawRateValid = (wire: %.0f)\n", (double)(o->can_0x250_ADC_250.ESP_YawRateValid)));
|
|
|
+ r = print_helper(r, fprintf(output, "ESP_LongAccelValid = (wire: %.0f)\n", (double)(o->can_0x250_ADC_250.ESP_LongAccelValid)));
|
|
|
+ r = print_helper(r, fprintf(output, "ESP_LatAccelValid = (wire: %.0f)\n", (double)(o->can_0x250_ADC_250.ESP_LatAccelValid)));
|
|
|
+ return r;
|
|
|
+}
|
|
|
+
|
|
|
+static int pack_can_0x358_ADC_358(can_obj_bcan_dbc_h_t *o, uint64_t *data) {
|
|
|
+ assert(o);
|
|
|
+ assert(data);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = 0;
|
|
|
+ /* ADS_UDLCTurnLightReq: start-bit 26, length 3, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x358_ADC_358.ADS_UDLCTurnLightReq)) & 0x7;
|
|
|
+ x <<= 32;
|
|
|
+ m |= x;
|
|
|
+ *data = reverse_byte_order(m);
|
|
|
+ o->can_0x358_ADC_358_tx = 1;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int unpack_can_0x358_ADC_358(can_obj_bcan_dbc_h_t *o, uint64_t data, uint8_t dlc, dbcc_time_stamp_t time_stamp) {
|
|
|
+ assert(o);
|
|
|
+ assert(dlc <= 8);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = reverse_byte_order(data);
|
|
|
+ if (dlc < 8)
|
|
|
+ return -1;
|
|
|
+ /* ADS_UDLCTurnLightReq: start-bit 26, length 3, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 32) & 0x7;
|
|
|
+ o->can_0x358_ADC_358.ADS_UDLCTurnLightReq = x;
|
|
|
+ o->can_0x358_ADC_358_rx = 1;
|
|
|
+ o->can_0x358_ADC_358_time_stamp_rx = time_stamp;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x358_ADS_UDLCTurnLightReq(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x358_ADC_358.ADS_UDLCTurnLightReq);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x358_ADS_UDLCTurnLightReq(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x358_ADC_358.ADS_UDLCTurnLightReq = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int print_can_0x358_ADC_358(const can_obj_bcan_dbc_h_t *o, FILE *output) {
|
|
|
+ assert(o);
|
|
|
+ assert(output);
|
|
|
+ int r = 0;
|
|
|
+ r = print_helper(r, fprintf(output, "ADS_UDLCTurnLightReq = (wire: %.0f)\n", (double)(o->can_0x358_ADC_358.ADS_UDLCTurnLightReq)));
|
|
|
+ return r;
|
|
|
+}
|
|
|
+
|
|
|
+static int pack_can_0x36e_ECU_36E(can_obj_bcan_dbc_h_t *o, uint64_t *data) {
|
|
|
+ assert(o);
|
|
|
+ assert(data);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = 0;
|
|
|
+ /* ADS_UDLCTurnLightReq: start-bit 7, length 3, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x36e_ECU_36E.ADS_UDLCTurnLightReq)) & 0x7;
|
|
|
+ x <<= 61;
|
|
|
+ m |= x;
|
|
|
+ *data = reverse_byte_order(m);
|
|
|
+ o->can_0x36e_ECU_36E_tx = 1;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int unpack_can_0x36e_ECU_36E(can_obj_bcan_dbc_h_t *o, uint64_t data, uint8_t dlc, dbcc_time_stamp_t time_stamp) {
|
|
|
+ assert(o);
|
|
|
+ assert(dlc <= 8);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = reverse_byte_order(data);
|
|
|
+ if (dlc < 8)
|
|
|
+ return -1;
|
|
|
+ /* ADS_UDLCTurnLightReq: start-bit 7, length 3, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 61) & 0x7;
|
|
|
+ o->can_0x36e_ECU_36E.ADS_UDLCTurnLightReq = x;
|
|
|
+ o->can_0x36e_ECU_36E_rx = 1;
|
|
|
+ o->can_0x36e_ECU_36E_time_stamp_rx = time_stamp;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x36e_ADS_UDLCTurnLightReq(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x36e_ECU_36E.ADS_UDLCTurnLightReq);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x36e_ADS_UDLCTurnLightReq(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x36e_ECU_36E.ADS_UDLCTurnLightReq = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int print_can_0x36e_ECU_36E(const can_obj_bcan_dbc_h_t *o, FILE *output) {
|
|
|
+ assert(o);
|
|
|
+ assert(output);
|
|
|
+ int r = 0;
|
|
|
+ r = print_helper(r, fprintf(output, "ADS_UDLCTurnLightReq = (wire: %.0f)\n", (double)(o->can_0x36e_ECU_36E.ADS_UDLCTurnLightReq)));
|
|
|
+ return r;
|
|
|
+}
|
|
|
+
|
|
|
+static int pack_can_0x3aa_ADC_3AA(can_obj_bcan_dbc_h_t *o, uint64_t *data) {
|
|
|
+ assert(o);
|
|
|
+ assert(data);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = 0;
|
|
|
+ /* VcuCrsSetSwtSts: start-bit 3, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x3aa_ADC_3AA.VcuCrsSetSwtSts)) & 0x3;
|
|
|
+ x <<= 58;
|
|
|
+ m |= x;
|
|
|
+ /* VcuCrsResuSwtSts: start-bit 5, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x3aa_ADC_3AA.VcuCrsResuSwtSts)) & 0x3;
|
|
|
+ x <<= 60;
|
|
|
+ m |= x;
|
|
|
+ /* VcuCrsDstSwtPlusSts: start-bit 7, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = ((uint8_t)(o->can_0x3aa_ADC_3AA.VcuCrsDstSwtPlusSts)) & 0x3;
|
|
|
+ x <<= 62;
|
|
|
+ m |= x;
|
|
|
+ *data = reverse_byte_order(m);
|
|
|
+ o->can_0x3aa_ADC_3AA_tx = 1;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int unpack_can_0x3aa_ADC_3AA(can_obj_bcan_dbc_h_t *o, uint64_t data, uint8_t dlc, dbcc_time_stamp_t time_stamp) {
|
|
|
+ assert(o);
|
|
|
+ assert(dlc <= 8);
|
|
|
+ register uint64_t x;
|
|
|
+ register uint64_t m = reverse_byte_order(data);
|
|
|
+ if (dlc < 8)
|
|
|
+ return -1;
|
|
|
+ /* VcuCrsSetSwtSts: start-bit 3, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 58) & 0x3;
|
|
|
+ o->can_0x3aa_ADC_3AA.VcuCrsSetSwtSts = x;
|
|
|
+ /* VcuCrsResuSwtSts: start-bit 5, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 60) & 0x3;
|
|
|
+ o->can_0x3aa_ADC_3AA.VcuCrsResuSwtSts = x;
|
|
|
+ /* VcuCrsDstSwtPlusSts: start-bit 7, length 2, endianess motorola, scaling 1, offset 0 */
|
|
|
+ x = (m >> 62) & 0x3;
|
|
|
+ o->can_0x3aa_ADC_3AA.VcuCrsDstSwtPlusSts = x;
|
|
|
+ o->can_0x3aa_ADC_3AA_rx = 1;
|
|
|
+ o->can_0x3aa_ADC_3AA_time_stamp_rx = time_stamp;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x3aa_VcuCrsSetSwtSts(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x3aa_ADC_3AA.VcuCrsSetSwtSts);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x3aa_VcuCrsSetSwtSts(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x3aa_ADC_3AA.VcuCrsSetSwtSts = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x3aa_VcuCrsResuSwtSts(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x3aa_ADC_3AA.VcuCrsResuSwtSts);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x3aa_VcuCrsResuSwtSts(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x3aa_ADC_3AA.VcuCrsResuSwtSts = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int decode_can_0x3aa_VcuCrsDstSwtPlusSts(const can_obj_bcan_dbc_h_t *o, uint8_t *out) {
|
|
|
+ assert(o);
|
|
|
+ assert(out);
|
|
|
+ uint8_t rval = (uint8_t)(o->can_0x3aa_ADC_3AA.VcuCrsDstSwtPlusSts);
|
|
|
+ *out = rval;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int encode_can_0x3aa_VcuCrsDstSwtPlusSts(can_obj_bcan_dbc_h_t *o, uint8_t in) {
|
|
|
+ assert(o);
|
|
|
+ o->can_0x3aa_ADC_3AA.VcuCrsDstSwtPlusSts = in;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+int print_can_0x3aa_ADC_3AA(const can_obj_bcan_dbc_h_t *o, FILE *output) {
|
|
|
+ assert(o);
|
|
|
+ assert(output);
|
|
|
+ int r = 0;
|
|
|
+ r = print_helper(r, fprintf(output, "VcuCrsSetSwtSts = (wire: %.0f)\n", (double)(o->can_0x3aa_ADC_3AA.VcuCrsSetSwtSts)));
|
|
|
+ r = print_helper(r, fprintf(output, "VcuCrsResuSwtSts = (wire: %.0f)\n", (double)(o->can_0x3aa_ADC_3AA.VcuCrsResuSwtSts)));
|
|
|
+ r = print_helper(r, fprintf(output, "VcuCrsDstSwtPlusSts = (wire: %.0f)\n", (double)(o->can_0x3aa_ADC_3AA.VcuCrsDstSwtPlusSts)));
|
|
|
+ return r;
|
|
|
+}
|
|
|
+
|
|
|
+int unpack_message(can_obj_bcan_dbc_h_t *o, const unsigned long id, uint64_t data, uint8_t dlc, dbcc_time_stamp_t time_stamp) {
|
|
|
+ assert(o);
|
|
|
+ assert(id < (1ul << 29)); /* 29-bit CAN ID is largest possible */
|
|
|
+ assert(dlc <= 8); /* Maximum of 8 bytes in a CAN packet */
|
|
|
+ switch (id) {
|
|
|
+ case 0x144: return unpack_can_0x144_ECU_144(o, data, dlc, time_stamp);
|
|
|
+ case 0x147: return unpack_can_0x147_ADC_147(o, data, dlc, time_stamp);
|
|
|
+ case 0x14a: return unpack_can_0x14a_ADC_14A(o, data, dlc, time_stamp);
|
|
|
+ case 0x24b: return unpack_can_0x24b_ECU_24B(o, data, dlc, time_stamp);
|
|
|
+ case 0x250: return unpack_can_0x250_ADC_250(o, data, dlc, time_stamp);
|
|
|
+ case 0x358: return unpack_can_0x358_ADC_358(o, data, dlc, time_stamp);
|
|
|
+ case 0x36e: return unpack_can_0x36e_ECU_36E(o, data, dlc, time_stamp);
|
|
|
+ case 0x3aa: return unpack_can_0x3aa_ADC_3AA(o, data, dlc, time_stamp);
|
|
|
+ default: break;
|
|
|
+ }
|
|
|
+ return -1;
|
|
|
+}
|
|
|
+
|
|
|
+int pack_message(can_obj_bcan_dbc_h_t *o, const unsigned long id, uint64_t *data) {
|
|
|
+ assert(o);
|
|
|
+ assert(id < (1ul << 29)); /* 29-bit CAN ID is largest possible */
|
|
|
+ switch (id) {
|
|
|
+ case 0x144: return pack_can_0x144_ECU_144(o, data);
|
|
|
+ case 0x147: return pack_can_0x147_ADC_147(o, data);
|
|
|
+ case 0x14a: return pack_can_0x14a_ADC_14A(o, data);
|
|
|
+ case 0x24b: return pack_can_0x24b_ECU_24B(o, data);
|
|
|
+ case 0x250: return pack_can_0x250_ADC_250(o, data);
|
|
|
+ case 0x358: return pack_can_0x358_ADC_358(o, data);
|
|
|
+ case 0x36e: return pack_can_0x36e_ECU_36E(o, data);
|
|
|
+ case 0x3aa: return pack_can_0x3aa_ADC_3AA(o, data);
|
|
|
+ default: break;
|
|
|
+ }
|
|
|
+ return -1;
|
|
|
+}
|
|
|
+
|
|
|
+int print_message(const can_obj_bcan_dbc_h_t *o, const unsigned long id, FILE *output) {
|
|
|
+ assert(o);
|
|
|
+ assert(id < (1ul << 29)); /* 29-bit CAN ID is largest possible */
|
|
|
+ assert(output);
|
|
|
+ switch (id) {
|
|
|
+ case 0x144: return print_can_0x144_ECU_144(o, output);
|
|
|
+ case 0x147: return print_can_0x147_ADC_147(o, output);
|
|
|
+ case 0x14a: return print_can_0x14a_ADC_14A(o, output);
|
|
|
+ case 0x24b: return print_can_0x24b_ECU_24B(o, output);
|
|
|
+ case 0x250: return print_can_0x250_ADC_250(o, output);
|
|
|
+ case 0x358: return print_can_0x358_ADC_358(o, output);
|
|
|
+ case 0x36e: return print_can_0x36e_ECU_36E(o, output);
|
|
|
+ case 0x3aa: return print_can_0x3aa_ADC_3AA(o, output);
|
|
|
+ default: break;
|
|
|
+ }
|
|
|
+ return -1;
|
|
|
+}
|
|
|
+
|