mirror of
https://github.com/infiniteCable2/panda.git
synced 2026-02-27 14:03:53 +08:00
* Jenkins test refactor and black panda addition * Added HW types needed by previous commit * Fixed ignition interrupts when not on EON build * Added functions for load switches * More test scripts for black panda * Added NONE power mode to the code * Fixed race condition when setting GPIO pins was interrupted. * Added relay test script * Fixed flashing with critical sections and GPS load switch * Fixing critical depth after reboot * Made the loopback test asserting * Made critical depth a local variable to avoid race conditions * Added GPS to power savings mode * Fixed DFU mode on white panda and bumped version * Fixed PEDAL_USB compilation error * Fixed misra compliance of new critical depth code * Cleaned up heartbeat logic in the testing code. Re-added ALL_CAN_BUT_MAIN_SILENT. Bumped version. Improved critical section code. * Fixed DFU flashing (once again) * Fixed VERSION * Added relay endurance test * Changed to alloutput on ELM mode for fingerprinting. * Fixed minor remarks
58 lines
1.8 KiB
C
58 lines
1.8 KiB
C
// ******************** Prototypes ********************
|
|
typedef void (*board_init)(void);
|
|
typedef void (*board_enable_can_transciever)(uint8_t transciever, bool enabled);
|
|
typedef void (*board_enable_can_transcievers)(bool enabled);
|
|
typedef void (*board_set_led)(uint8_t color, bool enabled);
|
|
typedef void (*board_set_usb_power_mode)(uint8_t mode);
|
|
typedef void (*board_set_esp_gps_mode)(uint8_t mode);
|
|
typedef void (*board_set_can_mode)(uint8_t mode);
|
|
typedef void (*board_usb_power_mode_tick)(uint64_t tcnt);
|
|
typedef bool (*board_check_ignition)(void);
|
|
|
|
struct board {
|
|
const char *board_type;
|
|
const harness_configuration *harness_config;
|
|
board_init init;
|
|
board_enable_can_transciever enable_can_transciever;
|
|
board_enable_can_transcievers enable_can_transcievers;
|
|
board_set_led set_led;
|
|
board_set_usb_power_mode set_usb_power_mode;
|
|
board_set_esp_gps_mode set_esp_gps_mode;
|
|
board_set_can_mode set_can_mode;
|
|
board_usb_power_mode_tick usb_power_mode_tick;
|
|
board_check_ignition check_ignition;
|
|
};
|
|
|
|
// ******************* Definitions ********************
|
|
// These should match the enums in cereal/log.capnp and __init__.py
|
|
#define HW_TYPE_UNKNOWN 0U
|
|
#define HW_TYPE_WHITE_PANDA 1U
|
|
#define HW_TYPE_GREY_PANDA 2U
|
|
#define HW_TYPE_BLACK_PANDA 3U
|
|
#define HW_TYPE_PEDAL 4U
|
|
|
|
// LED colors
|
|
#define LED_RED 0U
|
|
#define LED_GREEN 1U
|
|
#define LED_BLUE 2U
|
|
|
|
// USB power modes
|
|
#define USB_POWER_NONE 0U
|
|
#define USB_POWER_CLIENT 1U
|
|
#define USB_POWER_CDP 2U
|
|
#define USB_POWER_DCP 3U
|
|
|
|
// ESP modes
|
|
#define ESP_GPS_DISABLED 0U
|
|
#define ESP_GPS_ENABLED 1U
|
|
#define ESP_GPS_BOOTMODE 2U
|
|
|
|
// CAN modes
|
|
#define CAN_MODE_NORMAL 0U
|
|
#define CAN_MODE_GMLAN_CAN2 1U
|
|
#define CAN_MODE_GMLAN_CAN3 2U
|
|
#define CAN_MODE_OBD_CAN2 3U
|
|
|
|
// ********************* Globals **********************
|
|
uint8_t usb_power_mode = USB_POWER_NONE;
|