Add global usbMSCenabled flag.
Make ISPandReset honor this flag by disabling MSC first
This commit is contained in:
parent
050df7db06
commit
bb4b0f1b9c
|
@ -143,4 +143,7 @@ uint8_t getInput(void);
|
|||
uint32_t GetUUID32(void);
|
||||
uint16_t GetUUID16(void);
|
||||
|
||||
// for core/iap/iap.c (no official definition)
|
||||
void iap_entry(uint32_t param_tab[], uint32_t result_tab[]);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "lpc134x.h"
|
||||
#include "sysdefs.h"
|
||||
#include "basic/basic.h"
|
||||
#include "usb/usbmsc.h"
|
||||
|
||||
/* Missing from core */
|
||||
|
||||
|
@ -73,7 +75,11 @@ void EnableWatchdog(uint32_t ms){
|
|||
};
|
||||
|
||||
void ISPandReset(int delay){
|
||||
EnableWatchdog(1000*delay);
|
||||
ReinvokeISP();
|
||||
if(usbMSCenabled){
|
||||
usbMSCOff();
|
||||
delayms(500);
|
||||
};
|
||||
EnableWatchdog(1000*delay);
|
||||
ReinvokeISP();
|
||||
};
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
USB_DEV_INFO DeviceInfo;
|
||||
MSC_DEVICE_INFO MscDevInfo;
|
||||
ROM ** rom = (ROM **)0x1fff1ff8;
|
||||
char usbMSCenabled=0;
|
||||
|
||||
void usbMSCWrite(uint32_t offset, uint8_t src[], uint32_t length) {
|
||||
dataflash_random_write(src, offset, length);
|
||||
|
@ -84,6 +85,7 @@ void usbMSCInit(void) {
|
|||
|
||||
(*rom)->pUSBD->init(&DeviceInfo); /* USB Initialization */
|
||||
(*rom)->pUSBD->connect(true); /* USB Connect */
|
||||
usbMSCenabled=1;
|
||||
}
|
||||
|
||||
#ifdef CFG_USBMSC
|
||||
|
@ -94,5 +96,6 @@ void USB_IRQHandler() {
|
|||
|
||||
void usbMSCOff(void) {
|
||||
(*rom)->pUSBD->connect(false); /* USB Disconnect */
|
||||
usbMSCenabled=0;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "projectconfig.h"
|
||||
|
||||
extern char usbMSCenabled;
|
||||
void usbMSCWrite(uint32_t offset, uint8_t src[], uint32_t length);
|
||||
void usbMSCRead(uint32_t offset, uint8_t dst[], uint32_t length);
|
||||
void usbMSCInit(void);
|
||||
|
|
Loading…
Reference in New Issue