Remove serial driver use from the AVRISP project now that it is no longer needed.
[pub/USBasp.git] / Bootloaders / DFU / BootloaderDFU.h
index 5a83403..aac341f 100644 (file)
        \r
                #include "Descriptors.h"\r
                \r
        \r
                #include "Descriptors.h"\r
                \r
-               #include <LUFA/Drivers/USB/USB.h>                // USB Functionality\r
-               \r
+               #include <LUFA/Drivers/USB/USB.h>\r
+       \r
        /* Macros: */\r
                /** Configuration define. Define this token to true to case the bootloader to reject all memory commands\r
                 *  until a memory erase has been performed. When used in conjunction with the lockbits of the AVR, this\r
                 *  can protect the AVR's firmware from being dumped from a secured AVR. When false, memory operations are\r
                 *  allowed at any time.\r
                 */\r
        /* Macros: */\r
                /** Configuration define. Define this token to true to case the bootloader to reject all memory commands\r
                 *  until a memory erase has been performed. When used in conjunction with the lockbits of the AVR, this\r
                 *  can protect the AVR's firmware from being dumped from a secured AVR. When false, memory operations are\r
                 *  allowed at any time.\r
                 */\r
-               #define SECURE_MODE           false\r
+               #define SECURE_MODE              false\r
 \r
                /** Major bootloader version number. */\r
                #define BOOTLOADER_VERSION_MINOR 2\r
 \r
                /** Major bootloader version number. */\r
                #define BOOTLOADER_VERSION_MINOR 2\r
@@ -63,7 +63,7 @@
                /** Minor bootloader version number. */\r
                #define BOOTLOADER_VERSION_REV   0\r
 \r
                /** Minor bootloader version number. */\r
                #define BOOTLOADER_VERSION_REV   0\r
 \r
-               /** Complete bootloder version number expressed as a packed byte, constructed from the \r
+               /** Complete bootloader version number expressed as a packed byte, constructed from the \r
                 *  two individual bootloader version macros.\r
                 */\r
                #define BOOTLOADER_VERSION       ((BOOTLOADER_VERSION_MINOR << 4) | BOOTLOADER_VERSION_REV)\r
                 *  two individual bootloader version macros.\r
                 */\r
                #define BOOTLOADER_VERSION       ((BOOTLOADER_VERSION_MINOR << 4) | BOOTLOADER_VERSION_REV)\r
                \r
                /** Convenience macro, used to determine if the issued command is the given one-byte long command.\r
                 *\r
                \r
                /** Convenience macro, used to determine if the issued command is the given one-byte long command.\r
                 *\r
-                *  \param dataarr  Command byte array to check against\r
-                *  \param cb1      First command byte to check\r
+                *  \param[in] dataarr  Command byte array to check against\r
+                *  \param[in] cb1      First command byte to check\r
                 */\r
                 */\r
-               #define IS_ONEBYTE_COMMAND(dataarr, cb1)       (dataarr[0] == cb1)\r
+               #define IS_ONEBYTE_COMMAND(dataarr, cb1)       (dataarr[0] == (cb1))\r
 \r
                /** Convenience macro, used to determine if the issued command is the given two-byte long command.\r
                 *\r
 \r
                /** Convenience macro, used to determine if the issued command is the given two-byte long command.\r
                 *\r
-                *  \param dataarr  Command byte array to check against\r
-                *  \param cb1      First command byte to check\r
-                *  \param cb2      Second command byte to check\r
+                *  \param[in] dataarr  Command byte array to check against\r
+                *  \param[in] cb1      First command byte to check\r
+                *  \param[in] cb2      Second command byte to check\r
                 */\r
                 */\r
-               #define IS_TWOBYTE_COMMAND(dataarr, cb1, cb2) ((dataarr[0] == cb1) && (dataarr[1] == cb2))\r
+               #define IS_TWOBYTE_COMMAND(dataarr, cb1, cb2) ((dataarr[0] == (cb1)) && (dataarr[1] == (cb2)))\r
        \r
                /** Length of the DFU file suffix block, appended to the end of each complete memory write command.\r
                 *  The DFU file suffix is currently unused (but is designed to give extra file information, such as\r
        \r
                /** Length of the DFU file suffix block, appended to the end of each complete memory write command.\r
                 *  The DFU file suffix is currently unused (but is designed to give extra file information, such as\r
                 */\r
                #define DFU_FILLER_BYTES_SIZE    26\r
        \r
                 */\r
                #define DFU_FILLER_BYTES_SIZE    26\r
        \r
-               /** DFU class command request to detatch from the host. */\r
+               /** DFU class command request to detach from the host. */\r
                #define DFU_DETATCH              0x00\r
 \r
                /** DFU class command request to send data from the host to the bootloader. */\r
                #define DFU_DETATCH              0x00\r
 \r
                /** DFU class command request to send data from the host to the bootloader. */\r
                /** Type define for a non-returning function pointer to the loaded application. */\r
                typedef void (*AppPtr_t)(void) ATTR_NO_RETURN;\r
                \r
                /** Type define for a non-returning function pointer to the loaded application. */\r
                typedef void (*AppPtr_t)(void) ATTR_NO_RETURN;\r
                \r
-               /** Type define for a strucuture containing a complete DFU command issued by the host. */\r
+               /** Type define for a structure containing a complete DFU command issued by the host. */\r
                typedef struct\r
                {\r
                        uint8_t  Command; /**< Single byte command to perform, one of the COMMAND_* macro values */\r
                typedef struct\r
                {\r
                        uint8_t  Command; /**< Single byte command to perform, one of the COMMAND_* macro values */\r
                        errUNKNOWN                   = 14,\r
                        errSTALLEDPKT                = 15\r
                };\r
                        errUNKNOWN                   = 14,\r
                        errSTALLEDPKT                = 15\r
                };\r
-               \r
-       /* Event Handlers: */\r
-               /** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */\r
-               HANDLES_EVENT(USB_Disconnect);\r
-\r
-               /** Indicates that this module will catch the USB_UnhandledControlPacket event when thrown by the library. */\r
-               HANDLES_EVENT(USB_UnhandledControlPacket);\r
-               \r
+                               \r
        /* Function Prototypes: */\r
        /* Function Prototypes: */\r
+               void SetupHardware(void);\r
+               void ResetHardware(void);\r
+\r
+               void EVENT_USB_Device_UnhandledControlRequest(void);\r
+\r
                #if defined(INCLUDE_FROM_BOOTLOADER_C)\r
                        static void DiscardFillerBytes(uint8_t NumberOfBytes);\r
                        static void ProcessBootloaderCommand(void);\r
                #if defined(INCLUDE_FROM_BOOTLOADER_C)\r
                        static void DiscardFillerBytes(uint8_t NumberOfBytes);\r
                        static void ProcessBootloaderCommand(void);\r