Microchip® Advanced Software Framework

sam0/applications/usb_msc_bootloader/firmware_generator/main.c File Reference

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 void firmware_gen_system_init ( void  )
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 bool generate_firmware ( void  )
static
void main_usb_connection_event ( uhc_device_t dev,
bool  b_present 
)

Notify that a USB device has been connected or disconnected.

Parameters
devPointer on USB device information
b_presenttrue, 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.

DIR file_dir
static
FIL file_object1
static
FIL file_object2
static
uint32_t firmware_crc = 0
static

Referenced by generate_crc(), and generate_firmware().

FATFS fs
static
char input_file_name[]
static
Initial value:
= {
FIRMWARE_IN_FILE_NAME
}

Referenced by generate_crc(), generate_firmware(), and main().

volatile bool lun_connected = false
static

Referenced by main(), and main_usb_connection_event().

char output_file_name[]
static
Initial value:
= {
FIRMWARE_OUT_FILE_NAME
}

Referenced by generate_firmware(), and main().

TCHAR root_directory[20] = {'0', ':', 0}
static

Referenced by main().

volatile uint32_t sof_count = 0
static