39 #include "firmwareiapobj.h"
40 #include "flightstatus.h"
45 #define IAP_CMD_STEP_1 1122
46 #define IAP_CMD_STEP_2 2233
47 #define IAP_CMD_STEP_3 3344
48 #define IAP_CMD_STEP_3NB 4455
50 #define IAP_CMD_CRC 100
51 #define IAP_CMD_VERIFY 101
52 #define IAP_CMD_VERSION 102
54 #define IAP_STATE_READY 0
55 #define IAP_STATE_STEP_1 1
56 #define IAP_STATE_STEP_2 2
57 #define IAP_STATE_RESETTING 3
59 #define RESET_DELAY_MS 500
75 void *ctx,
void *obj,
int len);
97 if (FirmwareIAPObjInitialize() == -1) {
106 FirmwareIAPObjData
data;
107 FirmwareIAPObjGet(&data);
114 FirmwareIAPObjSet( &data );
128 void *ctx,
void *obj,
int len)
130 (void) ctx; (void) obj; (void) len;
133 static uint32_t last_time = 0;
140 FirmwareIAPObjData
data;
141 FirmwareIAPObjGet(&data);
143 if ( ev->
obj == FirmwareIAPObjHandle() ) {
145 FirmwareIAPObjGet(&data);
147 delta = this_time - last_time;
148 last_time = this_time;
170 FlightStatusData flightStatus;
171 FlightStatusGet(&flightStatus);
173 if(flightStatus.Armed != FLIGHTSTATUS_ARMED_DISARMED) {
238 (void) ctx; (void) obj; (void) len;
240 #if defined(PIOS_INCLUDE_ANNUNC) && defined(PIOS_LED_HEARTBEAT)
244 #if defined(PIOS_INCLUDE_ANNUNC) && defined(PIOS_LED_ALARM)
248 FirmwareIAPObjData
data;
249 FirmwareIAPObjGet(&data);
uint32_t PIOS_Thread_Systime(void)
Main PiOS header to include all the compiled in PiOS options.
uint32_t PIOS_BL_HELPER_CRC_Memory_Calc()
static uint32_t get_time(void)
Returns number of milliseconds from the start of the kernel.
const uint32_t iap_time_2_low_end
int32_t FirmwareIAPInitialize()
Performs object initialization functions.
const uint32_t iap_time_3_high_end
static uint8_t reset_count
void * PIOS_malloc_no_dma(size_t size)
const struct pios_board_info pios_board_info_blob
static uint32_t lastResetSysTime
int32_t EventPeriodicCallbackCreate(UAVObjEvent *ev, UAVObjEventCallback cb, uint16_t periodMs)
uint8_t data[XFER_BYTES_PER_PACKET]
int32_t FirmwareIAPStart()
#define MODULE_HIPRI_INITCALL(ifn, sfn)
void FirmwareIAPSetBoardRev(uint8_t rev)
void PIOS_Servo_PrepareForReset()
Determines the APB clock used by a given timer.
void PIOS_BL_HELPER_FLASH_Read_Description(uint8_t *array, uint8_t size)
#define PIOS_BOARD_INFO_BLOB_MAGIC
Event dispatcher, distributes object events as callbacks. Alternative to using tasks and queues...
void PIOS_IAP_SetRequest3(void)
int32_t PIOS_SYS_Reset(void)
#define IAP_STATE_RESETTING
const uint32_t iap_time_2_high_end
void PIOS_ANNUNC_Toggle(uint32_t annunc_id)
static void resetTask(const UAVObjEvent *ev, void *ctx, void *obj, int len)
Includes PiOS and core architecture components.
const uint32_t iap_time_3_low_end
void PIOS_IAP_SetRequest2(void)
void PIOS_IAP_SetRequest1(void)
Sets the 1st word of the request sequence.
RC Servo functions header.
static void FirmwareIAPCallback(const UAVObjEvent *ev, void *ctx, void *obj, int len)
FirmwareIAPCallback - callback function for firmware IAP requests.
#define PIOS_LED_HEARTBEAT
int32_t PIOS_SYS_SerialNumberGetBinary(uint8_t array[PIOS_SYS_SERIAL_NUM_BINARY_LEN])