+ USB_D_PLUS_PULLUP_OFF();\r
+ AT91C_BASE_RSTC->RSTC_RCR = RST_CONTROL_KEY | AT91C_RSTC_PROCRST;\r
+ break;\r
+\r
+ case CMD_START_FLASH:\r
+ if(c->arg[2] == START_FLASH_MAGIC) bootrom_unlocked = 1;\r
+ else bootrom_unlocked = 0;\r
+ {\r
+ int prot_start = (int)&_bootrom_start;\r
+ int prot_end = (int)&_bootrom_end;\r
+ int allow_start = (int)&_flash_start;\r
+ int allow_end = (int)&_flash_end;\r
+ int cmd_start = c->arg[0];\r
+ int cmd_end = c->arg[1];\r
+\r
+ /* Only allow command if the bootrom is unlocked, or the parameters are outside of the protected\r
+ * bootrom area. In any case they must be within the flash area.\r
+ */\r
+ if( (bootrom_unlocked || ((cmd_start >= prot_end) || (cmd_end < prot_start)))\r
+ && (cmd_start >= allow_start) && (cmd_end <= allow_end) ) {\r
+ start_addr = cmd_start;\r
+ end_addr = cmd_end;\r
+ } else {\r
+ start_addr = end_addr = 0;\r
+ dont_ack = 1;\r
+ c->cmd = CMD_NACK;\r
+ UsbSendPacket(packet, len);\r
+ }\r
+ }\r