#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <string.h>
#include "Descriptors.h"
#include "Config/AppConfig.h"
#include "Lib/SCSI.h"
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Platform/Platform.h>
#define LEDMASK_USB_BUSY LEDS_LED2 |
LED mask for the library LED driver, to indicate that the USB interface is busy.
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3) |
LED mask for the library LED driver, to indicate that the USB interface is enumerating.
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3) |
LED mask for the library LED driver, to indicate that an error has occurred in the USB interface.
#define LEDMASK_USB_NOTREADY LEDS_LED1 |
LED mask for the library LED driver, to indicate that the USB interface is not ready.
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4) |
LED mask for the library LED driver, to indicate that the USB interface is ready.
#define MAGIC_BOOT_KEY 0xDC42 |
Magic bootloader key to unlock forced application start mode.
void Application_Jump_Check |
( |
void |
) | |
|
Special startup routine to check if the bootloader was started via a watchdog reset, and if the magic application start key has been loaded into MagicBootKey. If the bootloader started via the watchdog and the key is valid, this will force the user application to start via a software jump.
bool CALLBACK_MS_Device_SCSICommandReceived |
( |
USB_ClassInfo_MS_Device_t *const |
MSInterfaceInfo) | |
|
Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed.
- Parameters
-
[in] | MSInterfaceInfo | Pointer to the Mass Storage class interface configuration structure being referenced |
void EVENT_USB_Device_ConfigurationChanged |
( |
void |
) | |
|
Event handler for the library USB Configuration Changed event.
void EVENT_USB_Device_Connect |
( |
void |
) | |
|
Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs.
void EVENT_USB_Device_ControlRequest |
( |
void |
) | |
|
Event handler for the library USB Control Request reception event.
void EVENT_USB_Device_Disconnect |
( |
void |
) | |
|
Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via the status LEDs and stops the Mass Storage management task.
Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence.
Flag to indicate if the bootloader should be running, or should exit and allow the application code to run via a soft reset. When cleared, the bootloader will abort, the USB interface will shut down and the application started via a forced watchdog reset.