[tuxdroid-svn] r1186 - in firmware/fuxusb/trunk: . src
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2008-05-22 08:53:27
|
Author: Paul_R Date: 2008-05-22 10:53:29 +0200 (Thu, 22 May 2008) New Revision: 1186 Modified: firmware/fuxusb/trunk/fuxusb.Opt firmware/fuxusb/trunk/src/bootloader.c firmware/fuxusb/trunk/src/config.h firmware/fuxusb/trunk/src/usb_commands.c firmware/fuxusb/trunk/src/usb_desc.h firmware/fuxusb/trunk/src/usb_ep.c Log: * Cleanup debugs messages. Modified: firmware/fuxusb/trunk/fuxusb.Opt =================================================================== (Binary files differ) Modified: firmware/fuxusb/trunk/src/bootloader.c =================================================================== --- firmware/fuxusb/trunk/src/bootloader.c 2008-05-22 07:43:15 UTC (rev 1185) +++ firmware/fuxusb/trunk/src/bootloader.c 2008-05-22 08:53:29 UTC (rev 1186) @@ -59,49 +59,27 @@ { /* Disable spi_task */ spi_task_on_Flag = False; -#ifdef BL_DEBUG - printf("BOOT CMD :: %bx - ", command_received[0]); -#endif if (command_received[0] == BOOT_INIT) { -#ifdef BL_DEBUG - printf("BOOT INIT \n"); -#endif init_bootloader(); } else if (!i2c_bootloading_Flag) { -#ifdef BL_DEBUG - printf("INIT FAIL \n"); -#endif bl_acknowledge(False, 1, 0, 0); bl_exit(); } else if (command_received[0] == BOOT_EXIT) { -#ifdef BL_DEBUG - printf("BOOT EXIT \n"); -#endif - bl_exit(); -#ifdef BL_DEBUG - printf("FLAG :: %BX \n", (uint8_t)(i2c_bootloading_Flag)); -#endif + bl_exit(); bl_acknowledge(True, 2, 0, 0); } else if (command_received[0] == BOOT_FILLPAGE) { -#ifdef BL_DEBUG - printf("BOOT FILLPAGE \n"); -#endif bl_fill_page(); } -#ifdef BL_DEBUG - else - printf("UNKNOWN CMD \n"); -#endif /* All data received */ if ((packet_idx == packets_per_page) && (address_idx == page_size)) @@ -137,9 +115,6 @@ else if (i2c_task_on_Flag) { -#ifdef BL_DEBUG - printf("I2C TASK PROCESS\n"); -#endif /* Send data through I2C */ bl_senddata(blHeader, 64); @@ -157,7 +132,7 @@ /** * \brief Fill page * A new page has been received. Check if the page is good, control the indexes - * and adresses, and put the data on the i2c. + * and adresses, and put the data on the i2c buffer. */ static void bl_fill_page(void) { @@ -189,7 +164,6 @@ bl_exit(); } - for(i = 3; i < Command_Ctr; i++) { blHeader.blData[address_idx++] = command_received[i]; @@ -217,6 +191,8 @@ /** * \brief Init bootloader mode. + * This function init the i2c communication, restart the dongle rf in bootloader + * mode, reset all bootloader variables and disable the INT0 interrupt (spi ready). */ static void init_bootloader(void) { @@ -247,6 +223,7 @@ /** *\brief Exit bootloader mode. + * When the bootloader mode exit, the spi and rf functions are re-initialized. */ static void bl_exit(void) { @@ -260,6 +237,8 @@ /* * Initialize i2c interface. + * This function set the I2C bitrate, init the interface and connect the + * bootloader pointer to the i2c buffer. */ static void bl_init(void) { @@ -287,15 +266,7 @@ i2cSendData[0] = blHeader.page_address >> 8; /* the first 2 bytes of the i2c frame are the page address */ i2cSendData[1] = blHeader.page_address; i2cSendDataLength = dataLength + 2; -#ifdef BOOTLOAD_DEBUG - { - uint8_t i; - printf("I2C: Page 0x%BX%BX:\n", i2cSendData[0], i2cSendData[1]); - for (i=2; i<i2cSendDataLength; i++) - printf("%BX", i2cSendData[i]); - printf("\n"); - } -#endif + i2cMasterStart(); } Modified: firmware/fuxusb/trunk/src/config.h =================================================================== --- firmware/fuxusb/trunk/src/config.h 2008-05-22 07:43:15 UTC (rev 1185) +++ firmware/fuxusb/trunk/src/config.h 2008-05-22 08:53:29 UTC (rev 1186) @@ -28,17 +28,12 @@ #include "lib_mcu/ext_5131.h" #include "lib_mcu/5131_drv.h" - - /* Debug modes : Don't forget to define MAIN_DEBUG to be able to use printf */ //#define MAIN_DEBUG -//#define BL_EP_DEBUG -//#define BL_DEBUG -//#define CMD_DEBUG -//#define FIFO_DEBUG //#define USB_ENUM_DEBUG -/* MCU config */ +/** \name MCU config + * @{ */ #define FOSC 24000 #define CPUB_VERSION #define X2_MODE @@ -47,6 +42,7 @@ #define BAUDRATE 115200 #define BDR_GENERATOR BRG_TIMER2 +/* @} */ /* Misc */ #define False 0 Modified: firmware/fuxusb/trunk/src/usb_commands.c =================================================================== --- firmware/fuxusb/trunk/src/usb_commands.c 2008-05-22 07:43:15 UTC (rev 1185) +++ firmware/fuxusb/trunk/src/usb_commands.c 2008-05-22 08:53:29 UTC (rev 1186) @@ -140,10 +140,6 @@ { Usb_select_ep(EP_CMD_IN); -#ifdef BL_EP_DEBUG - printf("SEND ACK \n"); -#endif - Usb_write_byte(BOOTLOADER_CMD); Usb_write_byte(ack ? B_ACK : B_NACK); Usb_write_byte(p1); Modified: firmware/fuxusb/trunk/src/usb_desc.h =================================================================== --- firmware/fuxusb/trunk/src/usb_desc.h 2008-05-22 07:43:15 UTC (rev 1185) +++ firmware/fuxusb/trunk/src/usb_desc.h 2008-05-22 08:53:29 UTC (rev 1186) @@ -29,7 +29,7 @@ #include "version.h" -/** Enable the HID interface */ +/** Enable / Disable the HID interface */ #undef HID_DEVICE /** \name Descriptors type Modified: firmware/fuxusb/trunk/src/usb_ep.c =================================================================== --- firmware/fuxusb/trunk/src/usb_ep.c 2008-05-22 07:43:15 UTC (rev 1185) +++ firmware/fuxusb/trunk/src/usb_ep.c 2008-05-22 08:53:29 UTC (rev 1186) @@ -72,22 +72,12 @@ clear_mic_ep(); if(Usb_test_it_ep(EP_CMD_OUT)) - { -#ifdef BL_EP_DEBUG - printf("CMD OUT RECEIVED ... "); -#endif + { if (new_cmd_enabled) { -#ifdef BL_EP_DEBUG - printf("PROCESS\n"); -#endif commands_parser(); clear_cmdout_ep(); } -#ifdef BL_EP_DEBUG - else - printf("ERROR\n"); -#endif } if (Usb_test_it_ep(EP_CMD_IN)) clear_cmdin_ep(); @@ -190,52 +180,30 @@ static void clear_cmdout_ep(void) { Usb_select_ep(EP_CMD_OUT); -#ifdef BL_EP_DEBUG - printf("Clear EP OUT:: %BX -> ", CMD_OUT_Bank_Nb); -#endif + // Release the EP fifo if (CMD_OUT_Bank_Nb == 0 && Usb_rx_bank0_complete()) { -#ifdef BL_EP_DEBUG - printf("BANK0 -> "); -#endif Usb_clear_rx_bank0(); CMD_OUT_Bank_Nb = 1; } else if(CMD_OUT_Bank_Nb == 1 && Usb_rx_bank1_complete()) { -#ifdef BL_EP_DEBUG - printf("BANK1 -> "); -#endif Usb_clear_rx_bank1(); CMD_OUT_Bank_Nb = 0; } else { -#ifdef BL_EP_DEBUG - printf("ERR : "); -#endif // Bad synchronisation : try to resynchronise if (Usb_rx_bank1_complete()) { -#ifdef BL_EP_DEBUG - printf("B1 -> "); - while(1); -#endif Usb_clear_rx_bank1(); } else { -#ifdef BL_EP_DEBUG - printf("B0 -> "); - while(1); -#endif Usb_clear_rx_bank0(); } } -#ifdef BL_EP_DEBUG - printf("%BX \n ", CMD_OUT_Bank_Nb); -#endif } /** @@ -246,36 +214,19 @@ static void clear_cmdin_ep(void) { Usb_select_ep(EP_CMD_IN); -#ifdef BL_EP_DEBUG - printf("Clear EP IN:: %BX -> ", CMD_IN_Bank_Nb); -#endif + if(Usb_tx_complete()) { Usb_clear_tx_complete(); CMD_IN_Bank_Nb--; -#ifdef BL_EP_DEBUG - printf("%BX -> ", CMD_IN_Bank_Nb); -#endif + if (CMD_IN_Bank_Nb<0) - { -#ifdef BL_EP_DEBUG - printf("RESET BANK "); -#endif + { CMD_IN_Bank_Nb = 0; } if (CMD_IN_Bank_Nb != 0) { -#ifdef BL_EP_DEBUG - printf("SET TX READY "); -#endif Usb_set_tx_ready(); } -#ifdef BL_EP_DEBUG - else - printf("NOTHING TO DO"); -#endif } -#ifdef BL_EP_DEBUG - printf("\n"); -#endif } |