int main(void) { Initialize(); //setup bus pirate //wait for the USB connection to enumerate #if defined (BUSPIRATEV4) && !defined (BPV4_DEBUG) BP_LEDUSB_DIR = 0; //BP_LEDUSB = 1; BP_USBLED_ON(); //BP_VREGEN_DIR = 0; // BP_VREGEN = 1; //BP_LEDMODE_DIR = 0; //BP_LEDMODE = 1; #ifdef USB_INTERRUPTS EnableUsbPerifInterrupts(USB_TRN + USB_SOF + USB_UERR + USB_URST); EnableUsbGlobalInterrupt(); #endif do { #ifndef USB_INTERRUPTS // if (!TestGlobalUsbInterruptEnable()) //JTR3 added usb_handler(); ////service USB tasks Guaranteed one pass in polling mode even when usb_device_state == CONFIGURED_STATE #endif // if ((usb_device_state < DEFAULT_STATE)) { // JTR2 no suspendControl available yet || (USBSuspendControl==1) ){ // } else if (usb_device_state < CONFIGURED_STATE) { // } } while (usb_device_state < CONFIGURED_STATE); // JTR addition. Do not proceed until device is configured. BP_USBLED_OFF(); usb_register_sof_handler(CDCFlushOnTimeout); // For timeout value see: cdc_config.h -> BPv4 -> CDC_FLUSH_MS #endif serviceuser(); return 0; }
int main(void) { firmware_signature = FIRMWARE_SIGNATURE; initialize_board(); #if defined(BUSPIRATEV4) BP_LEDUSB_DIR = OUTPUT; BP_USBLED_ON(); #ifdef USB_INTERRUPTS EnableUsbPerifInterrupts(USB_TRN | USB_SOF | USB_UERR | USB_URST); EnableUsbGlobalInterrupt(); #endif /* USB_INTERRUPTS */ /* Wait until the USB interface is configured. */ do { #ifndef USB_INTERRUPTS usb_handler(); #endif /* !USB_INTERRUPTS */ } while (usb_device_state < CONFIGURED_STATE); BP_USBLED_OFF(); usb_register_sof_handler(CDCFlushOnTimeout); #endif /* BUSPIRATEV4 */ /* Starts processing user requests. */ serviceuser(); return 0; }