Application to generate firmware for USB Host Mass Storage Bootloader.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include <string.h>
#include "conf_usb_host.h"
#include "conf_bootloader.h"
#include "main.h"
Macros | |
#define | MSC_DELAY_SOF_COUNT 1000 |
Functions | |
static void | firmware_gen_system_init (void) |
Initializes the device for the bootloader. More... | |
static void | generate_crc (void) |
Generate the CRC value for the firmware. More... | |
static bool | generate_firmware (void) |
Function to generate the final firmware. More... | |
int | main (void) |
Main function. More... | |
void | main_usb_connection_event (uhc_device_t *dev, bool b_present) |
Notify that a USB device has been connected or disconnected. More... | |
void | main_usb_sof_event (void) |
Notify that a SOF has been sent (each 1 ms) More... | |
Variables | |
COMPILER_WORD_ALIGNED volatile uint8_t | buffer [FLASH_BUFFER_SIZE] |
static DIR | file_dir |
static FIL | file_object1 |
static FIL | file_object2 |
static uint32_t | firmware_crc = 0 |
static FATFS | fs |
static char | input_file_name [] |
static volatile bool | lun_connected = false |
static char | output_file_name [] |
static TCHAR | root_directory [20] = {'0', ':', 0} |
static volatile uint32_t | sof_count = 0 |
#define MSC_DELAY_SOF_COUNT 1000 |
Referenced by main().
|
static |
Initializes the device for the bootloader.
References cpu_irq_enable, delay_ms, printf, sleepmgr_init(), system_init(), and uhc_start().
Referenced by main().
|
static |
Generate the CRC value for the firmware.
References buffer, buffer_size, CRC_BEAT_SIZE_WORD, dma_crc_disable(), dma_crc_get_checksum(), dma_crc_get_config_defaults(), dma_crc_io_calculation(), dma_crc_io_enable(), f_close(), f_open(), f_read(), FA_OPEN_EXISTING, FA_READ, firmware_crc, input_file_name, dma_crc_config::size, and dma_crc_config::type.
Referenced by main().
|
static |
Function to generate the final firmware.
References buf, buffer, buffer_size, f_close(), f_lseek(), f_open(), f_read(), f_sync(), f_write(), FA_CREATE_ALWAYS, FA_OPEN_EXISTING, FA_READ, FA_WRITE, firmware_crc, FR_OK, input_file_name, NULL, and output_file_name.
Referenced by main().
int main | ( | void | ) |
Main function.
Execution starts here.
References cpu_irq_disable, f_close(), f_mount(), f_open(), f_opendir(), FA_OPEN_EXISTING, FA_READ, firmware_gen_system_init(), FR_OK, FIL::fsize, generate_crc(), generate_firmware(), input_file_name, lun_connected, MSC_DELAY_SOF_COUNT, NULL, output_file_name, printf, root_directory, sof_count, uhc_stop(), and uhi_msc_mem_get_lun().
void main_usb_connection_event | ( | uhc_device_t * | dev, |
bool | b_present | ||
) |
Notify that a USB device has been connected or disconnected.
dev | Pointer on USB device information |
b_present | true, if the device has been connected |
References lun_connected, sof_count, and UNUSED.
void main_usb_sof_event | ( | void | ) |
Notify that a SOF has been sent (each 1 ms)
References sof_count.
COMPILER_WORD_ALIGNED volatile uint8_t buffer[FLASH_BUFFER_SIZE] |
Referenced by _http_client_handle_entity(), _http_client_move_buffer(), _http_client_read_chuked_entity(), _http_client_request(), _json_read_token(), at30tse_eeprom_read(), at30tse_eeprom_write(), at30tse_read_register(), at30tse_set_register_pointer(), dac_chan_write_buffer_job(), dao_ack_input(), dao_ack_output(), dao_input(), dao_output_target(), dio_input(), dio_output(), dis_output(), dma_crc_io_calculation(), dump_hex_buffer(), eeprom_emulator_read_buffer(), eeprom_emulator_write_buffer(), fetch_data(), find_buffer_cb(), generate_crc(), generate_firmware(), main(), packetbuf_copyto(), pds_nvm_write(), program_memory(), psock_init(), run_nvm_read_and_write_test(), run_nvm_update_test(), rww_eeprom_emulator_read_buffer(), rww_eeprom_emulator_write_buffer(), ser_fifo_init(), setup_dma_descriptor(), stream_writer_init(), and virtual_usb_trans().
|
static |
|
static |
|
static |
|
static |
Referenced by generate_crc(), and generate_firmware().
|
static |
|
static |
Referenced by generate_crc(), generate_firmware(), and main().
Referenced by main(), and main_usb_connection_event().
|
static |
Referenced by generate_firmware(), and main().
|
static |
Referenced by main(), main_usb_connection_event(), and main_usb_sof_event().