Class internal implementation.
Functions | |
static void | udi_dfu_atmel_mem_check (void) |
Process a blank check on memory. More... | |
static bool | udi_dfu_atmel_mem_getaddr (uint8_t *arg) |
Gets a memory address in a Atmel DFU command. More... | |
static bool | udi_dfu_atmel_mem_protected (void) |
Change DFU status to notify that the memory is protected. More... | |
static bool | udi_dfu_atmel_mem_read (void) |
Reads memory and transfer data to USB interface. More... | |
static bool | udi_dfu_atmel_mem_send_last_add (void) |
Send address which has failed during check memory. More... | |
static bool | udi_dfu_atmel_mem_write (void) |
Writes memory with data from USB interface. More... | |
static void | udi_dfu_atmel_sel_mem (uint8_t mem_num) |
Selects the memory. More... | |
Internal routines to manage DFU requests | |
static void | udi_dfu_atmel_reset_protocol (void) |
Resets DFU status and usb setup process callbacks. More... | |
static bool | udi_dfu_flip_msg_decode (void) |
Decodes the Atmel DFU Command Called by over_under_run callback when the first data packet from a DNLOAD DFU request is received. More... | |
Manages Atmel DFU command from protocol version 2 | |
static bool | udi_dfu_atmel_program (void) |
Decodes and prepares program memory command. More... | |
static bool | udi_dfu_atmel_read (void) |
Decodes and prepares read memory command. More... | |
static bool | udi_dfu_atmel_blankcheck (void) |
Decodes and process blank check memory command. More... | |
static bool | udi_dfu_atmel_erase_chip (void) |
Decodes and process erase chip command. More... | |
static void | udi_dfu_atmel_start (void) |
Decodes and prepares CPU reset command. More... | |
static bool | udi_dfu_atmel_select_memory (void) |
Decodes and process memory select command. More... | |
|
static |
Decodes and process blank check memory command.
1
if command was accepted, otherwise 0
. References dfu_status_t::bState, dfu_status_t::bStatus, DFU_STATE_DFUERROR, DFU_STATUS_ERRWRITE, isp_mem_t::fnct_read, udi_dfu_atmel_mem_check(), udi_dfu_atmel_mem_getaddr(), and udi_dfu_flip_msg.
Referenced by udi_dfu_flip_msg_decode().
|
static |
Decodes and process erase chip command.
1
if command was accepted, otherwise 0
. References Assert, dfu_status_t::bState, dfu_status_t::bStatus, DFU_STATE_DFUDNBUSY, DFU_STATE_DFUIDLE, DFU_STATUS_ERRNOTDONE, DFU_STATUS_OK, FLIP_V2_CMD_ERASE_ARG_CHIP, isp_erase_chip(), isp_erase_chip_split(), udi_dfu_atmel_security, and udi_dfu_flip_msg.
Referenced by udi_dfu_atmel_setup(), and udi_dfu_flip_msg_decode().
|
static |
Process a blank check on memory.
References dfu_status_t::bStatus, DFU_ATMEL_BUF_TRANS_SIZE, DFU_STATUS_ERRCHECK_ERASED, isp_mem_t::fnct_read, min, udi_dfu_atmel_buf_trans, udi_dfu_atmel_mem_add, udi_dfu_atmel_mem_nb_data, udi_dfu_atmel_mem_send_last_add(), and udi_dfu_atmel_upload_callback.
Referenced by udi_dfu_atmel_blankcheck().
|
static |
Gets a memory address in a Atmel DFU command.
arg | pointer to read address |
1
if command was accepted, otherwise 0
. References Assert, dfu_status_t::bState, dfu_status_t::bStatus, DFU_STATE_DFUERROR, DFU_STATUS_ERRADDRESS, isp_mem_t::size, udi_dfu_atmel_mem_add, and udi_dfu_atmel_mem_nb_data.
Referenced by udi_dfu_atmel_blankcheck(), udi_dfu_atmel_program(), and udi_dfu_atmel_read().
|
static |
Change DFU status to notify that the memory is protected.
1
if command was accepted, otherwise 0
. References dfu_status_t::bState, dfu_status_t::bStatus, DFU_STATE_DFUIDLE, and DFU_STATUS_ERRWRITE.
Referenced by udi_dfu_atmel_program(), and udi_dfu_atmel_read().
|
static |
Reads memory and transfer data to USB interface.
1
if command was accepted, otherwise 0
. References Assert, DFU_ATMEL_BUF_TRANS_SIZE, isp_mem_t::fnct_read, udd_set_setup_payload(), udi_dfu_atmel_buf_trans, udi_dfu_atmel_mem_add, and udi_dfu_atmel_mem_nb_data.
Referenced by udi_dfu_atmel_read().
|
static |
Send address which has failed during check memory.
1
if command was accepted, otherwise 0
. References udd_set_setup_payload(), udi_dfu_atmel_buf_trans, and udi_dfu_atmel_mem_add.
Referenced by udi_dfu_atmel_mem_check().
|
static |
Writes memory with data from USB interface.
1
if command was accepted, otherwise 0
. References Assert, DFU_ATMEL_BUF_TRANS_SIZE, isp_mem_t::fnct_write, Get_align, NULL, udd_ctrl_request_t::over_under_run, udd_ctrl_request_t::payload_size, udd_g_ctrlreq, udi_dfu_atmel_buf_trans, udi_dfu_atmel_mem_add, udi_dfu_atmel_mem_nb_data, and USB_DEVICE_EP_CTRL_SIZE.
Referenced by udi_dfu_atmel_program().
|
static |
Decodes and prepares program memory command.
1
if command was accepted, otherwise 0
. References dfu_status_t::bState, dfu_status_t::bStatus, DFU_ATMEL_BUF_TRANS_SIZE, DFU_STATE_DFUERROR, DFU_STATUS_ERRWRITE, isp_mem_t::fnct_write, udd_ctrl_request_t::over_under_run, udd_g_ctrlreq, udd_set_setup_payload(), udi_dfu_atmel_buf_trans, udi_dfu_atmel_mem_b_protected, udi_dfu_atmel_mem_getaddr(), udi_dfu_atmel_mem_protected(), udi_dfu_atmel_mem_write(), udi_dfu_atmel_security, and udi_dfu_flip_msg.
Referenced by udi_dfu_flip_msg_decode().
|
static |
Decodes and prepares read memory command.
1
if command was accepted, otherwise 0
. References dfu_status_t::bState, dfu_status_t::bStatus, DFU_STATE_DFUERROR, DFU_STATUS_ERRWRITE, isp_mem_t::fnct_read, udi_dfu_atmel_mem_b_protected, udi_dfu_atmel_mem_getaddr(), udi_dfu_atmel_mem_protected(), udi_dfu_atmel_mem_read(), udi_dfu_atmel_security, udi_dfu_atmel_upload_callback, and udi_dfu_flip_msg.
Referenced by udi_dfu_flip_msg_decode().
|
static |
Resets DFU status and usb setup process callbacks.
References dfu_status_t::bState, dfu_status_t::bStatus, udd_ctrl_request_t::callback, DFU_STATE_DFUIDLE, DFU_STATUS_OK, NULL, udd_ctrl_request_t::over_under_run, and udd_g_ctrlreq.
Referenced by udi_dfu_atmel_enable(), udi_dfu_atmel_setup(), and udi_dfu_flip_msg_decode().
|
static |
Selects the memory.
mem_num | memory id to select |
References ISP_MEM_BOOTLOADER, ISP_MEM_CONFIGURATION, ISP_MEM_SECURITY, ISP_MEM_SIGNATURE, isp_memories, isp_mems_t::mem, and udi_dfu_atmel_mem_b_protected.
Referenced by udi_dfu_atmel_select_memory().
|
static |
Decodes and process memory select command.
1
if command was accepted, otherwise 0
. References Assert, dfu_status_t::bState, dfu_status_t::bStatus, DFU_STATE_DFUERROR, DFU_STATUS_ERRADDRESS, FLIP_V2_CMD_SELECT_MEMORY_ARG_PAGE, FLIP_V2_CMD_SELECT_MEMORY_ARG_UNIT, ISP_MEM_COUNT, MSB0W, MSB1W, isp_mem_t::size, tmp, udi_dfu_atmel_mem_add, udi_dfu_atmel_sel_mem(), and udi_dfu_flip_msg.
Referenced by udi_dfu_flip_msg_decode().
|
static |
Decodes and prepares CPU reset command.
References Assert, FLIP_V2_CMD_START_APPLI_ARG_NO_RESET, FLIP_V2_CMD_START_APPLI_ARG_RESET, udi_dfu_atmel_reset, and udi_dfu_flip_msg.
Referenced by udi_dfu_flip_msg_decode().
|
static |
Decodes the Atmel DFU Command Called by over_under_run callback when the first data packet from a DNLOAD DFU request is received.
Note: An Atmel DFU commands can be stalled in following cases: memory security, bad address or blank check fail
References CAT_CMD, FLIP_V2_CMD_BLANK_CHECK, FLIP_V2_CMD_ERASE, FLIP_V2_CMD_GRP_DNLOAD, FLIP_V2_CMD_GRP_EXEC, FLIP_V2_CMD_GRP_SELECT, FLIP_V2_CMD_GRP_UPLOAD, FLIP_V2_CMD_PROGRAM_START, FLIP_V2_CMD_READ_MEMORY, FLIP_V2_CMD_SELECT_MEMORY, FLIP_V2_CMD_START_APPLI, isp_force_boot_isp(), NULL, udi_dfu_atmel_blankcheck(), udi_dfu_atmel_erase_chip(), udi_dfu_atmel_program(), udi_dfu_atmel_read(), udi_dfu_atmel_reset_protocol(), udi_dfu_atmel_select_memory(), udi_dfu_atmel_start(), udi_dfu_atmel_upload_callback, and udi_dfu_flip_msg.
Referenced by udi_dfu_atmel_setup().