Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/Tools/AP_Bootloader/support.h
Views: 1798
#pragma once12#include <AP_HAL_ChibiOS/AP_HAL_ChibiOS.h>34#define LED_ACTIVITY 15#define LED_BOOTLOADER 267/* board info forwarded from board-specific code to booloader */8struct boardinfo {9uint32_t board_type;10uint32_t board_rev;11uint32_t fw_size;12uint32_t extf_size;13} __attribute__((packed));1415extern struct boardinfo board_info;1617void init_uarts(void);18int16_t cin(unsigned timeout_ms);19int cin_word(uint32_t *wp, unsigned timeout_ms);20void cout(uint8_t *data, uint32_t len);21void port_setbaud(uint32_t baudrate);22#if defined(BOOTLOADER_FORWARD_OTG2_SERIAL)23bool update_otg2_serial_forward(void);24#endif25void flash_init();2627uint32_t flash_func_read_word(uint32_t offset);28bool flash_func_write_word(uint32_t offset, uint32_t v);29bool flash_func_write_words(uint32_t offset, uint32_t *v, uint8_t n);30uint32_t flash_func_sector_size(uint32_t sector);31bool flash_func_is_erased(uint32_t sector);32bool flash_func_erase_sector(uint32_t sector, bool force_erase = false);33uint32_t flash_func_read_otp(uint32_t idx);34uint32_t flash_func_read_sn(uint32_t idx);35void flash_set_keep_unlocked(bool);36void lock_bl_port(void);3738bool flash_write_flush(void);39bool flash_write_buffer(uint32_t address, const uint32_t *v, uint8_t nwords);4041uint32_t get_mcu_id(void);42uint32_t get_mcu_desc(uint32_t len, uint8_t *buf);4344uint32_t board_get_rtc_signature(void);45void board_set_rtc_signature(uint32_t sig);4647void led_on(unsigned led);48void led_off(unsigned led);49void led_toggle(unsigned led);5051void thread_sleep_ms(uint32_t ms);52void thread_sleep_us(uint32_t us);5354void custom_startup(void);5556#if defined(STM32H7) && CH_CFG_USE_HEAP57void check_ecc_errors(void);58#endif5960// printf to debug uart (or USB)61extern "C" {62void uprintf(const char *fmt, ...) FMT_PRINTF(1,2);63}6465// generate a LED sequence forever66void led_pulses(uint8_t npulses);6768typedef struct mcu_des_t {69uint16_t mcuid;70const char *desc;71} mcu_des_t;7273typedef struct mcu_rev_t {74uint16_t revid;75char rev;76} mcu_rev_t;777879