From 6df2768653904db3510864cf7de7d30cc2e42b1d Mon Sep 17 00:00:00 2001 From: bossiel Date: Wed, 3 Feb 2010 09:07:46 +0000 Subject: [PATCH] Update android support. --- trunk/android-projects/tinyNET/.project | 94 +++++ trunk/android-projects/tinyNET/makefile | 11 + trunk/android-projects/tinySAK/.cproject | 364 +----------------- .../Android Builder.launch | 4 +- trunk/android-projects/tinySAK/.project | 9 +- .../.settings/org.eclipse.cdt.core.prefs | 3 + trunk/android-projects/tinySAK/makefile | 48 +-- trunk/tinyNET/src/makefile | 58 +++ trunk/tinyNET/test/makefile | 28 ++ trunk/tinyNET/test/stdafx.h | 2 +- trunk/tinyNET/test/test.c | 6 +- trunk/tinyNET/test/test_dns.h | 2 +- trunk/tinyNET/test/test_nat.h | 2 +- trunk/tinyNET/test/test_sockets.h | 2 +- trunk/tinyNET/test/test_stun.h | 2 +- trunk/tinyNET/test/test_transport.h | 2 +- trunk/tinySAK/src/tinySAK_config.h | 2 +- trunk/tinySAK/src/tsk_buffer.c | 2 +- trunk/tinySAK/src/tsk_semaphore.c | 3 + trunk/tinySAK/src/tsk_string.c | 2 +- trunk/tinySAK/test/makefile | 2 +- trunk/tinySAK/test/test.c | 6 +- trunk/tinySAK/test/test_buffer.h | 6 +- trunk/tinySAK/test/test_params.h | 8 +- trunk/tinySAK/test/test_semaphore.h | 14 +- trunk/tinySAK/test/test_timer.h | 2 +- 26 files changed, 250 insertions(+), 434 deletions(-) create mode 100644 trunk/android-projects/tinyNET/.project create mode 100644 trunk/android-projects/tinyNET/makefile create mode 100644 trunk/android-projects/tinySAK/.settings/org.eclipse.cdt.core.prefs create mode 100644 trunk/tinyNET/src/makefile create mode 100644 trunk/tinyNET/test/makefile diff --git a/trunk/android-projects/tinyNET/.project b/trunk/android-projects/tinyNET/.project new file mode 100644 index 00000000..41c714bf --- /dev/null +++ b/trunk/android-projects/tinyNET/.project @@ -0,0 +1,94 @@ + + + tinyNET + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.autoBuildTarget + all + + + org.eclipse.cdt.make.core.buildArguments + OPTIONS="-O0 -g3 -DDEBUG_LEVEL=DEBUG_LEVEL_INFO" + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.cleanBuildTarget + clean + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.fullBuildTarget + all + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + false + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + root.mk + 1 + C:/Projects/Doubango/android-projects/root.mk + + + src + 2 + C:/Projects/Doubango/tinyNET/src + + + test + 2 + C:/Projects/Doubango/tinyNET/test + + + diff --git a/trunk/android-projects/tinyNET/makefile b/trunk/android-projects/tinyNET/makefile new file mode 100644 index 00000000..b9fc5488 --- /dev/null +++ b/trunk/android-projects/tinyNET/makefile @@ -0,0 +1,11 @@ +include ../root.mk + +export PROJECT=tinyNET + +all: + (cd $(DOUBANGO_HOME)/$(PROJECT)/src ; $(MAKE) all; $(MAKE) install; cp lib$(PROJECT).so $(OUTPUT_DIR)) + (cd $(DOUBANGO_HOME)/$(PROJECT)/test; $(MAKE) all; $(MAKE) install; cp test $(OUTPUT_DIR)) + +clean: + (cd $(DOUBANGO_HOME)/$(PROJECT)/src; $(MAKE) clean) + (cd $(DOUBANGO_HOME)/$(PROJECT)/test; $(MAKE) clean) \ No newline at end of file diff --git a/trunk/android-projects/tinySAK/.cproject b/trunk/android-projects/tinySAK/.cproject index 57100040..c9d128ea 100644 --- a/trunk/android-projects/tinySAK/.cproject +++ b/trunk/android-projects/tinySAK/.cproject @@ -3,360 +3,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - @@ -368,10 +21,11 @@ - - + + + @@ -703,9 +357,11 @@ + + + - @@ -717,7 +373,7 @@ - + diff --git a/trunk/android-projects/tinySAK/.externalToolBuilders/Android Builder.launch b/trunk/android-projects/tinySAK/.externalToolBuilders/Android Builder.launch index 34cfbcb2..9013d5c5 100644 --- a/trunk/android-projects/tinySAK/.externalToolBuilders/Android Builder.launch +++ b/trunk/android-projects/tinySAK/.externalToolBuilders/Android Builder.launch @@ -1,7 +1,9 @@ + + - + diff --git a/trunk/android-projects/tinySAK/.project b/trunk/android-projects/tinySAK/.project index 88568d34..a2e0ae2e 100644 --- a/trunk/android-projects/tinySAK/.project +++ b/trunk/android-projects/tinySAK/.project @@ -23,11 +23,11 @@ org.eclipse.cdt.make.core.buildArguments - DEBUG="-O0 -g -DDEBUG" -j1 + OPTIONS="-O0 -g3 -DDEBUG_LEVEL=DEBUG_LEVEL_INFO" -j1 org.eclipse.cdt.make.core.buildCommand - C:\Cygwin\bin\make + make org.eclipse.cdt.make.core.cleanBuildTarget @@ -85,6 +85,11 @@ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + root.mk + 1 + C:/Projects/Doubango/android-projects/root.mk + src 2 diff --git a/trunk/android-projects/tinySAK/.settings/org.eclipse.cdt.core.prefs b/trunk/android-projects/tinySAK/.settings/org.eclipse.cdt.core.prefs new file mode 100644 index 00000000..08e7bfc6 --- /dev/null +++ b/trunk/android-projects/tinySAK/.settings/org.eclipse.cdt.core.prefs @@ -0,0 +1,3 @@ +#Wed Feb 03 07:28:49 CET 2010 +eclipse.preferences.version=1 +environment/project/0.1008589285.2066038921=\r\n\r\n diff --git a/trunk/android-projects/tinySAK/makefile b/trunk/android-projects/tinySAK/makefile index bb0fe467..4454d0f6 100644 --- a/trunk/android-projects/tinySAK/makefile +++ b/trunk/android-projects/tinySAK/makefile @@ -1,42 +1,4 @@ -export ROOT = /cygdrive/c -export INSTALL_DIR = /data/tmp -export OUTPUT_DIR = $(shell pwd)/output -export NDK_PLATFORM_VER = 1.5 - -export ANDROID_NDK_ROOT:=$(ROOT)/android-ndk -export ANDROID_NDK_HOST:=windows -export ANDROID_SDK_ROOT:=$(ROOT)/android-sdk -export PREBUILD:=$(ANDROID_NDK_ROOT)/build/prebuilt/$(ANDROID_NDK_HOST)/arm-eabi-4.2.1 -export BIN := $(PREBUILD)/bin - -#export CPP = $(BIN)/arm-eabi-g++ -export CPP = $(BIN)/arm-eabi-gcc -export CC = $(BIN)/arm-eabi-gcc -export CFLAGS = $(DEBUG) -I$(ANDROID_NDK_ROOT)/build/platforms/android-$(NDK_PLATFORM_VER)/arch-arm/usr/include \ --march=armv5te \ --mtune=xscale \ --msoft-float \ --fpic \ --mthumb-interwork \ --ffunction-sections \ --funwind-tables \ --fstack-protector \ --fno-short-enums \ --D__ARM_ARCH_5__ \ --D__ARM_ARCH_5T__ \ --D__ARM_ARCH_5E__ \ --D__ARM_ARCH_5TE__ \ --DANDROID \ --MMD \ --MP -export LDFLAGS = -Wl,--no-gc-sections,--entry=main,-rpath=/system/lib,-rpath-link=$(ANDROID_NDK_ROOT)/build/platforms/android-$(NDK_PLATFORM_VER)/arch-arm/usr/lib,-dynamic-linker=/system/bin/linker -L$(ANDROID_NDK_ROOT)/build/platforms/android-$(NDK_PLATFORM_VER)/arch-arm/usr/lib -export LDFLAGS += -Wl,-T,$(PREBUILD)/arm-eabi/lib/ldscripts/armelf.xsc,-z,nocopyreloc,--gc-sections,--no-undefined -export LDFLAGS += -nostdlib -lc -Wl,--no-whole-archive -lc - -export LD_LIBRARY_PATH=/system/:$(INSTALL_DIR) - -#-T,$(PREBUILD)/arm-eabi/lib/ldscripts/armelf.xsc -#-T,/cygdrive/c/tmp/armelf_linux_eabi.xsc +include ../root.mk all: (cd ../../tinySAK/src ; $(MAKE) all; $(MAKE) install; cp libtinySAK.so $(OUTPUT_DIR)) @@ -44,10 +6,4 @@ all: clean: (cd ../../tinySAK/src; $(MAKE) clean) - (cd ../../tinySAK/test; $(MAKE) clean) - -agdbserver: - #$(ANDROID_SDK_ROOT)/tools/adb shell export LD_LIBRARY_PATH=/system/:$(INSTALL_DIR) - $(ANDROID_SDK_ROOT)/tools/adb forward tcp:1234: tcp:1234 - $(ANDROID_SDK_ROOT)/tools/adb shell $(INSTALL_DIR)/gdbserver :1234 $(INSTALL_DIR)/test - \ No newline at end of file + (cd ../../tinySAK/test; $(MAKE) clean) \ No newline at end of file diff --git a/trunk/tinyNET/src/makefile b/trunk/tinyNET/src/makefile new file mode 100644 index 00000000..c29ec4e0 --- /dev/null +++ b/trunk/tinyNET/src/makefile @@ -0,0 +1,58 @@ +APP := lib$(PROJECT).so + +INSTALL_DIR = /system/lib + +CFLAGS := $(CFLAGS) -I$(DOUBANGO_HOME)/tinySAK/src -I$(DOUBANGO_HOME)/$(PROJECT)/src +LDFLAGS := $(LDFLAGS) -Wl,-soname,lib$(PROJECT).so,-Bsymbolic,-shared,--whole-archive -ltinySAK + +all: $(APP) + +OBJS = \ + tnet.o\ + tnet_auth.o\ + tnet_nat.o\ + tnet_poll.o\ + tnet_socket.o\ + tnet_transport.o\ + tnet_transport_poll.o\ + tnet_transport_win32.o\ + tnet_utils.o\ + \ + dns/tnet_dns.o\ + dns/tnet_dns_a.o\ + dns/tnet_dns_aaaa.o\ + dns/tnet_dns_cname.o\ + dns/tnet_dns_message.o\ + dns/tnet_dns_mx.o\ + dns/tnet_dns_naptr.o\ + dns/tnet_dns_ns.o\ + dns/tnet_dns_opt.o\ + dns/tnet_dns_ptr.o\ + dns/tnet_dns_rr.o\ + dns/tnet_dns_soa.o\ + dns/tnet_dns_srv.o\ + dns/tnet_dns_txt.o\ + \ + ice/tnet_ice.o\ + \ + stun/tnet_stun.o\ + stun/tnet_stun_attribute.o\ + stun/tnet_stun_message.o\ + \ + turn/tnet_turn.o\ + turn/tnet_turn_attribute.o\ + turn/tnet_turn_message.o + +$(APP): $(OBJS) + $(CPP) $(LDFLAGS) -o $@ $^ + +%.o: %.c + $(CC) -c $(INCLUDE) $(CFLAGS) $< -o $@ + +install: $(APP) + $(ANDROID_SDK_ROOT)/tools/adb remount + $(ANDROID_SDK_ROOT)/tools/adb push $(APP) $(INSTALL_DIR)/$(APP) + $(ANDROID_SDK_ROOT)/tools/adb shell chmod 777 $(INSTALL_DIR)/$(APP) + +clean: + @rm -f $(OBJS) $(APP) \ No newline at end of file diff --git a/trunk/tinyNET/test/makefile b/trunk/tinyNET/test/makefile new file mode 100644 index 00000000..7aa22781 --- /dev/null +++ b/trunk/tinyNET/test/makefile @@ -0,0 +1,28 @@ +APP := test + +CFLAGS := $(CFLAGS) -I$(DOUBANGO_HOME)/$(PROJECT)/src -I$(DOUBANGO_HOME)/tinySAK/src +LDFLAGS := $(LDFLAGS) -Bsymbolic -ltinySAK -l$(PROJECT) + +all: $(APP) + +OBJS += $(APP).o + +$(APP): $(OBJS) + $(CPP) $(LDFLAGS) -o $@ $^ + +%.o: %.c + $(CC) -c $(INCLUDE) $(CFLAGS) $< -o $@ + +install: $(APP) + $(ANDROID_SDK_ROOT)/tools/adb push $(APP) $(INSTALL_DIR)/$(APP) + $(ANDROID_SDK_ROOT)/tools/adb shell chmod 777 $(INSTALL_DIR)/$(APP) + +run: + $(ANDROID_SDK_ROOT)/tools/adb shell $(INSTALL_DIR)/$(APP) + +#dbg: +# $(MAKE) $(MAKEFILE) DEBUG="-g -DDEBUG" +# $(MAKE) $(MAKEFILE) install + +clean: + @rm -f $(OBJS) $(APP) \ No newline at end of file diff --git a/trunk/tinyNET/test/stdafx.h b/trunk/tinyNET/test/stdafx.h index 6774e473..07b1ff6c 100644 --- a/trunk/tinyNET/test/stdafx.h +++ b/trunk/tinyNET/test/stdafx.h @@ -35,4 +35,4 @@ // TODO: reference additional headers your program requires here -#endif /* TEST_TNET_STDAFX_H */ \ No newline at end of file +#endif /* TEST_TNET_STDAFX_H */ diff --git a/trunk/tinyNET/test/test.c b/trunk/tinyNET/test/test.c index c222ebe4..a62017c2 100644 --- a/trunk/tinyNET/test/test.c +++ b/trunk/tinyNET/test/test.c @@ -41,13 +41,13 @@ #define RUN_TEST_LOOP 1 #define RUN_TEST_ALL 0 -#define RUN_TEST_SOCKETS 0 -#define RUN_TEST_TRANSPORT 0 +#define RUN_TEST_SOCKETS 0 /* FIXME: Android */ +#define RUN_TEST_TRANSPORT 1 #define RUN_TEST_AUTH 0 #define RUN_TEST_STUN 0 #define RUN_TEST_NAT 0 #define RUN_TEST_IFACES 0 -#define RUN_TEST_DNS 1 +#define RUN_TEST_DNS 0 #ifdef _WIN32_WCE int _tmain(int argc, _TCHAR* argv[]) diff --git a/trunk/tinyNET/test/test_dns.h b/trunk/tinyNET/test/test_dns.h index 45ac4ffa..621d0206 100644 --- a/trunk/tinyNET/test/test_dns.h +++ b/trunk/tinyNET/test/test_dns.h @@ -51,4 +51,4 @@ void test_dns() } -#endif /* TNET_TEST_DNS_H */ \ No newline at end of file +#endif /* TNET_TEST_DNS_H */ diff --git a/trunk/tinyNET/test/test_nat.h b/trunk/tinyNET/test/test_nat.h index 13b7a872..73cf34ce 100644 --- a/trunk/tinyNET/test/test_nat.h +++ b/trunk/tinyNET/test/test_nat.h @@ -225,4 +225,4 @@ void test_nat() -#endif /* TNET_TEST_NAT_H */ \ No newline at end of file +#endif /* TNET_TEST_NAT_H */ diff --git a/trunk/tinyNET/test/test_sockets.h b/trunk/tinyNET/test/test_sockets.h index f4640985..3c85187e 100644 --- a/trunk/tinyNET/test/test_sockets.h +++ b/trunk/tinyNET/test/test_sockets.h @@ -50,4 +50,4 @@ void test_sockets() TSK_OBJECT_SAFE_FREE(tcp_socket); } -#endif /* TNET_TEST_SOCKETS_H */ \ No newline at end of file +#endif /* TNET_TEST_SOCKETS_H */ diff --git a/trunk/tinyNET/test/test_stun.h b/trunk/tinyNET/test/test_stun.h index 5b3211bf..8807728a 100644 --- a/trunk/tinyNET/test/test_stun.h +++ b/trunk/tinyNET/test/test_stun.h @@ -109,4 +109,4 @@ void test_stun() test_stun_context(); } -#endif /* TNET_TEST_STUN_H */ \ No newline at end of file +#endif /* TNET_TEST_STUN_H */ diff --git a/trunk/tinyNET/test/test_transport.h b/trunk/tinyNET/test/test_transport.h index 0f448b5f..081f636e 100644 --- a/trunk/tinyNET/test/test_transport.h +++ b/trunk/tinyNET/test/test_transport.h @@ -21,7 +21,7 @@ */ #ifndef TNET_TEST_TRANSPORT_H #define TNET_TEST_TRANSPORT_H -#define REMOTE_IP /*"2a01:e35:8632:7050:6122:2706:2124:32cb"*/ "192.168.16.104" +#define REMOTE_IP /*"2a01:e35:8632:7050:6122:2706:2124:32cb"*/ "192.168.0.15" #define SIP_MESSAGE \ "REGISTER sip:micromethod.com SIP/2.0\r\n" \ diff --git a/trunk/tinySAK/src/tinySAK_config.h b/trunk/tinySAK/src/tinySAK_config.h index 37882a38..ab1ffe04 100644 --- a/trunk/tinySAK/src/tinySAK_config.h +++ b/trunk/tinySAK/src/tinySAK_config.h @@ -48,7 +48,7 @@ # define TSK_UNDER_WINDOWS 1 #endif -/* Used on Windows and Sysbian systems to export/import public functions and global variables. +/* Used on Windows and Symbian systems to export/import public functions and global variables. */ #if !defined(__GNUC__) && defined(TINYSAK_EXPORTS) # define TINYSAK_API __declspec(dllexport) diff --git a/trunk/tinySAK/src/tsk_buffer.c b/trunk/tinySAK/src/tsk_buffer.c index 683d74c4..f7a79cef 100644 --- a/trunk/tinySAK/src/tsk_buffer.c +++ b/trunk/tinySAK/src/tsk_buffer.c @@ -60,7 +60,7 @@ int tsk_buffer_appendEx(tsk_buffer_t* self, const char* format, ...) /* compute destination len for windows mobile */ -#ifdef _WIN32_WCE +#if defined(_WIN32_WCE) || defined(ANDROID) { int n; len = (strlen(format)*2); diff --git a/trunk/tinySAK/src/tsk_semaphore.c b/trunk/tinySAK/src/tsk_semaphore.c index d9243ff9..22af886b 100644 --- a/trunk/tinySAK/src/tsk_semaphore.c +++ b/trunk/tinySAK/src/tsk_semaphore.c @@ -54,6 +54,9 @@ # include # include # if TSK_USE_NAMED_SEM +# include /* O_CREAT */ +# include /* S_IRUSR, S_IWUSR*/ + static int sem_count = 0; typedef struct named_sem_s { diff --git a/trunk/tinySAK/src/tsk_string.c b/trunk/tinySAK/src/tsk_string.c index 700c9833..34248b47 100644 --- a/trunk/tinySAK/src/tsk_string.c +++ b/trunk/tinySAK/src/tsk_string.c @@ -226,7 +226,7 @@ int tsk_sprintf(char** str, const char* format, ...) /* compute destination len for windows mobile */ -#ifdef _WIN32_WCE +#if defined(_WIN32_WCE) || defined(ANDROID) { int n; len = (strlen(format)*2); diff --git a/trunk/tinySAK/test/makefile b/trunk/tinySAK/test/makefile index a2be59b7..a4a68fef 100644 --- a/trunk/tinySAK/test/makefile +++ b/trunk/tinySAK/test/makefile @@ -4,7 +4,7 @@ APP := test #TINYSAK_LIB := -L../ -ltinySAK CFLAGS := $(CFLAGS) -I../src -static -LDFLAGS := $(LDFLAGS) -Bsymbolic -L$(OUTPUT_DIR) -ltinySAK +LDFLAGS := $(LDFLAGS) -Bsymbolic -ltinySAK all: $(APP) diff --git a/trunk/tinySAK/test/test.c b/trunk/tinySAK/test/test.c index 4a03530f..52381521 100644 --- a/trunk/tinySAK/test/test.c +++ b/trunk/tinySAK/test/test.c @@ -34,13 +34,13 @@ #define LOOP 1 #define RUN_TEST_ALL 0 -#define RUN_TEST_LISTS 1 +#define RUN_TEST_LISTS 0 #define RUN_TEST_HEAP 0 #define RUN_TEST_STRINGS 0 #define RUN_TEST_URL 0 #define RUN_TEST_MUTEX 0 #define RUN_TEST_CONDWAIT 0 -#define RUN_TEST_SEMAPHORE 0 +#define RUN_TEST_SEMAPHORE 0 /* FIXME: android */ #define RUN_TEST_SAFEOBJECT 0 #define RUN_TEST_OBJECT 0 #define RUN_TEST_PARAMS 0 @@ -49,7 +49,7 @@ #define RUN_TEST_BUFFER 0 #define RUN_TEST_MD5 0 #define RUN_TEST_SHA1 0 -#define RUN_TEST_BASE64 0 +#define RUN_TEST_BASE64 1 #if RUN_TEST_LISTS || RUN_TEST_ALL #include "test_lists.h" diff --git a/trunk/tinySAK/test/test_buffer.h b/trunk/tinySAK/test/test_buffer.h index 6a978837..95f77fe3 100644 --- a/trunk/tinySAK/test/test_buffer.h +++ b/trunk/tinySAK/test/test_buffer.h @@ -32,14 +32,14 @@ void test_buffer() tsk_buffer_append(buffer, "Mamadou", strlen("Mamadou")); tsk_buffer_append(buffer, "\r\n", strlen("\r\n")); - TSK_DEBUG_INFO("1. Buffer=%s", TSK_BUFFER_TO_STRING(buffer)); + printf("1. Buffer=%s", TSK_BUFFER_TO_STRING(buffer)); tsk_buffer_appendEx(buffer, "val1=[%s] and val2=[%d]\n", "value1", 12); tsk_buffer_appendEx(buffer, "val3=[%s] and val4=[%s]\n", "458888554778555LL", "1254852"); - TSK_DEBUG_INFO("2. Buffer=%s", TSK_BUFFER_TO_STRING(buffer)); + printf("2. Buffer=%s", TSK_BUFFER_TO_STRING(buffer)); - TSK_BUFFER_SAFE_FREE(buffer); + TSK_OBJECT_SAFE_FREE(buffer); } #endif /* _TEST_BUFFER_H_ */ diff --git a/trunk/tinySAK/test/test_params.h b/trunk/tinySAK/test/test_params.h index 889fd3dd..18be3189 100644 --- a/trunk/tinySAK/test/test_params.h +++ b/trunk/tinySAK/test/test_params.h @@ -36,11 +36,11 @@ void test_params() tsk_list_push_back_data(params, (void**)¶m3); tsk_params_tostring(params, ',', buffer); - TSK_DEBUG_INFO("Buffer=[%s]", TSK_BUFFER_TO_STRING(buffer)); + printf("Buffer=[%s]", TSK_BUFFER_TO_STRING(buffer)); - TSK_BUFFER_SAFE_FREE(buffer); - TSK_LIST_SAFE_FREE(params); + TSK_OBJECT_SAFE_FREE(buffer); + TSK_OBJECT_SAFE_FREE(params); } -#endif /*_TEST_PARAMS_H_ */ \ No newline at end of file +#endif /*_TEST_PARAMS_H_ */ diff --git a/trunk/tinySAK/test/test_semaphore.h b/trunk/tinySAK/test/test_semaphore.h index 4797063f..48959f3b 100644 --- a/trunk/tinySAK/test/test_semaphore.h +++ b/trunk/tinySAK/test/test_semaphore.h @@ -22,16 +22,14 @@ #ifndef _TEST_SEMAPHORE_H_ #define _TEST_SEMAPHORE_H_ -int sema_count = 0; - void *threadfunc_semaphore1(void *parm) { tsk_semaphore_handle_t *semaphore = (tsk_semaphore_handle_t *)parm; int ret = 0; - sema_count++; + printf("threadfunc_semaphore1/// START %d\n", ret); ret = tsk_semaphore_decrement(semaphore); - printf("threadfunc_semaphore1/// %d\n", ret); + printf("threadfunc_semaphore1/// STOP %d\n", ret); return 0; } @@ -41,9 +39,9 @@ void *threadfunc_semaphore2(void *parm) tsk_semaphore_handle_t *semaphore = (tsk_semaphore_handle_t *)parm; int ret = 0; - sema_count++; + printf("threadfunc_semaphore2/// START %d\n", ret); ret = tsk_semaphore_decrement(semaphore); - printf("threadfunc_semaphore2/// %d\n", ret); + printf("threadfunc_semaphore2/// STOP %d\n", ret); return 0; } @@ -64,10 +62,12 @@ void test_semaphore() assert(!tsk_semaphore_increment(semaphore)); assert(!tsk_semaphore_increment(semaphore)); + tsk_thread_sleep(1000); + tsk_thread_join(&tid[0]); tsk_thread_join(&tid[1]); tsk_semaphore_destroy(&semaphore); } -#endif /* _TEST_SEMAPHORE_H_ */ \ No newline at end of file +#endif /* _TEST_SEMAPHORE_H_ */ diff --git a/trunk/tinySAK/test/test_timer.h b/trunk/tinySAK/test/test_timer.h index 1a60e495..c8521a3e 100644 --- a/trunk/tinySAK/test/test_timer.h +++ b/trunk/tinySAK/test/test_timer.h @@ -74,7 +74,7 @@ void test_timer() tsk_thread_sleep(4000); //tsk_timer_manager_stop(handle); - TSK_TIMER_MANAGER_SAFE_FREE(handle); + TSK_OBJECT_SAFE_FREE(handle); } #endif /* _TEST_TIMER_H_ */