[tuxdroid-svn] r1107 - in firmware/fuxusb/branches/usb_cleanup: bootloader usb
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2008-05-06 06:58:47
|
Author: Paul_R Date: 2008-05-06 08:58:50 +0200 (Tue, 06 May 2008) New Revision: 1107 Modified: firmware/fuxusb/branches/usb_cleanup/bootloader/bootloading.c firmware/fuxusb/branches/usb_cleanup/bootloader/i2c.c firmware/fuxusb/branches/usb_cleanup/bootloader/i2c.h firmware/fuxusb/branches/usb_cleanup/usb/usb_task.c Log: * Moved the i2c task into the i2c module Modified: firmware/fuxusb/branches/usb_cleanup/bootloader/bootloading.c =================================================================== --- firmware/fuxusb/branches/usb_cleanup/bootloader/bootloading.c 2008-05-06 06:44:57 UTC (rev 1106) +++ firmware/fuxusb/branches/usb_cleanup/bootloader/bootloading.c 2008-05-06 06:58:50 UTC (rev 1107) @@ -122,6 +122,9 @@ } + + + void bootloader_task(void) { uint8_t i; Modified: firmware/fuxusb/branches/usb_cleanup/bootloader/i2c.c =================================================================== --- firmware/fuxusb/branches/usb_cleanup/bootloader/i2c.c 2008-05-06 06:44:57 UTC (rev 1106) +++ firmware/fuxusb/branches/usb_cleanup/bootloader/i2c.c 2008-05-06 06:58:50 UTC (rev 1107) @@ -1,4 +1,7 @@ +#include "global.h" +#include "bootloader/bootloading.h" #include "bootloader\i2c.h" +#include "usb/usb_task.h" #define I2C_DEBUG 0 @@ -299,3 +302,33 @@ TWI_CLEAR_SI(); } #endif + + +void i2c_task(void) +{ + if (i2c_wait_counter) + /* Wait */ + ; + else if (i2c_task_on_Flag) + { + /* Send data through I2C */ + bl_senddata(blHeader, 64); +#ifdef BOOTLOAD_DEBUG + printf ("I2C: Send data"); + while (i2cFlags.i2c_busy) + { + uint8_t i; + for (i=0; i<0xFF; i++); + printf ("."); + } + printf (" [OK]\n"); +#else + while (i2cFlags.i2c_busy); +#endif + /* Wait 20ms before next I2C */ + i2c_wait_counter = 20; + /* ACK or NACK and exit I2C task */ + usb_Bootloader_acknowledge(i2cFlags.s_val, 0, 0, 0); + i2c_task_on_Flag = 0; + } +} Modified: firmware/fuxusb/branches/usb_cleanup/bootloader/i2c.h =================================================================== --- firmware/fuxusb/branches/usb_cleanup/bootloader/i2c.h 2008-05-06 06:44:57 UTC (rev 1106) +++ firmware/fuxusb/branches/usb_cleanup/bootloader/i2c.h 2008-05-06 06:58:50 UTC (rev 1107) @@ -2,7 +2,7 @@ * Copyright (c) 2006, C2ME S.A. * All rights reserved. * - * $Id:$ + * $Id$ */ #ifndef _I2C_H_ @@ -113,6 +113,7 @@ void i2cSetSlaveReceiveHandler(void (*i2cSlaveRx_func)(uint8_t receiveDataLength, uint8_t* recieveData)); void i2cSetSlaveTransmitHandler(uint8_t (*i2cSlaveTx_func)(uint8_t transmitDataLengthMax, uint8_t* transmitData)); void i2cMasterStart(void); +void i2c_task(void); #endif Modified: firmware/fuxusb/branches/usb_cleanup/usb/usb_task.c =================================================================== --- firmware/fuxusb/branches/usb_cleanup/usb/usb_task.c 2008-05-06 06:44:57 UTC (rev 1106) +++ firmware/fuxusb/branches/usb_cleanup/usb/usb_task.c 2008-05-06 06:58:50 UTC (rev 1107) @@ -756,31 +756,7 @@ if (i2c_bootloading_Flag) /* I2C bootloading */ { - if (i2c_wait_counter) - /* Wait */ - ; - else if (i2c_task_on_Flag) - { - /* Send data through I2C */ - bl_senddata(blHeader, 64); -#ifdef BOOTLOAD_DEBUG - printf ("I2C: Send data"); - while (i2cFlags.i2c_busy) - { - uint8_t i; - for (i=0; i<0xFF; i++); - printf ("."); - } - printf (" [OK]\n"); -#else - while (i2cFlags.i2c_busy); -#endif - /* Wait 20ms before next I2C */ - i2c_wait_counter = 20; - /* ACK or NACK and exit I2C task */ - usb_Bootloader_acknowledge(i2cFlags.s_val, 0, 0, 0); - i2c_task_on_Flag = 0; - } + i2c_task(); } |