X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/cb779e3d7d32d7c43e0a45bb526de0a04135b0c7..6655815b32fc26f15e83bf12d14a6684f70e2d31:/Bootloaders/DFU/BootloaderDFU.h diff --git a/Bootloaders/DFU/BootloaderDFU.h b/Bootloaders/DFU/BootloaderDFU.h index f7fda1b11..ffd330d7f 100644 --- a/Bootloaders/DFU/BootloaderDFU.h +++ b/Bootloaders/DFU/BootloaderDFU.h @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2010. + Copyright (C) Dean Camera, 2012. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted @@ -44,25 +44,25 @@ #include #include #include + #include #include #include "Descriptors.h" + #include "BootloaderAPI.h" + #include "Config/AppConfig.h" #include + #include /* Macros: */ - /** Configuration define. Define this token to true to case the bootloader to reject all memory commands - * until a memory erase has been performed. When used in conjunction with the lockbits of the AVR, this - * can protect the AVR's firmware from being dumped from a secured AVR. When false, memory operations are - * allowed at any time. - */ - #define SECURE_MODE false - /** Major bootloader version number. */ #define BOOTLOADER_VERSION_MINOR 2 /** Minor bootloader version number. */ #define BOOTLOADER_VERSION_REV 0 + + /** Magic bootloader key to unlock forced application start mode. */ + #define MAGIC_BOOT_KEY 0xDC42CACA /** Complete bootloader version number expressed as a packed byte, constructed from the * two individual bootloader version macros. @@ -102,25 +102,25 @@ #define DFU_FILLER_BYTES_SIZE 26 /** DFU class command request to detach from the host. */ - #define REQ_DFU_DETATCH 0x00 + #define DFU_REQ_DETATCH 0x00 /** DFU class command request to send data from the host to the bootloader. */ - #define REQ_DFU_DNLOAD 0x01 + #define DFU_REQ_DNLOAD 0x01 /** DFU class command request to send data from the bootloader to the host. */ - #define REQ_DFU_UPLOAD 0x02 + #define DFU_REQ_UPLOAD 0x02 /** DFU class command request to get the current DFU status and state from the bootloader. */ - #define REQ_DFU_GETSTATUS 0x03 + #define DFU_REQ_GETSTATUS 0x03 /** DFU class command request to reset the current DFU status and state variables to their defaults. */ - #define REQ_DFU_CLRSTATUS 0x04 + #define DFU_REQ_CLRSTATUS 0x04 /** DFU class command request to get the current DFU state of the bootloader. */ - #define REQ_DFU_GETSTATE 0x05 + #define DFU_REQ_GETSTATE 0x05 /** DFU class command request to abort the current multi-request transfer and return to the dfuIDLE state. */ - #define REQ_DFU_ABORT 0x06 + #define DFU_REQ_ABORT 0x06 /** DFU command to begin programming the device's memory. */ #define COMMAND_PROG_START 0x01 @@ -145,7 +145,7 @@ /** Type define for a structure containing a complete DFU command issued by the host. */ typedef struct { - uint8_t Command; /**< Single byte command to perform, one of the COMMAND_* macro values */ + uint8_t Command; /**< Single byte command to perform, one of the \c COMMAND_* macro values */ uint8_t Data[5]; /**< Command parameters */ uint16_t DataSize; /**< Size of the command parameters */ } DFU_Command_t; @@ -189,10 +189,10 @@ }; /* Function Prototypes: */ - void SetupHardware(void); - void ResetHardware(void); + static void SetupHardware(void); + static void ResetHardware(void); - void EVENT_USB_Device_UnhandledControlRequest(void); + void EVENT_USB_Device_ControlRequest(void); #if defined(INCLUDE_FROM_BOOTLOADER_C) static void DiscardFillerBytes(uint8_t NumberOfBytes); @@ -203,6 +203,8 @@ static void ProcessWriteCommand(void); static void ProcessReadCommand(void); #endif + + void Application_Jump_Check(void) ATTR_INIT_SECTION(3); #endif