diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-07-02 12:32:13 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-07-02 12:32:13 +0000 |
commit | 5f4dbf9ca9ba32bfeefa3dbab412867dc63f0892 (patch) | |
tree | a178d1e424124786e3f5e16e8e807a638812ed58 /test/test.c | |
parent | 8a02a67d832e1c3515f91f97dcb2a2b61be3268f (diff) | |
download | ChibiOS-5f4dbf9ca9ba32bfeefa3dbab412867dc63f0892.tar.gz ChibiOS-5f4dbf9ca9ba32bfeefa3dbab412867dc63f0892.tar.bz2 ChibiOS-5f4dbf9ca9ba32bfeefa3dbab412867dc63f0892.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@328 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test/test.c')
-rw-r--r-- | test/test.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/test/test.c b/test/test.c index f9a185d03..5f78c8526 100644 --- a/test/test.c +++ b/test/test.c @@ -167,22 +167,27 @@ void test_cpu_pulse(systime_t ms) { systime_t test_wait_tick(void) {
- systime_t time = chSysGetTime() + 1;
- if (time) {
- while (chSysGetTime() < time) {
-#if defined(WIN32)
- ChkIntSources();
-#endif
- }
- }
- else {
- while (chSysGetTime() > time) {
-#if defined(WIN32)
- ChkIntSources();
-#endif
- }
- }
- return time;
+ chThdSleep(1);
+ return chSysGetTime();
+}
+
+/*
+ * Timer utils.
+ */
+static VirtualTimer vt;
+bool_t test_timer_done;
+
+static void tmr(void *p) {
+
+ test_timer_done = TRUE;
+}
+
+void test_start_timer(systime_t time) {
+
+ test_timer_done = FALSE;
+ chSysLock();
+ chVTSetI(&vt, time, tmr, NULL);
+ chSysUnlock();
}
/*
|