tux-droid-svn Mailing List for Tux Droid CE (Page 198)
Status: Beta
Brought to you by:
ks156
You can subscribe to this list here.
2007 |
Jan
|
Feb
(32) |
Mar
(108) |
Apr
(71) |
May
(38) |
Jun
(128) |
Jul
(1) |
Aug
(14) |
Sep
(77) |
Oct
(104) |
Nov
(90) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(81) |
Feb
(18) |
Mar
(40) |
Apr
(102) |
May
(151) |
Jun
(74) |
Jul
(151) |
Aug
(257) |
Sep
(447) |
Oct
(379) |
Nov
(404) |
Dec
(430) |
2009 |
Jan
(173) |
Feb
(236) |
Mar
(519) |
Apr
(300) |
May
(112) |
Jun
(232) |
Jul
(314) |
Aug
(58) |
Sep
(203) |
Oct
(293) |
Nov
(26) |
Dec
(109) |
2010 |
Jan
(19) |
Feb
(25) |
Mar
(33) |
Apr
(1) |
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: remi <c2m...@c2...> - 2008-05-02 14:40:25
|
Author: remi Date: 2008-05-02 16:40:29 +0200 (Fri, 02 May 2008) New Revision: 1081 Modified: software_suite_v2/middleware/tuxdriver/trunk/include/tux_driver.h software_suite_v2/middleware/tuxdriver/trunk/test/Makefile.unix software_suite_v2/middleware/tuxdriver/trunk/test/Makefile.win32 software_suite_v2/middleware/tuxdriver/trunk/test/main.c software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile Log: added the compilation to a static library. changed the tux_driver.h header to static linking. changed the test program for a static connection to the library. Modified: software_suite_v2/middleware/tuxdriver/trunk/include/tux_driver.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/include/tux_driver.h 2008-05-02 13:27:52 UTC (rev 1080) +++ software_suite_v2/middleware/tuxdriver/trunk/include/tux_driver.h 2008-05-02 14:40:29 UTC (rev 1081) @@ -17,45 +17,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ -/* - * Imported functions: - * extern HMODULE TuxDrv_InitDll(const char *lpsz); - * extern long TuxDrv_UninitDll(void); - * extern void TuxDrv_Start(void); - * extern void TuxDrv_Stop(void); - * extern const char *TuxDrv_StrError(TuxDrvError error_code); - * extern void TuxDrv_GetDescriptor(tux_descriptor_t *tux_desc); - * extern void TuxDrv_SetStatusCallback(drv_status_callback_t funct); - * extern void TuxDrv_SetEndCycleCallback(drv_simple_callback_t funct); - * extern void TuxDrv_SetDongleConnectedCallback(drv_simple_callback_t funct); - * extern void TuxDrv_SetDongleDisconnectedCallback(drv_simple_callback_t funct); - * extern TuxDrvError TuxDrv_PerformCommand(double delay, char *cmd_str); - * extern void TuxDrv_ClearCommandStack(void); - * extern TuxDrvError TuxDrv_PerformMacroFile(char *file_path); - * extern TuxDrvError TuxDrv_PerformMacroText(char *macro); - * extern TuxDrvError TuxDrv_SoundReflash(char *tracks); - * extern void TuxDrv_SetLogLevel(log_level_t level); - * extern void TuxDrv_SetLogTarget(log_target_t target); - * extern TuxDrvError TuxDrv_GetStatusName(int id, char* name); - * extern TuxDrvError TuxDrv_GetStatusId(char* name, int *id); - * extern TuxDrvError TuxDrv_GetStatusState(int id, char *state); - * extern TuxDrvError TuxDrv_GetStatusValue(int id, char *value); - * extern void TuxDrv_GetAllStatusState(char *state); - * extern int TuxDrv_TokenizeStatus(char *status, drv_tokens_t *tokens); - * extern void TuxDrv_ResetPositions(void); - * extern void TuxDrv_ResetDongle(void); - * extern double get_time(void); - */ #ifndef _TUX_DRIVER_H_ #define _TUX_DRIVER_H_ #include <stdbool.h> -#ifndef WINAPI -# define WINAPI -#endif - /** * Id enumeration of high level status. */ @@ -227,217 +194,31 @@ LOG_LEVEL_NONE } log_level_t; -/** - * Dynamic library definitions for specific os. - */ +extern void TuxDrv_Start(void); +extern void TuxDrv_Stop(void); +extern const char *TuxDrv_StrError(TuxDrvError error_code); +extern void TuxDrv_GetDescriptor(tux_descriptor_t *tux_desc); +extern void TuxDrv_SetStatusCallback(drv_status_callback_t funct); +extern void TuxDrv_SetEndCycleCallback(drv_simple_callback_t funct); +extern void TuxDrv_SetDongleConnectedCallback(drv_simple_callback_t funct); +extern void TuxDrv_SetDongleDisconnectedCallback(drv_simple_callback_t funct); +extern TuxDrvError TuxDrv_PerformCommand(double delay, char *cmd_str); +extern void TuxDrv_ClearCommandStack(void); +extern TuxDrvError TuxDrv_PerformMacroFile(char *file_path); +extern TuxDrvError TuxDrv_PerformMacroText(char *macro); +extern TuxDrvError TuxDrv_SoundReflash(char *tracks); +extern void TuxDrv_SetLogLevel(log_level_t level); +extern void TuxDrv_SetLogTarget(log_target_t target); +extern TuxDrvError TuxDrv_GetStatusName(int id, char* name); +extern TuxDrvError TuxDrv_GetStatusId(char* name, int *id); +extern TuxDrvError TuxDrv_GetStatusState(int id, char *state); +extern TuxDrvError TuxDrv_GetStatusValue(int id, char *value); +extern void TuxDrv_GetAllStatusState(char *state); +extern int TuxDrv_TokenizeStatus(char *status, drv_tokens_t *tokens); +extern void TuxDrv_ResetPositions(void); +extern void TuxDrv_ResetDongle(void); +extern double get_time(void); -/** - * Windows arch. - */ -#ifdef WIN32 -# ifndef LOADSYMBOL -# define LOADSYMBOL GetProcAddress -# endif -# ifndef CLOSELIB -# define CLOSELIB FreeLibrary -# endif -# ifndef DYNHANDLE - typedef HMODULE DYNHANDLE; -# endif -/** - * Linux and mac arch. - */ -#else -# ifndef HWND -# define HWND void* -# endif -# ifndef HMODULE -# define HMODULE void* -# endif -# include <dlfcn.h> -# include <unistd.h> -# include <stdlib.h> -# include <string.h> -# ifndef LOADSYMBOL -# define LOADSYMBOL dlsym -# endif -# ifndef CLOSELIB -# define CLOSELIB dlclose -# endif -# ifndef DYNHANDLE - typedef void* DYNHANDLE; -# endif -#endif -/** - * Common arch. - */ -#ifndef DDECL -# define DDECL(x) LP_##x x=NULL; -#endif -#ifndef DCLEAR -# define DCLEAR(x) x=NULL; -#endif -#ifndef DYN -# define DYN(x) x=( LP_##x )LOADSYMBOL(hMod,#x); -#endif - -/** - * Function prototypes - */ -typedef void (WINAPI *LP_TuxDrv_Start)(void); -typedef void (WINAPI *LP_TuxDrv_Stop)(void); -typedef const char * (WINAPI *LP_TuxDrv_StrError)(TuxDrvError error_code); -typedef void (WINAPI *LP_TuxDrv_GetDescriptor)(tux_descriptor_t *tux_desc); -typedef void (WINAPI *LP_TuxDrv_SetStatusCallback)(drv_status_callback_t funct); -typedef void (WINAPI *LP_TuxDrv_SetEndCycleCallback)(drv_simple_callback_t funct); -typedef void (WINAPI *LP_TuxDrv_SetDongleConnectedCallback)(drv_simple_callback_t funct); -typedef void (WINAPI *LP_TuxDrv_SetDongleDisconnectedCallback)(drv_simple_callback_t funct); -typedef TuxDrvError (WINAPI *LP_TuxDrv_PerformCommand)(double delay, char *cmd_str); -typedef void (WINAPI *LP_TuxDrv_ClearCommandStack)(void); -typedef TuxDrvError (WINAPI *LP_TuxDrv_PerformMacroFile)(char *file_path); -typedef TuxDrvError (WINAPI *LP_TuxDrv_PerformMacroText)(char *macro); -typedef TuxDrvError (WINAPI *LP_TuxDrv_SoundReflash)(char *tracks); -typedef void (WINAPI *LP_TuxDrv_SetLogLevel)(log_level_t level); -typedef void (WINAPI *LP_TuxDrv_SetLogTarget)(log_target_t target); -typedef TuxDrvError (WINAPI *LP_TuxDrv_GetStatusName)(int id, char* name); -typedef TuxDrvError (WINAPI *LP_TuxDrv_GetStatusId)(char* name, int *id); -typedef TuxDrvError (WINAPI *LP_TuxDrv_GetStatusState)(int id, char *state); -typedef TuxDrvError (WINAPI *LP_TuxDrv_GetStatusValue)(int id, char *value); -typedef void (WINAPI *LP_TuxDrv_GetAllStatusState)(char *state); -typedef int (WINAPI *LP_TuxDrv_TokenizeStatus)(char *status, drv_tokens_t *tokens); -typedef void (WINAPI *LP_TuxDrv_ResetPositions)(void); -typedef void (WINAPI *LP_TuxDrv_ResetDongle)(void); -typedef double (WINAPI *LP_get_time)(void); - -/** - * Made instance of functions. - */ -DDECL(TuxDrv_Start); -DDECL(TuxDrv_Stop); -DDECL(TuxDrv_StrError); -DDECL(TuxDrv_GetDescriptor); -DDECL(TuxDrv_SetStatusCallback); -DDECL(TuxDrv_SetEndCycleCallback); -DDECL(TuxDrv_SetDongleConnectedCallback); -DDECL(TuxDrv_SetDongleDisconnectedCallback); -DDECL(TuxDrv_PerformCommand); -DDECL(TuxDrv_ClearCommandStack); -DDECL(TuxDrv_PerformMacroFile); -DDECL(TuxDrv_PerformMacroText); -DDECL(TuxDrv_SoundReflash); -DDECL(TuxDrv_SetLogLevel); -DDECL(TuxDrv_SetLogTarget); -DDECL(TuxDrv_GetStatusName); -DDECL(TuxDrv_GetStatusId); -DDECL(TuxDrv_GetStatusState); -DDECL(TuxDrv_GetStatusValue); -DDECL(TuxDrv_GetAllStatusState); -DDECL(TuxDrv_TokenizeStatus); -DDECL(TuxDrv_ResetPositions); -DDECL(TuxDrv_ResetDongle); -DDECL(get_time); - -/** - * Declaration of the handle to the library. - */ -HMODULE _TUXDRIVER_hMod = NULL; - -/** - * Get the function address in the library. - */ -void -LoadFunctions(hMod) -HMODULE hMod; -{ - _TUXDRIVER_hMod = hMod; - DYN(TuxDrv_Start); - DYN(TuxDrv_Stop); - DYN(TuxDrv_StrError); - DYN(TuxDrv_GetDescriptor); - DYN(TuxDrv_SetStatusCallback); - DYN(TuxDrv_SetEndCycleCallback); - DYN(TuxDrv_SetDongleConnectedCallback); - DYN(TuxDrv_SetDongleDisconnectedCallback); - DYN(TuxDrv_PerformCommand); - DYN(TuxDrv_ClearCommandStack); - DYN(TuxDrv_PerformMacroFile); - DYN(TuxDrv_PerformMacroText); - DYN(TuxDrv_SoundReflash); - DYN(TuxDrv_SetLogLevel); - DYN(TuxDrv_SetLogTarget); - DYN(TuxDrv_GetStatusName); - DYN(TuxDrv_GetStatusId); - DYN(TuxDrv_GetStatusState); - DYN(TuxDrv_GetStatusValue); - DYN(TuxDrv_GetAllStatusState); - DYN(TuxDrv_TokenizeStatus); - DYN(TuxDrv_ResetPositions); - DYN(TuxDrv_ResetDongle); - DYN(get_time); -} - -/** - * Initialization of library. - */ -HMODULE -TuxDrv_InitDll(lpsz) -const char *lpsz; -{ - - HMODULE hMod = NULL; -#ifdef WIN32 - hMod = LoadLibrary(lpsz); - if(!hMod || (hMod < (HMODULE)32)) - { - return hMod; - } -#else - hMod = dlopen(lpsz, RTLD_NOW); - if(!hMod) - { - return NULL; - } - setenv("TUXDRIVERLIBPATH", lpsz, 1); -#endif - LoadFunctions(hMod); - return hMod; -} - -/** - * Finalization of library. - */ -long -TuxDrv_UninitDll() -{ - CLOSELIB(_TUXDRIVER_hMod); - _TUXDRIVER_hMod = NULL; - DCLEAR(TuxDrv_Start); - DCLEAR(TuxDrv_Stop); - DCLEAR(TuxDrv_StrError); - DCLEAR(TuxDrv_GetDescriptor); - DCLEAR(TuxDrv_SetStatusCallback); - DCLEAR(TuxDrv_SetEndCycleCallback); - DCLEAR(TuxDrv_SetDongleConnectedCallback); - DCLEAR(TuxDrv_SetDongleDisconnectedCallback); - DCLEAR(TuxDrv_PerformCommand); - DCLEAR(TuxDrv_ClearCommandStack); - DCLEAR(TuxDrv_PerformMacroFile); - DCLEAR(TuxDrv_PerformMacroText); - DCLEAR(TuxDrv_SoundReflash); - DCLEAR(TuxDrv_SetLogLevel); - DCLEAR(TuxDrv_SetLogTarget); - DCLEAR(TuxDrv_GetStatusName); - DCLEAR(TuxDrv_GetStatusId); - DCLEAR(TuxDrv_GetStatusState); - DCLEAR(TuxDrv_GetStatusValue); - DCLEAR(TuxDrv_GetAllStatusState); - DCLEAR(TuxDrv_TokenizeStatus); - DCLEAR(TuxDrv_ResetPositions); - DCLEAR(TuxDrv_ResetDongle); - DCLEAR(get_time); - return 0; -} - #if defined(__cplusplus) } #endif Modified: software_suite_v2/middleware/tuxdriver/trunk/test/Makefile.unix =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/test/Makefile.unix 2008-05-02 13:27:52 UTC (rev 1080) +++ software_suite_v2/middleware/tuxdriver/trunk/test/Makefile.unix 2008-05-02 14:40:29 UTC (rev 1081) @@ -10,9 +10,9 @@ C_INCLUDE_DIRS = C_PREPROC = CFLAGS = -pipe -Wall -g2 -O0 -LIB_DIRS = -LIBS = -ldl -LDFLAGS = -pipe +LIB_DIRS = -L ../unix +LIBS = -ldl -ltuxdriver -lm +LDFLAGS = -pipe -static SRC_OBJS = \ $(OBJ_DIR)/main.o Modified: software_suite_v2/middleware/tuxdriver/trunk/test/Makefile.win32 =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/test/Makefile.win32 2008-05-02 13:27:52 UTC (rev 1080) +++ software_suite_v2/middleware/tuxdriver/trunk/test/Makefile.win32 2008-05-02 14:40:29 UTC (rev 1081) @@ -14,8 +14,8 @@ RC_INCLUDE_DIRS = RC_PREPROC = RCFLAGS = -LIB_DIRS = -LIBS = +LIB_DIRS = -L "../win32" +LIBS = -ltuxdriver LDFLAGS = -pipe ifeq ($(OS),Windows_NT) Modified: software_suite_v2/middleware/tuxdriver/trunk/test/main.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/test/main.c 2008-05-02 13:27:52 UTC (rev 1080) +++ software_suite_v2/middleware/tuxdriver/trunk/test/main.c 2008-05-02 14:40:29 UTC (rev 1081) @@ -213,23 +213,11 @@ argc -= optind; argv += optind; -#ifdef WIN32 - if (TuxDrv_InitDll("../win32/tux_driver.dll") == NULL) - { - return -1; - } -#else - if (TuxDrv_InitDll("../unix/tux_driver.so") == NULL) - { - return -1; - } -#endif TuxDrv_SetLogLevel(LOG_LEVEL_ERROR); TuxDrv_SetLogTarget(LOG_TARGET_SHELL); TuxDrv_SetStatusCallback(on_status_event); TuxDrv_SetEndCycleCallback(on_end_cycle); TuxDrv_Start(); - TuxDrv_UninitDll(); return 0; } Modified: software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile 2008-05-02 13:27:52 UTC (rev 1080) +++ software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile 2008-05-02 14:40:29 UTC (rev 1081) @@ -13,7 +13,7 @@ CFLAGS = -pipe -std=gnu99 -DUSB_DEBUG0 -DSHOW_EVENTS -DNO_MOTORS_CHECK -DNO_THREAD -Wall -g0 -O2 -fPIC LIB_DIRS = LIBS = -lgthread-2.0 -lm -LDFLAGS = -pipe -shared +LDFLAGS = -pipe -shared SRC_OBJS = \ $(OBJ_DIR)/tux_battery.o \ @@ -45,6 +45,7 @@ define build_target @echo Linking... @$(CC) -o "$(OUTPUT_DIR)/$(TARGET)" $(SRC_OBJS) $(LIB_DIRS) $(LIBS) $(LDFLAGS) +@ar rcs $(OUTPUT_DIR)/libtuxdriver.a $(SRC_OBJS) endef define compile_source Modified: software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile 2008-05-02 13:27:52 UTC (rev 1080) +++ software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile 2008-05-02 14:40:29 UTC (rev 1081) @@ -14,9 +14,9 @@ RC_INCLUDE_DIRS = RC_PREPROC = RCFLAGS = -LIB_DIRS = -L"../libs" +LIB_DIRS = LIBS = -lwinmm -lhid -lsetupapi -lhidparse -LDFLAGS = -pipe -shared -Wl,--output-def,"$(OBJ_DIR)\driver_dll.def",--out-implib,"$(OBJ_DIR)\libdriver_dll.dll.a" +LDFLAGS = -pipe -shared -Wl,--output-def,"$(OUTPUT_DIR)\libtuxdriver.def",--out-implib,"$(OUTPUT_DIR)\libtuxdriver.a" ifeq ($(OS),Windows_NT) NULL = |
From: Paul_R <c2m...@c2...> - 2008-05-02 13:27:50
|
Author: Paul_R Date: 2008-05-02 15:27:52 +0200 (Fri, 02 May 2008) New Revision: 1080 Added: software_suite_v2/middleware/tuxdriver/trunk/firmware/ software_suite_v2/middleware/tuxdriver/trunk/firmware/fuxusb.hex Log: * Added fuxusb.hex - HID. (from SVN rev 1077) This is the new firmware version, compatible with tux_driver. Added: software_suite_v2/middleware/tuxdriver/trunk/firmware/fuxusb.hex =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/firmware/fuxusb.hex (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/firmware/fuxusb.hex 2008-05-02 13:27:52 UTC (rev 1080) @@ -0,0 +1,577 @@ +:101BF900C281D2A3438F01D2AF1212541200468080 +:011C0900FBDF +:0C1CBE00C8040401C9000004CA000000B2 +:041960004102280018 +:10196400C10BC10EC10AC10CC10D43022B01022ED1 +:10145700EF90030824FFFFEE34FFFEED34FFFDECB1 +:1014670034FFFC0208279002FBE0FF04F090030220 +:10147700E0FCA3E02FF582E43CF583E5CFF0051A05 +:1014870022900308E0FCA3E0FDA3E0FEA3E0FFEC4D +:101497004D4E4F22E490030BF0FB22900223E0FE17 +:0514A700A3E0FF4E224E +:1012540090030812083300002710121D6F43BC804E +:1012640043BC1090030812148B600F900308A3A3CF +:10127400A3E090030812145B80E953BCEF7D80E483 +:10128400FF121D68E4FF121C2C12002653F1FC43CC +:10129400F103D2B375C70443D51053CEFE53CEEF3A +:1012A40053D5EFC20AC280C290C200E490019CF000 +:0C12B400C204C20DD207D209C206C20853 +:0112C000220B +:101B1200C291C281E4FFFE0FBF00010EE4B507F7D8 +:061B2200EEB47DF3D28158 +:011B2800229A +:101B2900D291C281E4FFFE0FBF00010EE4B507F7B1 +:061B3900EEB47DF3D28141 +:011B3F002283 +:101172003006709001E1E0C39402506775C704E441 +:10118200F5CF30A304F5CF800375CF0190019CE029 +:10119200F5CF900270E060081313543FF5CF80033F +:1011A200E4F5CFE4F51B900270E0FFE51BC39F500E +:1011B20009121C6C8FCF051B80EC900270E0F51BAE +:1011C200E51BC3943C5007E4F5CF051B80F2900168 +:1011D200E1E004F0C20A121DA2E490019CF0C206F2 +:0311E200121B6974 +:0111E50022E7 +:10172B003008319001E1E0C39402502875C704E4FE +:10173B00F51B900270E0FFE51BC39F5009121C6C58 +:10174B008FCF051B80EC121DA29001E1E004F0C2CB +:04175B0008121B69EC +:01175F002267 +:101B69009001E1E0600B75C704E5CE20E40343CEA4 +:021B7900102238 +:10160800900308EFF0A3EDF0A3EBF0121DA27FF01A +:10161800121A78900308E06004E4FF80027F011248 +:101628001A78900309E0FF121A7890030AE0FF1273 +:0F1638001A7890030BE0FF121A78D20802172BD2 +:05000600C20E021B29DF +:100FC50090019DE06401600302104FA3E0707BA3D4 +:100FD500E07077A3E0FF7002D206EF64FE7029F59A +:100FE500A8F5B175C3149003081208330000271043 +:100FF50043BC10121488600512145780F653BCEFD9 +:1010050075A61E75A6E180FE9001A0E0F4703BF583 +:10101500A8F5B175C314FD7F4012188D7B017DF4D1 +:101025007F04121AAE9003081208330000271043FC +:10103500BC10121488600512145780F653BCEF12C9 +:101045001D5975A61E75A6E180FE90019DE0B402AE +:0F1055000EA3E0FFB40103D20D22EF7002C20D13 +:011064002269 +:0E0F1200900308EBF0A3EAF0A3E9F0A3EDF0E2 +:100F2000E4A3F090030CE0FF90030BE0D39F407824 +:100F3000900308E0FBA3E0FAA3E0F98F8275830039 +:100F400012076764067057901CBE93FF121A7890C0 +:100F50001CBF120FA9901CC0120FA9901CC1120F28 +:100F6000B0901CC2120FB0901CC3120FB7901CC3DC +:100F7000E4740193FF121A78901CC5120FB7901CED +:100F8000C6120FBE901CC7120FBE901CC7E474019E +:100F900093FF121A78901CC9E493FF121A789003F9 +:080FA0000CE02404F0020F2311 +:100FA80022E493FF121A7822E493FF121A7822E4BB +:0D0FB80093FF121A7822E493FF121A782298 +:10004600200519E5BD20E50302041053BCBFD20507 +:1000560053BDFE53BDDF53BDF7020410E5BD543159 +:10006600602EE5BD30E00CC205D2B3C28153BDFEA1 +:1000760043BC40E5BD30E41853BDEF120026D2055F +:10008600121939121C3D121C4D121D9ED2B3C2818B +:10009600E5BD20E30302014953BDF7900224E004C5 +:1000A600F07006900223E004F09001DEE07002A3F7 +:1000B600E060109001DFE024FFF09001DEE034FF05 +:1000C600F08010200E0DE4F514F513D20FD291C274 +:1000D60010C211900228E0600214F030056590020B +:1000E60026E0605F30A32C20040F53F1FC43F1019E +:1000F600E4900223F0A3F0D2041214A27002D2B349 +:10010600BE0205BFFF02C2B3EFF47003EE640370D4 +:1001160032802730040F53F1FC43F103E4900223AD +:10012600F0A3F0C2041214A27002D2B3EF64104E10 +:100136007002C2B3EF64204E700990022374FFF080 +:10014600A314F012117212172B200B1C900226E03A +:10015600601630141375C701751A081215428FCF31 +:10016600D51AF843CE10D20BE5F87003020410E559 +:10017600F830E42275C704E5CE30E01A53CEFE907F +:1001860001E1E014F0E0C394005002E4F09001E1D4 +:10019600E0600343CE10E5F830E00BE4F5C7E5CEAA +:1001A60030E203121D7DE5F830E31A75C703121D10 +:1001B600B2EF600E300D0B751A08AFCF12182FD59F +:1001C6001AF853CEFDE5F830E21A75C702121DB2D1 +:1001D600EF600E200D0B751A08AFCF12182FD51A27 +:1001E600F853CEFDE5F830E10D75C701E5CE30E0F8 +:1001F6000553CEFEC20B200703020410E5F820E5E6 +:100206000302041030010302041075C705E5CE543D +:10021600427003020410121DB29001E0EFF090024A +:1002260025E5CFF0E0702F20A302D201E4F51A9065 +:1002360001E0E0FD14FFE51AC39F500E74E2251A93 +:10024600F582E4340112148080E57B017A0179E2BB +:10025600120F120203F1900225E0B40125E4F51A0B +:100266009001E0E014FFE51AC39F500E749D251A15 +:10027600F582E4340112148080E6120FC5C2010231 +:1002860003F1900225E0640260030203F1C201C299 +:1002960000900307E5CFF0E0B4013490022874FA29 +:1002A600F0121C0A121B12D20EE5CF25E09002FEB8 +:1002B600F0900305E5CFF09002FDE5CFF0E4900263 +:1002C60029F0A3F09002FBF0900304F00203AB20A8 +:1002D6000E0812149B7D01FF8011900307E0B40302 +:1002E6001012000612149B7D027F011216080203EB +:1002F600AB900307E0640260030203AB900304E0E3 +:100306007074AFCFEF9002FFF0A3E4F0AFCFE02F11 +:10031600F09002FFE03400F09001E0E0F9B405024D +:10032600803C9002FFE0FEA3E0FFEE547FFC9002CB +:1003360029E06C7003A3E06F6016EF64C07003EEF3 +:10034600641D600C9002FFE0B40E0AA3E0B4C00581 +:10035600E96424600C12149B7D03FF121608120038 +:1003660006E4F51A9001E0E024FCFFE51AC39F506D +:100376002E12146D80EE9001E0E06422600C1214DF +:100386009B7D04FF121608120006E4F51A9001E0A0 +:10039600E024FEFFE51AC39F500512146D80EE900F +:1003A6000304E004F09002FDE0FF900304E0FEB5D4 +:1003B6000726900305E0FD9002FBE0B5051A9002C2 +:1003C6002AE02DF0900229E03400F0E49002FBF0E0 +:1003D600900304F0D2038011EEC39F400C12149BCD +:1003E6007D05FF121608120006C20175C705200218 +:1003F6000CE5CE30E10753CEFDD202800D30020A65 +:10040600E5CE30E60553CEBFC202200503020657ED +:10041600300E4F900228E0600302065720030302C5 +:10042600065778087C037D017B017A0279FE7E00FF +:100436007F0612072890030E7440F01218BB900135 +:100446009AE020E0F99002287414F090019AE0C432 +:1004560013135401FFE490030BF0FBFD121608C2C0 +:10046600032230A30302064FD20C200003020657D4 +:1004760030B420300F1D9001DE7417F0A37470F0B5 +:10048600C211E4F515F514F513C20FC291D210C2CC +:1004960007C209201003020657201103020657E47B +:1004A600F54AC211E514702330130D30010575119C +:1004B6000A8010751102800B300105751108800342 +:1004C600E4F5118511C5751401804DE514B40114C8 +:1004D600E515B41103751402E51130E138121586DD +:1004E6008FC58034E51464027026E515B4150AE557 +:1004F6001130E302C201751403E51130E31074D024 +:100506002515F582E43401F583E0F5C5800A8005FA +:10051600E514B40303E4F5C50515E5137025AFC46A +:10052600BF8003D38001C3400430A3F22285C510E7 +:10053600E5C530E7057512228003751211751301A2 +:1005460002063FE51364017036AFC4BF8003D38053 +:1005560001C3400430A3F222E51030E109D29074C1 +:10056600222515F8A6C5E5122401FFE433FEE5159C +:100576006F7001EE600302063F75130202063FE547 +:10058600136402600302063FAFC4BF8003D3800139 +:10059600C3400430A3F222E51030E347AF127E00D9 +:1005A600EF2405FDEE33FCAB157A00D3EB9DEC642E +:1005B60080F8748098500BC3EB9512FD74442DF8A7 +:1005C600A6C5EF2406FFE43EFEEBB50716EAB50620 +:1005D60012900227E5C5F0E0FF90019CE0C39F5012 +:1005E60002EFF0E5122406FFE433FEE5156F700115 +:1005F600EE7046D207D209C210D291D20FE510543E +:10060600826016E4F51A7424251AF8E6FF1216BC61 +:10061600051AE51AC3951240EDE51030E333E546B9 +:10062600602FE4F51A7446251AF8E6FF121A7805C3 +:100636001AE51AC3940440ED22054A301113E54A1F +:10064600C3940550030204A822300C03121B29C2CE +:010656000C97 +:010657002280 +:06197400C18FC111C1107A +:0E1C7B00E4F514F513D20FD291C210C211225B +:1019390053AFFE43C31043C30253C3F753C3FB431F +:10194900C32043C340D2B2D2B4D291D288D2A8E440 +:07195900F514F513C2002292 +:03000300021DA635 +:031DA600D2113225 +:101C0A00121D8E121D619003027401F0A37406F076 +:011C1A0022A7 +:1018BB0090019AE054BFF0900308E090019BF090E8 +:1018CB000309E0FCA3E0FDEC900104F0A3EDF09024 +:0C18DB00030EE02402900199F0021C5D55 +:1014FC0090018DE0FF04F0748E2FF582E43401F539 +:10150C0083E595F022E0FF04F074042FF582E434B7 +:10151C0001F58322900199E0FF900103E0C39F2223 +:10152C00E0FBA3E0FAA3E0F9EA494B22A3E0FAA31B +:06153C00E0F5828A832223 +:041D8E0075938022A7 +:071D61007593C043B102229B +:0C1CCA00900186EBF0A3EAF0A3E9F02201 +:0C1CD60090018AEBF0A3EAF0A3E9F022F1 +:0F1C5D0090019AE04401F0E4900103F0021D921F +:041D92004393202235 +:0B1CFA0043931090019AE054FEF0228A +:031DA9008F9522F1 +:041D9600439304224D +:041D9A005393FB2242 +:031DAC00AF9522CE +:031DAF00AF9422CC +:03004300020CD9D3 +:100CD900C0E0C0F0C083C082C0D075D008AF94EF27 +:100CE9001208640E25000D3E080D3E100D46180D24 +:100CF90066200D46280D66300D70380D76400D665C +:100D0900480D73500D63580D86600D86680D867009 +:100D19000D86780D9C800DAE880D9C900DAE980DBA +:100D2900B5A00DE1A80DE1B00E08B80D70C00D70A9 +:100D3900C800000E285393DF90019B8008121520EC +:100D4900500B121511E0FF121DA9020E28121CFAF0 +:100D590090019AE04440F0020E281214FC90019A86 +:100D6900E04402F0020E25020E201214FC900189C3 +:100D7900E014FF90018DE0C39F5027802290019AD3 +:100D8900E04401F090018DE4F090019AE054FBF009 +:100D9900020E161214FC90018DE0C3940850030250 +:100DA9000E16020E1B90019AE04404F0121D619088 +:100DB900018612152C601890018DE0FF7B017A01E4 +:100DC900798EC00A900186121538D00A12088E90C1 +:100DD900019AE054FEF0804790018A12152C601A9E +:100DE9007B017A017904C00A90018A121538D00A68 +:100DF9007F8212088E900199EFF0900103E4F09040 +:100E09000103121511E0F5951215205005121D96D2 +:100E1900800D121D9A8008121D618003121CFA535D +:0D0E290093F7D0D0D082D083D0F0D0E0324B +:101AC800AE18AF19C390032AE09FFF900329E09E48 +:091AD800FED3EF94FFEE947F228F +:10176000AC18AD19ED2FFFEC3E900329F0A3EFF07C +:1017700020AF13121AC850047F0080027F01EF705F +:1017800013121D1080ED121AC850047F0080027FD2 +:0417900001EF60F213 +:011794002232 +:1019C300E4F519F518F517F51690032BF0A3F0F5C8 +:0F19D3008A758CF0438901438F02D28CD2A922EE +:0A1D100020AF06308D031213942259 +:03000B0002139449 +:10139400C0E0C0F0C083C082C0D075D000C000C01F +:1013A40004C005C006C007C28D438CF090032B74A3 +:1013B4000C75F04A1207FBFEC3E5F0944AEE940C58 +:1013C400E450047F0380027F02FEFDFCE5192FF543 +:1013D40019E5183EF518E5173DF517E5163CF51621 +:1013E400D007D006D005D004D000D0D0D082D0838E +:0513F400D0F0D0E03252 +:100AB6001201100100000020EB0307FF41000102B4 +:100AC60003010C034B00790073006F0068001203EA +:100AD600540075007800440072006F0069006400DD +:100AE6000C033100300030003000310012030904DD +:100AF60000000000000000000000000000001203DB +:100B0600540075007800440072006F0069006400AC +:100B16001E03540075007800440072006F006900DF +:100B260064002D004D006900630072006F0022030F +:100B3600540075007800440072006F00690064007C +:100B46002D0053007000650061006B0065007200A7 +:100B56001A03540075007800440072006F006900A3 +:100B660064002D005400540053001E035400750009 +:100B76007800440072006F00690064002D00410097 +:100B86007500640069006F000902290106010480EE +:100B9600320904000000010100080A2401000134A2 +:100BA600000201020C2402010102000100000006FD +:100BB6000C240202010100010000050009240303C0 +:100BC60001010001060924030401030002050904CA +:100BD60001000001020006090401010101020006EC +:100BE600072401030102000B240201010108014050 +:100BF6001F0009058101080001000007250100000A +:100C060000000904020000010200050904020101B6 +:100C160001020005072401020102000B2402010162 +:100C2600010801401F000905020108000100000734 +:100C3600250100000000090403000203000000096A +:100C4600211001000122220007058403400001074C +:100C5600050503400001090404000001010007091D +:100C6600240100011E0001050C24020701010001F8 +:100C7600000000070924030801030007070904050B +:100C8600000001020007090405010101020007072F +:100C96002401070102000B24020101010801401F83 +:100CA60000090503010800010000072501000000F6 +:100CB600000600FF0901A1010903150026FF0095A2 +:100CC60040750881020904150026FF009540750845 +:030CD6009102C0C8 +:10132B00E5CFF0A3E5CFF0A3E5CFF0A3E5CFF02217 +:10133B00900308E4F07412A3F09002F574FFF0A38D +:10134B002253CE7F53CEFB43CE102253CEFB43CE44 +:10135B00202253CEFB43CE8022900308E4F0A3223D +:10136B0053CEFD53CE7F229002F5E0FBA3E0FAA310 +:10137B00E0F92253CEDF53CEF72253CEFEE5CE5407 +:09138B004222E4F5CF43CE10220A +:10002600E49002F9F0A3F0A3F0900226F0C2059046 +:0C0036000223F0A3F09001E1F0C20222CE +:101647007D857F01121D687F01121C2C7D817F0221 +:10165700121D687F02121C2C7D817F03121D687F7B +:1016670003121C2C7D877F04121D687F04121C2C1B +:0C1677007D837F05121D687F05021C2C7E +:061D7D00E4F5C7020E367A +:100E36009002F4E5CFF09002F3E5CFF0A3E0546022 +:100E46006003020EC99002F3E024FEB40A00506962 +:100E5600900E6475F003A4C58325F0C58373020E56 +:100E6600BA020EBF020EBF020E8E020E82020EBF25 +:100E7600020E88020E94020EA4020EB5120890020B +:100E86000F0E121A1E020F0E121B40020F0E9002B8 +:100E9600F4E070051210F1806F121AFA806A90025F +:100EA600F4E0B48105121BC3805E12000E80591255 +:100EB60016F48054121A3C804F121356E5CE30E3D6 +:100EC600FB80429002F4E05460642070309002F39C +:100ED600E0247E600F146011146013240370141252 +:100EE60019E28024121A00801F121981801A121921 +:100EF600A28015121356E5CE30E3FB800812135676 +:0C0F0600E5CE30E3FB12137E53CE7F22B9 +:101B4000AFCF12134F43BC01E5CE30E0FB53CEFEC6 +:051B5000EF4480F5C622 +:011B5500226D +:1010F100AFCF53CE7F53CEFBEFD394015055900227 +:1011010026EFF064017058C2819003081208330081 +:10111100007D00900308E0FCA3E0FDA3E0FEA3E056 +:10112100FFEC4D4E4F6018EF24FFFFEE34FFFEED54 +:1011310034FFFDEC34FFFC90030812082780D4D261 +:1011410081C2B3121939121C4D121C3D121D9ED2BF +:1011510000800C43CE20E5CE30E3FB12137E224308 +:10116100CE10E5CE30E0FB53CEFE12164743BC0253 +:01117100225B +:1016F400AFCF900308E5CFF0AECFA3E5CFF053CE44 +:101704007F53CEFBEEB40313EF70109001E1F0C2EF +:10171400027F04121C2C7F05121C2C43CE10E5CE34 +:0617240030E0FB53CEFE95 +:01172A00229C +:10089000C212AFCFAECFEE24FE601E14605424E22D +:1008A000603E146029242160030209BB12133B74CB +:1008B0000AF0A374B6F00209D29003087401F07430 +:1008C0004B121342740BF0A3748EF00209D2121370 +:1008D000647422121343740CF0A374B7F00209D2AB +:1008E0001213647409121343740CF0A37445F002DC +:1008F00009D2EFB4090040030209AC900902F828BC +:10090000287302091D02092A02093C020949020949 +:100910005B02097902096802098A02099B12133BEA +:10092000740AF0A374F2F00209D2121364740C1268 +:100930001343740AF0A374C8F00209D212133B7473 +:100940000AF0A374D4F00209D2121364740C1213C7 +:1009500043740AF0A374E6F00209D212133B740B3D +:10096000F0A37404F00209D2121364741E1213432C +:10097000740BF0A37416F0805912136474221213CE +:1009800043740BF0A37434F08048121364741A1289 +:100990001343740BF0A37456F08037121364741E63 +:1009A000121343740BF0A37470F08026121356E5F3 +:1009B000CE20E314E5CE20E2F6800D121356E5CEEC +:1009C00020E305E5CE20E2F653CEF753CEDF53CE3B +:1009D0007F22E5CFE5CF90030BE5CFF090030AE54A +:1009E000CFF0900308E0FEA3E0FFA3E0FCA3E0FD4E +:1009F000D39FEC9E400DEF541F7004D212800CC2A6 +:100A0000128008900308ECF0A3EDF012135DD39070 +:100A10000309E09420900308E09400402812137228 +:100A20007D20120AA7900309E024E0F0900308E07B +:100A300034FFF0E5CE54427005E5CE30E0F51213F8 +:100A40008560CB8040121372900308A3E0FD120A68 +:100A5000A7E4900308F0A3F0E5CE54427005E5CE7C +:100A600030E0F51213856002801B30121D121372E4 +:100A7000E4FD121BE7E5CE54427005E5CE30E0F50B +:100A8000121385600553CEEF8019E5CE54427005F0 +:100A9000E5CE30E2F5E5CE20E20CE5CE544260062C +:060AA00053CE7F53CEFD92 +:100AA60022121BE79002F5EBF0A3EAF0A3E9F0228D +:1019E20090030812132B12135D12138DE5CE30E013 +:0D19F200FB53CEFEE5CE544260FA12136B9B +:0119FF0022C5 +:101A000090030812132B12135D12138DE5CE30E0F4 +:0D1A1000FB53CEFEE5CE544260FA12136B7C +:011A1D0022A6 +:1019810090030812132B12135D75CF0A43CE10E595 +:10199100CE30E0FB53CEFEE5CE544260FA12136B1B +:0119A1002223 +:1019A20090030812132B12135D75CF0143CE10E57D +:1019B200CE30E0FB53CEFEE5CE544260FA12136BFA +:0119C2002202 +:101B7B0090030F12132B12134CE5CE30E0FB53CE18 +:011B8B00FE5B +:011B8C002236 +:101B8D0090031312132B12134CE5CE30E0FB53CE02 +:011B9D00FE49 +:011B9E002224 +:101B9F0090031712132B12134CE5CE30E0FB53CEEC +:011BAF00FE37 +:011BB0002212 +:101BB10090031B12132B12134CE5CE30E0FB53CED6 +:011BC100FE25 +:011BC2002200 +:101A1E0012135D900226E0F5CF43CE10E5CE30E0F6 +:0E1A2E00FB53CEFEE5CE544260FA12136B223B +:101BC30012135D43CE20E5CE30E3FB12137E53CEDA +:021BD3007F226F +:1014AC00E5CFE5CFAFCF12135D9002F4E0247F605F +:1014BC000C14600E2402701975CF018014E4F5CF62 +:1014CC00800FEF547F24F8F582E43402F583E0F5C5 +:1014DC00CF12138DE5CE30E0FBE5CE20E2F653CEF5 +:0F14EC00FEE5CE544260FAE5CE20E2F512136B16 +:0114FB0022CE +:1013F9009002F4E0700B121356E5CE30E3FB53CEA6 +:10140900DF9002F4E0B4010B121356E5CE30E3FB92 +:1014190053CEDF9002F4E064027032E5CF702EE51E +:10142900CFAFCFEF247F701A75C70143CE20E4F503 +:10143900C79002F904F012134FE5CE30E0FB53CE0A +:0E144900FE22121356E5CE30E3FB12137E2274 +:1011E6009002F4E0700B121356E5CE30E3FB53CEBB +:1011F600DF9002F4E0B4010B121356E5CE30E3FBA8 +:1012060053CEDF9002F4E064027042E5CF703EE513 +:10121600CFAFCFEF6020247F702875C70153CEDF94 +:101226007F01121C2CE4F5C79002F9F012134FE56A +:10123600CE30E0FB800812134FE5CE30E0FB53CEF4 +:0E124600FE22121356E5CE30E3FB53CEDF221C +:101AFA0053CEFBE5CE544260FA53CEFD43CE10E5F9 +:081B0A00CE30E0FB53CEFE22B9 +:10000E00E5CF9002F2E5CFF012134FE5CE30E0FBD4 +:04001E0053CEFE229D +:101A3C0012135D9002F2E0F5CF43CE10E5CE30E00C +:0E1A4C00FB53CEFEE5CE544260FA12136B221D +:02197A00C11397 +:101A5A00E024B3F582E43402F583229002B1E00473 +:0E1A6A00F0E0FEC39420229002B1E014F022BE +:101C3D00E49002B1F09002B0F09002AFF0C2132226 +:101795007F08121A654002D213EEB43804121A718A +:1017A50022AECFEE9002AF7008121A5A7401F08083 +:1017B50005121A5AEEF09002AFE004F0E0B43802D8 +:0417C500E4F0DFCE9F +:0117C90022FD +:10182F00121A654002D213EEB43804121A7122EF65 +:10183F009002AF7008121A5A7401F08005121A5AEA +:0E184F00EFF09002AFE004F0E0B43802E4F0F5 +:01185D002268 +:101586009002B1E0FEC394105002C213EE701A909E +:1015960002B0E0FE70069002EAE0FF2274B22EF579 +:1015A60082E43402F583E0FF22121A719002B0122F +:1015B6001A5AE0FF9002B0E004F0E0B43802E4F01A +:0115C6002202 +:02197C00C11494 +:0B1D0500E02403F582E43400F58322A3 +:101C4D00E4900002F0900001F0900000F0C2142228 +:1016BC00900002E004F0E0FEC394804002D214EEED +:1016CC00FD7C00BC010ABD0107900002E014F02271 +:1016DC00900000121D05EFF0900000E004F0E0B463 +:0816EC000005E4B40101F02245 +:10154200900002E0FE7002C214EE701A900001E0F8 +:10155200FE7006900102E0FF2274022EF582E4344E +:1015620000F583E0FF22900002E014F090000112E7 +:101572001D05E0FF900001E004F0E0B40005E4B4D2 +:031582000101F074 +:011585002243 +:1017FD00E0FBA3E0FAA3E0F9900040120767FF9029 +:10180D0000410207679000417401120794E92441D9 +:10181D00F9E43AFA12074E543F0207C7900040020E +:02182D0007674B +:0E1C8900900040E41207D9900041E40207D910 +:101B560012182904543F12180BB507047F0180029E +:031B66007F0022DB +:0D1C9700121805B507047F0180027F0022AE +:0D1CA40012180CFF121829C39F543FFF2295 +:0818E70090032DECF0A3EDF0DD +:1018EF0012182904543F12180B6F6014900040EF28 +:1018FF001207D990032DA3E08F827583001207D9A9 +:01190F0022B5 +:1017CA00900323EBF0A3EAF0A3E9F09003231217A6 +:1017DA00FD6F601C121812900323E0FBA3E0FAA32A +:1017EA00E0F912180CF5827583001207677F002250 +:0317FA007F01224A +:10185E00900326EBF0A3EAF0A3E9F090032612170B +:10186E00FD6F6003121812900326E0FBA3E0FAA3AB +:0F187E00E0F912180CF582758300120767FF223C +:101BD50012180C5405FFB40308121CA4900332EF2D +:011BE500F00F +:011BE60022DC +:02197E00C11591 +:101A9300E4900272F0900271F0900270F0C215228D +:0B1AA300E02473F582E43402F5832296 +:061D8300A215E433FF226B +:041D9E00121A932260 +:041DA200121A93225C +:101A7800301503121DA2900270121AA3EFF0900203 +:0B1A880070E004F0E0B43C02D2152234 +:0E1C6C00900271121AA3E0FF900271E004F0E2 +:011C7A002247 +:0D1CB10012074EF5CF740129F9E43AFA222A +:071D68008FC7AF058FD422E5 +:1016830030F805E4F5C7802E30F90575C7018026CB +:1016930030FA0575C702801E30FB0575C703801637 +:1016A30030FC0575C704800E30FD0575C70580063F +:0916B30030FE0375C706AFC72223 +:031DB200AFE2227B +:091D2E00AFE3EFFEADE2EDFF2290 +:101BE700E4F5C7AF051DEF6005121CB180F543CEC4 +:021BF7001022BA +:0C1CE200AF051DEF6005121CB180F5225B +:101C1B00AF051DEF600AE5CF1207C7121CB680F0A7 +:011C2B002296 +:091D37008FC7E4F5CE43CE202253 +:101C2C007401A807088002C333D8FCF5D5E4F5D5B8 +:011C3C002285 +:071D6F0075A41043A302223A +:071D7600121D6F43BC802227 +:1019100041746D656C202852290A63353133312DAD +:101920007573622D6364632D315F305F320A0A0084 +:091930001B631B5B3F32356C00A8 +:0B15C70090031FEBF0A3EAF0A3E9F093 +:1015D20090031FE0FBA3E475F001120811A9F0FAD1 +:1015E20012074E900322F06013E0B40A057F0D1239 +:1015F2001D49900322E0FF121D4980D47F0D121D68 +:06160200497F0A021D49A8 +:091D40007BFF7A1979300215C706 +:1012C100900330EDF090032FEFF070097F0D121DA8 +:1012D100497F0A80377F1B121D497F5B121D499090 +:1012E1000330E0FFD39409400312131F900330121F +:1012F10013117F3B121D4990032FE0FFD394094046 +:101301000312131F90032F1213117F48121D49223C +:10131100E075F00A84E5F02430FF121D4922EF75D3 +:0A132100F00A842430FF121D492257 +:051D8900A29892162251 +:101AE100759840538FF7438F0175CBFF75CAF37516 +:091AF100C834D2CA439812D32272 +:081D49003099FDC2998F992227 +:071D51003098FDAF99C29824 +:011D58002268 +:0A1D1A008FC5E5C430E7FB7F01220E +:0A1D240043A22012FFC053A2DF22E9 +:0C1CEE008F1CAF058F1F121D24AF1D229C +:101AAE00A2AF9217C2AF8F1CAF038F1FAF058F1D52 +:091ABE00121D24A21792AF7F0152 +:011AC70022FC +:08188D0090030CEFF0A3EDF055 +:10189500A2AF9217C2AFE4FD7F08121CEE90030CB5 +:1018A500E0F45FFFA3E04FF51D751C07121D24A290 +:0518B5001792AF7F0156 +:0118BA00220B +:081D5900C2AF43A22002F40016 +:0300000002106586 +:0C106500787FE4F6D8FD75814A0210ACDB +:10065800E709F608DFFA8046E709F208DFFA803E84 +:1006680088828C83E709F0A3DFFA8032E309F60871 +:10067800DFFA8078E309F208DFFA807088828C83D9 +:10068800E309F0A3DFFA806489828A83E0A3F6088D +:10069800DFFA805889828A83E0A3F208DFFA804C67 +:1006A80080D280FA80C680D4806980F2803380103E +:1006B80080A680EA809A80A880DA80E280CA8033A7 +:1006C80089828A83ECFAE493A3C8C582C8CCC5831F +:1006D800CCF0A3C8C582C8CCC583CCDFE9DEE780EF +:1006E8000D89828A83E493A3F608DFF9ECFAA9F06E +:1006F800EDFB2289828A83ECFAE0A3C8C582C8CCC4 +:10070800C583CCF0A3C8C582C8CCC583CCDFEADEDC +:10071800E880DB89828A83E493A3F208DFF980CC3E +:1007280088F0EF60010E4E60C388F0ED2402B40437 +:100738000050B9F582EB2402B4040050AF232345DE +:0607480082239006A87355 +:10074E00BB010689828A83E0225002E722BBFE02A9 +:09075E00E32289828A83E49322DC +:10076700BB010CE58229F582E5833AF583E0225047 +:1007770006E92582F8E622BBFE06E92582F8E22291 +:0D078700E58229F582E5833AF583E49322AB +:10079400BB010FF8E58229F582E5833AF583E02869 +:1007A400F0225009C58229F8E58226F622BBFE090B +:1007B400C58229F8E22582F222F8EA2583F583E945 +:0307C40093282255 +:1007C700BB010689828A83F0225002F722BBFE0111 +:0207D700F3220B +:1007D900F8BB010DE58229F582E5833AF583E8F056 +:1007E900225006E92582C8F622BBFE05E92582C802 +:0207F900F222EA +:1007FB00C5F0F8A3E028F0C5F0F8E5821582700289 +:06080B001583E038F02225 +:10081100A3F8E0C5F025F0F0E5821582700215839A +:06082100E0C838F0E822F7 +:0C082700ECF0A3EDF0A3EEF0A3EFF02244 +:10083300A8828583F0D083D08212084A12084A1214 +:10084300084A12084AE473E493A3C583C5F0C58339 +:10085300C8C582C8F0A3C583C5F0C583C8C582C80F +:010863002272 +:10086400D083D082F8E4937012740193700DA3A323 +:1008740093F8740193F5828883E473740293686037 +:06088400EFA3A3A380DF37 +:06088A008A838982E473F9 +:10107100021BF9E493A3F8E493A34003F68001F281 +:1010810008DFF48029E493A3F85407240CC8C33380 +:10109100C4540F4420C8834004F456800146F6DF4F +:1010A100E4800B0102040810204080901960E47E66 +:1010B100019360BCA3FF543F30E509541FFEE49344 +:1010C100A360010ECF54C025E060A840B8E493A30B +:1010D100FAE493A3F8E493A3C8C582C8CAC583CA36 +:1010E100F0A3C8C582C8CAC583CADFE9DEE780BEEE +:011980000066 +:00000001FF |
From: Paul_R <c2m...@c2...> - 2008-05-02 13:09:15
|
Author: Paul_R Date: 2008-05-02 15:09:19 +0200 (Fri, 02 May 2008) New Revision: 1079 Removed: software_suite_v2/middleware/tuxdriver/trunk/obj/ Log: * Removed obj/ |
From: Paul_R <c2m...@c2...> - 2008-05-02 13:07:15
|
Author: Paul_R Date: 2008-05-02 15:07:20 +0200 (Fri, 02 May 2008) New Revision: 1078 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c Log: * Bug fix : wrong token index Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-05-02 12:25:43 UTC (rev 1077) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-05-02 13:07:20 UTC (rev 1078) @@ -581,7 +581,7 @@ ret = str_to_float(tokens[4], &intensity); effect_type = conststr_to_effectval(tokens[5]); ret &= str_to_float(tokens[6], &effect_speed); - ret &= str_to_uint8(tokens[6], &effect_step); + ret &= str_to_uint8(tokens[7], &effect_step); if (ret) { |
From: Paul_R <c2m...@c2...> - 2008-05-02 12:25:38
|
Author: Paul_R Date: 2008-05-02 14:25:43 +0200 (Fri, 02 May 2008) New Revision: 1077 Modified: firmware/fuxusb/branches/0.3/version.h Log: * Incremented the version (0.4.0 -> 0.4.1) (1st HID version) Modified: firmware/fuxusb/branches/0.3/version.h =================================================================== --- firmware/fuxusb/branches/0.3/version.h 2008-05-02 12:21:13 UTC (rev 1076) +++ firmware/fuxusb/branches/0.3/version.h 2008-05-02 12:25:43 UTC (rev 1077) @@ -15,7 +15,7 @@ #define VER_MAJOR 0 #define VER_MINOR 4 -#define VER_UPDATE 0 +#define VER_UPDATE 1 #define AUTHOR_ID 0 /* official release */ #define VARIATION 0 /* generic firmware */ |
From: remi <c2m...@c2...> - 2008-05-02 12:21:10
|
Author: remi Date: 2008-05-02 14:21:13 +0200 (Fri, 02 May 2008) New Revision: 1076 Added: software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_unix.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_unix.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_win32.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_win32.h Removed: software_suite_v2/middleware/tuxdriver/trunk/libs/ software_suite_v2/middleware/tuxdriver/trunk/src/usb.h Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile Log: merged the trunk with the HID branch. Added: software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_unix.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_unix.c (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_unix.c 2008-05-02 12:21:13 UTC (rev 1076) @@ -0,0 +1,197 @@ +/* + * Tux Droid - Hid interface (only for unix) + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef WIN32 + +#include <stdlib.h> +#include <stdio.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <asm/types.h> +#include <fcntl.h> +#include <unistd.h> +#include <linux/hiddev.h> + +#include <string.h> +#include <dirent.h> + +#include "tux_hid_unix.h" +#include "tux_misc.h" + +static int tux_device_hdl = -1; +static char tux_device_path[256] = ""; +static struct hiddev_usage_ref uref_out; +static struct hiddev_report_info rinfo_out; + +static bool +find_dongle_from_path(char *path, int vendor_id, int product_id) +{ + DIR* dir; + struct dirent *dinfo; + int fd = -1; + char device_path[256] = ""; + struct hiddev_devinfo device_info; + int err; + + dir = opendir(path); + if (dir != NULL) + { + while ((dinfo = readdir(dir)) != NULL) + { + if (strncmp(dinfo->d_name, "hiddev", 6) == 0) + { + sprintf(device_path, "%s/%s", path, dinfo->d_name); + + if ((fd = open(device_path, O_RDONLY)) >= 0) + { + err = ioctl(fd, HIDIOCGDEVINFO, &device_info); + if ((device_info.vendor == vendor_id) && + ((device_info.product & 0xFFFF) == product_id)) + { + sprintf(tux_device_path, "%s", device_path); + tux_device_hdl = fd; + + closedir(dir); + + return true; + } + else + { + close(fd); + } + } + } + } + + closedir(dir); + } + + return false; +} + +bool LIBLOCAL +tux_hid_capture(int vendor_id, int product_id) +{ + /* Normal path to scan is /dev/usb */ + if (find_dongle_from_path("/dev/usb", vendor_id, product_id)) + { + return true; + } + + /* Other possible path to scan is /dev/usb */ + if (find_dongle_from_path("/dev", vendor_id, product_id)) + { + return true; + } + + /* dongle not found */ + return false; +} + +void LIBLOCAL +tux_hid_release(void) +{ + if (tux_device_hdl != -1) + { + close(tux_device_hdl); + tux_device_hdl = -1; + } +} + +bool LIBLOCAL +tux_hid_write(int size, char *buffer) +{ + int i; + int err; + + rinfo_out.report_type = HID_REPORT_TYPE_OUTPUT; + rinfo_out.report_id = HID_REPORT_ID_FIRST; + + err = ioctl(tux_device_hdl, HIDIOCGREPORTINFO, &rinfo_out); + if (err < 0) + { + return false; + } + + for(i = 0; i < size; i++) + { + uref_out.report_type = HID_REPORT_TYPE_OUTPUT; + uref_out.report_id = HID_REPORT_ID_FIRST; + uref_out.usage_index = i; + uref_out.value = (unsigned char)buffer[i]; + + err = ioctl(tux_device_hdl,HIDIOCSUSAGE, &uref_out); + if (err < 0) + { + return false; + } + } + + err = ioctl(tux_device_hdl,HIDIOCSREPORT,&rinfo_out); + if (err < 0) + { + return false; + } + + return true; +} + +bool LIBLOCAL +tux_hid_read(int size, char *buffer) +{ + int i; + int err; + + rinfo_out.report_type = HID_REPORT_TYPE_INPUT; + rinfo_out.report_id = HID_REPORT_ID_FIRST; + + err = ioctl(tux_device_hdl, HIDIOCGREPORTINFO, &rinfo_out); + if (err < 0) + { + return false; + } + + for (i = 0; i < size; i++) + { + uref_out.report_type = HID_REPORT_TYPE_INPUT; + uref_out.report_id = HID_REPORT_ID_FIRST; + uref_out.usage_index = i; + + err = ioctl(tux_device_hdl, HIDIOCGUCODE, &uref_out); + if (err < 0) + { + return false; + } + + err = ioctl(tux_device_hdl, HIDIOCGUSAGE, &uref_out); + if (err < 0) + { + return false; + } + + buffer[i] = uref_out.value; + } + + return true; +} + +#endif /* Not WIN32 */ + Added: software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_unix.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_unix.h (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_unix.h 2008-05-02 12:21:13 UTC (rev 1076) @@ -0,0 +1,38 @@ +/* + * Tux Droid - Hid interface (only for unix) + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef WIN32 + +#ifndef _TUX_HID_H_ +#define _TUX_HID_H_ + +#include <stdbool.h> + +#define HID_RW_TIMEOUT 1000 + +extern bool tux_hid_capture(int vendor_id, int product_id); +extern void tux_hid_release(void); +extern bool tux_hid_write(int size, char *buffer); +extern bool tux_hid_read(int size, char *buffer); + +#endif /* _TUX_HID_H_ */ + +#endif /* Not WIN32 */ + Added: software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_win32.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_win32.c (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_win32.c 2008-05-02 12:21:13 UTC (rev 1076) @@ -0,0 +1,200 @@ +/* + * Tux Droid - Hid interface (only for windows) + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifdef WIN32 + +#include <windows.h> +#include <hidsdi.h> +#include <setupapi.h> +#include <dbt.h> +#include <stdbool.h> +#include <stdio.h> + +#include "tux_hid_win32.h" +#include "tux_misc.h" + +static char device_symbolic_name[256] = ""; +static HANDLE tux_device_hdl = NULL; +static COMMTIMEOUTS timeout; + +bool LIBLOCAL +tux_hid_capture(int vendor_id, int product_id) +{ + GUID hid_guid; + HANDLE h_dev_info; + SP_DEVICE_INTERFACE_DATA dev_info_data; + PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL; + int member_index = 0; + bool last_device = false; + long result; + unsigned long length = 0; + ULONG required; + HANDLE device_hdl = NULL; + HIDD_ATTRIBUTES attributes; + bool tux_found = false;; + + if (tux_device_hdl != NULL) + { + return false; + } + + HidD_GetHidGuid(&hid_guid); + + h_dev_info = SetupDiGetClassDevs(&hid_guid, + NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE); + + dev_info_data.cbSize = sizeof(dev_info_data); + + member_index = 0; + + do + { + result = SetupDiEnumDeviceInterfaces(h_dev_info, 0, + &hid_guid, member_index, &dev_info_data); + + if (result != 0) + { + result = SetupDiGetDeviceInterfaceDetail(h_dev_info, + &dev_info_data, NULL, 0, &length, NULL); + + detail_data = (PSP_DEVICE_INTERFACE_DETAIL_DATA)malloc(length); + detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); + + result = SetupDiGetDeviceInterfaceDetail(h_dev_info, + &dev_info_data, detail_data, length, &required, NULL); + + device_hdl = CreateFile(detail_data->DevicePath, 0, + FILE_SHARE_READ|FILE_SHARE_WRITE, (LPSECURITY_ATTRIBUTES)NULL, + OPEN_EXISTING, 0, NULL); + + attributes.Size = sizeof(attributes); + result = HidD_GetAttributes(device_hdl, &attributes); + + if ((attributes.VendorID == vendor_id) && + (attributes.ProductID == product_id)) + { + sprintf(device_symbolic_name, "%s", detail_data->DevicePath); + + CloseHandle(device_hdl); + + tux_device_hdl = CreateFile(detail_data->DevicePath, + GENERIC_WRITE|GENERIC_READ, + FILE_SHARE_READ|FILE_SHARE_WRITE, + (LPSECURITY_ATTRIBUTES)NULL, + OPEN_EXISTING, 0, NULL); + + timeout.ReadTotalTimeoutConstant = HID_RW_TIMEOUT; + timeout.WriteTotalTimeoutConstant = HID_RW_TIMEOUT; + SetCommTimeouts(tux_device_hdl, &timeout); + + tux_found = true; + + break; + } + + CloseHandle(device_hdl); + free(detail_data); + } + else + { + last_device = true; + } + + member_index++; + + } + while (last_device == false); + + if (tux_found) + { + return true; + } + else + { + return false; + } +} + +void LIBLOCAL +tux_hid_release(void) +{ + if (tux_device_hdl != NULL) + { + CloseHandle(tux_device_hdl); + tux_device_hdl = NULL; + } +} + +bool LIBLOCAL +tux_hid_write(int size, char *buffer) +{ + int wrt_count; + char report[65] = { [0 ... 64] = 0 }; + long result; + + if (tux_device_hdl == NULL) + { + return false; + } + + report[0] = 0; + memcpy(&report[1], buffer, size); + + result = WriteFile(tux_device_hdl, report, 65, &wrt_count, + NULL); + + if (!result) + { + return false; + } + else + { + return true; + } +} + +bool LIBLOCAL +tux_hid_read(int size, char *buffer) +{ + int rd_count; + char report[size + 1]; + long result; + + if (tux_device_hdl == NULL) + { + return false; + } + + result = ReadFile(tux_device_hdl, report, size + 1, &rd_count, + NULL); + + memcpy(buffer, &report[1], size); + + if (!result) + { + return false; + } + else + { + return true; + } +} + +#endif /* WIN32 */ Added: software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_win32.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_win32.h (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_hid_win32.h 2008-05-02 12:21:13 UTC (rev 1076) @@ -0,0 +1,35 @@ +/* + * Tux Droid - Hid interface (only for windows) + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifdef WIN32 + +#ifndef _TUX_HID_H_ +#define _TUX_HID_H_ + +#define HID_RW_TIMEOUT 1000 + +extern bool tux_hid_capture(int vendor_id, int product_id); +extern void tux_hid_release(void); +extern bool tux_hid_write(int size, char *buffer); +extern bool tux_hid_read(int size, char *buffer); + +#endif /* _TUX_HID_H_ */ + +#endif /* WIN32 */ Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c 2008-05-02 11:42:33 UTC (rev 1075) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c 2008-05-02 12:21:13 UTC (rev 1076) @@ -93,7 +93,7 @@ struct timezone tz; gettimeofday(&tv, &tz); - result = ((float)tv.tv_usec / 1000000) + (float)tv.tv_sec; + result = ((double)tv.tv_usec / 1000000) + (double)tv.tv_sec; return result; } Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-05-02 11:42:33 UTC (rev 1075) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-05-02 12:21:13 UTC (rev 1076) @@ -23,9 +23,9 @@ #include "log.h" #ifdef WIN32 -# include "usb.h" +# include "tux_hid_win32.h" #else -# include <usb.h> +# include "tux_hid_unix.h" #endif #include "tux_usb.h" @@ -33,8 +33,6 @@ # include "threading_uniform.h" #endif -static usb_dev_handle *tux_handle = NULL; -static struct usb_device *tux_device = NULL; static bool usb_connected = false; static frame_callback_t frame_callback_function; static simple_callback_t dongle_disconnect_function; @@ -55,11 +53,6 @@ static bool read_loop_started = false; static void set_connected(bool value); -static struct usb_device *usb_find_TuxDroid(void); -static struct usb_dev_handle *usb_open_TuxDroid(struct usb_device *tux_dev); -static int usb_write_TuxDroid(const void *buf, int size); -static int usb_read_TuxDroid(char *buf); -static void print_usb_debug(const char *str); static void set_read_loop_started(bool value); static bool get_read_loop_started(void); @@ -68,15 +61,6 @@ /** * */ -static void -print_usb_debug(const char *str) -{ - log_debug("USB debug : %s\n", str); -} - -/** - * - */ LIBLOCAL void tux_usb_set_frame_callback(frame_callback_t funct) { @@ -155,11 +139,6 @@ LIBLOCAL void tux_usb_init_module(void) { -#ifdef USB_DEBUG - usb_set_debug(4); -#else - usb_set_debug(0); -#endif #ifdef USE_MUTEX mutex_init(__connected_mutex); mutex_init(__read_write_mutex); @@ -244,112 +223,15 @@ /** * */ -static struct usb_device * -usb_find_TuxDroid(void) -{ - struct usb_bus *bus; - struct usb_device *tux_dev; - struct usb_device *tux_dev2; - - print_usb_debug("usb_init()"); - usb_init(); - print_usb_debug("usb_find_busses()"); - usb_find_busses(); - print_usb_debug("usb_find_devices()"); - usb_find_devices(); - - tux_dev2 = NULL; - - for (bus = usb_busses; bus; bus = bus->next) - { - for (tux_dev = bus->devices; tux_dev; tux_dev = tux_dev->next) - { - if (tux_dev->descriptor.idVendor == TUX_VID - && tux_dev->descriptor.idProduct == TUX_PID) - { - if (tux_dev->config->bNumInterfaces > 1) - { - tux_dev2 = tux_dev; - } - } - } - } - return tux_dev2; -} - -/** - * - */ -static struct usb_dev_handle * -usb_open_TuxDroid(struct usb_device *tux_dev) -{ - usb_dev_handle *tux_hdl; - int error; - - /* Open usb device */ - print_usb_debug("usb_open(tux_dev)"); - tux_hdl = usb_open(tux_dev); - - if (!tux_hdl) - { - return NULL; - } - - /* Setting configuration is normally not necessary as the snd-usb-audio - * will already have that done at this point. But in case we don't have usb - * sound support, it may help to set the configuration. */ - print_usb_debug("usb_set_configuration(tux_hdl, 1)"); - usb_set_configuration(tux_hdl, 1); - - /* Claim device interface */ - print_usb_debug("usb_claim_interface(tux_hdl, TUX_INTERFACE)"); - error = usb_claim_interface(tux_hdl, TUX_INTERFACE); - if (error != 0) - { - print_usb_debug("usb_claim_interface(tux_hdl, TUX_INTERFACE)"); - error = usb_claim_interface(tux_hdl, TUX_INTERFACE); - if (error != 0) - { - usb_reset(tux_hdl); - return NULL; - } - } - - return tux_hdl; -} - -/** - * - */ LIBLOCAL TuxUSBError tux_usb_capture(void) { read_error_counter = 0; - tux_device = usb_find_TuxDroid(); - if (!tux_device) + if (!tux_hid_capture(TUX_VID, TUX_PID)) { - log_error("Fux not found"); return TuxUSBFuxNotFound; } - - /* Old firmware should be discarded here */ -#ifndef USB_DEBUG - print_usb_debug("read tux_device->descriptor.bcdDevice"); - if (tux_device->descriptor.bcdDevice < MIN_FIRMWARE_VERSION) - { - log_error("Your fux firmware is too old"); - return TuxUSBFirmwareTooOld; - } -#endif - - /* Get Device handle */ - tux_handle = usb_open_TuxDroid(tux_device); - if (tux_handle == NULL) - { - log_error("Can't open the USB device"); - return TuxUSBHandleNotOpen; - } set_connected(true); @@ -362,19 +244,7 @@ LIBLOCAL TuxUSBError tux_usb_release(void) { - print_usb_debug("usb_release_interface(tux_handle, TUX_INTERFACE)"); - if (usb_release_interface(tux_handle, TUX_INTERFACE) < 0) - { - log_error("TuxUSBCantReleaseInterface"); - return TuxUSBCantReleaseInterface; - } - - print_usb_debug("usb_close(tux_handle)"); - if (usb_close(tux_handle) < 0) - { - log_error("Can't close the USB device"); - return TuxUSBCantCloseDevice; - } + tux_hid_release(); set_connected(false); @@ -384,50 +254,10 @@ /** * */ -static bool -is_error_no_device(int error) -{ - switch (error) { - case -EIO: - return true; - case -ENODEV: - return true; - case -110: - read_error_counter++; - if (read_error_counter >= TUX_USB_ERROR_LIMIT) - tux_usb_reset(); - return false; - case -116: - read_error_counter++; - if (read_error_counter >= TUX_USB_ERROR_LIMIT) - tux_usb_reset(); - return false; - case 0: - return false; - default: - return false; - } -} - -/** - * - */ -static int -usb_write_TuxDroid(const void *buf, int size) -{ - return usb_interrupt_write( tux_handle, - TUX_WRITE_EP, - (char *)buf, size, - TUX_WRITE_TIMEOUT); -} - -/** - * - */ LIBLOCAL TuxUSBError tux_usb_write(const void *buff) { - int ret; + bool ret; #ifndef USB_DEBUG void *buff2; unsigned char dest; @@ -460,22 +290,17 @@ } #endif - ret = usb_write_TuxDroid(buff, TUX_SEND_LENGTH); + ret = tux_hid_write(TUX_SEND_LENGTH, (char *)buff); #ifdef USE_MUTEX mutex_unlock(__read_write_mutex); #endif - if (ret != TUX_SEND_LENGTH) + if (!ret) { - if (is_error_no_device(ret)) - { - set_connected(false); - tux_usb_release(); - log_error("Fux is disconnected"); - return TuxUSBDisconnected; - } - log_error("Failed to write on USB device (%d)", ret); - return TuxUSBWriteError; + set_connected(false); + tux_usb_release(); + log_error("Fux is disconnected"); + return TuxUSBDisconnected; } return TuxUSBNoError; } @@ -483,33 +308,35 @@ /** * */ -static int -usb_read_TuxDroid(char *buf) -{ - return usb_interrupt_read( tux_handle, - TUX_READ_EP, - (char *)buf, - TUX_RECEIVE_LENGTH, - TUX_READ_TIMEOUT); -} - -/** - * - */ static void process_usb_frame(const char *data) { int i, j; int rf_state; int packet_count; - unsigned char *data_buf; - unsigned char packet_data[4]; + char *data_buf; + char packet_data[4]; rf_state = data[1]; packet_count = data[3]; - data_buf = (unsigned char *)data; + data_buf = (char *)data; data_buf += 4; + /* Having RF state to ON and no status frame is not normal */ + if ((packet_count == 0) && (rf_state == 1)) + { + read_error_counter++; + if (read_error_counter >= TUX_USB_ERROR_LIMIT) + { + /* Reset of the dongle */ + tux_usb_reset(); + } + } + else + { + read_error_counter = 0; + } + if (last_knowed_rf_state != rf_state) { last_knowed_rf_state = rf_state; @@ -529,13 +356,13 @@ { for (j = 0; j < 4; j++) { - packet_data[j] = data_buf[j]; + packet_data[j] = (unsigned char)data_buf[j]; } #ifdef USE_MUTEX mutex_lock(__callback_mutex); #endif if (frame_callback_function) - frame_callback_function(packet_data); + frame_callback_function((unsigned char*)packet_data); #ifdef USE_MUTEX mutex_unlock(__callback_mutex); #endif @@ -550,7 +377,7 @@ LIBLOCAL TuxUSBError tux_usb_read(void *buf) { - int ret; + bool ret; if (!tux_usb_connected()) { @@ -563,43 +390,29 @@ #ifdef USE_MUTEX mutex_lock(__read_write_mutex); #endif - ret = usb_write_TuxDroid(frame_status_request, TUX_SEND_LENGTH); - if (ret != TUX_SEND_LENGTH) + ret = tux_hid_write(TUX_SEND_LENGTH, (char *)frame_status_request); + if (!ret) { #ifdef USE_MUTEX mutex_unlock(__read_write_mutex); #endif - if (is_error_no_device(ret)) - { /* USB device error */ - set_connected(false); - tux_usb_release(); - log_error("Fux is disconnected"); - return TuxUSBDisconnected; - } - log_error("Failed to write on USB device (%d)", ret); - return TuxUSBWriteError; + set_connected(false); + tux_usb_release(); + log_error("Fux is disconnected"); + return TuxUSBDisconnected; } - ret = usb_read_TuxDroid((char *)buf); + ret = tux_hid_read(TUX_RECEIVE_LENGTH, (char *)buf); #ifdef USE_MUTEX mutex_unlock(__read_write_mutex); #endif - if (ret != TUX_RECEIVE_LENGTH) - { /* Frame not have 64 bytes */ - if (is_error_no_device(ret)) - { /* USB device error */ - set_connected(false); - tux_usb_release(); - log_error("Fux is disconnected"); - return TuxUSBDisconnected; - } - log_error("Failed to read on USB device (%d)", ret); - return TuxUSBReadError; - } - else + if (!ret) { - read_error_counter = 0; + set_connected(false); + tux_usb_release(); + log_error("Fux is disconnected"); + return TuxUSBDisconnected; } process_usb_frame((char *)buf); @@ -740,7 +553,7 @@ LIBLOCAL void tux_usb_reset(void) { - usb_write_TuxDroid(frame_reset_dongle, TUX_SEND_LENGTH); + tux_hid_write(TUX_SEND_LENGTH, (char *)frame_reset_dongle); } /** Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h 2008-05-02 11:42:33 UTC (rev 1075) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h 2008-05-02 12:21:13 UTC (rev 1076) @@ -36,7 +36,7 @@ #define TUX_WRITE_TIMEOUT 1000 #define TUX_READ_TIMEOUT 1000 #define TUX_READ_LOOP_INTERVAL 0.05 -#define TUX_USB_ERROR_LIMIT 4 +#define TUX_USB_ERROR_LIMIT 50 #define MIN_FIRMWARE_VERSION 0x030 #ifdef WIN32 Deleted: software_suite_v2/middleware/tuxdriver/trunk/src/usb.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/usb.h 2008-05-02 11:42:33 UTC (rev 1075) +++ software_suite_v2/middleware/tuxdriver/trunk/src/usb.h 2008-05-02 12:21:13 UTC (rev 1076) @@ -1,394 +0,0 @@ -#ifndef __USB_H__ -#define __USB_H__ - -#include <stdlib.h> -#include <windows.h> - -/* ensure byte-packed structures */ -#include <pshpack1.h> - -/* - * 'interface' is defined somewhere in the Windows header files. This macro - * is deleted here to avoid conflicts and compile errors. - */ - -#ifdef interface -#undef interface -#endif - -/* - * PATH_MAX from limits.h can't be used on Windows if the dll and - * import libraries are build/used by different compilers - */ - -#define LIBUSB_PATH_MAX 512 - - -/* - * USB spec information - * - * This is all stuff grabbed from various USB specs and is pretty much - * not subject to change - */ - -/* - * Device and/or Interface Class codes - */ -#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */ -#define USB_CLASS_AUDIO 1 -#define USB_CLASS_COMM 2 -#define USB_CLASS_HID 3 -#define USB_CLASS_PRINTER 7 -#define USB_CLASS_MASS_STORAGE 8 -#define USB_CLASS_HUB 9 -#define USB_CLASS_DATA 10 -#define USB_CLASS_VENDOR_SPEC 0xff - -/* - * Descriptor types - */ -#define USB_DT_DEVICE 0x01 -#define USB_DT_CONFIG 0x02 -#define USB_DT_STRING 0x03 -#define USB_DT_INTERFACE 0x04 -#define USB_DT_ENDPOINT 0x05 - -#define USB_DT_HID 0x21 -#define USB_DT_REPORT 0x22 -#define USB_DT_PHYSICAL 0x23 -#define USB_DT_HUB 0x29 - -/* - * Descriptor sizes per descriptor type - */ -#define USB_DT_DEVICE_SIZE 18 -#define USB_DT_CONFIG_SIZE 9 -#define USB_DT_INTERFACE_SIZE 9 -#define USB_DT_ENDPOINT_SIZE 7 -#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ -#define USB_DT_HUB_NONVAR_SIZE 7 - - - -/* All standard descriptors have these 2 fields in common */ -struct usb_descriptor_header { - unsigned char bLength; - unsigned char bDescriptorType; -}; - -/* String descriptor */ -struct usb_string_descriptor { - unsigned char bLength; - unsigned char bDescriptorType; - unsigned short wData[1]; -}; - -/* HID descriptor */ -struct usb_hid_descriptor { - unsigned char bLength; - unsigned char bDescriptorType; - unsigned short bcdHID; - unsigned char bCountryCode; - unsigned char bNumDescriptors; -}; - -/* Endpoint descriptor */ -#define USB_MAXENDPOINTS 32 -struct usb_endpoint_descriptor { - unsigned char bLength; - unsigned char bDescriptorType; - unsigned char bEndpointAddress; - unsigned char bmAttributes; - unsigned short wMaxPacketSize; - unsigned char bInterval; - unsigned char bRefresh; - unsigned char bSynchAddress; - - unsigned char *extra; /* Extra descriptors */ - int extralen; -}; - -#define USB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */ -#define USB_ENDPOINT_DIR_MASK 0x80 - -#define USB_ENDPOINT_TYPE_MASK 0x03 /* in bmAttributes */ -#define USB_ENDPOINT_TYPE_CONTROL 0 -#define USB_ENDPOINT_TYPE_ISOCHRONOUS 1 -#define USB_ENDPOINT_TYPE_BULK 2 -#define USB_ENDPOINT_TYPE_INTERRUPT 3 - -/* Interface descriptor */ -#define USB_MAXINTERFACES 32 -struct usb_interface_descriptor { - unsigned char bLength; - unsigned char bDescriptorType; - unsigned char bInterfaceNumber; - unsigned char bAlternateSetting; - unsigned char bNumEndpoints; - unsigned char bInterfaceClass; - unsigned char bInterfaceSubClass; - unsigned char bInterfaceProtocol; - unsigned char iInterface; - - struct usb_endpoint_descriptor *endpoint; - - unsigned char *extra; /* Extra descriptors */ - int extralen; -}; - -#define USB_MAXALTSETTING 128 /* Hard limit */ - -struct usb_interface { - struct usb_interface_descriptor *altsetting; - - int num_altsetting; -}; - -/* Configuration descriptor information.. */ -#define USB_MAXCONFIG 8 -struct usb_config_descriptor { - unsigned char bLength; - unsigned char bDescriptorType; - unsigned short wTotalLength; - unsigned char bNumInterfaces; - unsigned char bConfigurationValue; - unsigned char iConfiguration; - unsigned char bmAttributes; - unsigned char MaxPower; - - struct usb_interface *interface; - - unsigned char *extra; /* Extra descriptors */ - int extralen; -}; - -/* Device descriptor */ -struct usb_device_descriptor { - unsigned char bLength; - unsigned char bDescriptorType; - unsigned short bcdUSB; - unsigned char bDeviceClass; - unsigned char bDeviceSubClass; - unsigned char bDeviceProtocol; - unsigned char bMaxPacketSize0; - unsigned short idVendor; - unsigned short idProduct; - unsigned short bcdDevice; - unsigned char iManufacturer; - unsigned char iProduct; - unsigned char iSerialNumber; - unsigned char bNumConfigurations; -}; - -struct usb_ctrl_setup { - unsigned char bRequestType; - unsigned char bRequest; - unsigned short wValue; - unsigned short wIndex; - unsigned short wLength; -}; - -/* - * Standard requests - */ -#define USB_REQ_GET_STATUS 0x00 -#define USB_REQ_CLEAR_FEATURE 0x01 -/* 0x02 is reserved */ -#define USB_REQ_SET_FEATURE 0x03 -/* 0x04 is reserved */ -#define USB_REQ_SET_ADDRESS 0x05 -#define USB_REQ_GET_DESCRIPTOR 0x06 -#define USB_REQ_SET_DESCRIPTOR 0x07 -#define USB_REQ_GET_CONFIGURATION 0x08 -#define USB_REQ_SET_CONFIGURATION 0x09 -#define USB_REQ_GET_INTERFACE 0x0A -#define USB_REQ_SET_INTERFACE 0x0B -#define USB_REQ_SYNCH_FRAME 0x0C - -#define USB_TYPE_STANDARD (0x00 << 5) -#define USB_TYPE_CLASS (0x01 << 5) -#define USB_TYPE_VENDOR (0x02 << 5) -#define USB_TYPE_RESERVED (0x03 << 5) - -#define USB_RECIP_DEVICE 0x00 -#define USB_RECIP_INTERFACE 0x01 -#define USB_RECIP_ENDPOINT 0x02 -#define USB_RECIP_OTHER 0x03 - -/* - * Various libusb API related stuff - */ - -#define USB_ENDPOINT_IN 0x80 -#define USB_ENDPOINT_OUT 0x00 - -/* Error codes */ -#define USB_ERROR_BEGIN 500000 - -/* - * This is supposed to look weird. This file is generated from autoconf - * and I didn't want to make this too complicated. - */ -#define USB_LE16_TO_CPU(x) - -/* Data types */ -/* struct usb_device; */ -/* struct usb_bus; */ - -struct usb_device { - struct usb_device *next, *prev; - - char filename[LIBUSB_PATH_MAX]; - - struct usb_bus *bus; - - struct usb_device_descriptor descriptor; - struct usb_config_descriptor *config; - - void *dev; /* Darwin support */ - - unsigned char devnum; - - unsigned char num_children; - struct usb_device **children; -}; - -struct usb_bus { - struct usb_bus *next, *prev; - - char dirname[LIBUSB_PATH_MAX]; - - struct usb_device *devices; - unsigned long location; - - struct usb_device *root_dev; -}; - -/* Version information, Windows specific */ -struct usb_version { - struct { - int major; - int minor; - int micro; - int nano; - } dll; - struct { - int major; - int minor; - int micro; - int nano; - } driver; -}; - - -struct usb_dev_handle; -typedef struct usb_dev_handle usb_dev_handle; - -/* Variables */ -#ifndef __USB_C__ -#define usb_busses usb_get_busses() -#endif - - - -#include <poppack.h> - - -#ifdef __cplusplus -extern "C" { -#endif - - /* Function prototypes */ - - /* usb.c */ - usb_dev_handle *usb_open(struct usb_device *dev); - int usb_close(usb_dev_handle *dev); - int usb_get_string(usb_dev_handle *dev, int index, int langid, char *buf, - size_t buflen); - int usb_get_string_simple(usb_dev_handle *dev, int index, char *buf, - size_t buflen); - - /* descriptors.c */ - int usb_get_descriptor_by_endpoint(usb_dev_handle *udev, int ep, - unsigned char type, unsigned char index, - void *buf, int size); - int usb_get_descriptor(usb_dev_handle *udev, unsigned char type, - unsigned char index, void *buf, int size); - - /* <arch>.c */ - int usb_bulk_write(usb_dev_handle *dev, int ep, char *bytes, int size, - int timeout); - int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size, - int timeout); - int usb_interrupt_write(usb_dev_handle *dev, int ep, char *bytes, int size, - int timeout); - int usb_interrupt_read(usb_dev_handle *dev, int ep, char *bytes, int size, - int timeout); - int usb_control_msg(usb_dev_handle *dev, int requesttype, int request, - int value, int index, char *bytes, int size, - int timeout); - int usb_set_configuration(usb_dev_handle *dev, int configuration); - int usb_claim_interface(usb_dev_handle *dev, int interface); - int usb_release_interface(usb_dev_handle *dev, int interface); - int usb_set_altinterface(usb_dev_handle *dev, int alternate); - int usb_resetep(usb_dev_handle *dev, unsigned int ep); - int usb_clear_halt(usb_dev_handle *dev, unsigned int ep); - int usb_reset(usb_dev_handle *dev); - - char *usb_strerror(void); - - void usb_init(void); - void usb_set_debug(int level); - int usb_find_busses(void); - int usb_find_devices(void); - struct usb_device *usb_device(usb_dev_handle *dev); - struct usb_bus *usb_get_busses(void); - - - /* Windows specific functions */ - - #define LIBUSB_HAS_INSTALL_SERVICE_NP 1 - int usb_install_service_np(void); - void CALLBACK usb_install_service_np_rundll(HWND wnd, HINSTANCE instance, - LPSTR cmd_line, int cmd_show); - - #define LIBUSB_HAS_UNINSTALL_SERVICE_NP 1 - int usb_uninstall_service_np(void); - void CALLBACK usb_uninstall_service_np_rundll(HWND wnd, HINSTANCE instance, - LPSTR cmd_line, int cmd_show); - - #define LIBUSB_HAS_INSTALL_DRIVER_NP 1 - int usb_install_driver_np(const char *inf_file); - void CALLBACK usb_install_driver_np_rundll(HWND wnd, HINSTANCE instance, - LPSTR cmd_line, int cmd_show); - - #define LIBUSB_HAS_TOUCH_INF_FILE_NP 1 - int usb_touch_inf_file_np(const char *inf_file); - void CALLBACK usb_touch_inf_file_np_rundll(HWND wnd, HINSTANCE instance, - LPSTR cmd_line, int cmd_show); - - #define LIBUSB_HAS_INSTALL_NEEDS_RESTART_NP 1 - int usb_install_needs_restart_np(void); - - const struct usb_version *usb_get_version(void); - - int usb_isochronous_setup_async(usb_dev_handle *dev, void **context, - unsigned char ep, int pktsize); - int usb_bulk_setup_async(usb_dev_handle *dev, void **context, - unsigned char ep); - int usb_interrupt_setup_async(usb_dev_handle *dev, void **context, - unsigned char ep); - - int usb_submit_async(void *context, char *bytes, int size); - int usb_reap_async(void *context, int timeout); - int usb_reap_async_nocancel(void *context, int timeout); - int usb_cancel_async(void *context); - int usb_free_async(void **context); - - -#ifdef __cplusplus -} -#endif - -#endif /* __USB_H__ */ - Modified: software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile 2008-05-02 11:42:33 UTC (rev 1075) +++ software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile 2008-05-02 12:21:13 UTC (rev 1076) @@ -12,7 +12,7 @@ C_PREPROC = CFLAGS = -pipe -std=gnu99 -DUSB_DEBUG0 -DSHOW_EVENTS -DNO_MOTORS_CHECK -DNO_THREAD -Wall -g0 -O2 -fPIC LIB_DIRS = -LIBS = -lusb -lgthread-2.0 -lm +LIBS = -lgthread-2.0 -lm LDFLAGS = -pipe -shared SRC_OBJS = \ @@ -22,6 +22,7 @@ $(OBJ_DIR)/tux_error.o \ $(OBJ_DIR)/tux_eyes.o \ $(OBJ_DIR)/tux_firmware.o \ + $(OBJ_DIR)/tux_hid_unix.o \ $(OBJ_DIR)/tux_hw_status.o \ $(OBJ_DIR)/tux_id.o \ $(OBJ_DIR)/tux_leds.o \ @@ -153,6 +154,11 @@ ../src/tux_hw_status.h \ ../src/tux_sw_status.h $(compile_source) + +$(OBJ_DIR)/tux_hid_unix.o: ../src/tux_hid_unix.c \ +../src/tux_misc.h \ +../src/tux_hid_unix.h + $(compile_source) $(OBJ_DIR)/tux_hw_status.o: ../src/tux_hw_status.c \ ../src/tux_hw_status.h \ @@ -279,7 +285,6 @@ $(compile_source) $(OBJ_DIR)/tux_usb.o: ../src/tux_usb.c \ -../src/usb.h \ ../src/tux_usb.h \ ../src/tux_misc.h \ ../src/tux_error.h \ Modified: software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile 2008-05-02 11:42:33 UTC (rev 1075) +++ software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile 2008-05-02 12:21:13 UTC (rev 1076) @@ -8,14 +8,14 @@ OBJ_DIR = ..\obj OUTPUT_DIR = ..\win32 TARGET = tux_driver.dll -C_INCLUDE_DIRS = +C_INCLUDE_DIRS = -I"E:\MinGWStudio\MinGW\include\ddk" C_PREPROC = CFLAGS = -pipe -Wall -g2 -O0 RC_INCLUDE_DIRS = RC_PREPROC = RCFLAGS = LIB_DIRS = -L"../libs" -LIBS = -llibusb -lwinmm +LIBS = -lwinmm -lhid -lsetupapi -lhidparse LDFLAGS = -pipe -shared -Wl,--output-def,"$(OBJ_DIR)\driver_dll.def",--out-implib,"$(OBJ_DIR)\libdriver_dll.dll.a" ifeq ($(OS),Windows_NT) @@ -31,6 +31,7 @@ $(OBJ_DIR)/tux_error.o \ $(OBJ_DIR)/tux_eyes.o \ $(OBJ_DIR)/tux_firmware.o \ + $(OBJ_DIR)/tux_hid_win32.o \ $(OBJ_DIR)/tux_hw_status.o \ $(OBJ_DIR)/tux_id.o \ $(OBJ_DIR)/tux_leds.o \ @@ -163,6 +164,11 @@ ../src/tux_hw_status.h \ ../src/tux_sw_status.h $(compile_source) + +$(OBJ_DIR)/tux_hid_win32.o: ../src/tux_hid_win32.c \ +../src/tux_hid_win32.h \ +../src/tux_misc.h + $(compile_source) $(OBJ_DIR)/tux_hw_status.o: ../src/tux_hw_status.c \ ../src/tux_hw_status.h \ @@ -289,7 +295,6 @@ $(compile_source) $(OBJ_DIR)/tux_usb.o: ../src/tux_usb.c \ -../src/usb.h \ ../src/tux_usb.h \ ../src/tux_misc.h \ ../src/tux_error.h \ |
From: eFfeM <c2m...@c2...> - 2008-05-02 11:42:28
|
Author: eFfeM Date: 2008-05-02 13:42:33 +0200 (Fri, 02 May 2008) New Revision: 1075 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c Log: changed a float into int Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c 2008-05-02 11:32:19 UTC (rev 1074) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c 2008-05-02 11:42:33 UTC (rev 1075) @@ -187,7 +187,7 @@ static bool config_fading(leds_t leds, float fading_delay) { - float loops = fading_delay / FW_MAIN_LOOP_DELAY; + int loops = fading_delay / FW_MAIN_LOOP_DELAY; unsigned char frame[TUX_SEND_LENGTH - 1] = {0, 0, 0, 0}; /* Can't go infinitely fast. */ |
From: eFfeM <c2m...@c2...> - 2008-05-02 11:32:16
|
Author: eFfeM Date: 2008-05-02 13:32:19 +0200 (Fri, 02 May 2008) New Revision: 1074 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c Log: final batch of const additions, again with some other small changes Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c 2008-05-02 11:29:33 UTC (rev 1073) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c 2008-05-02 11:32:19 UTC (rev 1074) @@ -47,7 +47,7 @@ static simple_callback_t dongle_connected_funct; static simple_callback_t dongle_disconnected_funct; -static void on_frame(unsigned char *data); +static void on_frame(const unsigned char *data); static void on_rf_state(unsigned char state); static void on_usb_connect(void); static void on_usb_disconnect(void); @@ -94,7 +94,7 @@ * @param data 4 bytes array of status. */ static void -on_frame(unsigned char *data) +on_frame(const unsigned char *data) { unsigned char header; int ret; @@ -275,7 +275,7 @@ * */ LIBEXPORT TuxDrvError -TuxDrv_PerformCommand(double delay, char *cmd_str) +TuxDrv_PerformCommand(double delay, const char *cmd_str) { if (delay == 0.0) { @@ -302,7 +302,7 @@ * */ LIBEXPORT TuxDrvError -TuxDrv_PerformMacroFile(char *file_path) +TuxDrv_PerformMacroFile(const char *file_path) { return tux_cmd_parser_parse_file(file_path); } @@ -311,7 +311,7 @@ * */ LIBEXPORT TuxDrvError -TuxDrv_PerformMacroText(char *macro) +TuxDrv_PerformMacroText(const char *macro) { return tux_cmd_parser_parse_macro(macro); } @@ -320,7 +320,7 @@ * */ LIBEXPORT TuxDrvError -TuxDrv_SoundReflash(char *tracks) +TuxDrv_SoundReflash(const char *tracks) { return tux_sound_flash_cmd_reflash(tracks); } @@ -365,7 +365,7 @@ * */ LIBEXPORT TuxDrvError -TuxDrv_GetStatusId(char *name, int *id) +TuxDrv_GetStatusId(const char *name, int *id) { return tux_sw_status_id_from_name(name, id); } Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-05-02 11:29:33 UTC (rev 1073) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-05-02 11:32:19 UTC (rev 1074) @@ -502,12 +502,12 @@ int i, j; int rf_state; int packet_count; - char *data_buf; - char packet_data[4]; + unsigned char *data_buf; + unsigned char packet_data[4]; rf_state = data[1]; packet_count = data[3]; - data_buf = (char *)data; + data_buf = (unsigned char *)data; data_buf += 4; if (last_knowed_rf_state != rf_state) @@ -529,13 +529,13 @@ { for (j = 0; j < 4; j++) { - packet_data[j] = (unsigned char)data_buf[j]; + packet_data[j] = data_buf[j]; } #ifdef USE_MUTEX mutex_lock(__callback_mutex); #endif if (frame_callback_function) - frame_callback_function((unsigned char*)packet_data); + frame_callback_function(packet_data); #ifdef USE_MUTEX mutex_unlock(__callback_mutex); #endif Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h 2008-05-02 11:29:33 UTC (rev 1073) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h 2008-05-02 11:32:19 UTC (rev 1074) @@ -65,7 +65,7 @@ * Callback function for the frame receiving event * @param data A pointer to the frame */ -typedef void(*frame_callback_t)(unsigned char *data); +typedef void(*frame_callback_t)(const unsigned char *data); /** * Callback function prototype for the RF state event Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c 2008-05-02 11:29:33 UTC (rev 1073) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c 2008-05-02 11:32:19 UTC (rev 1074) @@ -206,7 +206,7 @@ LIBLOCAL void tux_user_inputs_update_RC5(void) { - char *code_str = ""; + const char *code_str = ""; if (rc5_on_receiving) { |
From: remi <c2m...@c2...> - 2008-05-02 11:29:30
|
Author: remi Date: 2008-05-02 13:29:33 +0200 (Fri, 02 May 2008) New Revision: 1073 Modified: software_suite_v2/middleware/tuxdriver/branches/hid_transition/unix/Makefile Log: removed "usb.h" (libusb win32) dependency from the unix makefile. Modified: software_suite_v2/middleware/tuxdriver/branches/hid_transition/unix/Makefile =================================================================== --- software_suite_v2/middleware/tuxdriver/branches/hid_transition/unix/Makefile 2008-05-02 11:26:39 UTC (rev 1072) +++ software_suite_v2/middleware/tuxdriver/branches/hid_transition/unix/Makefile 2008-05-02 11:29:33 UTC (rev 1073) @@ -285,7 +285,6 @@ $(compile_source) $(OBJ_DIR)/tux_usb.o: ../src/tux_usb.c \ -../src/usb.h \ ../src/tux_usb.h \ ../src/tux_misc.h \ ../src/tux_error.h \ |
From: remi <c2m...@c2...> - 2008-05-02 11:26:37
|
Author: remi Date: 2008-05-02 13:26:39 +0200 (Fri, 02 May 2008) New Revision: 1072 Modified: software_suite_v2/middleware/tuxdriver/branches/hid_transition/src/tux_misc.c Log: added 64 bit compatibility for the "get_time" function. Modified: software_suite_v2/middleware/tuxdriver/branches/hid_transition/src/tux_misc.c =================================================================== --- software_suite_v2/middleware/tuxdriver/branches/hid_transition/src/tux_misc.c 2008-05-02 11:22:59 UTC (rev 1071) +++ software_suite_v2/middleware/tuxdriver/branches/hid_transition/src/tux_misc.c 2008-05-02 11:26:39 UTC (rev 1072) @@ -93,7 +93,7 @@ struct timezone tz; gettimeofday(&tv, &tz); - result = ((float)tv.tv_usec / 1000000) + (float)tv.tv_sec; + result = ((double)tv.tv_usec / 1000000.0) + (double)tv.tv_sec; return result; } |
From: eFfeM <c2m...@c2...> - 2008-05-02 11:23:20
|
Author: eFfeM Date: 2008-05-02 13:22:59 +0200 (Fri, 02 May 2008) New Revision: 1071 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c Log: more const added, some small optimisations Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c 2008-05-02 10:29:05 UTC (rev 1070) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c 2008-05-02 11:22:59 UTC (rev 1071) @@ -99,7 +99,7 @@ } LIBLOCAL bool -str_to_uint8(char *str, unsigned char *dest) +str_to_uint8(const char *str, unsigned char *dest) { int r, val; @@ -118,7 +118,7 @@ } LIBLOCAL bool -str_to_int8(char *str, char *dest) +str_to_int8(const char *str, char *dest) { int r, val; @@ -137,7 +137,7 @@ } LIBLOCAL bool -str_to_int(char *str, int *dest) +str_to_int(const char *str, int *dest) { int r, val; @@ -153,7 +153,7 @@ } LIBLOCAL bool -str_to_bool(char *str, bool *dest) +str_to_bool(const char *str, bool *dest) { if (!strcmp(str, "True")) { @@ -173,7 +173,7 @@ } LIBLOCAL bool -str_to_float(char *str, float *dest) +str_to_float(const char *str, float *dest) { int r; float val; @@ -190,7 +190,7 @@ } LIBLOCAL bool -hex_to_uint8(char *str, unsigned char *dest) +hex_to_uint8(const char *str, unsigned char *dest) { int r; int val; Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.h 2008-05-02 10:29:05 UTC (rev 1070) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.h 2008-05-02 11:22:59 UTC (rev 1071) @@ -45,11 +45,11 @@ typedef void(*simple_callback_t)(void); extern double get_time(void); -extern bool str_to_uint8(char *str, unsigned char *dest); -extern bool str_to_int8(char *str, char *dest); -extern bool str_to_int(char *str, int *dest); -extern bool str_to_bool(char *str, bool *dest); -extern bool str_to_float(char *str, float *dest); -extern bool hex_to_uint8(char *str, unsigned char *dest); +extern bool str_to_uint8(const char *str, unsigned char *dest); +extern bool str_to_int8(const char *str, char *dest); +extern bool str_to_int(const char *str, int *dest); +extern bool str_to_bool(const char *str, bool *dest); +extern bool str_to_float(const char *str, float *dest); +extern bool hex_to_uint8(const char *str, unsigned char *dest); #endif /* _TUX_MISC_H_ */ Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c 2008-05-02 10:29:05 UTC (rev 1070) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c 2008-05-02 11:22:59 UTC (rev 1071) @@ -70,7 +70,7 @@ static void load_knowed_track_num(void); static void init_reflash_info(void); -static bool play_wav(char *wav_path); +static bool play_wav(const char *wav_path); /** * Init the sound flash descriptor part. @@ -373,7 +373,7 @@ (DWORD)&po, (DWORD)&pf); if (err == 0) { - *(int *)idx = po; + *idx = po; return true; } @@ -407,7 +407,7 @@ * */ static bool -get_idx_playback_from_name(int *idx, char *name) +get_idx_playback_from_name(int *idx, const char *name) { int i; WAVEOUTCAPSA wa_device; @@ -486,7 +486,7 @@ * */ static bool -play_wav(char *wav_path) +play_wav(const char *wav_path) { bool ret = true; @@ -549,7 +549,7 @@ * */ static int -parse_wavs(char *src_str, tokens_t *toks) +parse_wavs(const char *src_str, tokens_t *toks) { return tux_cmd_parser_get_tokens(src_str, toks, 256, "|"); } @@ -558,7 +558,7 @@ * */ LIBLOCAL TuxDrvError -tux_sound_flash_cmd_reflash(char *tracks) +tux_sound_flash_cmd_reflash(const char *tracks) { FILE *fp; int i; Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.h 2008-05-02 10:29:05 UTC (rev 1070) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.h 2008-05-02 11:22:59 UTC (rev 1071) @@ -47,6 +47,6 @@ extern bool tux_sound_flash_check_new_descriptor(bool save); extern bool tux_sound_flash_cmd_play(unsigned char track_num, float volume); extern void tux_sound_flash_state_machine_call(void); -extern TuxDrvError tux_sound_flash_cmd_reflash(char *tracks); +extern TuxDrvError tux_sound_flash_cmd_reflash(const char *tracks); #endif /* _TUX_SOUND_FLASH_H_ */ Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c 2008-05-02 10:29:05 UTC (rev 1070) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c 2008-05-02 11:22:59 UTC (rev 1071) @@ -84,7 +84,8 @@ * */ static void -init_status_struct(int id, int value_fmt, char *name, char *value_doc) +init_status_struct(int id, int value_fmt, const char *name, + const char *value_doc) { if ((id < 0) || (id >= SW_STATUS_NUMBER)) { @@ -294,7 +295,7 @@ * */ LIBLOCAL TuxDrvError -tux_sw_status_id_from_name(char *name, int *id) +tux_sw_status_id_from_name(const char *name, int *id) { int i = -1; @@ -322,7 +323,7 @@ /** * */ -LIBLOCAL char * +LIBLOCAL const char * tux_sw_status_value_fmt_from_id(int id) { switch (id) { @@ -395,7 +396,7 @@ LIBLOCAL TuxDrvError tux_sw_status_get_state_str(int id, char *state) { - char *fmt_str = ""; + const char *fmt_str; char name_str[128] = ""; char value_str[128] = ""; TuxDrvError err; @@ -469,7 +470,7 @@ * */ LIBLOCAL void -tux_sw_status_set_value(int id, void *value, bool make_event) +tux_sw_status_set_value(int id, const void *value, bool make_event) { char state_str[1024] = ""; Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.h 2008-05-02 10:29:05 UTC (rev 1070) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.h 2008-05-02 11:22:59 UTC (rev 1071) @@ -121,11 +121,11 @@ extern sw_status_table_t sw_status_table; extern void tux_sw_status_init(void); -extern void tux_sw_status_set_value(int id, void *value, bool make_event); +extern void tux_sw_status_set_value(int id, const void *value, bool make_event); extern void *tux_sw_status_get_value(int id); extern TuxDrvError tux_sw_status_name_from_id(int id, char* name); -extern TuxDrvError tux_sw_status_id_from_name(char* name, int *id); -extern char *tux_sw_status_value_fmt_from_id(int id); +extern TuxDrvError tux_sw_status_id_from_name(const char* name, int *id); +extern const char *tux_sw_status_value_fmt_from_id(int id); extern TuxDrvError tux_sw_status_get_state_str(int id, char *state); extern TuxDrvError tux_sw_status_get_value_str(int id, char *value); extern void tux_sw_status_get_all_state_str(char *state); Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-05-02 10:29:05 UTC (rev 1070) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-05-02 11:22:59 UTC (rev 1071) @@ -59,7 +59,7 @@ static struct usb_dev_handle *usb_open_TuxDroid(struct usb_device *tux_dev); static int usb_write_TuxDroid(const void *buf, int size); static int usb_read_TuxDroid(char *buf); -static void print_usb_debug(char *str); +static void print_usb_debug(const char *str); static void set_read_loop_started(bool value); static bool get_read_loop_started(void); @@ -69,7 +69,7 @@ * */ static void -print_usb_debug(char *str) +print_usb_debug(const char *str) { log_debug("USB debug : %s\n", str); } Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c 2008-05-02 10:29:05 UTC (rev 1070) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c 2008-05-02 11:22:59 UTC (rev 1071) @@ -101,7 +101,7 @@ /** * */ -static char * +static const char * RC5_code_to_str(int code) { switch (code) { |
From: eFfeM <c2m...@c2...> - 2008-05-02 10:29:02
|
Author: eFfeM Date: 2008-05-02 12:29:05 +0200 (Fri, 02 May 2008) New Revision: 1070 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c Log: added const to a lot of function arguments, on the fly did one or two cleanups Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-05-02 10:13:15 UTC (rev 1069) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-05-02 10:29:05 UTC (rev 1070) @@ -72,7 +72,7 @@ * */ static inline bool match_token(tokens_t tokens, int i, int t_num, - char *str, int t_count) + const char *str, int t_count) { return (i >= t_count) && (!strcmp(tokens[t_num], str)); } @@ -106,13 +106,13 @@ * */ LIBLOCAL int -tux_cmd_parser_get_tokens(char *src_str, tokens_t *toks, - int max_tokens, char *delimiters) +tux_cmd_parser_get_tokens(const char *src_str, tokens_t *toks, + int max_tokens, const char *delimiters) { - char *p; /* pointer to the next token */ - char *pnext; /* pointer to the next delimiter */ - int len; /* length of the next token */ - int cnt = 0; /* nr of tokens processed */ + const char *p; /* pointer to the next token */ + const char *pnext; /* pointer to the next delimiter */ + int len; /* length of the next token */ + int cnt = 0; /* nr of tokens processed */ p = src_str; @@ -129,7 +129,7 @@ if (pnext) { len = pnext - p; - strncpy((*toks)[cnt], p,len); + strncpy((*toks)[cnt], p, len); ((*toks)[cnt])[len] = 0; cnt++; if (cnt >= max_tokens) @@ -154,7 +154,7 @@ * */ static unsigned char -tux_movement_conststr_to_val(char *conststr) +tux_movement_conststr_to_val(const char *conststr) { if (!strcmp(conststr, "VERYLOW")) { @@ -207,7 +207,7 @@ * */ static unsigned char -conststr_to_ledval(char *conststr) +conststr_to_ledval(const char *conststr) { if (!strcmp(conststr, "LED_NONE")) { @@ -232,7 +232,7 @@ * */ static unsigned char -conststr_to_effectval(char *conststr) +conststr_to_effectval(const char *conststr) { if (!strcmp(conststr, "UNAFFECTED")) { @@ -712,7 +712,7 @@ * Parse a command. */ LIBLOCAL TuxDrvError -tux_cmd_parser_parse_command(char *cmd_str) +tux_cmd_parser_parse_command(const char *cmd_str) { tokens_t tokens; int nr_tokens; @@ -780,7 +780,7 @@ * */ static TuxDrvError -insert_cmd(float delay, char *cmd_str, cmd_stack_t *stack) +insert_cmd(float delay, const char *cmd_str, cmd_stack_t *stack) { TuxDrvError ret = E_TUXDRV_STACKOVERFLOW; int i; @@ -803,7 +803,8 @@ * */ LIBLOCAL TuxDrvError -tux_cmd_parser_insert_delay_command(float delay, char *cmd_str, bool sys_cmd) +tux_cmd_parser_insert_delay_command(float delay, const char *cmd_str, + bool sys_cmd) { TuxDrvError ret = E_TUXDRV_STACKOVERFLOW; @@ -912,7 +913,7 @@ * */ static TuxDrvError -parse_line(char *line_str) +parse_line(const char *line_str) { float delay= 0.0; char cmd_str[CMDSIZE] = ""; @@ -933,7 +934,7 @@ * */ LIBLOCAL TuxDrvError -tux_cmd_parser_parse_macro(char *macro_str) +tux_cmd_parser_parse_macro(const char *macro_str) { const char lex_ret[] = "\n"; char *line_tmp; @@ -978,7 +979,7 @@ * */ LIBLOCAL TuxDrvError -tux_cmd_parser_parse_file(char *file_path) +tux_cmd_parser_parse_file(const char *file_path) { char line[CMDSIZE] = ""; FILE *macro_file; Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.h 2008-05-02 10:13:15 UTC (rev 1069) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.h 2008-05-02 10:29:05 UTC (rev 1070) @@ -33,14 +33,14 @@ extern void tux_cmd_parser_init(void); extern void tux_cmd_parser_set_enable(bool value); -extern int tux_cmd_parser_get_tokens(char *src_str, tokens_t *toks, - int max_tokens, char *delimiters); -extern TuxDrvError tux_cmd_parser_parse_command(char *cmd_str); +extern int tux_cmd_parser_get_tokens(const char *src_str, tokens_t *toks, + int max_tokens, const char *delimiters); +extern TuxDrvError tux_cmd_parser_parse_command(const char *cmd_str); extern bool tux_cmd_parser_clear_delay_commands(void); extern TuxDrvError tux_cmd_parser_insert_delay_command(float delay, - char *cmd_str, bool sys_cmd); + const char *cmd_str, bool sys_cmd); extern void tux_cmd_parser_delay_stack_perform(void); -extern TuxDrvError tux_cmd_parser_parse_macro(char *macro_str); -extern TuxDrvError tux_cmd_parser_parse_file(char *file_path); +extern TuxDrvError tux_cmd_parser_parse_macro(const char *macro_str); +extern TuxDrvError tux_cmd_parser_parse_file(const char *file_path); #endif /* _TUX_CMD_PARSER_H_ */ Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c 2008-05-02 10:13:15 UTC (rev 1069) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c 2008-05-02 10:29:05 UTC (rev 1070) @@ -53,7 +53,7 @@ * @param id cpu identifier. * @return a string. */ -static char * +static const char * cpu_id_to_name(int id) { switch (id) @@ -81,7 +81,7 @@ { #ifdef LOCK_TUX FILE *f; - char ret_str[3] = "\n"; + char ret_str[] = "\n"; char *ret_c; f = fopen("./symbolic_versions", "r"); @@ -90,23 +90,23 @@ fgets(knowed_tuxcore_symbolic_version, sizeof(knowed_tuxcore_symbolic_version)-2, f); ret_c = strstr(knowed_tuxcore_symbolic_version, ret_str); - *(char *)ret_c = '\0'; + *ret_c = '\0'; fgets(knowed_tuxaudio_symbolic_version, sizeof(knowed_tuxaudio_symbolic_version)-2, f); ret_c = strstr(knowed_tuxaudio_symbolic_version, ret_str); - *(char *)ret_c = '\0'; + *ret_c = '\0'; fgets(knowed_fuxusb_symbolic_version, sizeof(knowed_fuxusb_symbolic_version)-2, f); ret_c = strstr(knowed_fuxusb_symbolic_version, ret_str); - *(char *)ret_c = '\0'; + *ret_c = '\0'; fgets(knowed_fuxrf_symbolic_version, sizeof(knowed_fuxrf_symbolic_version)-2, f); ret_c = strstr(knowed_fuxrf_symbolic_version, ret_str); - *(char *)ret_c = '\0'; + *ret_c = '\0'; fgets(knowed_tuxrf_symbolic_version, sizeof(knowed_tuxrf_symbolic_version)-2, f); ret_c = strstr(knowed_tuxrf_symbolic_version, ret_str); - *(char *)ret_c = '\0'; + *ret_c = '\0'; fclose(f); } #endif @@ -187,7 +187,7 @@ * */ static void -dump_descriptor_of_cpu(char *descriptor, firmware_descriptor_t *desc) +dump_descriptor_of_cpu(char *descriptor, const firmware_descriptor_t *desc) { char tmp_str[80] = ""; @@ -403,7 +403,8 @@ * */ static bool -test_fw_ver(firmware_descriptor_t *firmware, int major, int minor, int update) +test_fw_ver(const firmware_descriptor_t *firmware, int major, int minor, + int update) { if ((firmware->version_major != major) || (firmware->version_minor != minor) || |
From: eFfeM <c2m...@c2...> - 2008-05-02 10:13:16
|
Author: eFfeM Date: 2008-05-02 12:13:15 +0200 (Fri, 02 May 2008) New Revision: 1069 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c Log: let the functions that write to dongle and fux use the raw function instead of duplicating it Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-05-02 10:06:55 UTC (rev 1068) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-05-02 10:13:15 UTC (rev 1069) @@ -743,18 +743,16 @@ usb_write_TuxDroid(frame_reset_dongle, TUX_SEND_LENGTH); } -/** - * Send a command to Tuxdroid. - * @param data 4 bytes array +/** + * Send a raw command + * @param data 5 bytes array */ -LIBLOCAL bool -tux_usb_send_to_tux(const unsigned char* data) +LIBLOCAL bool +tux_usb_send_raw(const unsigned char* data) { int ret; - unsigned char frame[TUX_SEND_LENGTH] = {0, data[0], data[1], - data[2], data[3]}; - ret = tux_usb_write(frame); + ret = tux_usb_write(data); usleep(10000); @@ -768,50 +766,28 @@ } } -/** - * Send a command to fux dongle. +/** + * Send a command to Tuxdroid. * @param data 4 bytes array */ -LIBLOCAL bool -tux_usb_send_to_dongle(const unsigned char* data) +LIBLOCAL bool +tux_usb_send_to_tux(const unsigned char* data) { - int ret; - unsigned char frame[TUX_SEND_LENGTH] = {1, data[0], data[1], - data[2], data[3]}; + unsigned char frame[TUX_SEND_LENGTH] = {0, data[0], data[1], + data[2], data[3]}; - ret = tux_usb_write(frame); - - usleep(10000); - - if (ret != TuxUSBNoError) - { - return false; - } - else - { - return true; - } + return tux_usb_send_raw(frame); } /** - * Send a raw command to fux dongle. + * Send a command to fux dongle. * @param data 4 bytes array */ LIBLOCAL bool -tux_usb_send_raw(const unsigned char* data) +tux_usb_send_to_dongle(const unsigned char* data) { - int ret; + unsigned char frame[TUX_SEND_LENGTH] = {1, data[0], data[1], + data[2], data[3]}; - ret = tux_usb_write(data); - - usleep(10000); - - if (ret != TuxUSBNoError) - { - return false; - } - else - { - return true; - } + return tux_usb_send_raw(frame); } |
From: eFfeM <c2m...@c2...> - 2008-05-02 10:06:50
|
Author: eFfeM Date: 2008-05-02 12:06:55 +0200 (Fri, 02 May 2008) New Revision: 1068 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c Log: cleanup up; some small optimisations Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-05-02 09:58:21 UTC (rev 1067) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-05-02 10:06:55 UTC (rev 1068) @@ -44,10 +44,10 @@ #define NRCMDS 256 -#define check_result(funct_res) if (funct_res) \ - return E_TUXDRV_NOERROR; \ - else \ - return E_TUXDRV_INVALIDPARAMETER; +#define check_result(funct_res) if (funct_res) \ + return E_TUXDRV_NOERROR; \ + else \ + return E_TUXDRV_INVALIDPARAMETER; typedef struct { double timeout; @@ -109,10 +109,10 @@ tux_cmd_parser_get_tokens(char *src_str, tokens_t *toks, int max_tokens, char *delimiters) { - char *p; - char *pnext; - int len; - int cnt = 0; + char *p; /* pointer to the next token */ + char *pnext; /* pointer to the next delimiter */ + int len; /* length of the next token */ + int cnt = 0; /* nr of tokens processed */ p = src_str; @@ -124,6 +124,7 @@ { while (1) { + /* get the next delimiter */ pnext = strpbrk(p, delimiters); if (pnext) { @@ -138,6 +139,7 @@ } else { + /* no next delimiter, so copy all the remaining strings */ strcpy((*toks)[cnt], p); cnt++; break; @@ -275,27 +277,15 @@ { unsigned char data[TUX_SEND_LENGTH] = {0, 0, 0, 0, 0}; int r = 0; - - if (hex_to_uint8(tokens[0], &data[0])) + int i; + + for (i = 0; i < TUX_SEND_LENGTH; i++) { - r++; + if (hex_to_uint8(tokens[i], &data[i])) + { + r++; + } } - if (hex_to_uint8(tokens[1], &data[1])) - { - r++; - } - if (hex_to_uint8(tokens[2], &data[2])) - { - r++; - } - if (hex_to_uint8(tokens[3], &data[3])) - { - r++; - } - if (hex_to_uint8(tokens[4], &data[4])) - { - r++; - } if (r < TUX_SEND_LENGTH) { @@ -851,16 +841,20 @@ /* Clear user cmd */ memset(&user_cmd_stack, 0, sizeof(cmd_stack_t)); - /* Clear system cmd */ + /* process all pending system commands */ for (i = 0; i < NRCMDS; i++) { if (strcmp(sys_cmd_stack.cmd_list[i].cmd, "")) { tux_cmd_parser_parse_command(sys_cmd_stack.cmd_list[i].cmd); - memset(&sys_cmd_stack.cmd_list[i], 0, sizeof(delay_cmd_t)); + /* no need to execute the following command as we are going + to clear the complete stack after this for loop + memset(&sys_cmd_stack.cmd_list[i], 0, sizeof(delay_cmd_t)); + */ } } + /* Clear system cmd */ memset(&sys_cmd_stack, 0, sizeof(cmd_stack_t)); #ifdef USE_MUTEX @@ -890,7 +884,12 @@ if (curtime >= user_cmd_stack.cmd_list[i].timeout) { tux_cmd_parser_parse_command(user_cmd_stack.cmd_list[i].cmd); - memset(&user_cmd_stack.cmd_list[i], 0, sizeof(delay_cmd_t)); + /* next two commands are faster than a memset + writing a null byte to the first char of cmd is sufficient + to make it an empty string + */ + user_cmd_stack.cmd_list[i].timeout = 0; + user_cmd_stack.cmd_list[i].cmd[0] = 0; } } if (strcmp(sys_cmd_stack.cmd_list[i].cmd, "")) @@ -898,7 +897,8 @@ if (curtime >= sys_cmd_stack.cmd_list[i].timeout) { tux_cmd_parser_parse_command(sys_cmd_stack.cmd_list[i].cmd); - memset(&sys_cmd_stack.cmd_list[i], 0, sizeof(delay_cmd_t)); + sys_cmd_stack.cmd_list[i].timeout = 0; + sys_cmd_stack.cmd_list[i].cmd[0] = 0; } } } @@ -937,21 +937,24 @@ { const char lex_ret[] = "\n"; char *line_tmp; - char macro[8192]; - TuxDrvError ret; - TuxDrvError result = E_TUXDRV_NOERROR; + char macro[CMDSIZE]; + TuxDrvError ret = E_TUXDRV_NOERROR; #ifdef USE_MUTEX mutex_lock(__macro_mutex); #endif + /* + strtok is used, this modifies the string, hence the copy + if it is ok to write 0 bytes into the argument no copy is needed + */ strcpy(macro, macro_str); if ((line_tmp = strtok(macro, lex_ret)) != NULL) { ret = parse_line(line_tmp); if (ret != E_TUXDRV_NOERROR) { - result = ret; + return(ret); } while ((line_tmp = strtok(NULL, lex_ret)) != NULL) @@ -959,7 +962,6 @@ ret = parse_line(line_tmp); if (ret != E_TUXDRV_NOERROR) { - result = ret; break; } } @@ -969,7 +971,7 @@ mutex_unlock(__macro_mutex); #endif - return result; + return ret; } /** @@ -980,8 +982,7 @@ { char line[CMDSIZE] = ""; FILE *macro_file; - TuxDrvError ret; - TuxDrvError result = E_TUXDRV_NOERROR; + TuxDrvError ret = E_TUXDRV_NOERROR; #ifdef USE_MUTEX mutex_lock(__macro_mutex); @@ -996,19 +997,19 @@ ret = parse_line(line); if (ret != E_TUXDRV_NOERROR) { - result = ret; + break; } } fclose(macro_file); } else { - result = E_TUXDRV_FILEERROR; + ret = E_TUXDRV_FILEERROR; } #ifdef USE_MUTEX mutex_unlock(__macro_mutex); #endif - return result; + return ret; } |
From: Paul_R <c2m...@c2...> - 2008-05-02 09:58:18
|
Author: Paul_R Date: 2008-05-02 11:58:21 +0200 (Fri, 02 May 2008) New Revision: 1067 Removed: firmware/fuxusb/branches/0.3/lib_mcu/fa-usb/flash_api.bak firmware/fuxusb/branches/0.3/modules/fifo_stt/fifo_stt.bak firmware/fuxusb/branches/0.3/modules/timer_soft/timer_soft.gif Log: * Removed .bak and .gif files Deleted: firmware/fuxusb/branches/0.3/lib_mcu/fa-usb/flash_api.bak =================================================================== --- firmware/fuxusb/branches/0.3/lib_mcu/fa-usb/flash_api.bak 2008-05-02 09:42:15 UTC (rev 1066) +++ firmware/fuxusb/branches/0.3/lib_mcu/fa-usb/flash_api.bak 2008-05-02 09:58:21 UTC (rev 1067) @@ -1,222 +0,0 @@ -/*H************************************************************************** -* NAME: flash_api.h -*---------------------------------------------------------------------------- -* Copyright (c) 2003 Atmel. -*---------------------------------------------------------------------------- -* RELEASE: c5131-usb-flash-api-1_0_5 -* REVISION: 1.2 -*---------------------------------------------------------------------------- -* PURPOSE: -*****************************************************************************/ -#ifndef _FLASH_API_H_ -#define _FLASH_API_H - -/*_____ I N C L U D E S ____________________________________________________*/ - -/*_____ M A C R O S ________________________________________________________*/ - -/* -* These constants are used to compiled or not the corresponding function -* -* #define __API_RD_DEVICE_DATA => function __api_rd_device_data compiled -* #undef __API_RD_HSB => function __api_rd_HSB not compiled -*/ - -#undef __API_RD_CODE_BYTE -#undef __API_WR_CODE_BYTE -#undef __API_WR_CODE_PAGE -#undef __API_WR_CODE_PAGE_FIX -#undef __API_ERASE_BLOCK - -#define __API_RD_BOOT_VERSION -#define __API_RD_BSB -#define __API_RD_SBV -#define __API_RD_EB -#define __API_RD_DEVICE_DATA -#define __API_RD_DEVICE_ID1 -#define __API_RD_DEVICE_ID2 -#define __API_RD_DEVICE_ID3 -#define __API_RD_HSB -#define __API_RD_MANUFACTURER -#define __API_RD_SSB - - -#define __API_WR_BSB -#define __API_WR_SBV -#define __API_WR_SSB -#define __API_WR_EB - - -#define __API_ERASE_SBV - -#define __API_SET_X2 -#define __API_CLR_X2 -#define __API_SET_BLJB -#define __API_CLR_BLJB - -#undef __API_EEPROM_BUSY -#undef __API_RD_EEPROM_BYTE -#undef __API_WR_EEPROM_BYTE - -#define __API_START_BOOTLOADER -#define __API_START_ISP - - -// Constante value for api_command. -#define _COMMAND_ER_BLOCK 0 -#define _COMMAND_WR_CODE_BYTE 13 -#define _COMMAND_WR_CODE_PAGE 13 -#define _COMMAND_WR_XAF 4 -#define _COMMAND_RD_XAF 5 -#define _COMMAND_WR_FUSE_BIT 7 -#define _COMMAND_RD_HW 8 -#define _COMMAND_RD_SPECIAL 14 - -#define MSK_CMOD_WDTE 0x40 - -/*_____ D E F I N I T I O N ________________________________________________*/ - -typedef enum { - NO_SECURITY = 0xFF, - WR_SECURITY = 0xFE, - RD_WR_SECURITY = 0xFC - } ssb_t; - -typedef enum { - BLOCK_0 = 0x00, - BLOCK_1 = 0x20, - BLOCK_2 = 0x40, - BLOCK_3 = 0x80, - BLOCK_4 = 0xC0 } block_t; - -typedef enum { - EEPROM_NOT_BUSY, - EEPROM_BUSY }eeprom_t; - - -/*_____ D E C L A R A T I O N ______________________________________________*/ - - - -extern Uchar __api_rd_generic (Uchar command, Uchar dpl); -extern Uchar __api_wr_generic (Uchar command, Uchar value, Uchar dpl); -extern Uchar __api_wr_fuse (Uchar mask, Uchar filter); - - -/*---- API for Read access ------------------------------------------------*/ -/****************************************************************************/ -#ifdef __API_RD_BSB - #define __api_rd_BSB() __api_rd_generic(_COMMAND_RD_XAF, 0x00) -#endif - -#ifdef __API_RD_SBV - #define __api_rd_SBV() __api_rd_generic(_COMMAND_RD_XAF, 0x01) -#endif - -#ifdef __API_RD_SSB - #define __api_rd_SSB() __api_rd_generic(_COMMAND_RD_XAF, 0x05) -#endif - -#ifdef __API_RD_EB - #define __api_rd_EB() __api_rd_generic(_COMMAND_RD_XAF, 0x06) -#endif - -#ifdef __API_RD_HSB - #define __api_rd_HSB() __api_rd_generic(_COMMAND_RD_HW, 0x00) -#endif - -#ifdef __API_RD_MANUFACTURER - #define __api_rd_manufacturer() __api_rd_generic(_COMMAND_RD_XAF, 0x30) -#endif - -#ifdef __API_RD_DEVICE_ID1 - #define __api_rd_device_id1() __api_rd_generic(_COMMAND_RD_XAF, 0x31) -#endif - -#ifdef __API_RD_DEVICE_ID2 - #define __api_rd_device_id2() __api_rd_generic(_COMMAND_RD_XAF, 0x60) -#endif - -#ifdef __API_RD_DEVICE_ID3 - #define __api_rd_device_id3() __api_rd_generic(_COMMAND_RD_XAF, 0x61) -#endif - -#ifdef __API_RD_BOOT_VERSION - #define __api_rd_bootloader_version() __api_rd_generic(_COMMAND_RD_SPECIAL, 0x00) -#endif - -extern Uchar __api_rd_code_byte (Uchar code * pt_address); - - -/*---- API for Write access -----------------------------------------------*/ -/****************************************************************************/ - -extern Uchar __api_wr_code_byte (Uchar xdata* , Uchar); -extern Uchar __api_wr_code_page (Uchar xdata* pt_code, Uchar xdata* pt_xram, Uchar nb_data); -extern Uchar __api_wr_code_page_fix (Uchar xdata* pt_code, Uchar xdata* pt_xram, Uchar nb_data); - -#ifdef __API_WR_BSB - #define __api_wr_BSB(value) __api_wr_generic(_COMMAND_WR_XAF, value, 0) -#endif - -#ifdef __API_WR_SBV - #define __api_wr_SBV(value) __api_wr_generic(_COMMAND_WR_XAF, value, 1) -#endif - -#ifdef __API_WR_SSB - #define __api_wr_SSB(value) __api_wr_generic(_COMMAND_WR_XAF, value, 5) -#endif - -#ifdef __API_WR_EB - #define __api_wr_EB(value) __api_wr_generic(_COMMAND_WR_XAF, value, 6) -#endif - -#ifdef __API_ERASE_SBV - #define __api_erase_SBV() __api_wr_generic(_COMMAND_WR_XAF, 0xFF, 1) -#endif - -#ifdef __API_SET_X2 - #define __api_set_X2() __api_wr_fuse(0x80, 0x80) -#endif - -#ifdef __API_CLR_X2 - #define __api_clr_X2() __api_wr_fuse(0x80, 0x00) -#endif - -#ifdef __API_SET_BLJB - #define __api_set_BLJB() __api_wr_fuse(0x40, 0x40) -#endif - -#ifdef __API_CLR_BLJB - #define __api_clr_BLJB() __api_wr_fuse(0x40, 0x00) -#endif - -extern Uchar __api_erase_block (block_t); - -/*---- API for EEPROM access ----------------------------------------------*/ -/****************************************************************************/ - -#ifdef __API_EEPROM_BUSY - extern eeprom_t __api_eeprom_busy (void); -#endif - -#ifdef __API_RD_EEPROM_BYTE - extern Uchar __api_rd_eeprom_byte (Uchar xdata *); -#endif - -#ifdef __API_WR_EEPROM_BYTE - extern Uchar __api_wr_eeprom_byte (Uchar xdata *, Uchar); -#endif - -/*---- API to start bootloader execution ----------------------------------*/ -/****************************************************************************/ - -#ifdef __API_START_BOOTLOADER - extern void __api_start_bootloader (void); -#endif - -#ifdef __API_START_ISP - extern void __api_start_isp (void); -#endif - -#endif \ No newline at end of file Deleted: firmware/fuxusb/branches/0.3/modules/fifo_stt/fifo_stt.bak =================================================================== --- firmware/fuxusb/branches/0.3/modules/fifo_stt/fifo_stt.bak 2008-05-02 09:42:15 UTC (rev 1066) +++ firmware/fuxusb/branches/0.3/modules/fifo_stt/fifo_stt.bak 2008-05-02 09:58:21 UTC (rev 1067) @@ -1,99 +0,0 @@ -/*C************************************************************************** -* NAME: fifo_spk.c -*---------------------------------------------------------------------------- -* Copyright (c) 2006 C2me. -*---------------------------------------------------------------------------- -* RELEASE: c5131-usb-RF Dongle -* REVISION: 1.3 -*---------------------------------------------------------------------------- -* PURPOSE: -* -*****************************************************************************/ - -#include "config.h" -#include "fifo_stt.h" -#include "lib_mcu\usb\usb_drv.h" -#include "lib_mcu\uart\uart_lib.h" - -unsigned char FifoTbl_Stt[FIFOTBL_STT_MAX]; - -unsigned char FifoIn_STT_Idx; -unsigned char FifoOut_STT_Idx; - -unsigned char FifoOut_STT_cmpt; - -bit FifoOverLoad_STT = 0; - - -//------------------------------------------------------------------------ -// Fifo_isFull -// -//------------------------------------------------------------------------ -unsigned char FIFO_isFull() -{ - return (FifoOverLoad_STT); - -} - -//------------------------------------------------------------------------ -// void FIFO_Init( void) -// -//------------------------------------------------------------------------ -void FIFO_STT_init (void) -{ - FifoOut_STT_cmpt = 0; - FifoOut_STT_Idx = 0; - FifoIn_STT_Idx = 0; - FifoOverLoad_STT = 0; -} - -//------------------------------------------------------------------------ -// void FIFO_STT_flush( void) -// -//------------------------------------------------------------------------ -void FIFO_STT_flush (void) -{ - FifoOut_STT_cmpt = 0; - FifoOut_STT_Idx = 0; - FifoIn_STT_Idx = 0; - FifoOverLoad_STT = 0; -} - -//------------------------------------------------------------------------ -// void FIFO_STT_Put (BYTE data) -// -// Input : Data data to fill in the FIFO -// -//------------------------------------------------------------------------ -//#pragma ot(4, SPEED) -void FIFO_STT_put (unsigned char Data) -{ - if(FifoOverLoad_STT) - FIFO_STT_flush(); - - FifoTbl_STT[FifoIn_STT_Idx] = Data; // Put data into the FIFO - FifoIn_STT_Idx++; // Update FIFO in index - if (FifoIn_STT_Idx == FIFO_STT_OVERLOAD) // FIFO Overload - FifoOverLoad_STT = 1; - - -} - - -//------------------------------------------------------------------------ -// unsigned char FIFO_STT_Get(void) -// -// Return : Data -// -//------------------------------------------------------------------------ -//#pragma ot(4, SPEED) -unsigned char FIFO_STT_get (void) -{ - unsigned char Data; - - Data = FifoTbl_STT[FifoOut_STT_Idx]; - FifoOut_STT_Idx++; - - - return (Data); -} Deleted: firmware/fuxusb/branches/0.3/modules/timer_soft/timer_soft.gif =================================================================== (Binary files differ) |
From: Paul_R <c2m...@c2...> - 2008-05-02 09:42:17
|
Author: Paul_R Date: 2008-05-02 11:42:15 +0200 (Fri, 02 May 2008) New Revision: 1066 Added: firmware/fuxusb/branches/0.3/fuxusb.Uv2 Removed: firmware/fuxusb/branches/0.3/lib_board/ firmware/fuxusb/branches/0.3/modules/scheduler/ firmware/fuxusb/branches/0.3/usb_RFDongle.Uv2 Modified: firmware/fuxusb/branches/0.3/bootloading.c firmware/fuxusb/branches/0.3/config.h firmware/fuxusb/branches/0.3/global.c firmware/fuxusb/branches/0.3/main.c firmware/fuxusb/branches/0.3/modules/fifo/fifo_spk.c firmware/fuxusb/branches/0.3/modules/fifo_stt/fifo_stt.c firmware/fuxusb/branches/0.3/modules/spi/spi_task.c firmware/fuxusb/branches/0.3/modules/usb/usb_task.c Log: * Project cleanup : Removed unused modules Removed some #define Renamed the project (usb_RFDongle.Uv2 -> fuxusb.Uv2) Modified: firmware/fuxusb/branches/0.3/bootloading.c =================================================================== --- firmware/fuxusb/branches/0.3/bootloading.c 2008-05-02 08:19:25 UTC (rev 1065) +++ firmware/fuxusb/branches/0.3/bootloading.c 2008-05-02 09:42:15 UTC (rev 1066) @@ -6,7 +6,6 @@ * $Id: main.c 28 2006-01-12 16:51:01Z david $ */ -//#include "lib_mcu/twi/twi.h" #include "bootloading.h" #include "config.h" Modified: firmware/fuxusb/branches/0.3/config.h =================================================================== --- firmware/fuxusb/branches/0.3/config.h 2008-05-02 08:19:25 UTC (rev 1065) +++ firmware/fuxusb/branches/0.3/config.h 2008-05-02 09:42:15 UTC (rev 1066) @@ -25,9 +25,9 @@ /*_____ M A C R O S ________________________________________________________*/ +//#define MAIN_DEBUG //#define USB_ENUM_DEBUG -//#define MAIN_DEBUG //#define USB_TASK_DEBUG //#define BOOTLOAD_DEBUG //#define BOOTLOAD_USB_DEBUG Added: firmware/fuxusb/branches/0.3/fuxusb.Uv2 =================================================================== --- firmware/fuxusb/branches/0.3/fuxusb.Uv2 (rev 0) +++ firmware/fuxusb/branches/0.3/fuxusb.Uv2 2008-05-02 09:42:15 UTC (rev 1066) @@ -0,0 +1,141 @@ +### uVision2 Project, (C) Keil Software +### Do not modify ! + +Target (fuxusb), 0x0000 // Tools: 'MCS-51' + +Group (system) +Group (modules) +Group (lib_mcu) +Group (headers) + +File 1,1,<.\main.c><main.c> 0x0 +File 1,1,<.\global.c><global.c> 0x0 +File 1,1,<.\modules\usb\usb_task.c><usb_task.c> 0x0 +File 1,1,<.\modules\spi\spi_task.c><spi_task.c> 0x0 +File 1,1,<.\bootloading.c><bootloading.c> 0x0 +File 1,1,<.\i2c.c><i2c.c> 0x0 +File 2,1,<.\modules\timer_soft\timer_soft.c><timer_soft.c> 0x0 +File 2,1,<.\modules\usb_enum\usb_enum.c><usb_enum.c> 0x0 +File 2,1,<.\modules\fifo\fifo_spk.c><fifo_spk.c> 0x0 +File 2,1,<.\modules\fifo\fifo_mic.c><fifo_mic.c> 0x0 +File 2,1,<.\modules\fifo\fifo.c><fifo.c> 0x0 +File 2,1,<.\modules\fifo_stt\fifo_stt.c><fifo_stt.c> 0x0 +File 3,1,<.\lib_mcu\usb\usb_drv.c><usb_drv.c> 0x0 +File 3,1,<.\lib_mcu\uart\uart_lib.c><uart_lib.c> 0x0 +File 3,1,<.\lib_mcu\spi\spi_lib.c><spi_lib.c> 0x0 +File 3,1,<.\lib_mcu\fa-usb\flash_api.c><flash_api.c> 0x0 +File 4,5,<.\config.h><config.h> 0x0 +File 4,5,<.\lib_mcu\reg_5131.h><reg_5131.h> 0x0 +File 4,5,<.\lib_mcu\ext_5131.h><ext_5131.h> 0x0 +File 4,5,<.\lib_mcu\5131_drv.h><5131_drv.h> 0x0 +File 4,5,<.\lib_mcu\usb\usb_drv.h><usb_drv.h> 0x0 +File 4,5,<.\global.h><global.h> 0x0 +File 4,5,<.\bootloading.h><bootloading.h> 0x0 +File 4,5,<.\i2c.h><i2c.h> 0x0 +File 4,5,<.\lib_mcu\twi\twi.h><twi.h> 0x0 + + +Options 1,0,0 // Target 'fuxusb' + Device (AT89C5131) + Vendor (Atmel) + Cpu (IRAM(0-0xFF) XRAM(0-0x3FF) CLOCK(32000000)) + FlashUt ("batchisp" (-device $D -hardware RS232 -port COM1 -baudrate 19200 -operation MEMORY FLASH LOADBUFFER %H PROGRAM)) + StupF ("LIB\STARTUP.A51" ("Standard 8051 Startup Code")) + FlashDR () + Rgf (REG52.H) + Mem () + C () + A () + RL () + OH () + UseEnv=0 + EnvBin (C:\Keil\C51\BIN\) + EnvInc () + EnvLib () + EnvReg () + OrgReg () + TgStat=0 + OutDir (.\obj\) + OutName (fuxusb.aof) + GenApp=1 + GenLib=0 + GenHex=1 + Debug=1 + Browse=1 + LstDir (.\lst\) + HexSel=0 + MG32K=0 + TGMORE=0 + RunUsr 0 0 <> + RunUsr 1 0 <> + BrunUsr 0 0 <> + BrunUsr 1 0 <> + SVCSID <> + MODEL5=2 + RTOS5=0 + ROMSZ5=2 + DHOLD5=0 + XHOLD5=0 + T51FL=56 + CBANKS5=0 + XBANKS5=0 + RCB51 { 0,0,0,0,0,255,255,0,0 } + RXB51 { 0,0,0,0,0,0,0,0,0 } + OCM51 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + OCR51 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + IRO51 { 0,0,0,0,0,0,0,0,0 } + IRA51 { 0,0,0,0,0,0,1,0,0 } + XRA51 { 0,0,0,0,0,0,4,0,0 } + XRA512 { 0,0,0,0,0,0,0,0,0 } + C51FL=21646608 + C51VA=0 + C51MSC () + C51DEF (KEIL) + C51UDF () + INCC5 (.\;.\;.\;.\lib_c\) + AX51FL=4 + AX51MSC () + AX51SET () + AX51RST () + INCA5 () + PropFld { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + IncBld=1 + AlwaysBuild=0 + GenAsm=0 + AsmAsm=0 + PublicsOnly=0 + StopCode=3 + CustArgs () + LibMods () + BankNo=65535 + LX51FL=292 + LX51OVL () + LX51MSC () + LX51DWN (16) + LX51LFI () + LX51ASN () + LX51RES () + LX51CCL () + LX51UCL () + LX51CSC () + LX51UCS () + LX51COB () + LX51XDB () + LX51PDB () + LX51BIB () + LX51DAB () + LX51IDB () + LX51PRC () + LX51STK () + LX51COS () + LX51XDS () + LX51BIS () + LX51DAS () + LX51IDS () + OPTDL (S8051.DLL)()(DP51.DLL)(-p5131)(S8051.DLL)()(TP51.DLL)(-p5131) + OPTDBG 48126,-1,()()()()()()()()()() (BIN\MON51.DLL)()()() + FLASH1 { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + FLASH2 () + FLASH3 ("batchisp" (-device $D -hardware RS232 -port COM1 -baudrate 19200 -operation MEMORY FLASH LOADBUFFER %H PROGRAM)) +EndOpt + Modified: firmware/fuxusb/branches/0.3/global.c =================================================================== --- firmware/fuxusb/branches/0.3/global.c 2008-05-02 08:19:25 UTC (rev 1065) +++ firmware/fuxusb/branches/0.3/global.c 2008-05-02 09:42:15 UTC (rev 1066) @@ -12,12 +12,8 @@ *****************************************************************************/ #include "global.h" - #include "version.h" - - - /*_____ M A C R O S ________________________________________________________*/ /*_____ D E F I N I T I O N ________________________________________________*/ @@ -25,7 +21,6 @@ /*_____ D E C L A R A T I O N ______________________________________________*/ - //------------------------------------------------------- // SPI Controler //------------------------------------------------------- Modified: firmware/fuxusb/branches/0.3/main.c =================================================================== --- firmware/fuxusb/branches/0.3/main.c 2008-05-02 08:19:25 UTC (rev 1065) +++ firmware/fuxusb/branches/0.3/main.c 2008-05-02 09:42:15 UTC (rev 1066) @@ -12,17 +12,14 @@ *****************************************************************************/ /*_____ I N C L U D E S ____________________________________________________*/ - - #include "config.h" #include "lib_c/stdint.h" #include "global.h" -#include "lib_mcu\uart\uart_lib.h" #include "modules\usb\usb_task.h" -#include "modules\fifo\fifo_spk.h" -#include "modules\fifo\fifo_mic.h" -#include "modules\fifo_stt\fifo_stt.h" +#ifdef MAIN_DEBUG + #include "lib_mcu\uart\uart_lib.h" +#endif char code reserve [3] _at_ 0x23; /* for Monitor-51 serial interrupt */ Modified: firmware/fuxusb/branches/0.3/modules/fifo/fifo_spk.c =================================================================== --- firmware/fuxusb/branches/0.3/modules/fifo/fifo_spk.c 2008-05-02 08:19:25 UTC (rev 1065) +++ firmware/fuxusb/branches/0.3/modules/fifo/fifo_spk.c 2008-05-02 09:42:15 UTC (rev 1066) @@ -14,8 +14,8 @@ #include "config.h" #include "fifo_spk.h" #include "lib_mcu\usb\usb_drv.h" -#include "lib_mcu\uart\uart_lib.h" + unsigned char FifoTbl_SPK[FIFOTBL_SPK_MAX]; unsigned char FifoIn_SPK_Idx; Modified: firmware/fuxusb/branches/0.3/modules/fifo_stt/fifo_stt.c =================================================================== --- firmware/fuxusb/branches/0.3/modules/fifo_stt/fifo_stt.c 2008-05-02 08:19:25 UTC (rev 1065) +++ firmware/fuxusb/branches/0.3/modules/fifo_stt/fifo_stt.c 2008-05-02 09:42:15 UTC (rev 1066) @@ -14,8 +14,8 @@ #include "config.h" #include "fifo_stt.h" #include "lib_mcu\usb\usb_drv.h" -#include "lib_mcu\uart\uart_lib.h" + unsigned char FifoTbl_Stt[FIFOTBL_STT_MAX]; unsigned char FifoIn_STT_Idx; Modified: firmware/fuxusb/branches/0.3/modules/spi/spi_task.c =================================================================== --- firmware/fuxusb/branches/0.3/modules/spi/spi_task.c 2008-05-02 08:19:25 UTC (rev 1065) +++ firmware/fuxusb/branches/0.3/modules/spi/spi_task.c 2008-05-02 09:42:15 UTC (rev 1066) @@ -10,14 +10,12 @@ *****************************************************************************/ /*_____ I N C L U D E S ____________________________________________________*/ +#include "global.h" #include "config.h" -#include "lib_mcu\usb\usb_drv.h" #include "lib_mcu\spi\spi_lib.h" -#include "modules\usb_enum\usb_enum.h" #include "modules\spi\spi_task.h" -#include "modules\fifo\fifo_spk.h" -#include "modules\fifo\fifo_mic.h" #include "global.h" + /*_____ M A C R O S ________________________________________________________*/ /*_____ D E F I N I T I O N ________________________________________________*/ Modified: firmware/fuxusb/branches/0.3/modules/usb/usb_task.c =================================================================== --- firmware/fuxusb/branches/0.3/modules/usb/usb_task.c 2008-05-02 08:19:25 UTC (rev 1065) +++ firmware/fuxusb/branches/0.3/modules/usb/usb_task.c 2008-05-02 09:42:15 UTC (rev 1066) @@ -15,8 +15,6 @@ #include "lib_mcu\spi\spi_lib.h" #include "lib_mcu\usb\usb_drv.h" -#include "lib_mcu\usb\uart_usb_lib.h" -#include "lib_mcu\uart\uart_lib.h" #include "lib_mcu\fa-usb\flash_api.h" #include "modules\usb\usb_task.h" #include "modules\spi\spi_task.h" Deleted: firmware/fuxusb/branches/0.3/usb_RFDongle.Uv2 =================================================================== --- firmware/fuxusb/branches/0.3/usb_RFDongle.Uv2 2008-05-02 08:19:25 UTC (rev 1065) +++ firmware/fuxusb/branches/0.3/usb_RFDongle.Uv2 2008-05-02 09:42:15 UTC (rev 1066) @@ -1,143 +0,0 @@ -### uVision2 Project, (C) Keil Software -### Do not modify ! - -Target (RF_Dongle), 0x0000 // Tools: 'MCS-51' - -Group (system) -Group (modules) -Group (lib_board) -Group (lib_mcu) -Group (headers) - -File 1,1,<.\main.c><main.c> 0x0 -File 1,1,<.\global.c><global.c> 0x0 -File 1,1,<.\modules\usb\usb_task.c><usb_task.c> 0x0 -File 1,1,<.\modules\spi\spi_task.c><spi_task.c> 0x0 -File 1,1,<.\bootloading.c><bootloading.c> 0x0 -File 1,1,<.\i2c.c><i2c.c> 0x0 -File 2,1,<.\modules\timer_soft\timer_soft.c><timer_soft.c> 0x0 -File 2,1,<.\modules\usb_enum\usb_enum.c><usb_enum.c> 0x0 -File 2,1,<.\modules\fifo\fifo_spk.c><fifo_spk.c> 0x0 -File 2,1,<.\modules\fifo\fifo_mic.c><fifo_mic.c> 0x0 -File 2,1,<.\modules\fifo\fifo.c><fifo.c> 0x0 -File 2,1,<.\modules\fifo_stt\fifo_stt.c><fifo_stt.c> 0x0 -File 4,1,<.\lib_mcu\usb\usb_drv.c><usb_drv.c> 0x0 -File 4,1,<.\lib_mcu\uart\uart_lib.c><uart_lib.c> 0x0 -File 4,1,<.\lib_mcu\spi\spi_lib.c><spi_lib.c> 0x0 -File 4,1,<.\lib_mcu\fa-usb\flash_api.c><flash_api.c> 0x0 -File 5,5,<.\config.h><config.h> 0x0 -File 5,5,<.\lib_board\c5131_evab.h><c5131_evab.h> 0x0 -File 5,5,<.\lib_mcu\reg_5131.h><reg_5131.h> 0x0 -File 5,5,<.\lib_mcu\ext_5131.h><ext_5131.h> 0x0 -File 5,5,<.\lib_mcu\5131_drv.h><5131_drv.h> 0x0 -File 5,5,<.\lib_mcu\usb\usb_drv.h><usb_drv.h> 0x0 -File 5,5,<.\global.h><global.h> 0x0 -File 5,5,<.\bootloading.h><bootloading.h> 0x0 -File 5,5,<.\i2c.h><i2c.h> 0x0 -File 5,5,<.\lib_mcu\twi\twi.h><twi.h> 0x0 - - -Options 1,0,0 // Target 'RF_Dongle' - Device (AT89C5131) - Vendor (Atmel) - Cpu (IRAM(0-0xFF) XRAM(0-0x3FF) CLOCK(32000000)) - FlashUt ("batchisp" (-device $D -hardware RS232 -port COM1 -baudrate 19200 -operation MEMORY FLASH LOADBUFFER %H PROGRAM)) - StupF ("LIB\STARTUP.A51" ("Standard 8051 Startup Code")) - FlashDR () - Rgf (REG52.H) - Mem () - C () - A () - RL () - OH () - UseEnv=0 - EnvBin (C:\Keil\C51\BIN\) - EnvInc () - EnvLib () - EnvReg () - OrgReg () - TgStat=0 - OutDir (.\obj\) - OutName (fuxusb.aof) - GenApp=1 - GenLib=0 - GenHex=1 - Debug=1 - Browse=1 - LstDir (.\lst\) - HexSel=0 - MG32K=0 - TGMORE=0 - RunUsr 0 0 <> - RunUsr 1 0 <> - BrunUsr 0 0 <> - BrunUsr 1 0 <> - SVCSID <> - MODEL5=2 - RTOS5=0 - ROMSZ5=2 - DHOLD5=0 - XHOLD5=0 - T51FL=56 - CBANKS5=0 - XBANKS5=0 - RCB51 { 0,0,0,0,0,255,255,0,0 } - RXB51 { 0,0,0,0,0,0,0,0,0 } - OCM51 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } - OCR51 { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } - IRO51 { 0,0,0,0,0,0,0,0,0 } - IRA51 { 0,0,0,0,0,0,1,0,0 } - XRA51 { 0,0,0,0,0,0,4,0,0 } - XRA512 { 0,0,0,0,0,0,0,0,0 } - C51FL=21646608 - C51VA=0 - C51MSC () - C51DEF (KEIL) - C51UDF () - INCC5 (.\;.\;.\;.\lib_c\) - AX51FL=4 - AX51MSC () - AX51SET () - AX51RST () - INCA5 () - PropFld { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } - IncBld=1 - AlwaysBuild=0 - GenAsm=0 - AsmAsm=0 - PublicsOnly=0 - StopCode=3 - CustArgs () - LibMods () - BankNo=65535 - LX51FL=292 - LX51OVL () - LX51MSC () - LX51DWN (16) - LX51LFI () - LX51ASN () - LX51RES () - LX51CCL () - LX51UCL () - LX51CSC () - LX51UCS () - LX51COB () - LX51XDB () - LX51PDB () - LX51BIB () - LX51DAB () - LX51IDB () - LX51PRC () - LX51STK () - LX51COS () - LX51XDS () - LX51BIS () - LX51DAS () - LX51IDS () - OPTDL (S8051.DLL)()(DP51.DLL)(-p5131)(S8051.DLL)()(TP51.DLL)(-p5131) - OPTDBG 48126,-1,()()()()()()()()()() (BIN\MON51.DLL)()()() - FLASH1 { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } - FLASH2 () - FLASH3 ("batchisp" (-device $D -hardware RS232 -port COM1 -baudrate 19200 -operation MEMORY FLASH LOADBUFFER %H PROGRAM)) -EndOpt - |
From: Paul_R <c2m...@c2...> - 2008-05-02 08:19:28
|
Author: Paul_R Date: 2008-05-02 10:19:25 +0200 (Fri, 02 May 2008) New Revision: 1065 Modified: firmware/fuxusb/branches/0.3/config.h firmware/fuxusb/branches/0.3/global.c firmware/fuxusb/branches/0.3/global.h firmware/fuxusb/branches/0.3/modules/fifo/fifo_mic.c firmware/fuxusb/branches/0.3/modules/spi/spi_task.c firmware/fuxusb/branches/0.3/modules/usb/usb_task.c firmware/fuxusb/branches/0.3/modules/usb_enum/USB_ENUM.H firmware/fuxusb/branches/0.3/modules/usb_enum/usb_enum.c Log: * Merged back HID branch to 0.3 Modified: firmware/fuxusb/branches/0.3/config.h =================================================================== --- firmware/fuxusb/branches/0.3/config.h 2008-05-01 12:16:13 UTC (rev 1064) +++ firmware/fuxusb/branches/0.3/config.h 2008-05-02 08:19:25 UTC (rev 1065) @@ -81,10 +81,10 @@ /* CONFIGURATION DESCRIPTOR */ #ifdef TTS_INTERFACE_ENABLED -# define CONF_LENGTH 0x2001 // 288 +# define CONF_LENGTH 0x2901 // 297 # define NB_INTERFACE 6 #else -# define CONF_LENGTH 0xC500 // 197 +# define CONF_LENGTH 0xCE00 // 206 # define NB_INTERFACE 4 #endif @@ -130,12 +130,10 @@ #define USB_SERIAL_NUMBER {'1'<<8, '0'<<8, '0'<<8, '0'<<8, '1'<<8} #define USB_SN_LENGTH 5 - #define USB_CONFIG_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8} #define USB_CONFIG_LENGTH 8 - #define AUDIO_NORMAL_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8, '-'<<8, 'A'<<8, 'u'<<8, 'd'<<8, \ 'i'<<8, 'o'<<8} Modified: firmware/fuxusb/branches/0.3/global.c =================================================================== --- firmware/fuxusb/branches/0.3/global.c 2008-05-01 12:16:13 UTC (rev 1064) +++ firmware/fuxusb/branches/0.3/global.c 2008-05-02 08:19:25 UTC (rev 1065) @@ -29,17 +29,17 @@ //------------------------------------------------------- // SPI Controler //------------------------------------------------------- -bit spi_task_on_Flag; // = 1; // to turn ON the RF Task -// = 0; // to turn OFF the RF Task +bit spi_task_on_Flag; // = 1; // to turn ON the RF Task +// = 0; // to turn OFF the RF Task //------------------------------------------------------- // USB Controler //------------------------------------------------------- -unsigned int usb_sof_counter; -unsigned char usb_configuration_nb; -bit usb_connected_Flag; +unsigned int usb_sof_counter; +unsigned char usb_configuration_nb; +bit usb_connected_Flag; -bit CMD_OUT_Bank_Nb; // To store the number of the Bank used for the CMD_OUT Endpoint -unsigned char CMD_IN_Bank_Nb; +bit CMD_OUT_Bank_Nb; // To store the number of the Bank used for the CMD_OUT Endpoint +unsigned char CMD_IN_Bank_Nb; bit USB_ParserProcess_Permit_Flag; bit USB_StatusProcess_Permit_Flag; @@ -49,8 +49,8 @@ // I2C Controler //------------------------------------------------------- -unsigned char i2c_wait_counter = 0; -bit i2c_task_on_Flag; +unsigned char i2c_wait_counter = 0; +bit i2c_task_on_Flag; //------------------------------------------------------- // RF Controler @@ -58,13 +58,13 @@ // RF Header //------------------------------------------------------- -#define RF_2FRAMES_HDR 0x80 -#define RF_AUDIO_HDR 0x02 -#define RF_CMD_HDR 0x08 +#define RF_2FRAMES_HDR 0x80 +#define RF_AUDIO_HDR 0x02 +#define RF_CMD_HDR 0x08 //------------------------------------------------------- -bit RF_OFFLine_Back; +bit RF_OFFLine_Back; unsigned char RF_Status; unsigned char RF_Status_Temp; @@ -76,21 +76,21 @@ // From USB //------------------------------------------------------- -unsigned char USBCommand_ForDongle[65]; // For Dongle -unsigned char USBCommand_ForRF[65]; // For RF -unsigned char USBCommand_Ctr; // Store the number of byte sent by the LIBUSB -bit USBCommand_NewRequest_Flag; -unsigned char USBCommand_Header; // Needed to analyze the LIBUSB command : to RF or to I2C +unsigned char USBCommand_ForDongle[65]; // For Dongle +unsigned char USBCommand_ForRF[65]; // For RF +unsigned char USBCommand_Ctr; // Store the number of byte sent by the LIBUSB +bit USBCommand_NewRequest_Flag; +unsigned char USBCommand_Header; // Needed to analyze the LIBUSB command : to RF or to I2C -#define LIBUSB_TUX_CMD_HDR 0 -#define LIBUSB_DONGLE_CMD_HDR 1 -#define LIBUSB_BOOTLOADER_CMD_HDR 2 +#define LIBUSB_TUX_CMD_HDR 0 +#define LIBUSB_DONGLE_CMD_HDR 1 +#define LIBUSB_BOOTLOADER_CMD_HDR 2 //------------------------------------------------------- // Dongle Info //------------------------------------------------------- -code version_t info_version ={VERSION_CMD, CPU_VER_JOIN(FUXUSB_CPU_NUM, VER_MAJOR), VER_MINOR, VER_UPDATE}; -code revision_t info_revision={REVISION_CMD, REVISION_NUMBER, RELEASE_TYPE}; -code author_t info_author={AUTHOR_CMD, AUTHOR_ID, VARIATION}; +code version_t info_version ={VERSION_CMD, CPU_VER_JOIN(FUXUSB_CPU_NUM, VER_MAJOR), VER_MINOR, VER_UPDATE}; +code revision_t info_revision={REVISION_CMD, REVISION_NUMBER, RELEASE_TYPE}; +code author_t info_author={AUTHOR_CMD, AUTHOR_ID, VARIATION}; Modified: firmware/fuxusb/branches/0.3/global.h =================================================================== --- firmware/fuxusb/branches/0.3/global.h 2008-05-01 12:16:13 UTC (rev 1064) +++ firmware/fuxusb/branches/0.3/global.h 2008-05-02 08:19:25 UTC (rev 1065) @@ -24,8 +24,8 @@ /*_____ D E F I N I T I O N ________________________________________________*/ // Hardware -#define rf_reset_signal P0_1 -#define RF_OFFLINE P2_3 +#define rf_reset_signal P0_1 +#define RF_OFFLINE P2_3 /*_____ D E C L A R A T I O N ______________________________________________*/ @@ -34,21 +34,21 @@ //------------------------------------------------------- // SPI Controler //------------------------------------------------------- -extern bit spi_task_on_Flag; // = 1; // to turn ON the RF Task -// = 0; // to turn OFF the RF Task -extern unsigned int spi_watchdog_ctr; +extern bit spi_task_on_Flag; // = 1; // to turn ON the RF Task +// = 0; // to turn OFF the RF Task +extern unsigned int spi_watchdog_ctr; #define SPI_WATCHDOG_MAX (6000) //------------------------------------------------------- // USB Controler //------------------------------------------------------- -extern unsigned int usb_sof_counter; -extern unsigned char usb_configuration_nb; -extern bit usb_connected_Flag; +extern unsigned int usb_sof_counter; +extern unsigned char usb_configuration_nb; +extern bit usb_connected_Flag; -extern bit CMD_OUT_Bank_Nb; // To store the number of the Bank used for the CMD_OUT Endpoint -extern unsigned char CMD_IN_Bank_Nb; +extern bit CMD_OUT_Bank_Nb;// To store the number of the Bank used for the CMD_OUT Endpoint +extern unsigned char CMD_IN_Bank_Nb; extern bit USB_ParserProcess_Permit_Flag; extern bit USB_StatusProcess_Permit_Flag; @@ -60,7 +60,7 @@ //------------------------------------------------------- extern unsigned char i2c_wait_counter; -extern bit i2c_task_on_Flag; +extern bit i2c_task_on_Flag; //------------------------------------------------------- // RF Controler @@ -68,13 +68,13 @@ // RF Header //------------------------------------------------------- -#define RF_2FRAMES_HDR 0x80 -#define RF_AUDIO_HDR 0x02 -#define RF_CMD_HDR 0x08 +#define RF_2FRAMES_HDR 0x80 +#define RF_AUDIO_HDR 0x02 +#define RF_CMD_HDR 0x08 //------------------------------------------------------- -extern bit RF_OFFLine_Back; +extern bit RF_OFFLine_Back; extern unsigned char RF_Status; extern unsigned char RF_Status_Temp; @@ -86,17 +86,17 @@ // From USB //------------------------------------------------------- -extern unsigned char USBCommand_ForRF[]; // Store the USB Command -extern unsigned char USBCommand_ForDongle[]; // For Dongle -extern unsigned char USBCommand_Ctr; // Store the number of byte sent by the LIBUSB +extern unsigned char USBCommand_ForRF[]; // Store the USB Command +extern unsigned char USBCommand_ForDongle[]; // For Dongle +extern unsigned char USBCommand_Ctr; // Store the number of byte sent by the LIBUSB -extern bit USBCommand_NewRequest_Flag; -extern unsigned char USBCommand_Header; // Needed to analyze the LIBUSB command : to RF or to I2C +extern bit USBCommand_NewRequest_Flag; +extern unsigned char USBCommand_Header; // Needed to analyze the LIBUSB command : to RF or to I2C -#define LIBUSB_TUX_CMD_HDR 0 -#define LIBUSB_DONGLE_CMD_HDR 1 -#define LIBUSB_BOOTLOADER_CMD_HDR 2 +#define LIBUSB_TUX_CMD_HDR 0 +#define LIBUSB_DONGLE_CMD_HDR 1 +#define LIBUSB_BOOTLOADER_CMD_HDR 2 @@ -104,8 +104,8 @@ // Dongle Info //------------------------------------------------------- -extern code version_t info_version; -extern code revision_t info_revision; -extern code author_t info_author; +extern code version_t info_version; +extern code revision_t info_revision; +extern code author_t info_author; #endif /* _GLOBAL_H_ */ Modified: firmware/fuxusb/branches/0.3/modules/fifo/fifo_mic.c =================================================================== --- firmware/fuxusb/branches/0.3/modules/fifo/fifo_mic.c 2008-05-01 12:16:13 UTC (rev 1064) +++ firmware/fuxusb/branches/0.3/modules/fifo/fifo_mic.c 2008-05-02 08:19:25 UTC (rev 1065) @@ -19,7 +19,7 @@ //------------------------------------------------------------------------ -#define FIFOTBL_MIC_MAX 256 +#define FIFOTBL_MIC_MAX 256 #define FIFO_MIC_OVERLOAD FIFOTBL_MIC_MAX + 1 Modified: firmware/fuxusb/branches/0.3/modules/spi/spi_task.c =================================================================== --- firmware/fuxusb/branches/0.3/modules/spi/spi_task.c 2008-05-01 12:16:13 UTC (rev 1064) +++ firmware/fuxusb/branches/0.3/modules/spi/spi_task.c 2008-05-02 08:19:25 UTC (rev 1065) @@ -33,9 +33,9 @@ data unsigned char spi_count; data unsigned char spi_lenght_data; -bit spi_enable = 1; -bit spi_ready = 0; -bit spi_Start_Flag = 0; +bit spi_enable = 1; +bit spi_ready = 0; +bit spi_Start_Flag = 0; unsigned char spi_TestCtr ; // Debug @@ -91,33 +91,33 @@ #ifdef X2_MODE Set_spi_x2_mode(); #endif - SPCON |= MSK_MSTR; /* Master mode */ + SPCON |= MSK_MSTR; /* Master mode */ #ifdef SPI_Clock_Div128 SPCON |= 0x82; /* Fclk Periph/128 */ #endif #ifdef SPI_Clock_Div4 - SPCON |= 0x01; /* Fclk Periph/4 */ + SPCON |= 0x01; /* Fclk Periph/4 */ #endif #ifdef SPI_Clock_Div8 - SPCON |= 0x02; /* Fclk Periph/8 */ + SPCON |= 0x02; /* Fclk Periph/8 */ #endif #ifdef SPI_Clock_Div16 - SPCON |= 0x03; /* Fclk Periph/8 */ + SPCON |= 0x03; /* Fclk Periph/8 */ #endif - SPCON &= ~MSK_CPOL; /* CPOL=0; transmit mode example */ - SPCON &= ~MSK_CPHA; /* CPHA=0; transmit mode example */ + SPCON &= ~MSK_CPOL; /* CPOL=0; transmit mode example */ + SPCON &= ~MSK_CPHA; /* CPHA=0; transmit mode example */ SPCON |= MSK_SSDIS; - SPCON |= MSK_SPEN; /* run spi */ + SPCON |= MSK_SPEN; /* run spi */ - SPI_DREADY = 1; - SPI_START = 1; - SPI_CSn = 1; - IT0 = 1; // Falling Edge On Int0 - EX0 = 1; /* enable Int0 interrupt */ + SPI_DREADY = 1; + SPI_START = 1; + SPI_CSn = 1; + IT0 = 1; // Falling Edge On Int0 + EX0 = 1; /* enable Int0 interrupt */ - spi_slave = 0; // Reset State Machine of spi_task() - spi_master = 0; // Reset State Machine of spi_task() + spi_slave = 0; // Reset State Machine of spi_task() + spi_master = 0; // Reset State Machine of spi_task() spi_task_on_Flag = 0; } Modified: firmware/fuxusb/branches/0.3/modules/usb/usb_task.c =================================================================== --- firmware/fuxusb/branches/0.3/modules/usb/usb_task.c 2008-05-01 12:16:13 UTC (rev 1064) +++ firmware/fuxusb/branches/0.3/modules/usb/usb_task.c 2008-05-02 08:19:25 UTC (rev 1065) @@ -33,22 +33,22 @@ /*_____ D E F I N I T I O N ________________________________________________*/ -#define PONG_CHECK 0 /* count the pongs here */ -#define STATUS_CHECK 0 /* check validity of status bytes */ +#define PONG_CHECK 0 /* count the pongs here */ +#define STATUS_CHECK 0 /* check validity of status bytes */ void data_to_send(void); /*_____ D E C L A R A T I O N ______________________________________________*/ #if (PONG_CHECK) -unsigned char pong_received; /* value of the pong received from the sound cpu */ +unsigned char pong_received; /* value of the pong received from the sound cpu */ unsigned char pong_missed; /* counting the pong missed on the SPI */ #endif -bit EP_AUDIOIN_Loaded = 0; -bit i2c_bootloading_Flag = 0; /* bootloader mode */ +bit EP_AUDIOIN_Loaded = 0; +bit i2c_bootloading_Flag = 0; /* bootloader mode */ uint16_t address_tracking; -bit ReadStatus_USBRequest_Flag = 0; -bit Cpu_reset = 0; -bit Speaker_TTS_Select_Flag = 0; +bit ReadStatus_USBRequest_Flag = 0; +bit Cpu_reset = 0; +bit Speaker_TTS_Select_Flag = 0; fifo_t statusBuf; fifo_t *statusFifo = &statusBuf; @@ -56,7 +56,8 @@ data unsigned char received_status[4]; data unsigned char received_data[34]; data unsigned char Sample8; -data unsigned char Spi_Overflow_Ctr; +data unsigned char Spi_Overflow_Ctr; + /*F************************************************************************** * NAME: usb_task_init *---------------------------------------------------------------------------- @@ -104,7 +105,7 @@ P1_0 = 0; spi_task_on_Flag = 0; - RF_Status = 0; + RF_Status = 0; RF_OFFLine_Back = 0; Speaker_TTS_Select_Flag = 0; USB_ParserProcess_Permit_Flag = TRUE; @@ -162,7 +163,6 @@ if((USB_Status_NewCmd_Flag) && (CMD_IN_Bank_Nb < 2)) { - // &&(!(spi_master_config & RF_2FRAMES_HDR)) && (USB_StatusProcess_Permit_Flag) /* * If the bank number == 2, that means that both banks has been filled. */ @@ -207,22 +207,22 @@ void usb_Bootloader_command_process_task(void) { data Uchar i; - if((USB_Bootloader_NewCmd_Flag) && (CMD_IN_Bank_Nb < 2)) - { + if((USB_Bootloader_NewCmd_Flag) && (CMD_IN_Bank_Nb < 2)) + { Usb_select_ep(EP_CMD_IN); #ifdef BOOTLOAD_USB_DEBUG - printf ("BUSB: TX ready, UEPSTAX=0x%BX\n", UEPSTAX); + printf ("BUSB: TX ready, UEPSTAX=0x%BX\n", UEPSTAX); #endif - for(i=0;i<FifoIn_STT_Idx;i++) - { - Usb_write_byte(FIFO_STT_get()); - } + for(i=0;i<FifoIn_STT_Idx;i++) + { + Usb_write_byte(FIFO_STT_get()); + } FIFO_STT_flush(); CMD_IN_Bank_Nb ++; // Increase the bank number - USB_Bootloader_NewCmd_Flag = FALSE; + USB_Bootloader_NewCmd_Flag = FALSE; data_to_send(); - } + } } void data_to_send(void) @@ -256,7 +256,7 @@ FIFO_STT_put(p1); FIFO_STT_put(p2); FIFO_STT_put(p3); - USB_Bootloader_NewCmd_Flag = TRUE; + USB_Bootloader_NewCmd_Flag = TRUE; usb_Bootloader_command_process_task(); } @@ -294,6 +294,7 @@ if (USBCommand_ForDongle[0] == 0x01) { if (USBCommand_ForDongle[1] == 0x00) + { if(USBCommand_ForDongle[2] == 0x00) { @@ -305,15 +306,14 @@ USB_Status_NewCmd_Flag = TRUE; //DEBUG_2 = 0; } - // Complete reset - //////////////////////////////////////// - if(USBCommand_ForDongle[3] == 0xfe) + // Complete reset + //////////////////////////////////////// + if(USBCommand_ForDongle[3] == 0xfe) { - //--------------------------- - IEN0 = 0; - IEN1 = 0; - SPCON = 0x14; - tc=10000; + IEN0 = 0; + IEN1 = 0; + SPCON = 0x14; + tc=10000; Usb_detach(); while(tc) tc --; //tempo(TIMER_5_MS); Usb_attach(); @@ -326,10 +326,9 @@ if(USBCommand_ForDongle[3] == 0xff) { //--------------------------- - IEN0 = 0; - IEN1 = 0; - SPCON = 0x14; - + IEN0 = 0; + IEN1 = 0; + SPCON = 0x14; __api_clr_BLJB(); __api_wr_SBV (0xF4); tc=10000; @@ -342,14 +341,15 @@ WDTRST = 0xE1; while(1); } - } + } + } } - //-------------------------------------------------------------------------- + //------------------------------------------------------------------------- // Text To Speech // // USBCommand_ForDongle[1] == 0x01 Text To Speech Selected // USBCommand_ForDongle[1] == 0x00 Text To Speech UnSelected - //-------------------------------------------------------------------------- + //------------------------------------------------------------------------- if (USBCommand_ForDongle[0] == 0x02) { if (USBCommand_ForDongle[1] == 0x01) @@ -370,7 +370,7 @@ while (data_length > i) { - if (commands[i] == INFO_FUXUSB_CMD) // + if (commands[i] == INFO_FUXUSB_CMD) { // VERSION_CMD //------------------------------------- @@ -417,9 +417,6 @@ -void usb_task(void) -{ - data Uchar i; /*F************************************************************************** * NAME: usb_task *---------------------------------------------------------------------------- @@ -428,6 +425,9 @@ *---------------------------------------------------------------------------- * NOTE: *****************************************************************************/ +void usb_task(void) +{ + data Uchar i; if (!usb_connected_Flag) { if (Usb_resume()) @@ -440,9 +440,9 @@ Usb_clear_suspend(); Usb_clear_resume(); Usb_clear_sof(); - // FIFO_SPK_init(); - // FIFO_MIC_init(); - // spi_task_init(); + //FIFO_SPK_init(); + //FIFO_MIC_init(); + //spi_task_init(); } } else @@ -498,11 +498,11 @@ if (Usb_sof()) { Usb_clear_sof(); - usb_sof_counter ++; // == 0xFF == 250ms + usb_sof_counter ++; // == 0xFF == 250ms if(spi_watchdog_ctr) { - spi_watchdog_ctr--; // Decrement Watchdog + spi_watchdog_ctr--; // Decrement Watchdog } //--------------------------------------------------------- // Reset SPI Transfer @@ -510,10 +510,10 @@ else if (!i2c_bootloading_Flag) { //Led_1_on(); - spi_slave = HEADERS; // Set state machine + spi_slave = HEADERS; // Set state machine spi_master = HEADERM; - spi_enable = 1; // Communication Authorized - SPI_CSn = 1; // Chip select + spi_enable = 1; // Communication Authorized + SPI_CSn = 1; // Chip select spi_Start_Flag = 0; spi_ready = 0; } @@ -523,7 +523,6 @@ //-------------------------------------------------------------------------- if (i2c_wait_counter) i2c_wait_counter--; - //-------------------------------------------------------------------------- // Led Behavior //-------------------------------------------------------------------------- @@ -531,7 +530,6 @@ { if(RF_OFFLINE) { - if(RF_OFFLine_Back == 0) { Configure_led(0,LED_PORT_2MA); @@ -542,12 +540,12 @@ Led_0_off(); if (usb_sof_counter == 0x2FF) Led_0_on(); - if (usb_sof_counter == 0x3FF) // 0x0400 ==> Time Base = 1sec + if (usb_sof_counter == 0x3FF) //==> Time Base = 1sec usb_sof_counter = 0xFFFE; } - else // RF ON Line + else // RF ON Line { if(RF_OFFLine_Back == 1) { @@ -560,7 +558,7 @@ Led_0_off(); if (usb_sof_counter == 0x10) Led_0_on(); - if (usb_sof_counter == 0x20) // 0x0400 ==> Time Base = 1sec + if (usb_sof_counter == 0x20) //Time Base = 1sec usb_sof_counter = 0xFFFE; } } @@ -573,7 +571,7 @@ // //-------------------------------------------------------------------------- usb_Satus_command_process_task(); - usb_Bootloader_command_process_task(); + usb_Bootloader_command_process_task(); //-------------------------------------------------------------------------- // @@ -615,8 +613,8 @@ CMD_IN_Bank_Nb--; if (CMD_IN_Bank_Nb<0) CMD_IN_Bank_Nb = 0; - if (CMD_IN_Bank_Nb != 0) - Usb_set_tx_ready(); + if (CMD_IN_Bank_Nb != 0) + Usb_set_tx_ready(); } } @@ -660,7 +658,8 @@ i=8; do { - FIFO_SPK_put(Usb_read_byte()); // Use Only one Call to Get 8 Bytes + // Use Only one Call to Get 8 Bytes + FIFO_SPK_put(Usb_read_byte()); i--; }while(i); } @@ -686,13 +685,13 @@ i=8; do { - FIFO_SPK_put(Usb_read_byte()); // Use Only one Call to Get 8 Bytes + // Use Only one Call to Get 8 Bytes + FIFO_SPK_put(Usb_read_byte()); i--; }while(i); } - Usb_clear_rx(); - //DEBUG_1 = 0; + //DEBUG_1 = 0; } //-------------------------------------------------------------------------- @@ -709,7 +708,8 @@ if(Usb_tx_complete()) { Usb_clear_tx_complete(); - EP_AUDIOIN_Loaded = 0; // -> Enable a new Loading of the FIFO + // -> Enable a new Loading of the FIFO + EP_AUDIOIN_Loaded = 0; } } @@ -724,11 +724,9 @@ { if(Usb_test_it_ep(EP_CMD_OUT)) { - #ifdef FIFO_DEBUG printf("CMD OUT\n"); #endif - if(!USBCommand_NewRequest_Flag) { //DEBUG_2 = 1; @@ -736,9 +734,10 @@ //DEBUG_2 = 0; if(Usb_rx_complete()) { - USBCommand_Ctr = usb_get_nb_byte(); // Capture the number of Byte in USB FIFO - USBCommand_Header = Usb_read_byte(); // Read the Header - + // Capture the number of Byte in USB FIFO + USBCommand_Ctr = usb_get_nb_byte(); + // Read the Header + USBCommand_Header = Usb_read_byte(); //-------------------------------------------------------------------------- // // TUX CMD HEADER received @@ -749,12 +748,12 @@ //-------------------------------------------------------------------------- if(USBCommand_Header == LIBUSB_TUX_CMD_HDR) { - // printf (" LIBUSB_TUX_CMD_HDR \n"); if (!RF_OFFLINE) - USBCommand_NewRequest_Flag = 1; // to inform SPI_task that a new command is arrived + USBCommand_NewRequest_Flag = 1; for(i=0;i<(USBCommand_Ctr-1);i++) USBCommand_ForRF[i] = Usb_read_byte(); - tux_command_parser(USBCommand_ForRF, USBCommand_Ctr); + tux_command_parser(USBCommand_ForRF, \ + USBCommand_Ctr); } /* @@ -763,7 +762,7 @@ else if(USBCommand_Header == LIBUSB_DONGLE_CMD_HDR) { for(i=0;i<(USBCommand_Ctr-1);i++) - USBCommand_ForDongle[i] = Usb_read_byte(); + USBCommand_ForDongle[i] = Usb_read_byte(); #ifdef FIFO_DEBUG printf("usb command parser\n"); #endif @@ -1039,19 +1038,17 @@ //-------------------------------------------------------------------------- if ((SPI_START) && (spi_enable)) // Wait start { - spi_watchdog_ctr = SPI_WATCHDOG_MAX; - spi_ready = 0; - spi_count = 0; // Reset spi counter - spi_slave = HEADERS; // Set state machine - spi_master = HEADERM; - spi_enable = 0; // Communication in progress + spi_watchdog_ctr = SPI_WATCHDOG_MAX; + spi_ready = 0; + spi_count = 0; // Reset spi counter + spi_slave = HEADERS; // Set state machine + spi_master = HEADERM; + spi_enable = 0; // Communication in progress - SPI_CSn = 0; // Chip select - spi_Start_Flag = 1; - USB_ParserProcess_Permit_Flag = FALSE; - USB_StatusProcess_Permit_Flag = FALSE; - - + SPI_CSn = 0; // Chip select + spi_Start_Flag = 1; + USB_ParserProcess_Permit_Flag = FALSE; + USB_StatusProcess_Permit_Flag = FALSE; } //-------------------------------------------------------------------------- @@ -1061,12 +1058,11 @@ //-------------------------------------------------------------------------- if(spi_Start_Flag) { - //-------------------------------------------------------------------------- // // Excecute When RF Module is Ready // -// Falling Edge on spi_ready +// Falling Edge on spi_ready // //-------------------------------------------------------------------------- if(spi_ready) @@ -1084,23 +1080,26 @@ { if (USBCommand_NewRequest_Flag) // { - spi_slave_config = RF_AUDIO_HDR | RF_CMD_HDR; // Config byte + spi_slave_config = RF_AUDIO_HDR | + RF_CMD_HDR; // Config byte SPDAT = spi_slave_config; // Header byte - // printf ("CMD For RF \n"); } else { - spi_slave_config = RF_AUDIO_HDR; // Config byte - SPDAT = spi_slave_config; // Header byte + // Config byte + spi_slave_config = RF_AUDIO_HDR; + // Header byte + SPDAT = spi_slave_config; } } else { - if (USBCommand_NewRequest_Flag) // + if (USBCommand_NewRequest_Flag) { - - spi_slave_config = RF_CMD_HDR; // Config byte - SPDAT = spi_slave_config; // Header byte + // Config byte + spi_slave_config = RF_CMD_HDR; + // Header byte + SPDAT = spi_slave_config; #ifdef FIFO_DEBUG printf ("CMD For RF \n"); #endif @@ -1119,7 +1118,7 @@ spi_slave = PUT_COMMAND; // Next state if (spi_slave_config & RF_AUDIO_HDR) { - SPDAT = FIFO_SPK_get (); // Get data from FIFO + SPDAT = FIFO_SPK_get(); // Get data from FIFO } else SPDAT = 0x00; // No data to transmit @@ -1138,8 +1137,7 @@ } if (spi_slave_config & RF_CMD_HDR) { - SPDAT =USBCommand_ForRF[spi_count-18]; //0x00; // Get command from buffer - // printf (" %BX ", USBCommand_ForRF[spi_count-18]); + SPDAT =USBCommand_ForRF[spi_count-18]; } else SPDAT = 0x00; // No command to transmit @@ -1177,23 +1175,22 @@ if (spi_master_config & RF_AUDIO_HDR) { P1_0 = 1; - received_data[spi_count-2] = SPDAT; //FIFO_MIC_put(SPDAT); + received_data[spi_count-2] = SPDAT; } - if (spi_count == (spi_lenght_data + 1)) - spi_master = READ_COMMAND; // Go to the next state + // Go to the next state + spi_master = READ_COMMAND; } else if (spi_master == READ_COMMAND) { - while (!(SPSTA == 0x80)) // Wait SPI response + while (!(SPSTA == 0x80)) // Wait SPI response if(RF_OFFLINE) return; if (spi_master_config & RF_CMD_HDR) { - - if (spi_count <= spi_lenght_data + 5) - received_status[spi_count - spi_lenght_data - 2] = SPDAT; + received_status[spi_count - \ + spi_lenght_data - 2] = SPDAT; if (spi_count == spi_lenght_data + 6) { @@ -1214,7 +1211,9 @@ // // Store Sound Data in the FIFO MIC // - if (spi_master_config & (RF_2FRAMES_HDR|RF_AUDIO_HDR)) // Double frame + // Double frame + if (spi_master_config & (RF_2FRAMES_HDR | \ + RF_AUDIO_HDR)) { //Led_0_off(); i = 0; @@ -1222,16 +1221,16 @@ { FIFO_MIC_put(received_data[i]); i++; - }while(i<spi_lenght_data); + } while(i<spi_lenght_data); //Led_0_on(); } // // Store STATUS in the FIFO // - if (spi_master_config & RF_CMD_HDR) // Double frame + if (spi_master_config & RF_CMD_HDR) { if(received_status[0]) - { + { //Led_0_off(); i = 0; do{ Modified: firmware/fuxusb/branches/0.3/modules/usb_enum/USB_ENUM.H =================================================================== --- firmware/fuxusb/branches/0.3/modules/usb_enum/USB_ENUM.H 2008-05-01 12:16:13 UTC (rev 1064) +++ firmware/fuxusb/branches/0.3/modules/usb_enum/USB_ENUM.H 2008-05-02 08:19:25 UTC (rev 1065) @@ -1,461 +1,480 @@ -/*H************************************************************************** - * NAME: usb_cdc_enum.h - *---------------------------------------------------------------------------- - * Copyright (c) 2004 Atmel. - *---------------------------------------------------------------------------- - * RELEASE: c5131-usb-cdc-1_0_2 - * REVISION: 1.2 - *---------------------------------------------------------------------------- - * PURPOSE: - * This file contains the USB task definition - *****************************************************************************/ - -#ifndef _USB_ENUM_H_ -#define _USB_ENUM_H_ - -/*_____ I N C L U D E S ____________________________________________________*/ - - -/*_____ M A C R O S ________________________________________________________*/ - - - - -/*_____ S T A N D A R D R E Q U E S T S ______bRequest____________________*/ - -#define GET_STATUS 0x00 -#define GET_DEVICE 0x01 -#define CLEAR_FEATURE 0x01 /* see FEATURES below */ -#define GET_STRING 0x03 -#define SET_FEATURE 0x03 /* see FEATURES below */ -#define SET_ADDRESS 0x05 -#define GET_DESCRIPTOR 0x06 -#define SET_DESCRIPTOR 0x07 -#define GET_CONFIGURATION 0x08 -#define SET_CONFIGURATION 0x09 -#define GET_INTERFACE 0x0A -#define SET_INTERFACE 0x0B -#define SYNCH_FRAME 0x0C - -/*_____ A U D I O C L A S S R E Q U E S T S_____________________________*/ - -#define SET_CURRENT 0x01 -#define SET_MIN 0x02 -#define SET_MAX 0x03 -#define SET_RES 0x04 - -#define GET_CURRENT 0x81 -#define GET_MIN 0x82 -#define GET_MAX 0x83 -#define GET_RES 0x84 - - -#define GET_DEVICE_DESCRIPTOR 1 -#define GET_CONFIGURATION_DESCRIPTOR 4 - -/* CDC specific */ -#define GET_LINE_CODING 0x21 -#define SET_LINE_CODING 0x20 -#define SET_CONTROL_LINE_STATE 0x22 -#define SEND_BREAK 0x23 -#define SEND_ENCAPSULATED_COMMAND 0x00 -#define GET_ENCAPSULATED_COMMAND 0x01 -/* *** */ - -#define REQUEST_DEVICE_STATUS 0x80 -#define REQUEST_INTERFACE_STATUS 0x81 -#define REQUEST_ENDPOINT_STATUS 0x82 - -#define ZERO_TYPE 0x00 -#define INTERFACE_TYPE 0x01 -#define ENDPOINT_TYPE 0x02 - -/*_____ D E S C R I P T O R T Y P E S ____________________________________*/ - -#define DEVICE 0x01 -#define CONFIGURATION 0x02 -#define STRING 0x03 -#define INTERFACE 0x04 -#define ENDPOINT 0x05 - - -/*_____ S T A N D A R D F E A T U R E S __________________________________*/ - -#define DEVICE_REMOTE_WAKEUP_FEATURE 0x01 -#define ENDPOINT_HALT_FEATURE 0x00 - -/*_____ D E V I C E S T A T U S ___________________________________________*/ - -#define SELF_POWERED 1 - -/*_____ D E V I C E S T A T E _____________________________________________*/ - -#define ATTACHED 0 -#define POWERED 1 -#define DEFAULT 2 -#define ADDRESSED 3 -#define CONFIGURED 4 -#define SUSPENDED 5 - -#define USB_CONFIG_BUSPOWERED 0x80 -#define USB_CONFIG_SELFPOWERED 0x40 -#define USB_CONFIG_REMOTEWAKEUP 0x20 - -/*_____ E N D P O I N T _____________________________________________*/ - -#define OUT_ENDPOINT1 0x01 -#define OUT_ENDPOINT2 0x02 -#define OUT_ENDPOINT3 0x03 -#define OUT_ENDPOINT4 0x04 -#define OUT_ENDPOINT5 0x05 -#define OUT_ENDPOINT6 0x06 - -#define IN_ENDPOINT1 0x81 -#define IN_ENDPOINT2 0x82 -#define IN_ENDPOINT3 0x83 -#define IN_ENDPOINT4 0x84 -#define IN_ENDPOINT5 0x85 -#define IN_ENDPOINT6 0x86 - -/*_________________________________________________________ S T R U C T _____*/ -/*_____ U S B D E V I C E R E Q U E S T _________________________________*/ -struct Endpoint_information_st -{ - Uint16 fifo_size ; /* size of the endpoint FIFO */ - Uint16 fifo_left ; -}; - -struct USB_request_st -{ - Uchar bmRequestType; /* Characteristics of the request */ - Uchar bRequest; /* Specific request */ - Uint16 wValue; /* field that varies according to request */ - Uint16 wIndex; /* field that varies according to request */ - Uint16 wLength; /* Number of bytes to transfer if Data */ -}; - - -/*_____ U S B D E V I C E D E S C R I P T O R ___________________________*/ - -struct usb_st_device_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* DEVICE descriptor type */ - Uint16 bscUSB; /* Binay Coded Decimal Spec. release */ - Uchar bDeviceClass; /* Class code assigned by the USB */ - Uchar bDeviceSubClass; /* Sub-class code assigned by the USB */ - Uchar bDeviceProtocol; /* Protocol code assigned by the USB */ - Uchar bMaxPacketSize0; /* Max packet size for EP0 */ - Uint16 idVendor; /* Vendor ID. ATMEL = 0x03EB */ - Uint16 idProduct; /* Product ID assigned by the manufacturer */ - Uint16 bcdDevice; /* Device release number */ - Uchar iManufacturer; /* Index of manu. string descriptor */ - Uchar iProduct; /* Index of prod. string descriptor */ - Uchar iSerialNumber; /* Index of S.N. string descriptor */ - Uchar bNumConfigurations; /* Number of possible configurations */ -}; - - -/*_____ U S B C O N F I G U R A T I O N D E S C R I P T O R _____________*/ - -struct usb_st_configuration_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* CONFIGURATION descriptor type */ - Uint16 wTotalLength; /* total length of data returned */ - Uchar bNumInterfaces; /* number of interfaces for this conf. */ - Uchar bConfigurationValue; /* value for SetConfiguration resquest */ - Uchar iConfiguration; /* index of string descriptor */ - Uchar bmAttibutes; /* Configuration characteristics */ - Uchar MaxPower; /* maximum power consumption */ -}; - - -/*_____ U S B I N T E R F A C E D E S C R I P T O R _____________________*/ - -struct usb_st_interface_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* INTERFACE descriptor type */ - Uchar bInterfaceNumber; /* Number of interface */ - Uchar bAlternateSetting; /* value to select alternate setting */ - Uchar bNumEndpoints; /* Number of EP except EP 0 */ - Uchar bInterfaceClass; /* Class code assigned by the USB */ - Uchar bInterfaceSubClass; /* Sub-class code assigned by the USB */ - Uchar bInterfaceProtocol; /* Protocol code assigned by the USB */ - Uchar iInterface; /* Index of string descriptor */ -}; - -/*_____ U S B E N D P O I N T D E S C R I P T O R _______________________*/ - -struct usb_st_endpoint_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* ENDPOINT descriptor type */ - Uchar bEndpointAddress; /* Address of the endpoint */ - Uchar bmAttributes; /* Endpoint's attributes */ - Uint16 wMaxPacketSize; /* Maximum packet size for this EP */ - Uchar bInterval; /* Interval for polling EP in ms */ -}; - - -/*_____ U S B M A N U F A C T U R E R D E S C R I P T O R _______________*/ - -struct usb_st_manufacturer -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wstring[USB_MN_LENGTH];/* unicode characters */ -}; - - -/*_____ U S B P R O D U C T D E S C R I P T O R _________________________*/ - -struct usb_st_product -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wstring[USB_PN_LENGTH];/* unicode characters */ -}; - - -/*_____ U S B S E R I A L N U M B E R D E S C R I P T O R _____________*/ - -struct usb_st_serial_number -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wstring[USB_SN_LENGTH];/* unicode characters */ -}; - -/*_____ U S B C O N F I G D E S C R I P T O R _________________________*/ - -struct usb_st_config -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wstring[USB_CONFIG_LENGTH];/* unicode characters */ -}; - -/*_____ U S B L A N G U A G E D E S C R I P T O R ______________________*/ - -struct usb_st_language_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wstring[USB_CONFIG_LENGTH]; /* language id */ -}; - - -/*_____ U S B L A N G U A G E D E S C R I P T O R ______________________*/ - -struct usb_st_speaker_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wstring[AUDIO_SPEAKER_LENGTH]; /* language id */ -}; - -/*_____ U S B L A N G U A G E D E S C R I P T O R ______________________*/ - -struct usb_st_micro_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wstring[AUDIO_MICRO_LENGTH]; /* language id */ -}; - -/*_____ U S B L A N G U A G E D E S C R I P T O R ______________________*/ - -struct usb_st_tts_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wstring[AUDIO_TTS_LENGTH]; /* language id */ /* language id */ -}; - - -struct usb_st_audio_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* STRING descriptor type */ - Uint16 wstring[AUDIO_NORMAL_LENGTH]; /* language id */ /* language id */ -}; - - -/* HID specific */ -/*_____ U S B H I D D E S C R I P T O R __________________________________*/ - -struct usb_st_hid_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* HID descriptor type */ - Uint16 bscHID; /* Binay Coded Decimal Spec. release */ - Uchar bCountryCode; /* Hardware target country */ - Uchar bNumDescriptors; /* Number of HID class descriptors to follow */ - Uchar bRDescriptorType; /* Report descriptor type */ - Uint16 wDescriptorLength; /* Total length of Report descriptor */ -}; - -/* Audio Class specific */ - -/*_____ U S B S T D AUDIO CONTROL I N T E R F A C E D E S C R I P T O R _____________________*/ - -struct usb_Audio_st_ACinterface_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* INTERFACE descriptor type */ - Uchar bInterfaceNumber; /* Number of interface */ - Uchar bAlternateSetting; /* value to select alternate setting */ - Uchar bNumEndpoints; /* Number of EP except EP 0 */ - Uchar bInterfaceClass; /* Class code assigned by the USB */ - Uchar bInterfaceSubClass; /* Sub-class code assigned by the USB */ - Uchar bInterfaceProtocol; /* Protocol code assigned by the USB */ - Uchar iInterface; /* Index of string descriptor */ -}; - -/*_____ U S B C S AUDIO CONTROL I N T E R F A C E D E S C R I P T O R _____________________*/ - -struct usb_Audio_cs_ACinterface_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* HEADER descriptor subtype.*/ - Uint16 bcdADC; /* Audio Device Class Specification Release Number in Binary-Coded Decimal */ - Uint16 wTotalLength; /* Total number of bytes returned for the class-specific AudioControl interface descriptor */ - Uchar bInCollection; /* Number of EP except EP 0 */ - Uchar baInterfaceNr[2]; /* Class code assigned by the USB */ -}; - -struct usb_Audio_cs_ACinterface_descriptor_NbCol1 -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* HEADER descriptor subtype.*/ - Uint16 bcdADC; /* Audio Device Class Specification Release Number in Binary-Coded Decimal */ - Uint16 wTotalLength; /* Total number of bytes returned for the class-specific AudioControl interface descriptor */ - Uchar bInCollection; /* Number of EP except EP 0 */ - Uchar baInterfaceNr[1]; /* Class code assigned by the USB */ -}; - -/*_____ U S B I N P U T T E R M I N A L D E S C R I P T O R ___________________________*/ - -struct usb_Audio_InputTerminal_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* HEADER descriptor subtype.*/ - Uchar bTerminalID; /* CConstant characterizing the type of Termina*/ - Uint16 wTerminalType; /* Constant characterizing the type of Terminal.*/ - Uchar bAssocTerminal; /* ID of the Output Terminal to which this Input Terminal is associated */ - Uchar bNrChannels; /* Number of logical output channels in the Terminals output audio channel cluster. */ - Uint16 wChannelConfig; /* Describes the spatial location of the logical channels.*/ - Uchar iChannelNames; /*Index of a string descriptor, describing the name of the first logical channel */ - Uchar iTerminal; /*Index of a string descriptor, describing the Input Terminal. */ -}; - -/*_____ U S B O U T P U T T E R M I N A L D E S C R I P T O R ___________________________*/ - -struct usb_Audio_OutputTerminal_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* HEADER descriptor subtype.*/ - Uchar bTerminalID; /* CConstant characterizing the type of Termina*/ - Uint16 wTerminalType; /* Constant characterizing the type of Terminal.*/ - Uchar bAssocTerminal; /* ID of the Output Terminal to which this Input Terminal is associated */ - Uchar bSourceID; /*ID of the Unit or Terminal to which this Terminal is connected */ - Uchar iTerminal; /*Index of a string descriptor, describing the Input Terminal. */ -}; - -/*_____ U S B F E A T U R E U N I T D E S C R I P T O R ___________________________*/ - -struct usb_Audio_FeatureUnit_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* HEADER descriptor subtype.*/ - Uchar bUnitID; /* Constant uniquely identifying the Unit within the audio function.*/ - Uchar bSourceID; /* Constant characterizing the type of Terminal.*/ - Uchar bControlSize; /* Size in bytes of an element of the bmaControls() array: n*/ - Uchar bmaControls[2]; /*ID of the Unit or Terminal to which this Terminal is connected */ - Uchar iFeature; /*Index of a string descriptor, describing this Feature Unit.. */ -}; - -/*_____ U S B S T D AUDIO STREAM I N T E R F A C E D E S C R I P T O R _____________________*/ - -struct usb_Audio_st_ASinterface_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* INTERFACE descriptor type */ - Uchar bInterfaceNumber; /* Number of interface */ - Uchar bAlternateSetting; /* value to select alternate setting */ - Uchar bNumEndpoints; /* Number of EP except EP 0 */ - Uchar bInterfaceClass; /* Class code assigned by the USB */ - Uchar bInterfaceSubClass; /* Sub-class code assigned by the USB */ - Uchar bInterfaceProtocol; /* Protocol code assigned by the USB */ - Uchar iInterface; /* Index of string descriptor */ -}; - -/*_____ U S B C S AUDIO STREAM I N T E R F A C E D E S C R I P T O R _____________________*/ - -struct usb_Audio_cs_ASinterface_descriptor -{ - Uchar bLength; /* size of this descriptor in bytes */ - Uchar bDescriptorType; /* INTERFACE descriptor type */ - Uchar bDescriptorSubtype; /* AS_GENERAL descriptor subtype.*/ - Uchar bTerminalLink; /* The Terminal ID of the Terminal to which the endpoint of this interface is connected.*/ - Uchar bDelay; /* Delay (d) introduced by the data path */ - Uint16 wFormatTag; /* Class code assigned by the USB */ -}; - -/*_____ U S B AUDIO ST E N D P O I N T D E S C R I P T O R _______________________*/ - -struct usb_Audio_st_endpoint_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* ENDPOINT descriptor type */ - Uchar bEndpointAddress; /* Address of the endpoint */ - Uchar bmAttributes; /* Endpoint's attributes */ - Uint16 wMaxPacketSize; /* Maximum packet size for this EP */ - Uchar bInterval; /* Interval for polling EP in ms */ - Uchar bRefresh; /* Reset to 0.*/ - Uchar bSynchAddress; /* The address of the endpoint used to communicate synchronization information if required by this endpoint..*/ -}; - -/*_____ U S B AUDIO S T E N D P O I N T D E S C R I P T O R _______________________*/ - -struct usb_Audio_cs_ASendpoint_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* ENDPOINT descriptor type */ - Uchar bDescriptorSubtype; /* EP_GENERAL descriptor subtype. */ - Uchar bmAttributes; /* Endpoint's attributes */ - Uchar bLockDelayUnits; /*Indicates the units used for the wLockDelay field:*/ - Uint16 wLockDelay; /* Reset to 0.*/ -}; - -/*_____ U S B AUDIO S T E N D P O I N T D E S C R I P T O R _______________________*/ - -struct usb_Audio_TYPEI_FormatType_descriptor -{ - Uchar bLength; /* Size of this descriptor in bytes */ - Uchar bDescriptorType; /* ENDPOINT descriptor type */ - Uchar bDescriptorSubtype; /* EP_GENERAL descriptor subtype. */ - Uchar bFormatType; /* FORMAT_TYPE_I. Constant identifying the Format Type the AudioStreaming interface is using.*/ - Uchar bNrChannels; /*Indicates the number of physical channels in the audio data stream.:*/ - Uchar bSubframeSize; /* The number of bytes occupied by one audio subframe. Can be 1, 2, 3 or 4.*/ - Uchar bBitResolution; /* The number of effectively used bits from the available bits in an audio subframe.*/ - Uchar bSamFreqType; /*Indicates how the sampling frequency can be programmed */ - Uchar bSamFreqTbl[3]; /*See sampling frequency tables*/ -}; - -/*_____ D E C L A R A T I O N ______________________________________________*/ - - -void usb_var_init(void); -void usb_ep_init(void); -void usb_enumeration_process(void); - - -#endif /* _USB_ENUM_H_ */ +/*H************************************************************************** + * NAME: usb_cdc_enum.h + *---------------------------------------------------------------------------- + * Copyright (c) 2004 Atmel. + *---------------------------------------------------------------------------- + * RELEASE: c5131-usb-cdc-1_0_2 + * REVISION: 1.2 + *---------------------------------------------------------------------------- + * PURPOSE: + * This file contains the USB task definition + *****************************************************************************/ + +#ifndef _USB_ENUM_H_ +#define _USB_ENUM_H_ + +/*_____ I N C L U D E S ____________________________________________________*/ + + +/*_____ M A C R O S ________________________________________________________*/ + + + + +/*_____ S T A N D A R D R E Q U E S T S ______bRequest____________________*/ + +#define GET_STATUS 0x00 +#define GET_DEVICE 0x01 +#define CLEAR_FEATURE 0x01 /* see FEATURES below */ +#define GET_STRING 0x03 +#define SET_FEATURE 0x03 /* see FEATURES below */ +#define SET_ADDRESS 0x05 +#define GET_DESCRIPTOR 0x06 +#define SET_DESCRIPTOR 0x07 +#define GET_CONFIGURATION 0x08 +#define SET_CONFIGURATION 0x09 +#define GET_INTERFACE 0x0A +#define SET_INTERFACE 0x0B +#define SYNCH_FRAME 0x0C + +/* HID specific */ +#define HID_SET_IDLE 0x0A +#define HID_GET_IDLE 0x02 +/* *** */ + +/*_____ A U D I O C L A S S R E Q U E S T S_____________________________*/ + +#define SET_CURRENT 0x01 +#define SET_MIN 0x02 +#define SET_MAX 0x03 +#define SET_RES 0x04 + +#define GET_CURRENT 0x81 +#define GET_MIN 0x82 +#define GET_MAX 0x83 +#define GET_RES 0x84 + + +#define GET_DEVICE_DESCRIPTOR 1 +#define GET_CONFIGURATION_DESCRIPTOR 4 + +/* CDC specific */ +#define GET_LINE_CODING 0x21 +#define SET_LINE_CODING 0x20 +#define SET_CONTROL_LINE_STATE 0x22 +#define SEND_BREAK 0x23 +#define SEND_ENCAPSULATED_COMMAND 0x00 +#define GET_ENCAPSULATED_COMMAND 0x01 +/* *** */ + +/* HID specific */ +#define HID 0x21 +#define REPORT 0x22 +/* *** */ + +#define REQUEST_DEVICE_STATUS 0x80 +#define REQUEST_INTERFACE_STATUS 0x81 +#define REQUEST_ENDPOINT_STATUS 0x82 + +#define ZERO_TYPE 0x00 +#define INTERFACE_TYPE 0x01 +#define ENDPOINT_TYPE 0x02 + +/*_____ D E S C R I P T O R T Y P E S ____________________________________*/ + +#define DEVICE 0x01 +#define CONFIGURATION 0x02 +#define STRING 0x03 +#define INTERFACE 0x04 +#define ENDPOINT 0x05 + + +/*_____ S T A N D A R D F E A T U R E S __________________________________*/ + +#define DEVICE_REMOTE_WAKEUP_FEATURE 0x01 +#define ENDPOINT_HALT_FEATURE 0x00 + +/*_____ D E V I C E S T A T U S ___________________________________________*/ + +#define SELF_POWERED 1 + +/*_____ D E V I C E S T A T E _____________________________________________*/ + +#define ATTACHED 0 +#define POWERED 1 +#define DEFAULT 2 +#define ADDRESSED 3 +#define CONFIGURED 4 +#define SUSPENDED 5 + +#define USB_CONFIG_BUSPOWERED 0x80 +#define USB_CONFIG_SELFPOWERED 0x40 +#define USB_CONFIG_REMOTEWAKEUP 0x20 + +/*_____ E N D P O I N T _____________________________________________*/ + +#define OUT_ENDPOINT1 0x01 +#define OUT_ENDPOINT2 0x02 +#define OUT_ENDPOINT3 0x03 +#define OUT_ENDPOINT4 0x04 +#define OUT_ENDPOINT5 0x05 +#define OUT_ENDPOINT6 0x06 + +#define IN_ENDPOINT1 0x81 +#define IN_ENDPOINT2 0x82 +#define IN_ENDPOINT3 0x83 +#define IN_ENDPOINT4 0x84 +#define IN_ENDPOINT5 0x85 +#define IN_ENDPOINT6 0x86 + +/*_________________________________________________________ S T R U C T _____*/ +/*_____ U S B D E V I C E R E Q U E S T _________________________________*/ +struct Endpoint_information_st +{ + Uint16 fifo_size ; /* size of the endpoint FIFO */ + Uint16 fifo_left ; +}; + +struct USB_request_st +{ + Uchar bmRequestType; /* Characteristics of the request */ + Uchar bRequest; /* Specific request */ + Uint16 wValue; /* field that varies according to request */ + Uint16 wIndex; /* field that varies according to request */ + Uint16 wLength; /* Number of bytes to transfer if Data */ +}; + + +/*____... [truncated message content] |
From: eFfeM <c2m...@c2...> - 2008-05-01 12:16:10
|
Author: eFfeM Date: 2008-05-01 14:16:13 +0200 (Thu, 01 May 2008) New Revision: 1064 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c Log: factored out some duplicated code to a helper function there are probably more opportunities (but ran out of time) Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-05-01 12:03:23 UTC (rev 1063) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-05-01 12:16:13 UTC (rev 1064) @@ -789,48 +789,50 @@ /** * */ -LIBLOCAL TuxDrvError -tux_cmd_parser_insert_delay_command(float delay, char *cmd_str, bool sys_cmd) +static TuxDrvError +insert_cmd(float delay, char *cmd_str, cmd_stack_t *stack) { TuxDrvError ret = E_TUXDRV_STACKOVERFLOW; int i; double curtime = get_time(); + for (i = 0; i < NRCMDS; i++) + { + if (!strcmp(stack->cmd_list[i].cmd, "")) + { + strcpy(stack->cmd_list[i].cmd, cmd_str); + stack->cmd_list[i].timeout = delay + curtime; + ret = E_TUXDRV_NOERROR; + break; + } + } + return(ret); +} + +/** + * + */ +LIBLOCAL TuxDrvError +tux_cmd_parser_insert_delay_command(float delay, char *cmd_str, bool sys_cmd) +{ + TuxDrvError ret = E_TUXDRV_STACKOVERFLOW; + #ifdef USE_MUTEX mutex_lock(__stack_mutex); #endif if (sys_cmd) { - for (i = 0; i < NRCMDS; i++) - { - if (!strcmp(sys_cmd_stack.cmd_list[i].cmd, "")) - { - strcpy(sys_cmd_stack.cmd_list[i].cmd, cmd_str); - sys_cmd_stack.cmd_list[i].timeout = delay + curtime; - ret = E_TUXDRV_NOERROR; - break; - } - } + ret = insert_cmd(delay, cmd_str, &sys_cmd_stack); } else { - for (i = 0; i < NRCMDS; i++) - { - if (!strcmp(user_cmd_stack.cmd_list[i].cmd, "")) - { - strcpy(user_cmd_stack.cmd_list[i].cmd, cmd_str); - user_cmd_stack.cmd_list[i].timeout = delay + curtime; - ret = E_TUXDRV_NOERROR; - break; - } - } + ret = insert_cmd(delay, cmd_str, &user_cmd_stack); } #ifdef USE_MUTEX mutex_unlock(__stack_mutex); #endif - return ret; } |
From: eFfeM <c2m...@c2...> - 2008-05-01 12:03:18
|
Author: eFfeM Date: 2008-05-01 14:03:23 +0200 (Thu, 01 May 2008) New Revision: 1063 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c Log: removed some unneeded typecasts Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c 2008-05-01 11:58:08 UTC (rev 1062) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c 2008-05-01 12:03:23 UTC (rev 1063) @@ -109,7 +109,7 @@ { if ((val >= 0) && (val <= 255)) { - *(unsigned char *)dest = val; + *dest = val; return true; } } @@ -128,7 +128,7 @@ { if ((val >= -128) && (val <= 127)) { - *(char *)dest = val; + *dest = val; return true; } } @@ -145,7 +145,7 @@ if (r == 1) { - *(int *)dest = val; + *dest = val; return true; } @@ -157,14 +157,14 @@ { if (!strcmp(str, "True")) { - *(bool *)dest = true; + *dest = true; return true; } else { if (!strcmp(str, "False")) { - *(bool *)dest = false; + *dest = false; return true; } } @@ -182,7 +182,7 @@ if (r == 1) { - *(float *)dest = val; + *dest = val; return true; } @@ -201,7 +201,7 @@ { if ((val >= 0) && (val <= 255)) { - *(unsigned char *)dest = val; + *dest = val; return true; } } |
From: eFfeM <c2m...@c2...> - 2008-05-01 11:58:13
|
Author: eFfeM Date: 2008-05-01 13:58:08 +0200 (Thu, 01 May 2008) New Revision: 1062 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c Log: reworked tux_pong.c to using integer values and cleaned up a few things Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c 2008-05-01 09:50:30 UTC (rev 1061) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c 2008-05-01 11:58:08 UTC (rev 1062) @@ -18,57 +18,55 @@ * 02111-1307, USA. */ -#include <math.h> - #include "tux_hw_status.h" #include "tux_hw_cmd.h" #include "tux_pong.h" #include "tux_sw_status.h" #include "tux_usb.h" -static unsigned char received_pong = 0; -static float average_stack[10]; +#define STACK_SIZE 10 + +static int average_stack[STACK_SIZE]; static unsigned char stack_idx = 0; static unsigned char stack_fill_count = 0; -static unsigned char get_count = 0; /** * */ static void -stack_insert(float value) +stack_insert(int value) { - if (value > 100.0) + if (value > 100) { - value = 100.0; + value = 100; } average_stack[stack_idx] = value; stack_idx++; - if (stack_fill_count < 10) + if (stack_fill_count < STACK_SIZE) { stack_fill_count++; } - stack_idx %= 10; + stack_idx %= STACK_SIZE; } /** * */ -static float +static int stack_average(void) { unsigned char i; - float average = 0.0; + int average = 0; for (i = 0; i < stack_fill_count; i++) { average += average_stack[i]; } - return (average / (stack_fill_count * 1.0)); + return (average / stack_fill_count); } /** @@ -77,24 +75,20 @@ LIBLOCAL void tux_pong_update(void) { - unsigned char new_pending; - float average; - float local_average; - float last_average; + static unsigned char received_pong = 0; + int average; + int last_average; received_pong++; - new_pending = hw_status_table.pong.pongs_pending_number; - if (new_pending <= 190) + if (hw_status_table.pong.pongs_pending_number <= 190) { - local_average = received_pong * 10.0; - - if (local_average > 10.0) + if (received_pong > 1) { - stack_insert(local_average); + stack_insert(received_pong * 10); average = stack_average(); - last_average = *(float *)tux_sw_status_get_value(SW_ID_CONNECTION_QUALITY); - if (fabs(last_average - average) >= 1.0) + last_average = *(int *)tux_sw_status_get_value(SW_ID_CONNECTION_QUALITY); + if (average != last_average) { tux_sw_status_set_value(SW_ID_CONNECTION_QUALITY, (void *)&average, true); @@ -110,8 +104,9 @@ LIBLOCAL void tux_pong_get(void) { - unsigned char frame[TUX_SEND_LENGTH - 1] = { TUX_PONG_PING_CMD, - 200, 0, 0}; + static unsigned char get_count = 0; + const unsigned char frame[TUX_SEND_LENGTH - 1] = + { TUX_PONG_PING_CMD, 200, 0, 0}; get_count++; Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c 2008-05-01 09:50:30 UTC (rev 1061) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c 2008-05-01 11:58:08 UTC (rev 1062) @@ -211,8 +211,8 @@ tux_sw_status_set_value(SW_ID_RIGHT_LED_STATE, STRING_VALUE_OFF, false); - init_status_struct(SW_ID_CONNECTION_QUALITY, ID_FMT_FLOAT, - "connection_quality", "range[0.0..100.0]"); + init_status_struct(SW_ID_CONNECTION_QUALITY, ID_FMT_INT, + "connection_quality", "range[0..100]"); init_status_struct(SW_ID_AUDIO_FLASH_PLAY, ID_FMT_STRING, "audio_flash_play", "TRACK_<range[0..255]>|STOP"); |
From: eFfeM <c2m...@c2...> - 2008-05-01 09:57:43
|
Author: eFfeM Date: 2008-05-01 11:45:51 +0200 (Thu, 01 May 2008) New Revision: 1060 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c Log: some more changes caused by moving to mV Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-05-01 08:35:38 UTC (rev 1059) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-05-01 09:45:51 UTC (rev 1060) @@ -18,7 +18,6 @@ * 02111-1307, USA. */ -#include <math.h> #include <string.h> #include "tux_battery.h" @@ -35,7 +34,7 @@ } battery_state_t; static battery_state_t battery_state = EMPTY; -static float last_level_for_event = 0.0; +static int last_level_for_event = 0; /** * Update the status of the battery voltage. @@ -48,6 +47,7 @@ int adc_value; char *new_state_str = ""; char *old_state_str = ""; + int delta; adc_value = (hw_status_table.battery.high_level << 8); adc_value += hw_status_table.battery.low_level; @@ -58,7 +58,8 @@ old_level = *(int *)tux_sw_status_get_value(SW_ID_BATTERY_LEVEL); - if (fabs(new_level - last_level_for_event) > 0.1) + delta = new_level - last_level_for_event; + if ((delta > 100) || (delta < -100)) { last_level_for_event = new_level; if (!hw_status_table.battery.motors_state) |
From: eFfeM <c2m...@c2...> - 2008-05-01 09:56:42
|
Author: eFfeM Date: 2008-05-01 11:50:30 +0200 (Thu, 01 May 2008) New Revision: 1061 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c Log: turned constant for reporting treshold into a macro Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-05-01 09:45:51 UTC (rev 1060) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-05-01 09:50:30 UTC (rev 1061) @@ -33,6 +33,13 @@ EMPTY } battery_state_t; +/* + REPORTING_DELTA is the treshold value for changes; + changes smaller than this value are not reported + might become a controllable parameter in the future +*/ +#define REPORTING_DELTA 100 + static battery_state_t battery_state = EMPTY; static int last_level_for_event = 0; @@ -59,7 +66,7 @@ old_level = *(int *)tux_sw_status_get_value(SW_ID_BATTERY_LEVEL); delta = new_level - last_level_for_event; - if ((delta > 100) || (delta < -100)) + if ((delta > REPORTING_DELTA) || (delta < -REPORTING_DELTA)) { last_level_for_event = new_level; if (!hw_status_table.battery.motors_state) |
From: eFfeM <c2m...@c2...> - 2008-05-01 08:35:35
|
Author: eFfeM Date: 2008-05-01 10:35:38 +0200 (Thu, 01 May 2008) New Revision: 1059 Modified: software_suite_v2/middleware/tuxdriver/trunk/include/tux_driver.pas Log: changed to unix lf instead of dos cr/lf (like all other files) Modified: software_suite_v2/middleware/tuxdriver/trunk/include/tux_driver.pas =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/include/tux_driver.pas 2008-05-01 07:55:29 UTC (rev 1058) +++ software_suite_v2/middleware/tuxdriver/trunk/include/tux_driver.pas 2008-05-01 08:35:38 UTC (rev 1059) @@ -1,227 +1,227 @@ -{* - * Tux Droid - Driver - * Copyright (C) 2008 C2ME Sa - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - *} - -unit tux_driver; - -interface - -uses - Windows, classes; - -const - - DLL_NAME = 'tux_driver.dll'; - - {** - * Error codes enumeration. - *} - E_TUXDRV_BEGIN = 256; - E_TUXDRV_NOERROR = 0; - E_TUXDRV_PARSERISDISABLED = E_TUXDRV_BEGIN; - E_TUXDRV_INVALIDCOMMAND = E_TUXDRV_BEGIN + 1; - E_TUXDRV_STACKOVERFLOW = E_TUXDRV_BEGIN + 2; - E_TUXDRV_FILEERROR = E_TUXDRV_BEGIN + 3; - E_TUXDRV_BADWAVFILE = E_TUXDRV_BEGIN + 4; - E_TUXDRV_INVALIDIDENTIFIER = E_TUXDRV_BEGIN + 5; - E_TUXDRV_INVALIDNAME = E_TUXDRV_BEGIN + 6; - E_TUXDRV_INVALIDPARAMETER = E_TUXDRV_BEGIN + 7; - E_TUXDRV_BUSY = E_TUXDRV_BEGIN + 8; - E_TUXDRV_WAVSIZEEXCEDED = E_TUXDRV_BEGIN + 9; - - {** - * Id enumeration of high level status. - *} - SW_ID_WINGS_POSITION = 0; - SW_ID_WINGS_REMAINING_MVM = 1; - SW_ID_SPINNING_DIRECTION = 2; - SW_ID_SPINNING_REMAINING_MVM = 3; - SW_ID_LEFT_WING_BUTTON = 4; - SW_ID_RIGHT_WING_BUTTON = 5; - SW_ID_HEAD_BUTTON = 6; - SW_ID_REMOTE_BUTTON = 7; - SW_ID_MOUTH_POSITION = 8; - SW_ID_MOUTH_REMAINING_MVM = 9; - SW_ID_EYES_POSITION = 10; - SW_ID_EYES_REMAINING_MVM = 11; - SW_ID_DESCRIPTOR_COMPLETE = 12; - SW_ID_RF_STATE = 13; - SW_ID_DONGLE_PLUG = 14; - SW_ID_CHARGER_STATE = 15; - SW_ID_BATTERY_LEVEL = 16; - SW_ID_BATTERY_STATE = 17; - SW_ID_LIGHT_LEVEL = 18; - SW_ID_LEFT_LED_STATE = 19; - SW_ID_RIGHT_LED_STATE = 20; - SW_ID_CONNECTION_QUALITY = 21; - SW_ID_AUDIO_FLASH_PLAY = 22; - SW_ID_AUDIO_GENERAL_PLAY = 23; - SW_ID_FLASH_PROG_CURR_TRACK = 24; - SW_ID_FLASH_PROG_LAST_TRACK_SIZE = 25; - SW_ID_TUXCORE_SYMBOLIC_VERSION = 26; - SW_ID_TUXAUDIO_SYMBOLIC_VERSION = 27; - SW_ID_FUXUSB_SYMBOLIC_VERSION = 28; - SW_ID_FUXRF_SYMBOLIC_VERSION = 29; - SW_ID_TUXRF_SYMBOLIC_VERSION = 30; - SW_ID_DRIVER_SYMBOLIC_VERSION = 31; - SW_ID_SOUND_REFLASH_BEGIN = 32; - SW_ID_SOUND_REFLASH_END = 33; - SW_ID_SOUND_REFLASH_CURRENT_TRACK = 34; - -type - - {** - * Simple callback definition. - *} - drv_simple_callback_t = procedure; - - {** - * Status callback definition. - *} - drv_status_callback_t = procedure(status:PChar); cdecl; - - {** - * Logging target - *} - log_target_t = ( - LOG_TARGET_TUX = 0, - LOG_TARGET_SHELL - ); - - {** - * Logging levels, in increasing priorities - *} - log_level_t = ( - LOG_LEVEL_DEBUG = 0, - LOG_LEVEL_INFO, - LOG_LEVEL_WARNING, - LOG_LEVEL_ERROR, - LOG_LEVEL_NONE - ); - - {** - * Descriptor structure of a firmaware. - *} - p_firmware_descriptor_t = ^firmware_descriptor_t; - firmware_descriptor_t = packed record - cpu_id : integer; - version_major : cardinal; - version_minor : cardinal; - version_update : cardinal; - revision : cardinal; - rlmmr : cardinal; - author : cardinal; - variation : cardinal; - version_string : packed array[0..255] of char; - end; - - {** - * Descriptor structure of sound flash. - *} - p_sound_flash_descriptor_t = ^sound_flash_descriptor_t; - sound_flash_descriptor_t = packed record - number_of_sounds : cardinal; - flash_usage : cardinal; - available_record_time : cardinal; - end; - - {** - * Descriptor structure of ID connection. - *} - p_id_descriptor_t = ^id_descriptor_t; - id_descriptor_t = packed record - number : cardinal; - end; - - {** - * Global descriptor structure of tuxdroid. - *} - p_tux_descriptor_t = ^tux_descriptor_t; - tux_descriptor_t = packed record - firmwares : packed record - package : p_firmware_descriptor_t; - tuxcore : p_firmware_descriptor_t; - tuxaudio : p_firmware_descriptor_t; - tuxrf : p_firmware_descriptor_t; - fuxrf : p_firmware_descriptor_t; - fuxusb : p_firmware_descriptor_t; - end; - driver : packed record - version_major : cardinal; - version_minor : cardinal; - version_update : cardinal; - version_build : cardinal; - version_state : packed array[0..99] of char; - version_string : packed array[0..99] of char; - end; - sound_flash : p_sound_flash_descriptor_t; - id : p_id_descriptor_t; - end; - -{** - * DLL static linkage. - *} -procedure TuxDrv_Start; cdecl; - external DLL_NAME name 'TuxDrv_Start'; -procedure TuxDrv_Stop; cdecl; - external DLL_NAME name 'TuxDrv_Stop'; -procedure TuxDrv_SetStatusCallback(funct:drv_status_callback_t); cdecl; - external DLL_NAME name 'TuxDrv_SetStatusCallback'; -procedure TuxDrv_SetEndCycleCallback(funct:drv_simple_callback_t); cdecl; - external DLL_NAME name 'TuxDrv_SetEndCycleCallback'; -procedure TuxDrv_SetDongleConnectedCallback(funct:drv_simple_callback_t); cdecl; - external DLL_NAME name 'TuxDrv_SetDongleConnectedCallback'; -procedure TuxDrv_SetDongleDisconnectedCallback(funct:drv_simple_callback_t); cdecl; - external DLL_NAME name 'TuxDrv_SetDongleDisconnectedCallback'; -function TuxDrv_PerformCommand(delay:real; cmd_str:PChar):integer; cdecl; - external DLL_NAME name 'TuxDrv_PerformCommand'; -function TuxDrv_PerformMacroFile(file_path:PChar):integer; cdecl; - external DLL_NAME name 'TuxDrv_PerformMacroFile'; -function TuxDrv_PerformMacroText(macro:PChar):integer; cdecl; - external DLL_NAME name 'TuxDrv_PerformMacroText'; -function TuxDrv_GetStatusName(id:integer; name:PChar):integer; cdecl; - external DLL_NAME name 'TuxDrv_GetStatusName'; -function TuxDrv_GetStatusValue(id:integer; value:PChar):integer; cdecl; - external DLL_NAME name 'TuxDrv_GetStatusValue'; -function TuxDrv_GetStatusId(name:PChar; var id:integer):integer; cdecl; - external DLL_NAME name 'TuxDrv_GetStatusId'; -procedure TuxDrv_ClearCommandStack; cdecl; - external DLL_NAME name 'TuxDrv_ClearCommandStack'; -function TuxDrv_GetStatusState(id:integer; state:PChar):integer; cdecl; - external DLL_NAME name 'TuxDrv_GetStatusState'; -procedure TuxDrv_GetAllStatusState(state:PChar); cdecl; - external DLL_NAME name 'TuxDrv_GetAllStatusState'; -function TuxDrv_SoundReflash(tracks:PChar):integer; cdecl; - external DLL_NAME name 'TuxDrv_SoundReflash'; -procedure TuxDrv_ResetPositions; cdecl; - external DLL_NAME name 'TuxDrv_ResetPositions'; -procedure TuxDrv_ResetDongle; cdecl; - external DLL_NAME name 'TuxDrv_ResetDongle'; -procedure TuxDrv_SetLogLevel(level:integer); cdecl; - external DLL_NAME name 'TuxDrv_SetLogLevel'; -procedure TuxDrv_SetLogTarget(target:integer); cdecl; - external DLL_NAME name 'TuxDrv_SetLogTarget'; -procedure TuxDrv_GetDescriptor(tux_desc:p_tux_descriptor_t); cdecl; - external DLL_NAME name 'TuxDrv_GetDescriptor'; -function TuxDrv_StrError(error_code:integer):PChar; cdecl; - external DLL_NAME name 'TuxDrv_StrError'; - -implementation - -end. +{* + * Tux Droid - Driver + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + *} + +unit tux_driver; + +interface + +uses + Windows, classes; + +const + + DLL_NAME = 'tux_driver.dll'; + + {** + * Error codes enumeration. + *} + E_TUXDRV_BEGIN = 256; + E_TUXDRV_NOERROR = 0; + E_TUXDRV_PARSERISDISABLED = E_TUXDRV_BEGIN; + E_TUXDRV_INVALIDCOMMAND = E_TUXDRV_BEGIN + 1; + E_TUXDRV_STACKOVERFLOW = E_TUXDRV_BEGIN + 2; + E_TUXDRV_FILEERROR = E_TUXDRV_BEGIN + 3; + E_TUXDRV_BADWAVFILE = E_TUXDRV_BEGIN + 4; + E_TUXDRV_INVALIDIDENTIFIER = E_TUXDRV_BEGIN + 5; + E_TUXDRV_INVALIDNAME = E_TUXDRV_BEGIN + 6; + E_TUXDRV_INVALIDPARAMETER = E_TUXDRV_BEGIN + 7; + E_TUXDRV_BUSY = E_TUXDRV_BEGIN + 8; + E_TUXDRV_WAVSIZEEXCEDED = E_TUXDRV_BEGIN + 9; + + {** + * Id enumeration of high level status. + *} + SW_ID_WINGS_POSITION = 0; + SW_ID_WINGS_REMAINING_MVM = 1; + SW_ID_SPINNING_DIRECTION = 2; + SW_ID_SPINNING_REMAINING_MVM = 3; + SW_ID_LEFT_WING_BUTTON = 4; + SW_ID_RIGHT_WING_BUTTON = 5; + SW_ID_HEAD_BUTTON = 6; + SW_ID_REMOTE_BUTTON = 7; + SW_ID_MOUTH_POSITION = 8; + SW_ID_MOUTH_REMAINING_MVM = 9; + SW_ID_EYES_POSITION = 10; + SW_ID_EYES_REMAINING_MVM = 11; + SW_ID_DESCRIPTOR_COMPLETE = 12; + SW_ID_RF_STATE = 13; + SW_ID_DONGLE_PLUG = 14; + SW_ID_CHARGER_STATE = 15; + SW_ID_BATTERY_LEVEL = 16; + SW_ID_BATTERY_STATE = 17; + SW_ID_LIGHT_LEVEL = 18; + SW_ID_LEFT_LED_STATE = 19; + SW_ID_RIGHT_LED_STATE = 20; + SW_ID_CONNECTION_QUALITY = 21; + SW_ID_AUDIO_FLASH_PLAY = 22; + SW_ID_AUDIO_GENERAL_PLAY = 23; + SW_ID_FLASH_PROG_CURR_TRACK = 24; + SW_ID_FLASH_PROG_LAST_TRACK_SIZE = 25; + SW_ID_TUXCORE_SYMBOLIC_VERSION = 26; + SW_ID_TUXAUDIO_SYMBOLIC_VERSION = 27; + SW_ID_FUXUSB_SYMBOLIC_VERSION = 28; + SW_ID_FUXRF_SYMBOLIC_VERSION = 29; + SW_ID_TUXRF_SYMBOLIC_VERSION = 30; + SW_ID_DRIVER_SYMBOLIC_VERSION = 31; + SW_ID_SOUND_REFLASH_BEGIN = 32; + SW_ID_SOUND_REFLASH_END = 33; + SW_ID_SOUND_REFLASH_CURRENT_TRACK = 34; + +type + + {** + * Simple callback definition. + *} + drv_simple_callback_t = procedure; + + {** + * Status callback definition. + *} + drv_status_callback_t = procedure(status:PChar); cdecl; + + {** + * Logging target + *} + log_target_t = ( + LOG_TARGET_TUX = 0, + LOG_TARGET_SHELL + ); + + {** + * Logging levels, in increasing priorities + *} + log_level_t = ( + LOG_LEVEL_DEBUG = 0, + LOG_LEVEL_INFO, + LOG_LEVEL_WARNING, + LOG_LEVEL_ERROR, + LOG_LEVEL_NONE + ); + + {** + * Descriptor structure of a firmaware. + *} + p_firmware_descriptor_t = ^firmware_descriptor_t; + firmware_descriptor_t = packed record + cpu_id : integer; + version_major : cardinal; + version_minor : cardinal; + version_update : cardinal; + revision : cardinal; + rlmmr : cardinal; + author : cardinal; + variation : cardinal; + version_string : packed array[0..255] of char; + end; + + {** + * Descriptor structure of sound flash. + *} + p_sound_flash_descriptor_t = ^sound_flash_descriptor_t; + sound_flash_descriptor_t = packed record + number_of_sounds : cardinal; + flash_usage : cardinal; + available_record_time : cardinal; + end; + + {** + * Descriptor structure of ID connection. + *} + p_id_descriptor_t = ^id_descriptor_t; + id_descriptor_t = packed record + number : cardinal; + end; + + {** + * Global descriptor structure of tuxdroid. + *} + p_tux_descriptor_t = ^tux_descriptor_t; + tux_descriptor_t = packed record + firmwares : packed record + package : p_firmware_descriptor_t; + tuxcore : p_firmware_descriptor_t; + tuxaudio : p_firmware_descriptor_t; + tuxrf : p_firmware_descriptor_t; + fuxrf : p_firmware_descriptor_t; + fuxusb : p_firmware_descriptor_t; + end; + driver : packed record + version_major : cardinal; + version_minor : cardinal; + version_update : cardinal; + version_build : cardinal; + version_state : packed array[0..99] of char; + version_string : packed array[0..99] of char; + end; + sound_flash : p_sound_flash_descriptor_t; + id : p_id_descriptor_t; + end; + +{** + * DLL static linkage. + *} +procedure TuxDrv_Start; cdecl; + external DLL_NAME name 'TuxDrv_Start'; +procedure TuxDrv_Stop; cdecl; + external DLL_NAME name 'TuxDrv_Stop'; +procedure TuxDrv_SetStatusCallback(funct:drv_status_callback_t); cdecl; + external DLL_NAME name 'TuxDrv_SetStatusCallback'; +procedure TuxDrv_SetEndCycleCallback(funct:drv_simple_callback_t); cdecl; + external DLL_NAME name 'TuxDrv_SetEndCycleCallback'; +procedure TuxDrv_SetDongleConnectedCallback(funct:drv_simple_callback_t); cdecl; + external DLL_NAME name 'TuxDrv_SetDongleConnectedCallback'; +procedure TuxDrv_SetDongleDisconnectedCallback(funct:drv_simple_callback_t); cdecl; + external DLL_NAME name 'TuxDrv_SetDongleDisconnectedCallback'; +function TuxDrv_PerformCommand(delay:real; cmd_str:PChar):integer; cdecl; + external DLL_NAME name 'TuxDrv_PerformCommand'; +function TuxDrv_PerformMacroFile(file_path:PChar):integer; cdecl; + external DLL_NAME name 'TuxDrv_PerformMacroFile'; +function TuxDrv_PerformMacroText(macro:PChar):integer; cdecl; + external DLL_NAME name 'TuxDrv_PerformMacroText'; +function TuxDrv_GetStatusName(id:integer; name:PChar):integer; cdecl; + external DLL_NAME name 'TuxDrv_GetStatusName'; +function TuxDrv_GetStatusValue(id:integer; value:PChar):integer; cdecl; + external DLL_NAME name 'TuxDrv_GetStatusValue'; +function TuxDrv_GetStatusId(name:PChar; var id:integer):integer; cdecl; + external DLL_NAME name 'TuxDrv_GetStatusId'; +procedure TuxDrv_ClearCommandStack; cdecl; + external DLL_NAME name 'TuxDrv_ClearCommandStack'; +function TuxDrv_GetStatusState(id:integer; state:PChar):integer; cdecl; + external DLL_NAME name 'TuxDrv_GetStatusState'; +procedure TuxDrv_GetAllStatusState(state:PChar); cdecl; + external DLL_NAME name 'TuxDrv_GetAllStatusState'; +function TuxDrv_SoundReflash(tracks:PChar):integer; cdecl; + external DLL_NAME name 'TuxDrv_SoundReflash'; +procedure TuxDrv_ResetPositions; cdecl; + external DLL_NAME name 'TuxDrv_ResetPositions'; +procedure TuxDrv_ResetDongle; cdecl; + external DLL_NAME name 'TuxDrv_ResetDongle'; +procedure TuxDrv_SetLogLevel(level:integer); cdecl; + external DLL_NAME name 'TuxDrv_SetLogLevel'; +procedure TuxDrv_SetLogTarget(target:integer); cdecl; + external DLL_NAME name 'TuxDrv_SetLogTarget'; +procedure TuxDrv_GetDescriptor(tux_desc:p_tux_descriptor_t); cdecl; + external DLL_NAME name 'TuxDrv_GetDescriptor'; +function TuxDrv_StrError(error_code:integer):PChar; cdecl; + external DLL_NAME name 'TuxDrv_StrError'; + +implementation + +end. |
From: eFfeM <c2m...@c2...> - 2008-05-01 07:55:35
|
Author: eFfeM Date: 2008-05-01 09:55:29 +0200 (Thu, 01 May 2008) New Revision: 1058 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c Log: made battery value an integer value (in mV) Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-04-30 17:56:55 UTC (rev 1057) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-05-01 07:55:29 UTC (rev 1058) @@ -43,17 +43,20 @@ LIBLOCAL void tux_battery_update_level(void) { - float new_level = 0.0; - float old_level = 0.0; + int new_level = 0; + int old_level = 0; int adc_value; char *new_state_str = ""; char *old_state_str = ""; adc_value = (hw_status_table.battery.high_level << 8); adc_value += hw_status_table.battery.low_level; - new_level = adc_value * 0.00322 * 2.319; + new_level = adc_value * 7.467; + /* 7.467 = 0.00322 * 2.319 * 1000 no idea where the first two are from + 1000 is to go to mV + */ - old_level = *(float *)tux_sw_status_get_value(SW_ID_BATTERY_LEVEL); + old_level = *(int *)tux_sw_status_get_value(SW_ID_BATTERY_LEVEL); if (fabs(new_level - last_level_for_event) > 0.1) { Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.h 2008-04-30 17:56:55 UTC (rev 1057) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.h 2008-05-01 07:55:29 UTC (rev 1058) @@ -21,10 +21,11 @@ #ifndef _TUX_BATTERY_H_ #define _TUX_BATTERY_H_ -#define TUX_BATTERY_FULL_VALUE 6.0 -#define TUX_BATTERY_HIGH_VALUE 5.4 -#define TUX_BATTERY_LOW_VALUE 4.5 -#define TUX_BATTERY_EMPTY_VALUE 0.0 +/* values are in mV */ +#define TUX_BATTERY_FULL_VALUE 6000 +#define TUX_BATTERY_HIGH_VALUE 5400 +#define TUX_BATTERY_LOW_VALUE 4500 +#define TUX_BATTERY_EMPTY_VALUE 0000 extern void tux_battery_update_level(void); Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c 2008-04-30 17:56:55 UTC (rev 1057) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c 2008-05-01 07:55:29 UTC (rev 1058) @@ -190,8 +190,8 @@ tux_sw_status_set_value(SW_ID_CHARGER_STATE, STRING_VALUE_UNPLUGGED, false); - init_status_struct(SW_ID_BATTERY_LEVEL, ID_FMT_FLOAT, - "battery_level", "range[4.0..6.5]"); + init_status_struct(SW_ID_BATTERY_LEVEL, ID_FMT_INT, + "battery_level", "range[4000..6500] (mV)"); init_status_struct(SW_ID_BATTERY_STATE, ID_FMT_STRING, "battery_state", "EMPTY|LOW|HIGH|FULL"); |
From: eFfeM <c2m...@c2...> - 2008-04-30 17:56:50
|
Author: eFfeM Date: 2008-04-30 19:56:55 +0200 (Wed, 30 Apr 2008) New Revision: 1057 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c Log: replaced sprintf(str, "%s", data) with strcpy(str, data); removed two local variables in tux_sw_status.c Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c 2008-04-30 17:52:28 UTC (rev 1056) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c 2008-04-30 17:56:55 UTC (rev 1057) @@ -396,7 +396,7 @@ if (waveOutGetDevCapsA(def_idx, &wa_device, sizeof(wa_device)) == 0) { - sprintf(name, "%s", wa_device.szPname); + strcpy(name, wa_device.szPname); return true; } Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c 2008-04-30 17:52:28 UTC (rev 1056) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c 2008-04-30 17:56:55 UTC (rev 1057) @@ -349,9 +349,6 @@ static void get_status_value_str(int id, char *str) { - char *bool_true = "True"; - char *bool_false = "False"; - #ifdef USE_MUTEX mutex_lock(__status_mutex); #endif @@ -359,11 +356,11 @@ case ID_FMT_BOOL: if (*(unsigned char *)sw_status_table[id].value) { - sprintf(str, "%s", bool_true); + strcpy(str, "True"); } else { - sprintf(str, "%s", bool_false); + strcpy(str, "False"); } break; case ID_FMT_UINT8: @@ -380,7 +377,7 @@ sprintf(str, "%f", *(float *)sw_status_table[id].value); break; case ID_FMT_STRING: - sprintf(str, "%s", (char *)sw_status_table[id].value); + strcpy(str, (char *)sw_status_table[id].value); break; default: break; |