From 4d2e568b56607bb166c4d2dd004b1c9970c2879f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 20 Jan 2009 20:11:02 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@650 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/Makefile | 2 +- demos/Win32-MinGW/chcore.c | 6 +++--- demos/Win32-MinGW/chcore.h | 36 ++++++++++++++++++------------------ test/testsem.c | 1 + 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index bda1426cb..841557827 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -77,7 +77,7 @@ ULIBDIR = ULIBS = # Define optimisation level here -OPT = -ggdb -Os -fomit-frame-pointer +OPT = -ggdb -O2 -fomit-frame-pointer # # End of user defines diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index 1dc05569c..446508e3c 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -98,7 +98,7 @@ void ChkIntSources(void) { * @param msg pointer to the message */ __attribute__((fastcall)) -void sys_puts(char *msg) { +void port_puts(char *msg) { } /** @@ -107,7 +107,7 @@ void sys_puts(char *msg) { * @param ntp the thread to be switched in */ __attribute__((fastcall)) -void sys_switch(Thread *otp, Thread *ntp) { +void port_switch(Thread *otp, Thread *ntp) { register struct intctx volatile *esp asm("esp"); asm volatile ("push %ebp \n\t" \ @@ -126,7 +126,7 @@ void sys_switch(Thread *otp, Thread *ntp) { * Halts the system. In this implementation it just exits the simulation. */ __attribute__((fastcall)) -void sys_halt(void) { +void port_halt(void) { exit(2); } diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h index 40555df63..029de3566 100644 --- a/demos/Win32-MinGW/chcore.h +++ b/demos/Win32-MinGW/chcore.h @@ -65,9 +65,9 @@ struct intctx { * This structure usually contains just the saved stack pointer defined as a * pointer to a @p intctx structure. */ -typedef struct { +struct context { struct intctx volatile *esp; -} Context; +}; #define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a) @@ -130,71 +130,71 @@ typedef struct { * IRQ prologue code, inserted at the start of all IRQ handlers enabled to * invoke system APIs. */ -#define SYS_IRQ_PROLOGUE() +#define PORT_IRQ_PROLOGUE() /** * IRQ epilogue code, inserted at the end of all IRQ handlers enabled to * invoke system APIs. */ -#define SYS_IRQ_EPILOGUE() +#define PORT_IRQ_EPILOGUE() /** - * IRQ handler function modifier. + * IRQ handler function declaration. */ -#define SYS_IRQ_HANDLER +#define PORT_IRQ_HANDLER(id) void id(void) /** * Simulator initialization. */ -#define sys_init() InitCore() +#define port_init() InitCore() /** * Does nothing in this simulator. */ -#define sys_disable_all() +#define port_lock() /** * Does nothing in this simulator. */ -#define sys_disable() +#define port_unlock() /** * Does nothing in this simulator. */ -#define sys_enable() +#define port_lock_from_isr() /** * Does nothing in this simulator. */ -#define sys_lock() +#define port_unlock_from_isr() /** * Does nothing in this simulator. */ -#define sys_unlock() +#define port_disable() /** * Does nothing in this simulator. */ -#define sys_lock_from_isr() +#define port_suspend() /** * Does nothing in this simulator. */ -#define sys_unlock_from_isr() +#define port_enable() /** * In the simulator this does a polling pass on the simulated interrupt * sources. */ -#define sys_wait_for_interrupt() ChkIntSources() +#define port_wait_for_interrupt() ChkIntSources() #ifdef __cplusplus extern "C" { #endif - __attribute__((fastcall)) void sys_puts(char *msg); - __attribute__((fastcall)) void sys_switch(Thread *otp, Thread *ntp); - __attribute__((fastcall)) void sys_halt(void); + __attribute__((fastcall)) void port_puts(char *msg); + __attribute__((fastcall)) void port_switch(Thread *otp, Thread *ntp); + __attribute__((fastcall)) void port_halt(void); void InitCore(void); void ChkIntSources(void); void threadexit(void); diff --git a/test/testsem.c b/test/testsem.c index 72ed6126f..e7992d6a2 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -92,6 +92,7 @@ static void sem2_execute(void) { test_emit_token('A' + i); chSemWaitTimeout(&sem1, MS2ST(500)); } + test_assert(chSemGetCounter(&sem1) == 0, "non zero counter"); test_assert_sequence("ABCDE"); test_assert_time_window(target_time, target_time + ALLOWED_DELAY); } -- cgit v1.2.3