[tuxdroid-svn] r569 - firmware/fuxusb/trunk/modules/usb
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2007-10-02 13:19:04
|
Author: jaguarondi Date: 2007-10-02 15:19:03 +0200 (Tue, 02 Oct 2007) New Revision: 569 Modified: firmware/fuxusb/trunk/modules/usb/usb_task.c Log: * Removed the blocking on the OUT EP with USBCommand_NewRequest_Flag, this doesn't make sense there and was buggy. Modified: firmware/fuxusb/trunk/modules/usb/usb_task.c =================================================================== --- firmware/fuxusb/trunk/modules/usb/usb_task.c 2007-10-02 12:41:45 UTC (rev 568) +++ firmware/fuxusb/trunk/modules/usb/usb_task.c 2007-10-02 13:19:03 UTC (rev 569) @@ -118,7 +118,11 @@ data Uchar i; if (status_requested && FifoIn_STT_Idx && !CMDIN_ToSend_Flag) - { + { +#ifdef USB_CMD_DEBUG + printf("Stacking %Bu data from status on USB fifo.\n", + FifoIn_STT_Idx); +#endif //Led_0_off(); Usb_select_ep(EP_CMD_IN); Usb_write_byte(0); @@ -511,7 +515,7 @@ } //-------------------------------------------------------------------------- - // I2C pause timer + // Soft tiumer that suspend the I2C process when needed, 1ms unit (sof) //-------------------------------------------------------------------------- if (i2c_wait_counter) i2c_wait_counter--; @@ -724,15 +728,13 @@ // // //-------------------------------------------------------------------------- - if(USB_ParserProcess_Permit_Flag) + if(USB_ParserProcess_Permit_Flag) /* XXX should be removed from here */ if(Usb_test_it_ep(EP_CMD_OUT)) { - // printf ("if(Usb_test_it_ep(EP_CMD_OUT)) \n"); - if(!USBCommand_NewRequest_Flag) /* XXX can lock in case the RF is not responding, check this for bootloader */ - { - //DEBUG_2 = 1; +#ifdef USB_CMD_DEBUG + printf("Event on EP_CMD_OUT, data received:\n"); +#endif Usb_select_ep(EP_CMD_OUT); - //DEBUG_2 = 0; if(Usb_rx_complete()) { USBCommand_Ctr = usb_get_nb_byte(); // Capture the number of Byte in USB FIFO @@ -748,11 +750,14 @@ //-------------------------------------------------------------------------- if(USBCommand_Header == LIBUSB_TUX_CMD_HDR) { - #ifdef USB_CMD_DEBUG - printf("CMD TUX"); + printf("TUX command "); #endif - USBCommand_NewRequest_Flag = 1; // to inform SPI_task that a new command is arrived + /* XXX Changed this flag handling so that the OUT EP is + * not blocked anymore by this flag, but commands are + * not buffered and can be overwritten now. Is this a + * problem? Change this to a fifo? */ + USBCommand_NewRequest_Flag = 1; for(i=0;i<(USBCommand_Ctr-1);i++) { USBCommand_ForRF[i] = Usb_read_byte(); @@ -770,10 +775,9 @@ // //-------------------------------------------------------------------------- else if(USBCommand_Header == LIBUSB_DONGLE_CMD_HDR) - { #ifdef USB_CMD_DEBUG - printf("CMD DONGLE "); + printf("DONGLE command "); #endif for(i=0;i<(USBCommand_Ctr-1);i++) { @@ -786,8 +790,6 @@ printf("\n"); #endif usb_command_parser(); - USBCommand_NewRequest_Flag = 0; /* re-enable USB to get the next value */ - } //-------------------------------------------------------------------------- // @@ -797,11 +799,10 @@ else if(USBCommand_Header == LIBUSB_BOOTLOADER_CMD_HDR) { #ifdef USB_CMD_DEBUG - printf("CMD BOOTLOADER \n"); + printf("BOOTLOADER command\n"); #endif i2c_bootloading_Flag = 1; //printf ("LIBUSB_BOOTLOADER_CMD_HDR \n"); - USBCommand_NewRequest_Flag = 0; /* set that data has been received */ spi_task_on_Flag = 0; /* disables the spi task and enables I2C bootloading */ Command_FromUSB_bootload_cmd = Usb_read_byte(); /* first byte after the header is the bootloading command */ if (Command_FromUSB_bootload_cmd == BOOT_INIT) /* initialize a new page programming */ @@ -873,8 +874,6 @@ #endif /* TODO add an error return function on the USB */ } - - USBCommand_NewRequest_Flag = 0; /* re-enable USB to get the next value */ } Usb_select_ep(EP_CMD_OUT); /* release the bank */ if(CMD_OUT_usb_Bank==0) @@ -890,13 +889,11 @@ CMD_OUT_usb_Bank ^=1; } - } - } - } //if(Usb_endpoint_interrupt()) + } /* if(Usb_test_it_ep(EP_CMD_OUT)) */ + } /* if(Usb_endpoint_interrupt()) */ + } /* if (!usb_connected_Flag) */ - } - if(!usb_connected_Flag) return; |