X-Git-Url: http://rtime.felk.cvut.cz/gitweb/fpga/lx-cpu1/lx-rocon.git/blobdiff_plain/595eccb6252523c875206b0d218f6d167a96bac8..1aee21879a09ee87ae2de13c80139eb9e7d96525:/sw/app/rocon/appl_usb.c diff --git a/sw/app/rocon/appl_usb.c b/sw/app/rocon/appl_usb.c index 38dcd13..1bdc8b0 100644 --- a/sw/app/rocon/appl_usb.c +++ b/sw/app/rocon/appl_usb.c @@ -226,6 +226,15 @@ int usb_spi_flash_pkt_rd(struct usb_ep_t *ep, int len, int code) return USB_COMPLETE_OK; } +int usb_spi_flash_mass_erase(int mode) +{ +#ifdef CONFIG_OC_MTD_DRV_SYSLESS + mtd_spi_set_protect_mode(&mtd_spi_state, 0, 0); + mtd_spi_chip_erase(&mtd_spi_state, mode, 0); +#endif /*CONFIG_KEYVAL*/ + return 0; +} + static void usb_goto(unsigned address) { #ifdef CONFIG_KEYVAL @@ -408,6 +417,12 @@ int appl_usb_vendor(usb_device_t *udev) usb_flash_erase((uint32_t)dreq->wValue << 10, dreq->wIndex << 10); return 1; + case USB_VENDOR_MASS_ERASE: + usb_send_control_data(udev, NULL, 0); + if (dreq->wIndex == 5) + usb_spi_flash_mass_erase(dreq->wValue); + return 1; + case USB_VENDOR_CALL: vendor_call_ret = SWAP(appl_usb_vendor_call(dreq->wIndex, dreq->wValue)); usb_send_control_data(udev, (unsigned char *) &vendor_call_ret, sizeof(uint16_t));