git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6250 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
156a195bf7
commit
9d0c6fb8bf
|
@ -380,10 +380,10 @@ extern const stm32_dma_stream_t _stm32_dma_streams[STM32_DMA_STREAMS];
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void dmaInit(void);
|
void dmaInit(void);
|
||||||
bool_t dmaStreamAllocate(const stm32_dma_stream_t *dmastp,
|
bool dmaStreamAllocate(const stm32_dma_stream_t *dmastp,
|
||||||
uint32_t priority,
|
uint32_t priority,
|
||||||
stm32_dmaisr_t func,
|
stm32_dmaisr_t func,
|
||||||
void *param);
|
void *param);
|
||||||
void dmaStreamRelease(const stm32_dma_stream_t *dmastp);
|
void dmaStreamRelease(const stm32_dma_stream_t *dmastp);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,10 +392,10 @@ extern const stm32_dma_stream_t _stm32_dma_streams[STM32_DMA_STREAMS];
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void dmaInit(void);
|
void dmaInit(void);
|
||||||
bool_t dmaStreamAllocate(const stm32_dma_stream_t *dmastp,
|
bool dmaStreamAllocate(const stm32_dma_stream_t *dmastp,
|
||||||
uint32_t priority,
|
uint32_t priority,
|
||||||
stm32_dmaisr_t func,
|
stm32_dmaisr_t func,
|
||||||
void *param);
|
void *param);
|
||||||
void dmaStreamRelease(const stm32_dma_stream_t *dmastp);
|
void dmaStreamRelease(const stm32_dma_stream_t *dmastp);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,10 +447,10 @@ extern const stm32_dma_stream_t _stm32_dma_streams[STM32_DMA_STREAMS];
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void dmaInit(void);
|
void dmaInit(void);
|
||||||
bool_t dmaStreamAllocate(const stm32_dma_stream_t *dmastp,
|
bool dmaStreamAllocate(const stm32_dma_stream_t *dmastp,
|
||||||
uint32_t priority,
|
uint32_t priority,
|
||||||
stm32_dmaisr_t func,
|
stm32_dmaisr_t func,
|
||||||
void *param);
|
void *param);
|
||||||
void dmaStreamRelease(const stm32_dma_stream_t *dmastp);
|
void dmaStreamRelease(const stm32_dma_stream_t *dmastp);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,44 +62,6 @@
|
||||||
#define CH_KERNEL_PATCH 0
|
#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.*/
|
/* Forward declarations.*/
|
||||||
typedef struct thread thread_t;
|
typedef struct thread thread_t;
|
||||||
typedef struct virtual_timer virtual_timer_t;
|
typedef struct virtual_timer virtual_timer_t;
|
||||||
|
@ -114,10 +76,10 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Inclusion of all the kernel sub-headers.*/
|
/* Inclusion of all the kernel sub-headers.*/
|
||||||
#include "chconf.h"
|
|
||||||
#include "chtypes.h"
|
#include "chtypes.h"
|
||||||
#include "chdebug.h"
|
#include "chconf.h"
|
||||||
#include "chcore.h"
|
#include "chcore.h"
|
||||||
|
#include "chdebug.h"
|
||||||
#include "chtm.h"
|
#include "chtm.h"
|
||||||
#include "chstats.h"
|
#include "chstats.h"
|
||||||
#include "chsys.h"
|
#include "chsys.h"
|
||||||
|
|
|
@ -60,6 +60,42 @@
|
||||||
/* Module macros. */
|
/* 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. */
|
/* External declarations. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
@ -80,48 +116,6 @@ static inline systime_t port_timer_get_time(void) {
|
||||||
return stGetCounter();
|
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.
|
* @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) {
|
static inline systime_t port_timer_get_alarm(void) {
|
||||||
|
|
||||||
chDbgAssert(stIsAlarmActive() != false, "not active");
|
|
||||||
|
|
||||||
return stGetAlarm();
|
return stGetAlarm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,9 +206,9 @@ struct context {
|
||||||
tp->p_ctx.r13 = (struct port_intctx *)((uint8_t *)workspace + \
|
tp->p_ctx.r13 = (struct port_intctx *)((uint8_t *)workspace + \
|
||||||
wsize - \
|
wsize - \
|
||||||
sizeof(struct port_intctx)); \
|
sizeof(struct port_intctx)); \
|
||||||
tp->p_ctx.r13->r4 = (void *)(pf); \
|
tp->p_ctx.r13->r4 = (regarm_t)(pf); \
|
||||||
tp->p_ctx.r13->r5 = (void *)(arg); \
|
tp->p_ctx.r13->r5 = (regarm_t)(arg); \
|
||||||
tp->p_ctx.r13->lr = (void *)(_port_thread_start); \
|
tp->p_ctx.r13->lr = (regarm_t)(_port_thread_start); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -305,9 +305,9 @@ struct context {
|
||||||
tp->p_ctx.r13 = (struct port_intctx *)((uint8_t *)workspace + \
|
tp->p_ctx.r13 = (struct port_intctx *)((uint8_t *)workspace + \
|
||||||
wsize - \
|
wsize - \
|
||||||
sizeof(struct port_intctx)); \
|
sizeof(struct port_intctx)); \
|
||||||
tp->p_ctx.r13->r4 = (void *)(pf); \
|
tp->p_ctx.r13->r4 = (regarm_t)(pf); \
|
||||||
tp->p_ctx.r13->r5 = (void *)(arg); \
|
tp->p_ctx.r13->r5 = (regarm_t)(arg); \
|
||||||
tp->p_ctx.r13->lr = (void *)(_port_thread_start); \
|
tp->p_ctx.r13->lr = (regarm_t)(_port_thread_start); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,7 +33,24 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
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 systime_t; /**< System time. */
|
||||||
typedef uint32_t rtcnt_t; /**< Realtime counter. */
|
typedef uint32_t rtcnt_t; /**< Realtime counter. */
|
||||||
typedef uint64_t rttime_t; /**< Time accumulator. */
|
typedef uint64_t rttime_t; /**< Time accumulator. */
|
||||||
|
|
12
test/test.c
12
test/test.c
|
@ -56,7 +56,7 @@ static ROMCONST struct testcase * ROMCONST *patterns[] = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool_t local_fail, global_fail;
|
static bool local_fail, global_fail;
|
||||||
static unsigned failpoint;
|
static unsigned failpoint;
|
||||||
static char tokens_buffer[MAX_TOKENS];
|
static char tokens_buffer[MAX_TOKENS];
|
||||||
static char *tokp;
|
static char *tokp;
|
||||||
|
@ -154,7 +154,7 @@ void test_emit_token(char token) {
|
||||||
/*
|
/*
|
||||||
* Assertions.
|
* Assertions.
|
||||||
*/
|
*/
|
||||||
bool_t _test_fail(unsigned point) {
|
bool _test_fail(unsigned point) {
|
||||||
|
|
||||||
local_fail = TRUE;
|
local_fail = TRUE;
|
||||||
global_fail = TRUE;
|
global_fail = TRUE;
|
||||||
|
@ -162,14 +162,14 @@ bool_t _test_fail(unsigned point) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t _test_assert(unsigned point, bool_t condition) {
|
bool _test_assert(unsigned point, bool condition) {
|
||||||
|
|
||||||
if (!condition)
|
if (!condition)
|
||||||
return _test_fail(point);
|
return _test_fail(point);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t _test_assert_sequence(unsigned point, char *expected) {
|
bool _test_assert_sequence(unsigned point, char *expected) {
|
||||||
char *cp = tokens_buffer;
|
char *cp = tokens_buffer;
|
||||||
while (cp < tokp) {
|
while (cp < tokp) {
|
||||||
if (*cp++ != *expected++)
|
if (*cp++ != *expected++)
|
||||||
|
@ -181,7 +181,7 @@ bool_t _test_assert_sequence(unsigned point, char *expected) {
|
||||||
return FALSE;
|
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));
|
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.
|
* @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 virtual_timer_t vt;
|
||||||
static void tmr(void *p) {
|
static void tmr(void *p) {
|
||||||
|
|
10
test/test.h
10
test/test.h
|
@ -84,10 +84,10 @@ extern "C" {
|
||||||
void test_print(const char *msgp);
|
void test_print(const char *msgp);
|
||||||
void test_println(const char *msgp);
|
void test_println(const char *msgp);
|
||||||
void test_emit_token(char token);
|
void test_emit_token(char token);
|
||||||
bool_t _test_fail(unsigned point);
|
bool _test_fail(unsigned point);
|
||||||
bool_t _test_assert(unsigned point, bool_t condition);
|
bool _test_assert(unsigned point, bool condition);
|
||||||
bool_t _test_assert_sequence(unsigned point, char *expected);
|
bool _test_assert_sequence(unsigned point, char *expected);
|
||||||
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);
|
||||||
void test_terminate_threads(void);
|
void test_terminate_threads(void);
|
||||||
void test_wait_threads(void);
|
void test_wait_threads(void);
|
||||||
systime_t test_wait_tick(void);
|
systime_t test_wait_tick(void);
|
||||||
|
@ -165,7 +165,7 @@ extern "C" {
|
||||||
extern thread_t *threads[MAX_THREADS];
|
extern thread_t *threads[MAX_THREADS];
|
||||||
extern union test_buffers test;
|
extern union test_buffers test;
|
||||||
extern void * ROMCONST wa[];
|
extern void * ROMCONST wa[];
|
||||||
extern bool_t test_timer_done;
|
extern bool test_timer_done;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _TEST_H_ */
|
#endif /* _TEST_H_ */
|
||||||
|
|
|
@ -188,9 +188,9 @@ ROMCONST struct testcase testdyn2 = {
|
||||||
* coverage.
|
* coverage.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool_t regfind(thread_t *tp) {
|
static bool regfind(thread_t *tp) {
|
||||||
thread_t *ftp;
|
thread_t *ftp;
|
||||||
bool_t found = FALSE;
|
bool found = false;
|
||||||
|
|
||||||
ftp = chRegFirstThread();
|
ftp = chRegFirstThread();
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -431,7 +431,7 @@ static void mtx5_setup(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mtx5_execute(void) {
|
static void mtx5_execute(void) {
|
||||||
bool_t b;
|
bool b;
|
||||||
tprio_t prio;
|
tprio_t prio;
|
||||||
|
|
||||||
prio = chThdGetPriorityX();
|
prio = chThdGetPriorityX();
|
||||||
|
|
Loading…
Reference in New Issue