aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/Win32-MinGW/main.c2
-rw-r--r--docs/src/concepts.dox6
-rw-r--r--docs/src/timing.dox2
-rw-r--r--readme.txt6
-rw-r--r--src/chsys.c8
-rw-r--r--src/chthreads.c2
-rw-r--r--src/chvt.c10
-rw-r--r--src/include/sys.h4
-rw-r--r--src/include/vt.h16
-rw-r--r--test/test.c8
-rw-r--r--test/testevt.c2
-rw-r--r--test/testsem.c2
12 files changed, 47 insertions, 21 deletions
diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c
index 1d80b9d76..c2ac24868 100644
--- a/demos/Win32-MinGW/main.c
+++ b/demos/Win32-MinGW/main.c
@@ -194,7 +194,7 @@ static msg_t ShellThread(void *arg) {
else if (stricmp(lp, "time") == 0) {
if (checkend(sd))
continue;
- sprintf(line, "Time: %d\r\n", chSysGetTime());
+ sprintf(line, "Time: %d\r\n", chTimeNow());
PrintLineFDD(sd, line);
}
else if (stricmp(lp, "hello") == 0) {
diff --git a/docs/src/concepts.dox b/docs/src/concepts.dox
index d8d874bac..8ef626c01 100644
--- a/docs/src/concepts.dox
+++ b/docs/src/concepts.dox
@@ -34,9 +34,9 @@
* @section naming Naming Conventions
* ChibiOS/RT APIs are all named following this convention:
* @a ch\<group\>\<action\>\<suffix\>().
- * The possible groups are: @a Sys, @a Sch, @a VT, @a Thd, @a Sem, @a Mtx,
- * @a Cond, @a Evt, @a Msg, @a IQ, @a OQ, @a HQ, @a FDD, @a HDD, @a Dbg,
- * @a Heap, @a Pool.
+ * The possible groups are: @a Sys, @a Sch, @a Time @a VT, @a Thd, @a Sem,
+ * @a Mtx, @a Cond, @a Evt, @a Msg, @a IQ, @a OQ, @a HQ, @a FDD, @a HDD,
+ * @a Dbg, @a Heap, @a Pool.
*
* @section api_suffixes API Names Suffixes
* The suffix can be one of the following:
diff --git a/docs/src/timing.dox b/docs/src/timing.dox
index 9fd19545d..7732bef0b 100644
--- a/docs/src/timing.dox
+++ b/docs/src/timing.dox
@@ -46,7 +46,7 @@ msg_t my_thread(void *param) {
* @code
msg_t my_thread(void *param) {
- systick_t time = chSysGetTime(); /* T0 */
+ systick_t time = chTimeNow(); /* T0 */
while (TRUE) {
time += MS2ST(1000); /* Next deadline */
do_something();
diff --git a/readme.txt b/readme.txt
index ef9fcf4e0..5c3163a41 100644
--- a/readme.txt
+++ b/readme.txt
@@ -75,7 +75,13 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
*** 1.1.2unstable ***
- FIX: Fixed priority inheritance problem with condvars (bug 2674756) and
added a specific test case to the test suite (backported in stable branch).
+- FIX: Fixed a wrong parameter check in chVTSetI() (bug 2679155).
+- FIX: Build error with options CH_USE_NESTED_LOCKS && !CH_OPTIMIZE_SPEED
+ (bug 2678928).
- FIX: Removed unused chSysPuts() macro (bug 2672678).
+- FIX: Renamed function chSysInTimeWindow() as chTimeIsWithin() and renamed
+ the macro chSysGetTime() in chTimeNow(), the old names are still recognized
+ but marked as deprecated (fixes the bug 2678953 but goes a bit further).
- Removed testcond.c|h and moved the test cases into testmtx.c. Mutexes and
condvars have to be tested together.
- Added architecture diagram to the documentation.
diff --git a/src/chsys.c b/src/chsys.c
index 20c1e17fb..666d0cfef 100644
--- a/src/chsys.c
+++ b/src/chsys.c
@@ -110,14 +110,18 @@ void chSysTimerHandlerI(void) {
#if CH_USE_NESTED_LOCKS && !CH_OPTIMIZE_SPEED
void chSysLock(void) {
- chDbgAssert(currp->p_locks >= 0, "chinit.c, chSysLock()");
+ chDbgAssert(currp->p_locks >= 0,
+ "chSysLock(), #1",
+ "negative nesting counter");
if (currp->p_locks++ == 0)
port_lock();
}
void chSysUnlock(void) {
- chDbgAssert(currp->p_locks > 0, "chinit.c, chSysUnlock()");
+ chDbgAssert(currp->p_locks > 0,
+ "chSysUnlock(), #1",
+ "non-positive nesting counter");
if (--currp->p_locks == 0)
port_unlock();
}
diff --git a/src/chthreads.c b/src/chthreads.c
index a22514f09..70db14130 100644
--- a/src/chthreads.c
+++ b/src/chthreads.c
@@ -290,7 +290,7 @@ void chThdSleep(systime_t time) {
void chThdSleepUntil(systime_t time) {
chSysLock();
- if ((time -= chSysGetTime()) > 0)
+ if ((time -= chTimeNow()) > 0)
chThdSleepS(time);
chSysUnlock();
}
diff --git a/src/chvt.c b/src/chvt.c
index 76ab6a7f3..9d4fec138 100644
--- a/src/chvt.c
+++ b/src/chvt.c
@@ -19,7 +19,7 @@
/**
* @file chvt.c
- * @brief Time related code.
+ * @brief Time and Virtual Timers related code.
* @addtogroup Time
* @{
*/
@@ -58,8 +58,8 @@ void vt_init(void) {
void chVTSetI(VirtualTimer *vtp, systime_t time, vtfunc_t vtfunc, void *par) {
VirtualTimer *p;
- chDbgCheck((vtp != NULL) && (vtfunc != NULL) &&
- (time != TIME_IMMEDIATE) && (time != TIME_INFINITE), "chVTSetI");
+ chDbgCheck((vtp != NULL) && (vtfunc != NULL) && (time != TIME_INFINITE),
+ "chVTSetI");
vtp->vt_par = par;
vtp->vt_func = vtfunc;
@@ -103,9 +103,9 @@ void chVTResetI(VirtualTimer *vtp) {
* @retval TRUE current time within the specified time window.
* @retval FALSE current time not within the specified time window.
*/
-bool_t chSysInTimeWindow(systime_t start, systime_t end) {
+bool_t chTimeIsWithin(systime_t start, systime_t end) {
- systime_t time = chSysGetTime();
+ systime_t time = chTimeNow();
return end >= start ? (time >= start) && (time < end) :
(time >= start) || (time < end);
}
diff --git a/src/include/sys.h b/src/include/sys.h
index 90fbfd1a1..a84d33da8 100644
--- a/src/include/sys.h
+++ b/src/include/sys.h
@@ -171,6 +171,10 @@ extern "C" {
#endif
void chSysInit(void);
void chSysTimerHandlerI(void);
+#if CH_USE_NESTED_LOCKS && !CH_OPTIMIZE_SPEED
+ void chSysLock(void);
+ void chSysUnlock(void);
+#endif /* CH_USE_NESTED_LOCKS && !CH_OPTIMIZE_SPEED */
#ifdef __cplusplus
}
#endif
diff --git a/src/include/vt.h b/src/include/vt.h
index e104bb101..e736e1af0 100644
--- a/src/include/vt.h
+++ b/src/include/vt.h
@@ -104,7 +104,7 @@ extern "C" {
void vt_init(void);
void chVTSetI(VirtualTimer *vtp, systime_t time, vtfunc_t vtfunc, void *par);
void chVTResetI(VirtualTimer *vtp);
- bool_t chSysInTimeWindow(systime_t start, systime_t end);
+ bool_t chTimeIsWithin(systime_t start, systime_t end);
#ifdef __cplusplus
}
#endif
@@ -118,8 +118,20 @@ extern "C" {
* @note The counter can reach its maximum and then returns to zero.
* @note This function is designed to work with the @p chThdSleepUntil().
*/
-#define chSysGetTime() (vtlist.vt_systime)
+#define chTimeNow() (vtlist.vt_systime)
+/**
+ * Provided for backward compatibility.
+ * @deprecated Will be removed in 1.2.0.
+ */
+#define chSysGetTime() chTimeNow()
+
+/**
+ * Provided for backward compatibility.
+ * @deprecated Will be removed in 1.2.0.
+ */
+#define chSysInTimeWindow(start, end) chTimeIsWithin(start, end)
+
#endif /* _VT_H_ */
/** @} */
diff --git a/test/test.c b/test/test.c
index be3c8d9c5..3be813bb2 100644
--- a/test/test.c
+++ b/test/test.c
@@ -146,7 +146,7 @@ bool_t _test_assert_sequence(char *expected) {
bool_t _test_assert_time_window(systime_t start, systime_t end) {
- return _test_assert(chSysInTimeWindow(start, end), "time window error");
+ return _test_assert(chTimeIsWithin(start, end), "time window error");
}
/*
@@ -171,8 +171,8 @@ void test_wait_threads(void) {
void test_cpu_pulse(unsigned ms) {
systime_t duration = MS2ST(ms);
- systime_t start = chSysGetTime();
- while (chSysInTimeWindow(start, start + duration)) {
+ systime_t start = chTimeNow();
+ while (chTimeIsWithin(start, start + duration)) {
#if defined(WIN32)
ChkIntSources();
#endif
@@ -182,7 +182,7 @@ void test_cpu_pulse(unsigned ms) {
systime_t test_wait_tick(void) {
chThdSleep(1);
- return chSysGetTime();
+ return chTimeNow();
}
/*
diff --git a/test/testevt.c b/test/testevt.c
index 192c6e6be..9c6f7bf6e 100644
--- a/test/testevt.c
+++ b/test/testevt.c
@@ -77,7 +77,7 @@ static void evt1_execute(void) {
chEvtInit(&es2);
chEvtRegisterMask(&es1, &el1, 1);
chEvtRegisterMask(&es2, &el2, 4);
- target_time = chSysGetTime() + MS2ST(50);
+ target_time = chTimeNow() + MS2ST(50);
threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-1, thread, "A");
m = chEvtWaitAll(5);
test_assert_time_window(target_time, target_time + ALLOWED_DELAY);
diff --git a/test/testsem.c b/test/testsem.c
index 2482f1295..e954871d5 100644
--- a/test/testsem.c
+++ b/test/testsem.c
@@ -86,7 +86,7 @@ static void sem2_execute(void) {
msg= chSemWaitTimeout(&sem1, TIME_IMMEDIATE);
test_assert(msg == RDY_TIMEOUT, "#1");
- target_time = chSysGetTime() + MS2ST(5 * 500);
+ target_time = chTimeNow() + MS2ST(5 * 500);
for (i = 0; i < 5; i++) {
test_emit_token('A' + i);
msg = chSemWaitTimeout(&sem1, MS2ST(500));