mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-02-18 17:23:52 +08:00
enable misra-constParameterCallback (#1827)
This commit is contained in:
@@ -57,7 +57,7 @@ uint16_t current_safety_param = 0;
|
||||
const safety_hooks *current_hooks = &nooutput_hooks;
|
||||
safety_config current_safety_config;
|
||||
|
||||
bool safety_rx_hook(CANPacket_t *to_push) {
|
||||
bool safety_rx_hook(const CANPacket_t *to_push) {
|
||||
bool controls_allowed_prev = controls_allowed;
|
||||
|
||||
bool valid = rx_msg_safety_check(to_push, ¤t_safety_config, current_hooks->get_checksum,
|
||||
@@ -222,7 +222,7 @@ void update_addr_timestamp(RxCheck addr_list[], int index) {
|
||||
}
|
||||
}
|
||||
|
||||
bool rx_msg_safety_check(CANPacket_t *to_push,
|
||||
bool rx_msg_safety_check(const CANPacket_t *to_push,
|
||||
const safety_config *cfg,
|
||||
const get_checksum_t get_checksum,
|
||||
const compute_checksum_t compute_checksum,
|
||||
@@ -547,7 +547,7 @@ bool longitudinal_brake_checks(int desired_brake, const LongitudinalLimits limit
|
||||
return violation;
|
||||
}
|
||||
|
||||
bool longitudinal_interceptor_checks(CANPacket_t *to_send) {
|
||||
bool longitudinal_interceptor_checks(const CANPacket_t *to_send) {
|
||||
return !get_longitudinal_allowed() && (GET_BYTE(to_send, 0) || GET_BYTE(to_send, 1));
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ RxCheck body_rx_checks[] = {
|
||||
{.msg = {{0x201, 0, 8, .check_checksum = false, .max_counter = 0U, .frequency = 100U}, { 0 }, { 0 }}},
|
||||
};
|
||||
|
||||
static void body_rx_hook(CANPacket_t *to_push) {
|
||||
static void body_rx_hook(const CANPacket_t *to_push) {
|
||||
// body is never at standstill
|
||||
vehicle_moving = true;
|
||||
|
||||
@@ -15,7 +15,7 @@ static void body_rx_hook(CANPacket_t *to_push) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool body_tx_hook(CANPacket_t *to_send) {
|
||||
static bool body_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
int len = GET_LEN(to_send);
|
||||
|
||||
@@ -130,12 +130,12 @@ enum {
|
||||
} chrysler_platform = CHRYSLER_PACIFICA;
|
||||
const ChryslerAddrs *chrysler_addrs = &CHRYSLER_ADDRS;
|
||||
|
||||
static uint32_t chrysler_get_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t chrysler_get_checksum(const CANPacket_t *to_push) {
|
||||
int checksum_byte = GET_LEN(to_push) - 1U;
|
||||
return (uint8_t)(GET_BYTE(to_push, checksum_byte));
|
||||
}
|
||||
|
||||
static uint32_t chrysler_compute_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t chrysler_compute_checksum(const CANPacket_t *to_push) {
|
||||
// TODO: clean this up
|
||||
// http://illmatics.com/Remote%20Car%20Hacking.pdf
|
||||
uint8_t checksum = 0xFFU;
|
||||
@@ -168,11 +168,11 @@ static uint32_t chrysler_compute_checksum(CANPacket_t *to_push) {
|
||||
return (uint8_t)(~checksum);
|
||||
}
|
||||
|
||||
static uint8_t chrysler_get_counter(CANPacket_t *to_push) {
|
||||
static uint8_t chrysler_get_counter(const CANPacket_t *to_push) {
|
||||
return (uint8_t)(GET_BYTE(to_push, 6) >> 4);
|
||||
}
|
||||
|
||||
static void chrysler_rx_hook(CANPacket_t *to_push) {
|
||||
static void chrysler_rx_hook(const CANPacket_t *to_push) {
|
||||
const int bus = GET_BUS(to_push);
|
||||
const int addr = GET_ADDR(to_push);
|
||||
|
||||
@@ -213,7 +213,7 @@ static void chrysler_rx_hook(CANPacket_t *to_push) {
|
||||
generic_rx_checks((bus == 0) && (addr == chrysler_addrs->LKAS_COMMAND));
|
||||
}
|
||||
|
||||
static bool chrysler_tx_hook(CANPacket_t *to_send) {
|
||||
static bool chrysler_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
void default_rx_hook(CANPacket_t *to_push) {
|
||||
void default_rx_hook(const CANPacket_t *to_push) {
|
||||
UNUSED(to_push);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ static safety_config nooutput_init(uint16_t param) {
|
||||
return (safety_config){NULL, 0, NULL, 0};
|
||||
}
|
||||
|
||||
static bool nooutput_tx_hook(CANPacket_t *to_send) {
|
||||
static bool nooutput_tx_hook(const CANPacket_t *to_send) {
|
||||
UNUSED(to_send);
|
||||
return false;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ static safety_config alloutput_init(uint16_t param) {
|
||||
return (safety_config){NULL, 0, NULL, 0};
|
||||
}
|
||||
|
||||
static bool alloutput_tx_hook(CANPacket_t *to_send) {
|
||||
static bool alloutput_tx_hook(const CANPacket_t *to_send) {
|
||||
UNUSED(to_send);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
static bool elm327_tx_hook(CANPacket_t *to_send) {
|
||||
static bool elm327_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
int len = GET_LEN(to_send);
|
||||
|
||||
@@ -68,7 +68,7 @@ RxCheck ford_rx_checks[] = {
|
||||
{.msg = {{FORD_DesiredTorqBrk, 0, 8, .frequency = 50U}, { 0 }, { 0 }}},
|
||||
};
|
||||
|
||||
static uint8_t ford_get_counter(CANPacket_t *to_push) {
|
||||
static uint8_t ford_get_counter(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
uint8_t cnt = 0;
|
||||
@@ -83,7 +83,7 @@ static uint8_t ford_get_counter(CANPacket_t *to_push) {
|
||||
return cnt;
|
||||
}
|
||||
|
||||
static uint32_t ford_get_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t ford_get_checksum(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
uint8_t chksum = 0;
|
||||
@@ -101,7 +101,7 @@ static uint32_t ford_get_checksum(CANPacket_t *to_push) {
|
||||
return chksum;
|
||||
}
|
||||
|
||||
static uint32_t ford_compute_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t ford_compute_checksum(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
uint8_t chksum = 0;
|
||||
@@ -128,7 +128,7 @@ static uint32_t ford_compute_checksum(CANPacket_t *to_push) {
|
||||
return chksum;
|
||||
}
|
||||
|
||||
static bool ford_get_quality_flag_valid(CANPacket_t *to_push) {
|
||||
static bool ford_get_quality_flag_valid(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
bool valid = false;
|
||||
@@ -201,7 +201,7 @@ const SteeringLimits FORD_STEERING_LIMITS = {
|
||||
.inactive_angle_is_zero = true,
|
||||
};
|
||||
|
||||
static void ford_rx_hook(CANPacket_t *to_push) {
|
||||
static void ford_rx_hook(const CANPacket_t *to_push) {
|
||||
if (GET_BUS(to_push) == FORD_MAIN_BUS) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
@@ -265,7 +265,7 @@ static void ford_rx_hook(CANPacket_t *to_push) {
|
||||
|
||||
}
|
||||
|
||||
static bool ford_tx_hook(CANPacket_t *to_send) {
|
||||
static bool ford_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
|
||||
int addr = GET_ADDR(to_send);
|
||||
|
||||
@@ -64,7 +64,7 @@ enum {GM_ASCM, GM_CAM} gm_hw = GM_ASCM;
|
||||
bool gm_cam_long = false;
|
||||
bool gm_pcm_cruise = false;
|
||||
|
||||
static void gm_rx_hook(CANPacket_t *to_push) {
|
||||
static void gm_rx_hook(const CANPacket_t *to_push) {
|
||||
if (GET_BUS(to_push) == 0U) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
@@ -135,7 +135,7 @@ static void gm_rx_hook(CANPacket_t *to_push) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool gm_tx_hook(CANPacket_t *to_send) {
|
||||
static bool gm_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
|
||||
|
||||
@@ -104,12 +104,12 @@ int honda_get_pt_bus(void) {
|
||||
return ((honda_hw == HONDA_BOSCH) && !honda_bosch_radarless) ? 1 : 0;
|
||||
}
|
||||
|
||||
static uint32_t honda_get_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t honda_get_checksum(const CANPacket_t *to_push) {
|
||||
int checksum_byte = GET_LEN(to_push) - 1U;
|
||||
return (uint8_t)(GET_BYTE(to_push, checksum_byte)) & 0xFU;
|
||||
}
|
||||
|
||||
static uint32_t honda_compute_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t honda_compute_checksum(const CANPacket_t *to_push) {
|
||||
int len = GET_LEN(to_push);
|
||||
uint8_t checksum = 0U;
|
||||
unsigned int addr = GET_ADDR(to_push);
|
||||
@@ -126,7 +126,7 @@ static uint32_t honda_compute_checksum(CANPacket_t *to_push) {
|
||||
return (uint8_t)((8U - checksum) & 0xFU);
|
||||
}
|
||||
|
||||
static uint8_t honda_get_counter(CANPacket_t *to_push) {
|
||||
static uint8_t honda_get_counter(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
uint8_t cnt = 0U;
|
||||
@@ -140,7 +140,7 @@ static uint8_t honda_get_counter(CANPacket_t *to_push) {
|
||||
return cnt;
|
||||
}
|
||||
|
||||
static void honda_rx_hook(CANPacket_t *to_push) {
|
||||
static void honda_rx_hook(const CANPacket_t *to_push) {
|
||||
const bool pcm_cruise = ((honda_hw == HONDA_BOSCH) && !honda_bosch_long) || \
|
||||
((honda_hw == HONDA_NIDEC) && !enable_gas_interceptor);
|
||||
int pt_bus = honda_get_pt_bus();
|
||||
@@ -269,7 +269,7 @@ static void honda_rx_hook(CANPacket_t *to_push) {
|
||||
|
||||
}
|
||||
|
||||
static bool honda_tx_hook(CANPacket_t *to_send) {
|
||||
static bool honda_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
int bus = GET_BUS(to_send);
|
||||
|
||||
@@ -85,7 +85,7 @@ RxCheck hyundai_legacy_rx_checks[] = {
|
||||
bool hyundai_legacy = false;
|
||||
|
||||
|
||||
static uint8_t hyundai_get_counter(CANPacket_t *to_push) {
|
||||
static uint8_t hyundai_get_counter(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
uint8_t cnt = 0;
|
||||
@@ -104,7 +104,7 @@ static uint8_t hyundai_get_counter(CANPacket_t *to_push) {
|
||||
return cnt;
|
||||
}
|
||||
|
||||
static uint32_t hyundai_get_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t hyundai_get_checksum(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
uint8_t chksum = 0;
|
||||
@@ -121,7 +121,7 @@ static uint32_t hyundai_get_checksum(CANPacket_t *to_push) {
|
||||
return chksum;
|
||||
}
|
||||
|
||||
static uint32_t hyundai_compute_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t hyundai_compute_checksum(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
uint8_t chksum = 0;
|
||||
@@ -157,7 +157,7 @@ static uint32_t hyundai_compute_checksum(CANPacket_t *to_push) {
|
||||
return chksum;
|
||||
}
|
||||
|
||||
static void hyundai_rx_hook(CANPacket_t *to_push) {
|
||||
static void hyundai_rx_hook(const CANPacket_t *to_push) {
|
||||
int bus = GET_BUS(to_push);
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
@@ -214,7 +214,7 @@ static void hyundai_rx_hook(CANPacket_t *to_push) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool hyundai_tx_hook(CANPacket_t *to_send) {
|
||||
static bool hyundai_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ int hyundai_canfd_hda2_get_lkas_addr(void) {
|
||||
return hyundai_canfd_hda2_alt_steering ? 0x110 : 0x50;
|
||||
}
|
||||
|
||||
static uint8_t hyundai_canfd_get_counter(CANPacket_t *to_push) {
|
||||
static uint8_t hyundai_canfd_get_counter(const CANPacket_t *to_push) {
|
||||
uint8_t ret = 0;
|
||||
if (GET_LEN(to_push) == 8U) {
|
||||
ret = GET_BYTE(to_push, 1) >> 4;
|
||||
@@ -147,12 +147,12 @@ static uint8_t hyundai_canfd_get_counter(CANPacket_t *to_push) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint32_t hyundai_canfd_get_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t hyundai_canfd_get_checksum(const CANPacket_t *to_push) {
|
||||
uint32_t chksum = GET_BYTE(to_push, 0) | (GET_BYTE(to_push, 1) << 8);
|
||||
return chksum;
|
||||
}
|
||||
|
||||
static void hyundai_canfd_rx_hook(CANPacket_t *to_push) {
|
||||
static void hyundai_canfd_rx_hook(const CANPacket_t *to_push) {
|
||||
int bus = GET_BUS(to_push);
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
@@ -227,7 +227,7 @@ static void hyundai_canfd_rx_hook(CANPacket_t *to_push) {
|
||||
|
||||
}
|
||||
|
||||
static bool hyundai_canfd_tx_hook(CANPacket_t *to_send) {
|
||||
static bool hyundai_canfd_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ void hyundai_common_cruise_buttons_check(const int cruise_button, const int main
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t hyundai_common_canfd_compute_checksum(CANPacket_t *to_push) {
|
||||
uint32_t hyundai_common_canfd_compute_checksum(const CANPacket_t *to_push) {
|
||||
int len = GET_LEN(to_push);
|
||||
uint32_t address = GET_ADDR(to_push);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ RxCheck mazda_rx_checks[] = {
|
||||
};
|
||||
|
||||
// track msgs coming from OP so that we know what CAM msgs to drop and what to forward
|
||||
static void mazda_rx_hook(CANPacket_t *to_push) {
|
||||
static void mazda_rx_hook(const CANPacket_t *to_push) {
|
||||
if ((int)GET_BUS(to_push) == MAZDA_MAIN) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
@@ -68,7 +68,7 @@ static void mazda_rx_hook(CANPacket_t *to_push) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool mazda_tx_hook(CANPacket_t *to_send) {
|
||||
static bool mazda_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
int bus = GET_BUS(to_send);
|
||||
|
||||
@@ -40,7 +40,7 @@ const int NISSAN_PARAM_ALT_EPS_BUS = 1;
|
||||
|
||||
bool nissan_alt_eps = false;
|
||||
|
||||
static void nissan_rx_hook(CANPacket_t *to_push) {
|
||||
static void nissan_rx_hook(const CANPacket_t *to_push) {
|
||||
int bus = GET_BUS(to_push);
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
@@ -93,7 +93,7 @@ static void nissan_rx_hook(CANPacket_t *to_push) {
|
||||
}
|
||||
|
||||
|
||||
static bool nissan_tx_hook(CANPacket_t *to_send) {
|
||||
static bool nissan_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
bool violation = false;
|
||||
|
||||
@@ -115,15 +115,15 @@ bool subaru_gen2 = false;
|
||||
bool subaru_longitudinal = false;
|
||||
|
||||
|
||||
static uint32_t subaru_get_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t subaru_get_checksum(const CANPacket_t *to_push) {
|
||||
return (uint8_t)GET_BYTE(to_push, 0);
|
||||
}
|
||||
|
||||
static uint8_t subaru_get_counter(CANPacket_t *to_push) {
|
||||
static uint8_t subaru_get_counter(const CANPacket_t *to_push) {
|
||||
return (uint8_t)(GET_BYTE(to_push, 1) & 0xFU);
|
||||
}
|
||||
|
||||
static uint32_t subaru_compute_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t subaru_compute_checksum(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
int len = GET_LEN(to_push);
|
||||
uint8_t checksum = (uint8_t)(addr) + (uint8_t)((unsigned int)(addr) >> 8U);
|
||||
@@ -133,7 +133,7 @@ static uint32_t subaru_compute_checksum(CANPacket_t *to_push) {
|
||||
return checksum;
|
||||
}
|
||||
|
||||
static void subaru_rx_hook(CANPacket_t *to_push) {
|
||||
static void subaru_rx_hook(const CANPacket_t *to_push) {
|
||||
const int bus = GET_BUS(to_push);
|
||||
const int alt_main_bus = subaru_gen2 ? SUBARU_ALT_BUS : SUBARU_MAIN_BUS;
|
||||
|
||||
@@ -179,7 +179,7 @@ static void subaru_rx_hook(CANPacket_t *to_push) {
|
||||
generic_rx_checks((addr == MSG_SUBARU_ES_LKAS) && (bus == SUBARU_MAIN_BUS));
|
||||
}
|
||||
|
||||
static bool subaru_tx_hook(CANPacket_t *to_send) {
|
||||
static bool subaru_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
bool violation = false;
|
||||
|
||||
@@ -41,7 +41,7 @@ const int SUBARU_PG_PARAM_REVERSED_DRIVER_TORQUE = 1;
|
||||
bool subaru_pg_reversed_driver_torque = false;
|
||||
|
||||
|
||||
static void subaru_preglobal_rx_hook(CANPacket_t *to_push) {
|
||||
static void subaru_preglobal_rx_hook(const CANPacket_t *to_push) {
|
||||
const int bus = GET_BUS(to_push);
|
||||
|
||||
if (bus == SUBARU_PG_MAIN_BUS) {
|
||||
@@ -77,7 +77,7 @@ static void subaru_preglobal_rx_hook(CANPacket_t *to_push) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool subaru_preglobal_tx_hook(CANPacket_t *to_send) {
|
||||
static bool subaru_preglobal_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ bool tesla_powertrain = false; // Are we the second panda intercepting the powe
|
||||
|
||||
bool tesla_stock_aeb = false;
|
||||
|
||||
static void tesla_rx_hook(CANPacket_t *to_push) {
|
||||
static void tesla_rx_hook(const CANPacket_t *to_push) {
|
||||
int bus = GET_BUS(to_push);
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
@@ -116,7 +116,7 @@ static void tesla_rx_hook(CANPacket_t *to_push) {
|
||||
}
|
||||
|
||||
|
||||
static bool tesla_tx_hook(CANPacket_t *to_send) {
|
||||
static bool tesla_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
bool violation = false;
|
||||
|
||||
@@ -97,7 +97,7 @@ bool toyota_stock_longitudinal = false;
|
||||
bool toyota_lta = false;
|
||||
int toyota_dbc_eps_torque_factor = 100; // conversion factor for STEER_TORQUE_EPS in %: see dbc file
|
||||
|
||||
static uint32_t toyota_compute_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t toyota_compute_checksum(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
int len = GET_LEN(to_push);
|
||||
uint8_t checksum = (uint8_t)(addr) + (uint8_t)((unsigned int)(addr) >> 8U) + (uint8_t)(len);
|
||||
@@ -107,12 +107,12 @@ static uint32_t toyota_compute_checksum(CANPacket_t *to_push) {
|
||||
return checksum;
|
||||
}
|
||||
|
||||
static uint32_t toyota_get_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t toyota_get_checksum(const CANPacket_t *to_push) {
|
||||
int checksum_byte = GET_LEN(to_push) - 1U;
|
||||
return (uint8_t)(GET_BYTE(to_push, checksum_byte));
|
||||
}
|
||||
|
||||
static uint8_t toyota_get_counter(CANPacket_t *to_push) {
|
||||
static uint8_t toyota_get_counter(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
uint8_t cnt = 0U;
|
||||
@@ -123,7 +123,7 @@ static uint8_t toyota_get_counter(CANPacket_t *to_push) {
|
||||
return cnt;
|
||||
}
|
||||
|
||||
static bool toyota_get_quality_flag_valid(CANPacket_t *to_push) {
|
||||
static bool toyota_get_quality_flag_valid(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
bool valid = false;
|
||||
@@ -133,7 +133,7 @@ static bool toyota_get_quality_flag_valid(CANPacket_t *to_push) {
|
||||
return valid;
|
||||
}
|
||||
|
||||
static void toyota_rx_hook(CANPacket_t *to_push) {
|
||||
static void toyota_rx_hook(const CANPacket_t *to_push) {
|
||||
if (GET_BUS(to_push) == 0U) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
@@ -213,7 +213,7 @@ static void toyota_rx_hook(CANPacket_t *to_push) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool toyota_tx_hook(CANPacket_t *to_send) {
|
||||
static bool toyota_tx_hook(const CANPacket_t *to_send) {
|
||||
bool tx = true;
|
||||
int addr = GET_ADDR(to_send);
|
||||
int bus = GET_BUS(to_send);
|
||||
|
||||
@@ -52,16 +52,16 @@ uint8_t volkswagen_crc8_lut_8h2f[256]; // Static lookup table for CRC8 poly 0x2F
|
||||
bool volkswagen_mqb_brake_pedal_switch = false;
|
||||
bool volkswagen_mqb_brake_pressure_detected = false;
|
||||
|
||||
static uint32_t volkswagen_mqb_get_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t volkswagen_mqb_get_checksum(const CANPacket_t *to_push) {
|
||||
return (uint8_t)GET_BYTE(to_push, 0);
|
||||
}
|
||||
|
||||
static uint8_t volkswagen_mqb_get_counter(CANPacket_t *to_push) {
|
||||
static uint8_t volkswagen_mqb_get_counter(const CANPacket_t *to_push) {
|
||||
// MQB message counters are consistently found at LSB 8.
|
||||
return (uint8_t)GET_BYTE(to_push, 1) & 0xFU;
|
||||
}
|
||||
|
||||
static uint32_t volkswagen_mqb_compute_crc(CANPacket_t *to_push) {
|
||||
static uint32_t volkswagen_mqb_compute_crc(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
int len = GET_LEN(to_push);
|
||||
|
||||
@@ -107,7 +107,7 @@ static safety_config volkswagen_mqb_init(uint16_t param) {
|
||||
BUILD_SAFETY_CFG(volkswagen_mqb_rx_checks, VOLKSWAGEN_MQB_STOCK_TX_MSGS);
|
||||
}
|
||||
|
||||
static void volkswagen_mqb_rx_hook(CANPacket_t *to_push) {
|
||||
static void volkswagen_mqb_rx_hook(const CANPacket_t *to_push) {
|
||||
if (GET_BUS(to_push) == 0U) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
@@ -193,7 +193,7 @@ static void volkswagen_mqb_rx_hook(CANPacket_t *to_push) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool volkswagen_mqb_tx_hook(CANPacket_t *to_send) {
|
||||
static bool volkswagen_mqb_tx_hook(const CANPacket_t *to_send) {
|
||||
int addr = GET_ADDR(to_send);
|
||||
bool tx = true;
|
||||
|
||||
|
||||
@@ -46,13 +46,13 @@ RxCheck volkswagen_pq_rx_checks[] = {
|
||||
{.msg = {{MSG_GRA_NEU, 0, 4, .check_checksum = true, .max_counter = 15U, .frequency = 30U}, { 0 }, { 0 }}},
|
||||
};
|
||||
|
||||
static uint32_t volkswagen_pq_get_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t volkswagen_pq_get_checksum(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
return (uint32_t)GET_BYTE(to_push, (addr == MSG_MOTOR_5) ? 7 : 0);
|
||||
}
|
||||
|
||||
static uint8_t volkswagen_pq_get_counter(CANPacket_t *to_push) {
|
||||
static uint8_t volkswagen_pq_get_counter(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
uint8_t counter = 0U;
|
||||
|
||||
@@ -66,7 +66,7 @@ static uint8_t volkswagen_pq_get_counter(CANPacket_t *to_push) {
|
||||
return counter;
|
||||
}
|
||||
|
||||
static uint32_t volkswagen_pq_compute_checksum(CANPacket_t *to_push) {
|
||||
static uint32_t volkswagen_pq_compute_checksum(const CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
int len = GET_LEN(to_push);
|
||||
uint8_t checksum = 0U;
|
||||
@@ -95,7 +95,7 @@ static safety_config volkswagen_pq_init(uint16_t param) {
|
||||
BUILD_SAFETY_CFG(volkswagen_pq_rx_checks, VOLKSWAGEN_PQ_STOCK_TX_MSGS);
|
||||
}
|
||||
|
||||
static void volkswagen_pq_rx_hook(CANPacket_t *to_push) {
|
||||
static void volkswagen_pq_rx_hook(const CANPacket_t *to_push) {
|
||||
if (GET_BUS(to_push) == 0U) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
|
||||
@@ -169,7 +169,7 @@ static void volkswagen_pq_rx_hook(CANPacket_t *to_push) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool volkswagen_pq_tx_hook(CANPacket_t *to_send) {
|
||||
static bool volkswagen_pq_tx_hook(const CANPacket_t *to_send) {
|
||||
int addr = GET_ADDR(to_send);
|
||||
bool tx = true;
|
||||
|
||||
|
||||
@@ -144,12 +144,12 @@ typedef struct {
|
||||
int tx_msgs_len;
|
||||
} safety_config;
|
||||
|
||||
typedef uint32_t (*get_checksum_t)(CANPacket_t *to_push);
|
||||
typedef uint32_t (*compute_checksum_t)(CANPacket_t *to_push);
|
||||
typedef uint8_t (*get_counter_t)(CANPacket_t *to_push);
|
||||
typedef bool (*get_quality_flag_valid_t)(CANPacket_t *to_push);
|
||||
typedef uint32_t (*get_checksum_t)(const CANPacket_t *to_push);
|
||||
typedef uint32_t (*compute_checksum_t)(const CANPacket_t *to_push);
|
||||
typedef uint8_t (*get_counter_t)(const CANPacket_t *to_push);
|
||||
typedef bool (*get_quality_flag_valid_t)(const CANPacket_t *to_push);
|
||||
|
||||
bool safety_rx_hook(CANPacket_t *to_push);
|
||||
bool safety_rx_hook(const CANPacket_t *to_push);
|
||||
bool safety_tx_hook(CANPacket_t *to_send);
|
||||
uint32_t get_ts_elapsed(uint32_t ts, uint32_t ts_last);
|
||||
int to_signed(int d, int bits);
|
||||
@@ -174,7 +174,7 @@ int get_addr_check_index(const CANPacket_t *to_push, RxCheck addr_list[], const
|
||||
void update_counter(RxCheck addr_list[], int index, uint8_t counter);
|
||||
void update_addr_timestamp(RxCheck addr_list[], int index);
|
||||
bool is_msg_valid(RxCheck addr_list[], int index);
|
||||
bool rx_msg_safety_check(CANPacket_t *to_push,
|
||||
bool rx_msg_safety_check(const CANPacket_t *to_push,
|
||||
const safety_config *rx_checks,
|
||||
const get_checksum_t get_checksum,
|
||||
const compute_checksum_t compute_checksum,
|
||||
@@ -190,12 +190,12 @@ bool longitudinal_speed_checks(int desired_speed, const LongitudinalLimits limit
|
||||
bool longitudinal_gas_checks(int desired_gas, const LongitudinalLimits limits);
|
||||
bool longitudinal_transmission_rpm_checks(int desired_transmission_rpm, const LongitudinalLimits limits);
|
||||
bool longitudinal_brake_checks(int desired_brake, const LongitudinalLimits limits);
|
||||
bool longitudinal_interceptor_checks(CANPacket_t *to_send);
|
||||
bool longitudinal_interceptor_checks(const CANPacket_t *to_send);
|
||||
void pcm_cruise_check(bool cruise_engaged);
|
||||
|
||||
typedef safety_config (*safety_hook_init)(uint16_t param);
|
||||
typedef void (*rx_hook)(CANPacket_t *to_push);
|
||||
typedef bool (*tx_hook)(CANPacket_t *to_send);
|
||||
typedef void (*rx_hook)(const CANPacket_t *to_push);
|
||||
typedef bool (*tx_hook)(const CANPacket_t *to_send);
|
||||
typedef int (*fwd_hook)(int bus_num, int addr);
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -17,7 +17,6 @@ unmatchedSuppression
|
||||
# fixing the violations and all are intended to be removed soon after
|
||||
|
||||
unusedFunction
|
||||
constParameterCallback
|
||||
|
||||
misra-config
|
||||
misra-c2012-1.2 # this is from the extensions (e.g. __typeof__) used in the MIN, MAX, ABS, and CLAMP macros
|
||||
|
||||
Reference in New Issue
Block a user