Add missing project files for the new HIDReportViewer project to upgrade its status...
[pub/USBasp.git] / Bootloaders / HID / BootloaderHID.c
index 174041e..4a43954 100644 (file)
@@ -113,10 +113,18 @@ void EVENT_USB_Device_ControlRequest(void)
                        while (!(Endpoint_IsOUTReceived()));\r
                \r
                        /* Read in the write destination address */\r
-                       uint16_t PageAddress = Endpoint_Read_Word_LE();\r
+                       #if (FLASHEND > 0xFFFF)\r
+                       uint32_t PageAddress = ((uint32_t)Endpoint_Read_16_LE() << 8);\r
+                       #else\r
+                       uint16_t PageAddress = Endpoint_Read_16_LE();\r
+                       #endif\r
                        \r
                        /* Check if the command is a program page command, or a start application command */\r
+                       #if (FLASHEND > 0xFFFF)\r
+                       if ((uint16_t)(PageAddress >> 8) == COMMAND_STARTAPPLICATION)\r
+                       #else\r
                        if (PageAddress == COMMAND_STARTAPPLICATION)\r
+                       #endif\r
                        {\r
                                RunBootloader = false;\r
                        }\r
@@ -137,7 +145,7 @@ void EVENT_USB_Device_ControlRequest(void)
                                        }\r
 \r
                                        /* Write the next data word to the FLASH page */\r
-                                       boot_page_fill(PageAddress + ((uint16_t)PageWord << 1), Endpoint_Read_Word_LE());\r
+                                       boot_page_fill(PageAddress + ((uint16_t)PageWord << 1), Endpoint_Read_16_LE());\r
                                }\r
 \r
                                /* Write the filled FLASH page to memory */\r