diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-08-16 17:41:56 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2013-08-16 17:41:56 +0000 |
commit | bfa3ba9f00d263a15d6d6b2dec2aa0b81058df27 (patch) | |
tree | 817fc88a260e36d897b48dce522f2057b15346e0 /test | |
parent | 752b44ba0e550159fb6d2372c54a278fb94080eb (diff) | |
download | ChibiOS-bfa3ba9f00d263a15d6d6b2dec2aa0b81058df27.tar.gz ChibiOS-bfa3ba9f00d263a15d6d6b2dec2aa0b81058df27.tar.bz2 ChibiOS-bfa3ba9f00d263a15d6d6b2dec2aa0b81058df27.zip |
Turned more macros in inline functions.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6166 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test')
-rw-r--r-- | test/test.c | 4 | ||||
-rw-r--r-- | test/testbmk.c | 46 | ||||
-rw-r--r-- | test/testdyn.c | 6 | ||||
-rw-r--r-- | test/testevt.c | 10 | ||||
-rw-r--r-- | test/testmsg.c | 4 | ||||
-rw-r--r-- | test/testmtx.c | 60 | ||||
-rw-r--r-- | test/testqueues.c | 4 | ||||
-rw-r--r-- | test/testsem.c | 18 | ||||
-rw-r--r-- | test/testthd.c | 42 |
9 files changed, 97 insertions, 97 deletions
diff --git a/test/test.c b/test/test.c index f88b402a7..77759f5b8 100644 --- a/test/test.c +++ b/test/test.c @@ -224,10 +224,10 @@ void test_wait_threads(void) { void test_cpu_pulse(unsigned duration) {
systime_t start, end, now;
- start = chThdSelf()->p_time;
+ start = chThdGetTicksX(chThdGetSelfX());
end = start + MS2ST(duration);
do {
- now = chThdSelf()->p_time;
+ now = chThdGetTicksX(chThdGetSelfX());
#if defined(SIMULATOR)
ChkIntSources();
#endif
diff --git a/test/testbmk.c b/test/testbmk.c index 4ce953163..5149323a6 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -105,7 +105,7 @@ static unsigned int msg_loop_test(thread_t *tp) { static void bmk1_execute(void) {
uint32_t n;
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread1, NULL);
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-1, thread1, NULL);
n = msg_loop_test(threads[0]);
test_wait_threads();
test_print("--- Score : ");
@@ -134,7 +134,7 @@ ROMCONST struct testcase testbmk1 = { static void bmk2_execute(void) {
uint32_t n;
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread1, NULL);
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+1, thread1, NULL);
n = msg_loop_test(threads[0]);
test_wait_threads();
test_print("--- Score : ");
@@ -169,11 +169,11 @@ static msg_t thread2(void *p) { static void bmk3_execute(void) {
uint32_t n;
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread1, NULL);
- threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-2, thread2, NULL);
- threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread2, NULL);
- threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-4, thread2, NULL);
- threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-5, thread2, NULL);
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+1, thread1, NULL);
+ threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-2, thread2, NULL);
+ threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread2, NULL);
+ threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-4, thread2, NULL);
+ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-5, thread2, NULL);
n = msg_loop_test(threads[0]);
test_wait_threads();
test_print("--- Score : ");
@@ -202,7 +202,7 @@ ROMCONST struct testcase testbmk3 = { msg_t thread4(void *p) {
msg_t msg;
- thread_t *self = chThdSelf();
+ thread_t *self = chThdGetSelfX();
(void)p;
chSysLock();
@@ -218,7 +218,7 @@ static void bmk4_execute(void) { thread_t *tp;
uint32_t n;
- tp = threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1,
+ tp = threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+1,
thread4, NULL);
n = 0;
test_wait_tick();
@@ -267,7 +267,7 @@ static void bmk5_execute(void) { uint32_t n = 0;
void *wap = wa[0];
- tprio_t prio = chThdGetPriority() - 1;
+ tprio_t prio = chThdGetPriorityX() - 1;
test_wait_tick();
test_start_timer(1000);
do {
@@ -306,7 +306,7 @@ static void bmk6_execute(void) { uint32_t n = 0;
void *wap = wa[0];
- tprio_t prio = chThdGetPriority() + 1;
+ tprio_t prio = chThdGetPriorityX() + 1;
test_wait_tick();
test_start_timer(1000);
do {
@@ -342,7 +342,7 @@ ROMCONST struct testcase testbmk6 = { static msg_t thread3(void *p) {
(void)p;
- while (!chThdShouldTerminate())
+ while (!chThdShouldTerminateX())
chSemWait(&sem1);
return 0;
}
@@ -355,11 +355,11 @@ static void bmk7_setup(void) { static void bmk7_execute(void) {
uint32_t n;
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread3, NULL);
- threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()+4, thread3, NULL);
- threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()+3, thread3, NULL);
- threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()+2, thread3, NULL);
- threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()+1, thread3, NULL);
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+5, thread3, NULL);
+ threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()+4, thread3, NULL);
+ threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()+3, thread3, NULL);
+ threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()+2, thread3, NULL);
+ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()+1, thread3, NULL);
n = 0;
test_wait_tick();
@@ -410,7 +410,7 @@ static msg_t thread8(void *p) { #if defined(SIMULATOR)
ChkIntSources();
#endif
- } while(!chThdShouldTerminate());
+ } while(!chThdShouldTerminateX());
return 0;
}
@@ -420,11 +420,11 @@ static void bmk8_execute(void) { n = 0;
test_wait_tick();
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread8, (void *)&n);
- threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-1, thread8, (void *)&n);
- threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-1, thread8, (void *)&n);
- threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-1, thread8, (void *)&n);
- threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread8, (void *)&n);
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&n);
+ threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&n);
+ threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&n);
+ threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&n);
+ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread8, (void *)&n);
chThdSleepSeconds(1);
test_terminate_threads();
diff --git a/test/testdyn.c b/test/testdyn.c index 7ba281e31..3eb3304d5 100644 --- a/test/testdyn.c +++ b/test/testdyn.c @@ -83,7 +83,7 @@ static void dyn1_setup(void) { static void dyn1_execute(void) {
size_t n, sz;
void *p1;
- tprio_t prio = chThdGetPriority();
+ tprio_t prio = chThdGetPriorityX();
(void)chHeapStatus(&heap1, &sz);
/* Starting threads from the heap. */
@@ -140,7 +140,7 @@ static void dyn2_setup(void) { static void dyn2_execute(void) {
int i;
- tprio_t prio = chThdGetPriority();
+ tprio_t prio = chThdGetPriorityX();
/* Adding the WAs to the pool. */
for (i = 0; i < 4; i++)
@@ -207,7 +207,7 @@ static void dyn3_setup(void) { static void dyn3_execute(void) {
thread_t *tp;
- tprio_t prio = chThdGetPriority();
+ tprio_t prio = chThdGetPriorityX();
/* Testing references increase/decrease and final detach.*/
tp = chThdCreateFromHeap(&heap1, WA_SIZE, prio-1, thread, "A");
diff --git a/test/testevt.c b/test/testevt.c index bb9381139..49507f067 100644 --- a/test/testevt.c +++ b/test/testevt.c @@ -167,8 +167,8 @@ static void evt2_execute(void) { */
test_wait_tick();
target_time = chVTGetSystemTime() + MS2ST(50);
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() - 1,
- thread1, chThdSelf());
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
+ thread1, chThdGetSelfX());
m = chEvtWaitOne(ALL_EVENTS);
test_assert_time_window(4, target_time, target_time + ALLOWED_DELAY);
test_assert(5, m == 1, "single event error");
@@ -190,8 +190,8 @@ static void evt2_execute(void) { */
test_wait_tick();
target_time = chVTGetSystemTime() + MS2ST(50);
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() - 1,
- thread1, chThdSelf());
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
+ thread1, chThdGetSelfX());
m = chEvtWaitAny(ALL_EVENTS);
test_assert_time_window(9, target_time, target_time + ALLOWED_DELAY);
test_assert(10, m == 1, "single event error");
@@ -208,7 +208,7 @@ static void evt2_execute(void) { chEvtRegisterMask(&es2, &el2, 4);
test_wait_tick();
target_time = chVTGetSystemTime() + MS2ST(50);
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() - 1,
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
thread2, "A");
m = chEvtWaitAll(5);
test_assert_time_window(12, target_time, target_time + ALLOWED_DELAY);
diff --git a/test/testmsg.c b/test/testmsg.c index 30d7f24dd..b3b2aedcd 100644 --- a/test/testmsg.c +++ b/test/testmsg.c @@ -71,8 +71,8 @@ static void msg1_execute(void) { /*
* Testing the whole messages loop.
*/
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() + 1,
- thread, chThdSelf());
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() + 1,
+ thread, chThdGetSelfX());
tp = chMsgWait();
msg = chMsgGet(tp);
chMsgRelease(tp, msg);
diff --git a/test/testmtx.c b/test/testmtx.c index c775cb51b..cd10fa986 100644 --- a/test/testmtx.c +++ b/test/testmtx.c @@ -96,7 +96,7 @@ static msg_t thread1(void *p) { static void mtx1_execute(void) {
- tprio_t prio = chThdGetPriority(); /* Because priority inheritance.*/
+ tprio_t prio = chThdGetPriorityX(); /* Because priority inheritance.*/
chMtxLock(&m1);
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread1, "E");
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread1, "D");
@@ -105,7 +105,7 @@ static void mtx1_execute(void) { threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread1, "A");
chMtxUnlock();
test_wait_threads();
- test_assert(1, prio == chThdGetPriority(), "wrong priority level");
+ test_assert(1, prio == chThdGetPriorityX(), "wrong priority level");
test_assert_sequence(2, "ABCDE");
}
@@ -192,9 +192,9 @@ static void mtx2_execute(void) { test_wait_tick();
time = chVTGetSystemTime();
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread2H, 0);
- threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-2, thread2M, 0);
- threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread2L, 0);
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-1, thread2H, 0);
+ threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-2, thread2M, 0);
+ threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread2L, 0);
test_wait_threads();
test_assert_sequence(1, "ABC");
test_assert_time_window(2, time + MS2ST(100), time + MS2ST(100) + ALLOWED_DELAY);
@@ -310,11 +310,11 @@ static void mtx3_execute(void) { test_wait_tick();
time = chVTGetSystemTime();
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread3LL, 0);
- threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread3L, 0);
- threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread3M, 0);
- threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread3H, 0);
- threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread3HH, 0);
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread3LL, 0);
+ threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread3L, 0);
+ threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread3M, 0);
+ threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread3H, 0);
+ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread3HH, 0);
test_wait_threads();
test_assert_sequence(1, "ABCDE");
test_assert_time_window(2, time + MS2ST(110), time + MS2ST(110) + ALLOWED_DELAY);
@@ -365,46 +365,46 @@ static msg_t thread4b(void *p) { static void mtx4_execute(void) {
tprio_t p, p1, p2;
- p = chThdGetPriority();
+ p = chThdGetPriorityX();
p1 = p + 1;
p2 = p + 2;
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, p1, thread4a, "B");
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, p2, thread4b, "A");
chMtxLock(&m2);
- test_assert(1, chThdGetPriority() == p, "wrong priority level");
+ test_assert(1, chThdGetPriorityX() == p, "wrong priority level");
chThdSleepMilliseconds(100);
- test_assert(2, chThdGetPriority() == p1, "wrong priority level");
+ test_assert(2, chThdGetPriorityX() == p1, "wrong priority level");
chMtxLock(&m1);
- test_assert(3, chThdGetPriority() == p1, "wrong priority level");
+ test_assert(3, chThdGetPriorityX() == p1, "wrong priority level");
chThdSleepMilliseconds(100);
- test_assert(4, chThdGetPriority() == p2, "wrong priority level");
+ test_assert(4, chThdGetPriorityX() == p2, "wrong priority level");
chMtxUnlock();
- test_assert(5, chThdGetPriority() == p1, "wrong priority level");
+ test_assert(5, chThdGetPriorityX() == p1, "wrong priority level");
chThdSleepMilliseconds(100);
- test_assert(6, chThdGetPriority() == p1, "wrong priority level");
+ test_assert(6, chThdGetPriorityX() == p1, "wrong priority level");
chMtxUnlockAll();
- test_assert(7, chThdGetPriority() == p, "wrong priority level");
+ test_assert(7, chThdGetPriorityX() == p, "wrong priority level");
test_wait_threads();
/* Test repeated in order to cover chMtxUnlockS().*/
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, p1, thread4a, "D");
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, p2, thread4b, "C");
chMtxLock(&m2);
- test_assert(8, chThdGetPriority() == p, "wrong priority level");
+ test_assert(8, chThdGetPriorityX() == p, "wrong priority level");
chThdSleepMilliseconds(100);
- test_assert(9, chThdGetPriority() == p1, "wrong priority level");
+ test_assert(9, chThdGetPriorityX() == p1, "wrong priority level");
chMtxLock(&m1);
- test_assert(10, chThdGetPriority() == p1, "wrong priority level");
+ test_assert(10, chThdGetPriorityX() == p1, "wrong priority level");
chThdSleepMilliseconds(100);
- test_assert(11, chThdGetPriority() == p2, "wrong priority level");
+ test_assert(11, chThdGetPriorityX() == p2, "wrong priority level");
chSysLock();
chMtxUnlockS();
chSysUnlock();
- test_assert(12, chThdGetPriority() == p1, "wrong priority level");
+ test_assert(12, chThdGetPriorityX() == p1, "wrong priority level");
chThdSleepMilliseconds(100);
- test_assert(13, chThdGetPriority() == p1, "wrong priority level");
+ test_assert(13, chThdGetPriorityX() == p1, "wrong priority level");
chMtxUnlockAll();
- test_assert(14, chThdGetPriority() == p, "wrong priority level");
+ test_assert(14, chThdGetPriorityX() == p, "wrong priority level");
test_wait_threads();
}
@@ -434,7 +434,7 @@ static void mtx5_execute(void) { bool_t b;
tprio_t prio;
- prio = chThdGetPriority();
+ prio = chThdGetPriorityX();
b = chMtxTryLock(&m1);
test_assert(1, b, "already locked");
@@ -448,7 +448,7 @@ static void mtx5_execute(void) { test_assert(3, queue_isempty(&m1.m_queue), "queue not empty");
test_assert(4, m1.m_owner == NULL, "still owned");
- test_assert(5, chThdGetPriority() == prio, "wrong priority level");
+ test_assert(5, chThdGetPriorityX() == prio, "wrong priority level");
chMtxLock(&m1);
chMtxUnlockAll();
@@ -492,7 +492,7 @@ static msg_t thread10(void *p) { static void mtx6_execute(void) {
- tprio_t prio = chThdGetPriority();
+ tprio_t prio = chThdGetPriorityX();
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread10, "E");
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread10, "D");
threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread10, "C");
@@ -535,7 +535,7 @@ static void mtx7_setup(void) { static void mtx7_execute(void) {
- tprio_t prio = chThdGetPriority();
+ tprio_t prio = chThdGetPriorityX();
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread10, "E");
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread10, "D");
threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread10, "C");
@@ -594,7 +594,7 @@ static msg_t thread12(void *p) { static void mtx8_execute(void) {
- tprio_t prio = chThdGetPriority();
+ tprio_t prio = chThdGetPriorityX();
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread11, "A");
threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread10, "C");
threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread12, "B");
diff --git a/test/testqueues.c b/test/testqueues.c index 6ef057f3a..0d1bcc872 100644 --- a/test/testqueues.c +++ b/test/testqueues.c @@ -138,7 +138,7 @@ static void queues1_execute(void) { chIQResetI(&iq);
chSysUnlock();
test_assert_lock(11, chIQGetFullI(&iq) == 0, "still full");
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread1, NULL);
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+1, thread1, NULL);
test_assert_lock(12, chIQGetFullI(&iq) == 0, "not empty");
test_wait_threads();
@@ -203,7 +203,7 @@ static void queues2_execute(void) { n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE * 2, TIME_IMMEDIATE);
test_assert(6, n == TEST_QUEUES_SIZE, "wrong returned size");
test_assert_lock(7, chOQIsFullI(&oq), "not full");
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread2, NULL);
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+1, thread2, NULL);
test_assert_lock(8, chOQGetFullI(&oq) == TEST_QUEUES_SIZE, "not empty");
test_wait_threads();
diff --git a/test/testsem.c b/test/testsem.c index 0810300ea..0d74f3613 100644 --- a/test/testsem.c +++ b/test/testsem.c @@ -83,11 +83,11 @@ static msg_t thread1(void *p) { static void sem1_execute(void) {
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread1, "A");
- threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()+1, thread1, "B");
- threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()+3, thread1, "C");
- threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()+4, thread1, "D");
- threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()+2, thread1, "E");
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+5, thread1, "A");
+ threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()+1, thread1, "B");
+ threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()+3, thread1, "C");
+ threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()+4, thread1, "D");
+ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()+2, thread1, "E");
chSemSignal(&sem1);
chSemSignal(&sem1);
chSemSignal(&sem1);
@@ -99,7 +99,7 @@ static void sem1_execute(void) { #else
test_assert_sequence(1, "ABCDE");
#endif
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread1, "A");
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+5, thread1, "A");
chSysLock();
chSemAddCounterI(&sem1, 2);
chSysUnlock();
@@ -157,7 +157,7 @@ static void sem2_execute(void) { /*
* Testing not timeout condition.
*/
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority() - 1,
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1,
thread2, 0);
msg = chSemWaitTimeout(&sem1, MS2ST(500));
test_wait_threads();
@@ -215,7 +215,7 @@ static msg_t thread3(void *p) { static void sem3_execute(void) {
- threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread3, 0);
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+1, thread3, 0);
chSemSignalWait(&sem1, &sem1);
test_assert(1, queue_isempty(&sem1.s_queue), "queue not empty");
test_assert(2, sem1.s_cnt == 0, "counter not zero");
@@ -256,7 +256,7 @@ static void sem4_execute(void) { /* Starts a signaler thread at a lower priority.*/
threads[0] = chThdCreateStatic(wa[0], WA_SIZE,
- chThdGetPriority()-1, thread4, &bsem);
+ chThdGetPriorityX()-1, thread4, &bsem);
/* Waits to be signaled.*/
chBSemWait(&bsem);
diff --git a/test/testthd.c b/test/testthd.c index af71a2041..34de252a8 100644 --- a/test/testthd.c +++ b/test/testthd.c @@ -65,11 +65,11 @@ static msg_t thread(void *p) { static void thd1_execute(void) {
- 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");
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread, "E");
+ threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread, "D");
+ threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C");
+ threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread, "B");
+ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread, "A");
test_wait_threads();
test_assert_sequence(1, "ABCDE");
}
@@ -93,13 +93,13 @@ ROMCONST struct testcase testthd1 = { static void thd2_execute(void) {
- 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[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread, "D");
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread, "E");
+ threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread, "A");
+ threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread, "B");
/* Done this way for coverage of chThdCreateI() and chThdResume().*/
chSysLock();
- threads[2] = chThdCreateI(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C");
+ threads[2] = chThdCreateI(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C");
chSysUnlock();
chThdResume(threads[2]);
test_wait_threads();
@@ -126,47 +126,47 @@ ROMCONST struct testcase testthd2 = { static void thd3_execute(void) {
tprio_t prio, p1;
- prio = chThdGetPriority();
+ prio = chThdGetPriorityX();
p1 = chThdSetPriority(prio + 1);
test_assert(1, p1 == prio,
"unexpected returned priority level");
- test_assert(2, chThdGetPriority() == prio + 1,
+ test_assert(2, chThdGetPriorityX() == prio + 1,
"unexpected priority level");
p1 = chThdSetPriority(p1);
test_assert(3, p1 == prio + 1,
"unexpected returned priority level");
- test_assert(4, chThdGetPriority() == prio,
+ test_assert(4, chThdGetPriorityX() == prio,
"unexpected priority level");
#if CH_CFG_USE_MUTEXES || defined(__DOXYGEN__)
/* Simulates a priority boost situation (p_prio > p_realprio).*/
chSysLock();
- chThdSelf()->p_prio += 2;
+ chThdGetSelfX()->p_prio += 2;
chSysUnlock();
- test_assert(5, chThdGetPriority() == prio + 2,
+ test_assert(5, chThdGetPriorityX() == prio + 2,
"unexpected priority level");
/* Tries to raise but below the boost level. */
p1 = chThdSetPriority(prio + 1);
test_assert(6, p1 == prio,
"unexpected returned priority level");
- test_assert(7, chThdSelf()->p_prio == prio + 2,
+ test_assert(7, chThdGetSelfX()->p_prio == prio + 2,
"unexpected priority level");
- test_assert(8, chThdSelf()->p_realprio == prio + 1,
+ test_assert(8, chThdGetSelfX()->p_realprio == prio + 1,
"unexpected returned real priority level");
/* Tries to raise above the boost level. */
p1 = chThdSetPriority(prio + 3);
test_assert(9, p1 == prio + 1,
"unexpected returned priority level");
- test_assert(10, chThdSelf()->p_prio == prio + 3,
+ test_assert(10, chThdGetSelfX()->p_prio == prio + 3,
"unexpected priority level");
- test_assert(11, chThdSelf()->p_realprio == prio + 3,
+ test_assert(11, chThdGetSelfX()->p_realprio == prio + 3,
"unexpected real priority level");
chSysLock();
- chThdSelf()->p_prio = prio;
- chThdSelf()->p_realprio = prio;
+ chThdGetSelfX()->p_prio = prio;
+ chThdGetSelfX()->p_realprio = prio;
chSysUnlock();
#endif
}
|