aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-10-15 18:26:16 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-10-15 18:26:16 +0000
commit875c8f368683e77371f75c0b9f1aa18237f118f2 (patch)
tree960b33a15794765955b8f87d8bdc69eab2a369ef /test
parente6757ceef9a5d80d1102b6b4215929c719a4b96a (diff)
downloadChibiOS-875c8f368683e77371f75c0b9f1aa18237f118f2.tar.gz
ChibiOS-875c8f368683e77371f75c0b9f1aa18237f118f2.tar.bz2
ChibiOS-875c8f368683e77371f75c0b9f1aa18237f118f2.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@468 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test')
-rw-r--r--test/test.c10
-rw-r--r--test/test.h6
-rw-r--r--test/testmtx.c14
-rw-r--r--test/testsem.c6
4 files changed, 19 insertions, 17 deletions
diff --git a/test/test.c b/test/test.c
index fa2625215..bd39b1371 100644
--- a/test/test.c
+++ b/test/test.c
@@ -182,10 +182,11 @@ void test_wait_threads(void) {
chThdWait(threads[i]);
}
-void test_cpu_pulse(systime_t ms) {
+void test_cpu_pulse(unsigned ms) {
+ systime_t duration = MS2ST(ms);
systime_t start = chSysGetTime();
- while (chSysInTimeWindow(start, start + ms)) {
+ while (chSysInTimeWindow(start, start + duration)) {
#if defined(WIN32)
ChkIntSources();
#endif
@@ -209,11 +210,12 @@ static void tmr(void *p) {
test_timer_done = TRUE;
}
-void test_start_timer(systime_t time) {
+void test_start_timer(unsigned ms) {
+ systime_t duration = MS2ST(ms);
test_timer_done = FALSE;
chSysLock();
- chVTSetI(&vt, time, tmr, NULL);
+ chVTSetI(&vt, duration, tmr, NULL);
chSysUnlock();
}
diff --git a/test/test.h b/test/test.h
index bb59c196e..524907b76 100644
--- a/test/test.h
+++ b/test/test.h
@@ -22,7 +22,7 @@
#define MAX_THREADS 5
#define MAX_TOKENS 16
-#define DELAY_BETWEEN_TESTS 200
+#define DELAY_BETWEEN_TESTS MS2ST(200)
#if defined(CH_ARCHITECTURE_AVR) || defined(CH_ARCHITECTURE_MSP430)
#define THREADS_STACK_SIZE 64
@@ -53,8 +53,8 @@ extern "C" {
void test_terminate_threads(void);
void test_wait_threads(void);
systime_t test_wait_tick(void);
- void test_cpu_pulse(systime_t ms);
- void test_start_timer(systime_t time);
+ void test_cpu_pulse(unsigned ms);
+ void test_start_timer(unsigned ms);
#if defined(WIN32)
void ChkIntSources(void);
#endif
diff --git a/test/testmtx.c b/test/testmtx.c
index 3954e9338..f389ebe6f 100644
--- a/test/testmtx.c
+++ b/test/testmtx.c
@@ -85,7 +85,7 @@ static void mtx2_teardown(void) {
static msg_t thread2(void *p) {
- chThdSleep(5);
+ chThdSleep(MS2ST(10));
chMtxLock(&m1);
chMtxUnlock();
test_emit_token(*(char *)p);
@@ -95,7 +95,7 @@ static msg_t thread2(void *p) {
static msg_t thread3(void *p) {
chMtxLock(&m1);
- chThdSleep(20);
+ chThdSleep(MS2ST(40));
chMtxUnlock();
test_emit_token(*(char *)p);
return 0;
@@ -103,7 +103,7 @@ static msg_t thread3(void *p) {
static msg_t thread4(void *p) {
- chThdSleep(10);
+ chThdSleep(MS2ST(20));
test_cpu_pulse(50);
test_emit_token(*(char *)p);
return 0;
@@ -156,7 +156,7 @@ static msg_t thread5(void *p) {
static msg_t thread6(void *p) {
- chThdSleep(10);
+ chThdSleep(MS2ST(10));
chMtxLock(&m2);
test_cpu_pulse(20);
chMtxLock(&m1);
@@ -170,7 +170,7 @@ static msg_t thread6(void *p) {
static msg_t thread7(void *p) {
- chThdSleep(20);
+ chThdSleep(MS2ST(20));
chMtxLock(&m2);
test_cpu_pulse(50);
chMtxUnlock();
@@ -180,7 +180,7 @@ static msg_t thread7(void *p) {
static msg_t thread8(void *p) {
- chThdSleep(40);
+ chThdSleep(MS2ST(40));
test_cpu_pulse(200);
test_emit_token(*(char *)p);
return 0;
@@ -188,7 +188,7 @@ static msg_t thread8(void *p) {
static msg_t thread9(void *p) {
- chThdSleep(50);
+ chThdSleep(MS2ST(50));
chMtxLock(&m2);
test_cpu_pulse(50);
chMtxUnlock();
diff --git a/test/testsem.c b/test/testsem.c
index 6afa715cb..f2105a7dd 100644
--- a/test/testsem.c
+++ b/test/testsem.c
@@ -21,7 +21,7 @@
#include "test.h"
-#define ALLOWED_DELAY 5
+#define ALLOWED_DELAY MS2ST(5)
static Semaphore sem1;
@@ -85,10 +85,10 @@ static void sem2_execute(void) {
int i;
systime_t target_time;
- target_time = chSysGetTime() + 5 * 500;
+ target_time = chSysGetTime() + MS2ST(5 * 500);
for (i = 0; i < 5; i++) {
test_emit_token('A' + i);
- chSemWaitTimeout(&sem1, 500);
+ chSemWaitTimeout(&sem1, MS2ST(500));
}
test_assert_sequence("ABCDE");
test_assert_time_window(target_time, target_time + ALLOWED_DELAY);