USB PIC Bootloader. User Manual


7.4.1. Boot_rsp union

To ease software development, all bootloader responses are described as structures.

As interface between PC and Bootloader supports only packages of fixed size, all structures are boot_rsp union members:

typedef union
{
/*
 * data field is used to make all responses the same length
 */
   unsigned char data[BOOT_RSP_SIZE];
   boot_rsp_header header;
   boot_rsp_read_flash read_flash;
   boot_rsp_write_flash write_flash;
   boot_rsp_erase_flash erase_flash;
   boot_rsp_fw_ver get_fw_ver;
   boot_rsp_read_id read_id;
   boot_rsp_write_id write_id;
   boot_rsp_read_eeprom read_eeprom;
   boot_rsp_write_eeprom write_eeprom;
} boot_rsp;

Fields assignment:

data

Data field is used to make the size of all packages equal to BOOT_RSP_SIZE bytes.

header

Header field is used to access common for all packages parameters - cmd and echo. These parameters are also available from the structures that define specific responses.

All other fields are used to access the particular response parameters.