From 9d0c6fb8bf7bf63c137d7c19fdefc7760d2f133a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 3 Sep 2013 08:48:20 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6250 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32F0xx/stm32_dma.h | 8 +-- os/hal/ports/STM32F30x/stm32_dma.h | 8 +-- os/hal/ports/STM32F4xx/stm32_dma.h | 8 +-- os/rt/include/ch.h | 42 +----------- os/rt/ports/ARMCMx/chcore_timer.h | 80 ++++++++++------------ os/rt/ports/ARMCMx/chcore_v6m.h | 6 +- os/rt/ports/ARMCMx/chcore_v7m.h | 6 +- os/rt/ports/ARMCMx/compilers/GCC/chtypes.h | 19 ++++- test/test.c | 12 ++-- test/test.h | 10 +-- test/testdyn.c | 4 +- test/testmtx.c | 2 +- 12 files changed, 88 insertions(+), 117 deletions(-) diff --git a/os/hal/ports/STM32F0xx/stm32_dma.h b/os/hal/ports/STM32F0xx/stm32_dma.h index 277ebf4d4..3acff9647 100644 --- a/os/hal/ports/STM32F0xx/stm32_dma.h +++ b/os/hal/ports/STM32F0xx/stm32_dma.h @@ -380,10 +380,10 @@ extern const stm32_dma_stream_t _stm32_dma_streams[STM32_DMA_STREAMS]; extern "C" { #endif void dmaInit(void); - bool_t dmaStreamAllocate(const stm32_dma_stream_t *dmastp, - uint32_t priority, - stm32_dmaisr_t func, - void *param); + bool dmaStreamAllocate(const stm32_dma_stream_t *dmastp, + uint32_t priority, + stm32_dmaisr_t func, + void *param); void dmaStreamRelease(const stm32_dma_stream_t *dmastp); #ifdef __cplusplus } diff --git a/os/hal/ports/STM32F30x/stm32_dma.h b/os/hal/ports/STM32F30x/stm32_dma.h index 2415f00f2..21c97a38b 100644 --- a/os/hal/ports/STM32F30x/stm32_dma.h +++ b/os/hal/ports/STM32F30x/stm32_dma.h @@ -392,10 +392,10 @@ extern const stm32_dma_stream_t _stm32_dma_streams[STM32_DMA_STREAMS]; extern "C" { #endif void dmaInit(void); - bool_t dmaStreamAllocate(const stm32_dma_stream_t *dmastp, - uint32_t priority, - stm32_dmaisr_t func, - void *param); + bool dmaStreamAllocate(const stm32_dma_stream_t *dmastp, + uint32_t priority, + stm32_dmaisr_t func, + void *param); void dmaStreamRelease(const stm32_dma_stream_t *dmastp); #ifdef __cplusplus } diff --git a/os/hal/ports/STM32F4xx/stm32_dma.h b/os/hal/ports/STM32F4xx/stm32_dma.h index 62b0fbd43..cb0d01688 100644 --- a/os/hal/ports/STM32F4xx/stm32_dma.h +++ b/os/hal/ports/STM32F4xx/stm32_dma.h @@ -447,10 +447,10 @@ extern const stm32_dma_stream_t _stm32_dma_streams[STM32_DMA_STREAMS]; extern "C" { #endif void dmaInit(void); - bool_t dmaStreamAllocate(const stm32_dma_stream_t *dmastp, - uint32_t priority, - stm32_dmaisr_t func, - void *param); + bool dmaStreamAllocate(const stm32_dma_stream_t *dmastp, + uint32_t priority, + stm32_dmaisr_t func, + void *param); void dmaStreamRelease(const stm32_dma_stream_t *dmastp); #ifdef __cplusplus } diff --git a/os/rt/include/ch.h b/os/rt/include/ch.h index c2c486c0f..21c172ec9 100644 --- a/os/rt/include/ch.h +++ b/os/rt/include/ch.h @@ -62,44 +62,6 @@ #define CH_KERNEL_PATCH 0 /** @} */ -/** - * @name Common constants - */ -/** - * @brief Generic 'false' boolean constant. - */ -#if !defined(FALSE) || defined(__DOXYGEN__) -#define FALSE 0 -#endif - -/** - * @brief Generic 'true' boolean constant. - */ -#if !defined(TRUE) || defined(__DOXYGEN__) -#define TRUE (!FALSE) -#endif - -/** - * @brief Generic success constant. - * @details This constant is functionally equivalent to @p false but more - * readable, it can be used as return value of all those functions - * returning a @p bool as a status indicator. - */ -#if !defined(CH_SUCCESS) || defined(__DOXYGEN__) -#define CH_SUCCESS false -#endif - -/** - * @brief Generic failure constant. - * @details This constant is functionally equivalent to @p true but more - * readable, it can be used as return value of all those functions - * returning a @p bool as a status indicator. - */ -#if !defined(CH_FAILED) || defined(__DOXYGEN__) -#define CH_FAILED true -#endif -/** @} */ - /* Forward declarations.*/ typedef struct thread thread_t; typedef struct virtual_timer virtual_timer_t; @@ -114,10 +76,10 @@ extern "C" { #endif /* Inclusion of all the kernel sub-headers.*/ -#include "chconf.h" #include "chtypes.h" -#include "chdebug.h" +#include "chconf.h" #include "chcore.h" +#include "chdebug.h" #include "chtm.h" #include "chstats.h" #include "chsys.h" diff --git a/os/rt/ports/ARMCMx/chcore_timer.h b/os/rt/ports/ARMCMx/chcore_timer.h index da3bd82de..1a0f98ac0 100644 --- a/os/rt/ports/ARMCMx/chcore_timer.h +++ b/os/rt/ports/ARMCMx/chcore_timer.h @@ -60,6 +60,42 @@ /* Module macros. */ /*===========================================================================*/ +/** + * @brief Starts the alarm. + * @note Makes sure that no spurious alarms are triggered after + * this call. + * + * @param[in] time the time to be set for the first alarm + * + * @notapi + */ +#define port_timer_start_alarm(time) { \ + chDbgAssert(stIsAlarmActive() == false, "already active"); \ + stStartAlarm(time); \ +} + +/** + * @brief Stops the alarm interrupt. + * + * @notapi + */ +#define port_timer_stop_alarm() { \ + chDbgAssert(stIsAlarmActive() != false, "not active"); \ + stStopAlarm(); \ +} + +/** + * @brief Sets the alarm time. + * + * @param[in] time the time to be set for the next alarm + * + * @notapi + */ +#define port_timer_set_alarm(time) { \ + chDbgAssert(stIsAlarmActive() != false, "not active"); \ + stSetAlarm(time); \ +} + /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ @@ -80,48 +116,6 @@ static inline systime_t port_timer_get_time(void) { return stGetCounter(); } -/** - * @brief Starts the alarm. - * @note Makes sure that no spurious alarms are triggered after - * this call. - * - * @param[in] time the time to be set for the first alarm - * - * @notapi - */ -static inline void port_timer_start_alarm(systime_t time) { - - chDbgAssert(stIsAlarmActive() == false, "already active"); - - stStartAlarm(time); -} - -/** - * @brief Stops the alarm interrupt. - * - * @notapi - */ -static inline void port_timer_stop_alarm(void) { - - chDbgAssert(stIsAlarmActive() != false, "not active"); - - stStopAlarm(); -} - -/** - * @brief Sets the alarm time. - * - * @param[in] time the time to be set for the next alarm - * - * @notapi - */ -static inline void port_timer_set_alarm(systime_t time) { - - chDbgAssert(stIsAlarmActive() != false, "not active"); - - stSetAlarm(time); -} - /** * @brief Returns the current alarm time. * @@ -131,8 +125,6 @@ static inline void port_timer_set_alarm(systime_t time) { */ static inline systime_t port_timer_get_alarm(void) { - chDbgAssert(stIsAlarmActive() != false, "not active"); - return stGetAlarm(); } diff --git a/os/rt/ports/ARMCMx/chcore_v6m.h b/os/rt/ports/ARMCMx/chcore_v6m.h index f1af44fdc..f72216f95 100644 --- a/os/rt/ports/ARMCMx/chcore_v6m.h +++ b/os/rt/ports/ARMCMx/chcore_v6m.h @@ -206,9 +206,9 @@ struct context { tp->p_ctx.r13 = (struct port_intctx *)((uint8_t *)workspace + \ wsize - \ sizeof(struct port_intctx)); \ - tp->p_ctx.r13->r4 = (void *)(pf); \ - tp->p_ctx.r13->r5 = (void *)(arg); \ - tp->p_ctx.r13->lr = (void *)(_port_thread_start); \ + tp->p_ctx.r13->r4 = (regarm_t)(pf); \ + tp->p_ctx.r13->r5 = (regarm_t)(arg); \ + tp->p_ctx.r13->lr = (regarm_t)(_port_thread_start); \ } /** diff --git a/os/rt/ports/ARMCMx/chcore_v7m.h b/os/rt/ports/ARMCMx/chcore_v7m.h index c2c47024f..d768afaef 100644 --- a/os/rt/ports/ARMCMx/chcore_v7m.h +++ b/os/rt/ports/ARMCMx/chcore_v7m.h @@ -305,9 +305,9 @@ struct context { tp->p_ctx.r13 = (struct port_intctx *)((uint8_t *)workspace + \ wsize - \ sizeof(struct port_intctx)); \ - tp->p_ctx.r13->r4 = (void *)(pf); \ - tp->p_ctx.r13->r5 = (void *)(arg); \ - tp->p_ctx.r13->lr = (void *)(_port_thread_start); \ + tp->p_ctx.r13->r4 = (regarm_t)(pf); \ + tp->p_ctx.r13->r5 = (regarm_t)(arg); \ + tp->p_ctx.r13->lr = (regarm_t)(_port_thread_start); \ } /** diff --git a/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h b/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h index 26a1e5c81..bc33d2e10 100644 --- a/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h +++ b/os/rt/ports/ARMCMx/compilers/GCC/chtypes.h @@ -33,7 +33,24 @@ #include #include -typedef bool bool_t; /**< Fast boolean type. */ +/** + * @name Common constants + */ +/** + * @brief Generic 'false' boolean constant. + */ +#if !defined(FALSE) || defined(__DOXYGEN__) +#define FALSE 0 +#endif + +/** + * @brief Generic 'true' boolean constant. + */ +#if !defined(TRUE) || defined(__DOXYGEN__) +#define TRUE (!FALSE) +#endif +/** @} */ + typedef uint32_t systime_t; /**< System time. */ typedef uint32_t rtcnt_t; /**< Realtime counter. */ typedef uint64_t rttime_t; /**< Time accumulator. */ diff --git a/test/test.c b/test/test.c index 77759f5b8..58cad43c3 100644 --- a/test/test.c +++ b/test/test.c @@ -56,7 +56,7 @@ static ROMCONST struct testcase * ROMCONST *patterns[] = { NULL }; -static bool_t local_fail, global_fail; +static bool local_fail, global_fail; static unsigned failpoint; static char tokens_buffer[MAX_TOKENS]; static char *tokp; @@ -154,7 +154,7 @@ void test_emit_token(char token) { /* * Assertions. */ -bool_t _test_fail(unsigned point) { +bool _test_fail(unsigned point) { local_fail = TRUE; global_fail = TRUE; @@ -162,14 +162,14 @@ bool_t _test_fail(unsigned point) { return TRUE; } -bool_t _test_assert(unsigned point, bool_t condition) { +bool _test_assert(unsigned point, bool condition) { if (!condition) return _test_fail(point); return FALSE; } -bool_t _test_assert_sequence(unsigned point, char *expected) { +bool _test_assert_sequence(unsigned point, char *expected) { char *cp = tokens_buffer; while (cp < tokp) { if (*cp++ != *expected++) @@ -181,7 +181,7 @@ bool_t _test_assert_sequence(unsigned point, char *expected) { return FALSE; } -bool_t _test_assert_time_window(unsigned point, systime_t start, systime_t end) { +bool _test_assert_time_window(unsigned point, systime_t start, systime_t end) { return _test_assert(point, chVTIsSystemTimeWithin(start, end)); } @@ -255,7 +255,7 @@ systime_t test_wait_tick(void) { /** * @brief Set to @p TRUE when the test timer reaches its deadline. */ -bool_t test_timer_done; +bool test_timer_done; static virtual_timer_t vt; static void tmr(void *p) { diff --git a/test/test.h b/test/test.h index 136631d8f..1088d0517 100644 --- a/test/test.h +++ b/test/test.h @@ -84,10 +84,10 @@ extern "C" { void test_print(const char *msgp); void test_println(const char *msgp); void test_emit_token(char token); - bool_t _test_fail(unsigned point); - bool_t _test_assert(unsigned point, bool_t condition); - bool_t _test_assert_sequence(unsigned point, char *expected); - bool_t _test_assert_time_window(unsigned point, systime_t start, systime_t end); + bool _test_fail(unsigned point); + bool _test_assert(unsigned point, bool condition); + bool _test_assert_sequence(unsigned point, char *expected); + bool _test_assert_time_window(unsigned point, systime_t start, systime_t end); void test_terminate_threads(void); void test_wait_threads(void); systime_t test_wait_tick(void); @@ -165,7 +165,7 @@ extern "C" { extern thread_t *threads[MAX_THREADS]; extern union test_buffers test; extern void * ROMCONST wa[]; -extern bool_t test_timer_done; +extern bool test_timer_done; #endif #endif /* _TEST_H_ */ diff --git a/test/testdyn.c b/test/testdyn.c index 3eb3304d5..cd73e73ce 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -188,9 +188,9 @@ ROMCONST struct testcase testdyn2 = { * coverage. */ -static bool_t regfind(thread_t *tp) { +static bool regfind(thread_t *tp) { thread_t *ftp; - bool_t found = FALSE; + bool found = false; ftp = chRegFirstThread(); do { diff --git a/test/testmtx.c b/test/testmtx.c index cd10fa986..b40242d3d 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -431,7 +431,7 @@ static void mtx5_setup(void) { } static void mtx5_execute(void) { - bool_t b; + bool b; tprio_t prio; prio = chThdGetPriorityX();