git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4670 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2012-09-16 08:41:45 +00:00
parent 6d730a713c
commit dfb876b3a1
1 changed files with 10 additions and 10 deletions

View File

@ -78,7 +78,7 @@ static EVENTSOURCE_DECL(es2);
static void evt1_setup(void) { static void evt1_setup(void) {
chEvtClearFlags(ALL_EVENTS); chEvtGetAndClearEvents(ALL_EVENTS);
} }
static void h1(eventid_t id) {(void)id;test_emit_token('A');} static void h1(eventid_t id) {(void)id;test_emit_token('A');}
@ -131,7 +131,7 @@ ROMCONST struct testcase testevt1 = {
static void evt2_setup(void) { static void evt2_setup(void) {
chEvtClearFlags(ALL_EVENTS); chEvtGetAndClearEvents(ALL_EVENTS);
} }
static msg_t thread1(void *p) { static msg_t thread1(void *p) {
@ -158,12 +158,12 @@ static void evt2_execute(void) {
/* /*
* Test on chEvtWaitOne() without wait. * Test on chEvtWaitOne() without wait.
*/ */
chEvtAddFlags(5); chEvtAddEvents(5);
m = chEvtWaitOne(ALL_EVENTS); m = chEvtWaitOne(ALL_EVENTS);
test_assert(1, m == 1, "single event error"); test_assert(1, m == 1, "single event error");
m = chEvtWaitOne(ALL_EVENTS); m = chEvtWaitOne(ALL_EVENTS);
test_assert(2, m == 4, "single event error"); test_assert(2, m == 4, "single event error");
m = chEvtClearFlags(ALL_EVENTS); m = chEvtGetAndClearEvents(ALL_EVENTS);
test_assert(3, m == 0, "stuck event"); test_assert(3, m == 0, "stuck event");
/* /*
@ -176,17 +176,17 @@ static void evt2_execute(void) {
m = chEvtWaitOne(ALL_EVENTS); m = chEvtWaitOne(ALL_EVENTS);
test_assert_time_window(4, target_time, target_time + ALLOWED_DELAY); test_assert_time_window(4, target_time, target_time + ALLOWED_DELAY);
test_assert(5, m == 1, "single event error"); test_assert(5, m == 1, "single event error");
m = chEvtClearFlags(ALL_EVENTS); m = chEvtGetAndClearEvents(ALL_EVENTS);
test_assert(6, m == 0, "stuck event"); test_assert(6, m == 0, "stuck event");
test_wait_threads(); test_wait_threads();
/* /*
* Test on chEvtWaitAny() without wait. * Test on chEvtWaitAny() without wait.
*/ */
chEvtAddFlags(5); chEvtAddEvents(5);
m = chEvtWaitAny(ALL_EVENTS); m = chEvtWaitAny(ALL_EVENTS);
test_assert(7, m == 5, "unexpected pending bit"); test_assert(7, m == 5, "unexpected pending bit");
m = chEvtClearFlags(ALL_EVENTS); m = chEvtGetAndClearEvents(ALL_EVENTS);
test_assert(8, m == 0, "stuck event"); test_assert(8, m == 0, "stuck event");
/* /*
@ -199,7 +199,7 @@ static void evt2_execute(void) {
m = chEvtWaitAny(ALL_EVENTS); m = chEvtWaitAny(ALL_EVENTS);
test_assert_time_window(9, target_time, target_time + ALLOWED_DELAY); test_assert_time_window(9, target_time, target_time + ALLOWED_DELAY);
test_assert(10, m == 1, "single event error"); test_assert(10, m == 1, "single event error");
m = chEvtClearFlags(ALL_EVENTS); m = chEvtGetAndClearEvents(ALL_EVENTS);
test_assert(11, m == 0, "stuck event"); test_assert(11, m == 0, "stuck event");
test_wait_threads(); test_wait_threads();
@ -216,7 +216,7 @@ static void evt2_execute(void) {
thread2, "A"); thread2, "A");
m = chEvtWaitAll(5); m = chEvtWaitAll(5);
test_assert_time_window(12, target_time, target_time + ALLOWED_DELAY); test_assert_time_window(12, target_time, target_time + ALLOWED_DELAY);
m = chEvtClearFlags(ALL_EVENTS); m = chEvtGetAndClearEvents(ALL_EVENTS);
test_assert(13, m == 0, "stuck event"); test_assert(13, m == 0, "stuck event");
test_wait_threads(); test_wait_threads();
chEvtUnregister(&es1, &el1); chEvtUnregister(&es1, &el1);
@ -250,7 +250,7 @@ ROMCONST struct testcase testevt2 = {
static void evt3_setup(void) { static void evt3_setup(void) {
chEvtClearFlags(ALL_EVENTS); chEvtGetAndClearEvents(ALL_EVENTS);
} }
static void evt3_execute(void) { static void evt3_execute(void) {