30 #include "mcu_periph/sys_time_arch.h"
39 #include "libopencm3/cm3/scb.h"
45 #define PX4IO_PORT (&((PX4IO_UART).device))
46 #define FLASH_PORT (&((FLASH_UART).device))
50 #define PROTO_INSYNC 0x12
51 #define PROTO_EOC 0x20
54 #define PROTO_FAILED 0x11
55 #define PROTO_INVALID 0x13
57 #define PROTO_GET_SYNC 0x21
58 #define PROTO_GET_DEVICE 0x22
59 #define PROTO_CHIP_ERASE 0x23
60 #define PROTO_LOAD_ADDRESS 0x24
61 #define PROTO_PROG_MULTI 0x27
62 #define PROTO_GET_CRC 0x29
63 #define PROTO_BOOT 0x30
109 while (state < 4 && FLASH_PORT->char_available(
FLASH_PORT->periph)) {
113 if (b ==
'p') { state++; }
else {
return; }
116 if (b ==
'p') { state++; }
else {
return; }
119 if (b ==
'r') { state++; }
else {
return; }
122 if (b ==
'z') { state++; }
else {
return; }
129 if (state != 4) {
return;}
207 while (state < 4 && PX4IO_PORT->char_available(
PX4IO_PORT->periph)) {
215 if (b == 0xe5) { state++; }
else { state = 0; }
218 if (b == 0x32) { state++; }
else { state = 0; }
221 if (b == 0x0a) { state++; }
else { state = 0; }
234 for (
int i = 0; i < 15 && !ret ; i++) {
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
#define PX4IO_P_SETUP_REBOOT_BL
void uart_periph_set_baudrate(struct uart_periph *p, uint32_t baud)
Set baudrate.
#define PROTO_GET_SYNC
NOP for re-establishing sync.
void intermcu_set_enabled(bool value)
void sys_time_cancel_timer(tid_t id)
Cancel a system timer by id.
#define PROTO_EOC
end of command
void px4flash_event(void)
#define PROTO_INSYNC
'in sync' byte sent before status
void sys_time_usleep(uint32_t us)
sys_time_usleep(uint32_t us)
static uint8_t crc_packet(struct IOPacket *pkt)
Architecture independent timing functions.
int8_t tid_t
sys_time timer id type
Rotorcraft Inter-MCU on the autopilot.
tid_t px4iobl_tid
id for time out of the px4 bootloader reset
static bool sys_time_check_and_ack_timer(tid_t id)
Check if timer has elapsed.
uint16_t regs[PKT_MAX_REGS]
arch independent LED (Light Emitting Diodes) API
#define PX4IO_REBOOT_BL_MAGIC
tid_t sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.