mirror of https://github.com/rusefi/ChibiOS.git
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@521 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
4c4689df98
commit
b3e92dc720
|
@ -23,7 +23,7 @@
|
|||
#include "board.h"
|
||||
#include <sam7x_serial.h>
|
||||
|
||||
static WorkingArea(waThread1, 64);
|
||||
static WORKING_AREA(waThread1, 64);
|
||||
static msg_t Thread1(void *arg) {
|
||||
|
||||
while (TRUE) {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
/*
|
||||
* Red LEDs blinker thread, times are in milliseconds.
|
||||
*/
|
||||
static WorkingArea(waThread1, 64);
|
||||
static WORKING_AREA(waThread1, 64);
|
||||
static msg_t Thread1(void *arg) {
|
||||
|
||||
while (TRUE) {
|
||||
|
@ -48,7 +48,7 @@ static msg_t Thread1(void *arg) {
|
|||
/*
|
||||
* Yellow LED blinker thread, times are in milliseconds.
|
||||
*/
|
||||
static WorkingArea(waThread2, 64);
|
||||
static WORKING_AREA(waThread2, 64);
|
||||
static msg_t Thread2(void *arg) {
|
||||
|
||||
while (TRUE) {
|
||||
|
@ -60,7 +60,7 @@ static msg_t Thread2(void *arg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static WorkingArea(waTestThread, 128);
|
||||
static WORKING_AREA(waTestThread, 128);
|
||||
|
||||
/*
|
||||
* Executed as event handler at 500mS intervals.
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
/*
|
||||
* System idle thread loop.
|
||||
*/
|
||||
void _IdleThread(void *p) {
|
||||
void _idle(void *p) {
|
||||
|
||||
while (TRUE) {
|
||||
// Note, it is disabled because it causes trouble with the JTAG probe.
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
/*
|
||||
* System idle thread loop.
|
||||
*/
|
||||
void _IdleThread(void *p) {
|
||||
void _idle(void *p) {
|
||||
|
||||
while (TRUE) {
|
||||
// Note, it is disabled because it causes trouble with the JTAG probe.
|
||||
|
|
|
@ -20,8 +20,16 @@
|
|||
#ifndef _CHCORE_H_
|
||||
#define _CHCORE_H_
|
||||
|
||||
/**
|
||||
* Macro defining the ARM7 architecture.
|
||||
*/
|
||||
#define CH_ARCHITECTURE_ARM7
|
||||
|
||||
/*
|
||||
* 32 bit stack alignment.
|
||||
*/
|
||||
typedef uint32_t stkalign_t;
|
||||
|
||||
typedef void *regarm;
|
||||
|
||||
/*
|
||||
|
@ -113,13 +121,22 @@ extern "C" {
|
|||
#else /* !THUMB */
|
||||
#define INT_REQUIRED_STACK 0
|
||||
#endif /* !THUMB */
|
||||
#define StackAlign(n) ((((n) - 1) | 3) + 1)
|
||||
#define UserStackSize(n) StackAlign(sizeof(Thread) + \
|
||||
|
||||
/*
|
||||
* Enforces a 32 bit alignment for a stack area size value.
|
||||
*/
|
||||
#define STACK_ALIGN(n) ((((n) - 1) | sizeof(stkalign_t)) + 1)
|
||||
|
||||
#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \
|
||||
sizeof(struct intctx) + \
|
||||
sizeof(struct extctx) + \
|
||||
(n) + \
|
||||
INT_REQUIRED_STACK)
|
||||
#define WorkingArea(s, n) uint32_t s[UserStackSize(n) >> 2];
|
||||
|
||||
/*
|
||||
* Declares a 32bit aligned thread working area.
|
||||
*/
|
||||
#define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n)];
|
||||
|
||||
#ifdef THUMB
|
||||
#define chSysSwitchI chSysSwitchI_thumb
|
||||
|
@ -154,7 +171,7 @@ extern "C" {
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void _IdleThread(void *p) __attribute__((noreturn));
|
||||
void _idle(void *p) __attribute__((weak, noreturn));
|
||||
void chSysHalt(void);
|
||||
void chSysSwitchI(Thread *otp, Thread *ntp);
|
||||
void chSysPuts(char *msg);
|
||||
|
|
|
@ -77,6 +77,11 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
|
|||
- FIX: Duplicated sections in the documentation removed.
|
||||
- NEW: Added chPoolAllocI() and chPoolFreeI() APIs in order to allow the use
|
||||
of memory pools from interrupt handlers and timer callbacks.
|
||||
- CHANGE: The macros WorkingArea(), UserStackSize() and StackAlign() are now
|
||||
deprecated and will be removed in version 1.0.0. Use the new equivalents
|
||||
WORKING_AREA(), THD_WA_SIZE() and STACK_ALIGN() instead.
|
||||
- CHANGE: Renamed the default idle thread function from _IdleThread() to
|
||||
_idle().
|
||||
|
||||
*** 0.8.1 ***
|
||||
- FIX: Fixed a regression in version 0.8.0, the configuration switch
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
*/
|
||||
void chSysInit(void) {
|
||||
static Thread mainthread;
|
||||
static WorkingArea(waIdleThread, IDLE_THREAD_STACK_SIZE);
|
||||
static WORKING_AREA(idle_wa, IDLE_THREAD_STACK_SIZE);
|
||||
|
||||
chSchInit();
|
||||
chDbgInit();
|
||||
|
@ -54,8 +54,7 @@ void chSysInit(void) {
|
|||
* serve interrupts in its context while keeping the lowest energy saving
|
||||
* mode compatible with the system status.
|
||||
*/
|
||||
chThdCreateStatic(waIdleThread, sizeof(waIdleThread),
|
||||
IDLEPRIO, (tfunc_t)_IdleThread, NULL);
|
||||
chThdCreateStatic(idle_wa, sizeof(idle_wa), IDLEPRIO, (tfunc_t)_idle, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -85,7 +85,7 @@ Thread *chThdInit(void *workspace, size_t wsize,
|
|||
/* thread structure is layed out in the lower part of the thread workspace */
|
||||
Thread *tp = workspace;
|
||||
|
||||
chDbgAssert((wsize >= UserStackSize(0)) && (prio <= HIGHPRIO) &&
|
||||
chDbgAssert((wsize >= THD_WA_SIZE(0)) && (prio <= HIGHPRIO) &&
|
||||
(workspace != NULL) && (pf != NULL),
|
||||
"chthreads.c, chThdInit()");
|
||||
#ifdef CH_USE_DEBUG
|
||||
|
|
|
@ -35,8 +35,10 @@
|
|||
* put the processor in the lowest power mode capable to serve interrupts.
|
||||
* The priority is internally set to the minimum system value so that this
|
||||
* thread is executed only if there are no other ready threads in the system.
|
||||
* @note Implementation should declare this function as a weak symbol in order
|
||||
* to allow applications to re-implement it.
|
||||
*/
|
||||
void _IdleThread(void *p) {
|
||||
void _idle(void *p) {
|
||||
|
||||
while (TRUE)
|
||||
;
|
||||
|
@ -54,6 +56,12 @@ void chSysHalt(void) {
|
|||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the interrupts, it is only invoked once into \p chSysInit().
|
||||
*/
|
||||
void chSysEnable(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Enters the ChibiOS/RT system mutual exclusion zone. The implementation is
|
||||
* architecture dependent, on single core systems usually this function usually
|
||||
|
|
|
@ -30,6 +30,11 @@
|
|||
*/
|
||||
#define CH_ARCHITECTURE_XXX
|
||||
|
||||
/**
|
||||
* Base type for stack alignment.
|
||||
*/
|
||||
typedef uint8_t stkalign_t;
|
||||
|
||||
/**
|
||||
* Interrupt saved context.
|
||||
*/
|
||||
|
@ -59,20 +64,34 @@ typedef struct {
|
|||
#define IDLE_THREAD_STACK_SIZE 0
|
||||
|
||||
/**
|
||||
* Per-thread stack overhead for interrupts servicing.
|
||||
* Per-thread stack overhead for interrupts servicing, it is used in the
|
||||
* calculation of the correct working area size.
|
||||
*/
|
||||
#define INT_REQUIRED_STACK 0
|
||||
|
||||
/**
|
||||
* Enforces a stack size alignment.
|
||||
* Enforces a correct alignment for a stack area size value.
|
||||
* @deprecated Use STACK_ALIGN() instead, this macro will be removed in
|
||||
* version 1.0.0.
|
||||
*/
|
||||
#define StackAlign(n) (n)
|
||||
#define StackAlign(n) STACK_ALIGN(n)
|
||||
|
||||
/**
|
||||
* Macro to be used when allocating stack spaces, it adds the system-specific
|
||||
* overhead.
|
||||
* Enforces a correct alignment for a stack area size value.
|
||||
*/
|
||||
#define UserStackSize(n) StackAlign(sizeof(Thread) + \
|
||||
#define STACK_ALIGN(n) ((((n) - 1) | sizeof(stkalign_t)) + 1)
|
||||
|
||||
/**
|
||||
* Computes the thread working area global size.
|
||||
* @deprecated Use THD_WA_SIZE() instead, this macro will be removed in
|
||||
* version 1.0.0.
|
||||
*/
|
||||
#define UserStackSize(n) THD_WA_SIZE(n)
|
||||
|
||||
/**
|
||||
* Computes the thread working area global size.
|
||||
*/
|
||||
#define THD_WA_SIZE(n) StackAlign(sizeof(Thread) + \
|
||||
sizeof(struct intctx) + \
|
||||
sizeof(struct extctx) + \
|
||||
(n) + (INT_REQUIRED_STACK))
|
||||
|
@ -80,17 +99,20 @@ typedef struct {
|
|||
/**
|
||||
* Macro used to allocate a thread working area aligned as both position and
|
||||
* size.
|
||||
* @deprecated Use WORKING_AREA() instead, this macro will be removed in
|
||||
* version 1.0.0.
|
||||
*/
|
||||
#define WorkingArea(s, n) uint8_t s[UserStackSize(n)];
|
||||
#define WorkingArea(s, n) WORKING_AREA(s, n)
|
||||
|
||||
/**
|
||||
* Enables the interrupts, it is only invoked once into \p chSysInit().
|
||||
* Macro used to allocate a thread working area aligned as both position and
|
||||
* size.
|
||||
*/
|
||||
#define chSysEnable()
|
||||
#define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n)];
|
||||
|
||||
/**
|
||||
* IRQ handler enter code.
|
||||
* @note Usually IRQ handlers function are also declared naked.
|
||||
* @note Usually IRQ handlers functions are also declared naked.
|
||||
* @note On some architectures this macro can be empty.
|
||||
*/
|
||||
#define chSysIRQEnterI()
|
||||
|
@ -98,7 +120,7 @@ typedef struct {
|
|||
/**
|
||||
* IRQ handler exit code.
|
||||
* @note Usually IRQ handlers function are also declared naked.
|
||||
* @note This macro must perform the final reschedulation by using
|
||||
* @note This macro usually performs the final reschedulation by using
|
||||
* \p chSchRescRequiredI() and \p chSchDoRescheduleI().
|
||||
*/
|
||||
#define chSysIRQExitI()
|
||||
|
@ -106,8 +128,9 @@ typedef struct {
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void _IdleThread(void *p);
|
||||
void _idle(void *p);
|
||||
void chSysHalt(void);
|
||||
void chSysEnable(void);
|
||||
void chSysLock(void);
|
||||
void chSysUnlock(void);
|
||||
void chSysSwitchI(Thread *otp, Thread *ntp);
|
||||
|
|
10
test/test.c
10
test/test.c
|
@ -83,11 +83,11 @@ static bool_t local_fail, global_fail;
|
|||
static char *failmsg;
|
||||
static char tokens_buffer[MAX_TOKENS];
|
||||
static char *tokp;
|
||||
static WorkingArea(waT0, THREADS_STACK_SIZE);
|
||||
static WorkingArea(waT1, THREADS_STACK_SIZE);
|
||||
static WorkingArea(waT2, THREADS_STACK_SIZE);
|
||||
static WorkingArea(waT3, THREADS_STACK_SIZE);
|
||||
static WorkingArea(waT4, THREADS_STACK_SIZE);
|
||||
static WORKING_AREA(waT0, THREADS_STACK_SIZE);
|
||||
static WORKING_AREA(waT1, THREADS_STACK_SIZE);
|
||||
static WORKING_AREA(waT2, THREADS_STACK_SIZE);
|
||||
static WORKING_AREA(waT3, THREADS_STACK_SIZE);
|
||||
static WORKING_AREA(waT4, THREADS_STACK_SIZE);
|
||||
|
||||
void *wa[MAX_THREADS] = {waT0, waT1, waT2, waT3, waT4};
|
||||
Thread *threads[MAX_THREADS];
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#else
|
||||
#define THREADS_STACK_SIZE 128
|
||||
#endif
|
||||
#define STKSIZE UserStackSize(THREADS_STACK_SIZE)
|
||||
#define WA_SIZE THD_WA_SIZE(THREADS_STACK_SIZE)
|
||||
|
||||
struct testcase {
|
||||
char *(*gettest)(void);
|
||||
|
|
|
@ -59,7 +59,7 @@ static char *bmk1_gettest(void) {
|
|||
static void bmk1_execute(void) {
|
||||
uint32_t n;
|
||||
|
||||
threads[0] = chThdCreateFast(chThdGetPriority()-1, wa[0], STKSIZE, thread1);
|
||||
threads[0] = chThdCreateFast(chThdGetPriority()-1, wa[0], WA_SIZE, thread1);
|
||||
n = msg_loop_test(threads[0]);
|
||||
chThdTerminate(threads[0]);
|
||||
test_wait_threads();
|
||||
|
@ -85,7 +85,7 @@ static char *bmk2_gettest(void) {
|
|||
static void bmk2_execute(void) {
|
||||
uint32_t n;
|
||||
|
||||
threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], STKSIZE, thread1);
|
||||
threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], WA_SIZE, thread1);
|
||||
n = msg_loop_test(threads[0]);
|
||||
chThdTerminate(threads[0]);
|
||||
test_wait_threads();
|
||||
|
@ -116,11 +116,11 @@ static char *bmk3_gettest(void) {
|
|||
static void bmk3_execute(void) {
|
||||
uint32_t n;
|
||||
|
||||
threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], STKSIZE, thread1);
|
||||
threads[1] = chThdCreateFast(chThdGetPriority()-2, wa[1], STKSIZE, thread2);
|
||||
threads[2] = chThdCreateFast(chThdGetPriority()-3, wa[2], STKSIZE, thread2);
|
||||
threads[3] = chThdCreateFast(chThdGetPriority()-4, wa[3], STKSIZE, thread2);
|
||||
threads[4] = chThdCreateFast(chThdGetPriority()-5, wa[4], STKSIZE, thread2);
|
||||
threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], WA_SIZE, thread1);
|
||||
threads[1] = chThdCreateFast(chThdGetPriority()-2, wa[1], WA_SIZE, thread2);
|
||||
threads[2] = chThdCreateFast(chThdGetPriority()-3, wa[2], WA_SIZE, thread2);
|
||||
threads[3] = chThdCreateFast(chThdGetPriority()-4, wa[3], WA_SIZE, thread2);
|
||||
threads[4] = chThdCreateFast(chThdGetPriority()-5, wa[4], WA_SIZE, thread2);
|
||||
n = msg_loop_test(threads[0]);
|
||||
chThdTerminate(threads[0]);
|
||||
test_wait_threads();
|
||||
|
@ -151,7 +151,7 @@ static void bmk4_execute(void) {
|
|||
test_wait_tick();
|
||||
test_start_timer(1000);
|
||||
do {
|
||||
chThdWait(chThdCreateFast(prio, wap, STKSIZE, thread2));
|
||||
chThdWait(chThdCreateFast(prio, wap, WA_SIZE, thread2));
|
||||
n++;
|
||||
#if defined(WIN32)
|
||||
ChkIntSources();
|
||||
|
@ -182,7 +182,7 @@ static void bmk5_execute(void) {
|
|||
test_wait_tick();
|
||||
test_start_timer(1000);
|
||||
do {
|
||||
chThdCreateFast(prio, wap, STKSIZE, thread2);
|
||||
chThdCreateFast(prio, wap, WA_SIZE, thread2);
|
||||
n++;
|
||||
#if defined(WIN32)
|
||||
ChkIntSources();
|
||||
|
@ -220,11 +220,11 @@ static void bmk6_setup(void) {
|
|||
static void bmk6_execute(void) {
|
||||
uint32_t n;
|
||||
|
||||
threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], STKSIZE, thread3);
|
||||
threads[1] = chThdCreateFast(chThdGetPriority()+2, wa[1], STKSIZE, thread3);
|
||||
threads[2] = chThdCreateFast(chThdGetPriority()+3, wa[2], STKSIZE, thread3);
|
||||
threads[3] = chThdCreateFast(chThdGetPriority()+4, wa[3], STKSIZE, thread3);
|
||||
threads[4] = chThdCreateFast(chThdGetPriority()+5, wa[4], STKSIZE, thread3);
|
||||
threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], WA_SIZE, thread3);
|
||||
threads[1] = chThdCreateFast(chThdGetPriority()+2, wa[1], WA_SIZE, thread3);
|
||||
threads[2] = chThdCreateFast(chThdGetPriority()+3, wa[2], WA_SIZE, thread3);
|
||||
threads[3] = chThdCreateFast(chThdGetPriority()+4, wa[3], WA_SIZE, thread3);
|
||||
threads[4] = chThdCreateFast(chThdGetPriority()+5, wa[4], WA_SIZE, thread3);
|
||||
|
||||
n = 0;
|
||||
test_wait_tick();
|
||||
|
|
|
@ -53,11 +53,11 @@ static void cond1_execute(void) {
|
|||
|
||||
// Bacause priority inheritance.
|
||||
tprio_t prio = chThdGetPriority();
|
||||
threads[0] = chThdCreate(prio+1, 0, wa[0], STKSIZE, thread1, "E");
|
||||
threads[1] = chThdCreate(prio+2, 0, wa[1], STKSIZE, thread1, "D");
|
||||
threads[2] = chThdCreate(prio+3, 0, wa[2], STKSIZE, thread1, "C");
|
||||
threads[3] = chThdCreate(prio+4, 0, wa[3], STKSIZE, thread1, "B");
|
||||
threads[4] = chThdCreate(prio+5, 0, wa[4], STKSIZE, thread1, "A");
|
||||
threads[0] = chThdCreate(prio+1, 0, wa[0], WA_SIZE, thread1, "E");
|
||||
threads[1] = chThdCreate(prio+2, 0, wa[1], WA_SIZE, thread1, "D");
|
||||
threads[2] = chThdCreate(prio+3, 0, wa[2], WA_SIZE, thread1, "C");
|
||||
threads[3] = chThdCreate(prio+4, 0, wa[3], WA_SIZE, thread1, "B");
|
||||
threads[4] = chThdCreate(prio+5, 0, wa[4], WA_SIZE, thread1, "A");
|
||||
test_assert(prio == chThdGetPriority(), "priority return failure");
|
||||
chCondSignal(&c1);
|
||||
chCondSignal(&c1);
|
||||
|
@ -84,11 +84,11 @@ static void cond2_execute(void) {
|
|||
|
||||
// Bacause priority inheritance.
|
||||
tprio_t prio = chThdGetPriority();
|
||||
threads[0] = chThdCreate(prio+1, 0, wa[0], STKSIZE, thread1, "E");
|
||||
threads[1] = chThdCreate(prio+2, 0, wa[1], STKSIZE, thread1, "D");
|
||||
threads[2] = chThdCreate(prio+3, 0, wa[2], STKSIZE, thread1, "C");
|
||||
threads[3] = chThdCreate(prio+4, 0, wa[3], STKSIZE, thread1, "B");
|
||||
threads[4] = chThdCreate(prio+5, 0, wa[4], STKSIZE, thread1, "A");
|
||||
threads[0] = chThdCreate(prio+1, 0, wa[0], WA_SIZE, thread1, "E");
|
||||
threads[1] = chThdCreate(prio+2, 0, wa[1], WA_SIZE, thread1, "D");
|
||||
threads[2] = chThdCreate(prio+3, 0, wa[2], WA_SIZE, thread1, "C");
|
||||
threads[3] = chThdCreate(prio+4, 0, wa[3], WA_SIZE, thread1, "B");
|
||||
threads[4] = chThdCreate(prio+5, 0, wa[4], WA_SIZE, thread1, "A");
|
||||
test_assert(prio == chThdGetPriority(), "priority return failure");
|
||||
chCondBroadcast(&c1);
|
||||
test_wait_threads();
|
||||
|
|
|
@ -48,9 +48,9 @@ static void dyn1_execute(void) {
|
|||
/* Test skipped if the heap is already fragmented. */
|
||||
if ((n = chHeapStatus(&sz)) == 1) {
|
||||
/* Starting threads from the heap. */
|
||||
threads[0] = chThdCreateFromHeap(UserStackSize(THREADS_STACK_SIZE),
|
||||
threads[0] = chThdCreateFromHeap(THD_WA_SIZE(THREADS_STACK_SIZE),
|
||||
prio-1, thread, "A");
|
||||
threads[1] = chThdCreateFromHeap(UserStackSize(THREADS_STACK_SIZE),
|
||||
threads[1] = chThdCreateFromHeap(THD_WA_SIZE(THREADS_STACK_SIZE),
|
||||
prio-2, thread, "B");
|
||||
|
||||
test_assert((threads[0] != NULL) &&
|
||||
|
@ -88,7 +88,7 @@ static char *dyn2_gettest(void) {
|
|||
|
||||
static void dyn2_setup(void) {
|
||||
|
||||
chPoolInit(&mp1, UserStackSize(THREADS_STACK_SIZE));
|
||||
chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE));
|
||||
}
|
||||
|
||||
static void dyn2_teardown(void) {
|
||||
|
|
|
@ -47,7 +47,7 @@ static msg_t thread(void *p) {
|
|||
static void msg1_execute(void) {
|
||||
msg_t msg;
|
||||
|
||||
threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-1, thread, chThdSelf());
|
||||
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread, chThdSelf());
|
||||
do {
|
||||
chMsgRelease(msg = chMsgWait());
|
||||
if (msg)
|
||||
|
|
|
@ -52,11 +52,11 @@ static void mtx1_execute(void) {
|
|||
|
||||
tprio_t prio = chThdGetPriority(); // Bacause priority inheritance.
|
||||
chMtxLock(&m1);
|
||||
threads[0] = chThdCreateStatic(wa[0], STKSIZE, prio+1, thread1, "E");
|
||||
threads[1] = chThdCreateStatic(wa[1], STKSIZE, prio+2, thread1, "D");
|
||||
threads[2] = chThdCreateStatic(wa[2], STKSIZE, prio+3, thread1, "C");
|
||||
threads[3] = chThdCreateStatic(wa[3], STKSIZE, prio+4, thread1, "B");
|
||||
threads[4] = chThdCreateStatic(wa[4], STKSIZE, prio+5, thread1, "A");
|
||||
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread1, "E");
|
||||
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread1, "D");
|
||||
threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread1, "C");
|
||||
threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread1, "B");
|
||||
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A");
|
||||
chMtxUnlock();
|
||||
test_wait_threads();
|
||||
test_assert(prio == chThdGetPriority(), "priority return failure");
|
||||
|
@ -117,9 +117,9 @@ static msg_t thread4(void *p) {
|
|||
*/
|
||||
static void mtx2_execute(void) {
|
||||
|
||||
threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-1, thread2, "A");
|
||||
threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()-3, thread3, "C");
|
||||
threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()-2, thread4, "B");
|
||||
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread2, "A");
|
||||
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-3, thread3, "C");
|
||||
threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-2, thread4, "B");
|
||||
test_wait_threads();
|
||||
test_assert_sequence("ABC");
|
||||
}
|
||||
|
@ -206,11 +206,11 @@ static msg_t thread9(void *p) {
|
|||
*/
|
||||
static void mtx3_execute(void) {
|
||||
|
||||
threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-5, thread5, "E");
|
||||
threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()-4, thread6, "D");
|
||||
threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()-3, thread7, "C");
|
||||
threads[3] = chThdCreateStatic(wa[3], STKSIZE, chThdGetPriority()-2, thread8, "B");
|
||||
threads[4] = chThdCreateStatic(wa[4], STKSIZE, chThdGetPriority()-1, thread9, "A");
|
||||
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread5, "E");
|
||||
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread6, "D");
|
||||
threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread7, "C");
|
||||
threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread8, "B");
|
||||
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread9, "A");
|
||||
test_wait_threads();
|
||||
test_assert_sequence("ABCDE");
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ static char *pools1_gettest(void) {
|
|||
|
||||
static void pools1_setup(void) {
|
||||
|
||||
chPoolInit(&mp1, UserStackSize(THREADS_STACK_SIZE));
|
||||
chPoolInit(&mp1, THD_WA_SIZE(THREADS_STACK_SIZE));
|
||||
}
|
||||
|
||||
static void pools1_teardown(void) {
|
||||
|
|
|
@ -40,11 +40,11 @@ static void rdy1_teardown(void) {
|
|||
|
||||
static void rdy1_execute(void) {
|
||||
|
||||
threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-5, thread, "E");
|
||||
threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()-4, thread, "D");
|
||||
threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()-3, thread, "C");
|
||||
threads[3] = chThdCreateStatic(wa[3], STKSIZE, chThdGetPriority()-2, thread, "B");
|
||||
threads[4] = chThdCreateStatic(wa[4], STKSIZE, chThdGetPriority()-1, thread, "A");
|
||||
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E");
|
||||
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D");
|
||||
threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C");
|
||||
threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B");
|
||||
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread, "A");
|
||||
test_wait_threads();
|
||||
test_assert_sequence("ABCDE");
|
||||
}
|
||||
|
@ -69,11 +69,11 @@ static void rdy2_teardown(void) {
|
|||
|
||||
static void rdy2_execute(void) {
|
||||
|
||||
threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()-4, thread, "D");
|
||||
threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()-5, thread, "E");
|
||||
threads[4] = chThdCreateStatic(wa[4], STKSIZE, chThdGetPriority()-1, thread, "A");
|
||||
threads[3] = chThdCreateStatic(wa[3], STKSIZE, chThdGetPriority()-2, thread, "B");
|
||||
threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()-3, thread, "C");
|
||||
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D");
|
||||
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E");
|
||||
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread, "A");
|
||||
threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B");
|
||||
threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C");
|
||||
test_wait_threads();
|
||||
test_assert_sequence("ABCDE");
|
||||
}
|
||||
|
|
|
@ -49,11 +49,11 @@ static msg_t thread(void *p) {
|
|||
|
||||
static void sem1_execute(void) {
|
||||
|
||||
threads[0] = chThdCreateStatic(wa[0], STKSIZE, chThdGetPriority()+5, thread, "A");
|
||||
threads[1] = chThdCreateStatic(wa[1], STKSIZE, chThdGetPriority()+1, thread, "B");
|
||||
threads[2] = chThdCreateStatic(wa[2], STKSIZE, chThdGetPriority()+3, thread, "C");
|
||||
threads[3] = chThdCreateStatic(wa[3], STKSIZE, chThdGetPriority()+4, thread, "D");
|
||||
threads[4] = chThdCreateStatic(wa[4], STKSIZE, chThdGetPriority()+2, thread, "E");
|
||||
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread, "A");
|
||||
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()+1, thread, "B");
|
||||
threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()+3, thread, "C");
|
||||
threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()+4, thread, "D");
|
||||
threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()+2, thread, "E");
|
||||
chSemSignal(&sem1);
|
||||
chSemSignal(&sem1);
|
||||
chSemSignal(&sem1);
|
||||
|
|
Loading…
Reference in New Issue