aboutsummaryrefslogtreecommitdiffstats
path: root/os/various
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-11-04 14:51:30 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-11-04 14:51:30 +0000
commit981e11216a3e1534a403c6844b06f164480c3ff9 (patch)
treec2535aec07c15929e8827414ad1aed2153588e20 /os/various
parenta4b5f16690659eb74f83392cc336038c00c36fd1 (diff)
downloadChibiOS-981e11216a3e1534a403c6844b06f164480c3ff9.tar.gz
ChibiOS-981e11216a3e1534a403c6844b06f164480c3ff9.tar.bz2
ChibiOS-981e11216a3e1534a403c6844b06f164480c3ff9.zip
Various fixes after recent changes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10934 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/various')
-rw-r--r--os/various/lwip_bindings/arch/sys_arch.c18
-rw-r--r--os/various/lwip_bindings/lwipthread.c2
-rw-r--r--os/various/lwip_bindings/lwipthread.h2
-rw-r--r--os/various/shell/shell_cmd.c28
4 files changed, 37 insertions, 13 deletions
diff --git a/os/various/lwip_bindings/arch/sys_arch.c b/os/various/lwip_bindings/arch/sys_arch.c
index 13590fd98..8e0f56ea5 100644
--- a/os/various/lwip_bindings/arch/sys_arch.c
+++ b/os/various/lwip_bindings/arch/sys_arch.c
@@ -101,18 +101,19 @@ void sys_sem_signal_S(sys_sem_t *sem) {
}
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) {
- systime_t tmo, start, remaining;
+ systime_t start;
+ sysinterval_t tmo, remaining;
osalSysLock();
- tmo = timeout > 0 ? MS2ST((systime_t)timeout) : TIME_INFINITE;
+ tmo = timeout > 0 ? TIME_MS2I((time_msecs_t)timeout) : TIME_INFINITE;
start = osalOsGetSystemTimeX();
if (chSemWaitTimeoutS(*sem, tmo) != MSG_OK) {
osalSysUnlock();
return SYS_ARCH_TIMEOUT;
}
- remaining = osalOsGetSystemTimeX() - start;
+ remaining = chTimeDiffX(start, osalOsGetSystemTimeX());
osalSysUnlock();
- return (u32_t)ST2MS(remaining);
+ return (u32_t)TIME_I2MS(remaining);
}
int sys_sem_valid(sys_sem_t *sem) {
@@ -173,18 +174,19 @@ err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg) {
}
u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout) {
- systime_t tmo, start, remaining;
+ systime_t start;
+ sysinterval_t tmo, remaining;
osalSysLock();
- tmo = timeout > 0 ? MS2ST((systime_t)timeout) : TIME_INFINITE;
+ tmo = timeout > 0 ? TIME_MS2I((time_msecs_t)timeout) : TIME_INFINITE;
start = osalOsGetSystemTimeX();
if (chMBFetchTimeoutS(*mbox, (msg_t *)msg, tmo) != MSG_OK) {
osalSysUnlock();
return SYS_ARCH_TIMEOUT;
}
- remaining = osalOsGetSystemTimeX() - start;
+ remaining = chTimeDiffX(start, osalOsGetSystemTimeX());
osalSysUnlock();
- return (u32_t)ST2MS(remaining);
+ return (u32_t)TIME_I2MS(remaining);
}
u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg) {
diff --git a/os/various/lwip_bindings/lwipthread.c b/os/various/lwip_bindings/lwipthread.c
index df70dd021..5a7b3d732 100644
--- a/os/various/lwip_bindings/lwipthread.c
+++ b/os/various/lwip_bindings/lwipthread.c
@@ -129,7 +129,7 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p) {
MACTransmitDescriptor td;
(void)netif;
- if (macWaitTransmitDescriptor(&ETHD1, &td, MS2ST(LWIP_SEND_TIMEOUT)) != MSG_OK)
+ if (macWaitTransmitDescriptor(&ETHD1, &td, TIME_MS2I(LWIP_SEND_TIMEOUT)) != MSG_OK)
return ERR_TIMEOUT;
#if ETH_PAD_SIZE
diff --git a/os/various/lwip_bindings/lwipthread.h b/os/various/lwip_bindings/lwipthread.h
index 61eb1b2dd..ae72ccb74 100644
--- a/os/various/lwip_bindings/lwipthread.h
+++ b/os/various/lwip_bindings/lwipthread.h
@@ -65,7 +65,7 @@
* @brief Link poll interval.
*/
#if !defined(LWIP_LINK_POLL_INTERVAL) || defined(__DOXYGEN__)
-#define LWIP_LINK_POLL_INTERVAL S2ST(5)
+#define LWIP_LINK_POLL_INTERVAL TIME_S2I(5)
#endif
/**
diff --git a/os/various/shell/shell_cmd.c b/os/various/shell/shell_cmd.c
index cf350ff4d..63a433e0c 100644
--- a/os/various/shell/shell_cmd.c
+++ b/os/various/shell/shell_cmd.c
@@ -32,6 +32,7 @@
#if (SHELL_CMD_TEST_ENABLED == TRUE) || defined(__DOXYGEN__)
#include "rt_test_root.h"
+#include "oslib_test_root.h"
#endif
/*===========================================================================*/
@@ -171,17 +172,38 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
#endif
#if (SHELL_CMD_TEST_ENABLED == TRUE) || defined(__DOXYGEN__)
+static THD_FUNCTION(test_rt, arg) {
+ BaseSequentialStream *chp = (BaseSequentialStream *)arg;
+ test_execute(chp, &rt_test_suite);
+}
+
+static THD_FUNCTION(test_oslib, arg) {
+ BaseSequentialStream *chp = (BaseSequentialStream *)arg;
+ test_execute(chp, &oslib_test_suite);
+}
+
static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
thread_t *tp;
+ tfunc_t tfp;
(void)argv;
- if (argc > 0) {
- shellUsage(chp, "test");
+ if (argc != 1) {
+ shellUsage(chp, "test rt|oslib");
+ return;
+ }
+ if (!strcmp(argv[0], "rt")) {
+ tfp = test_rt;
+ }
+ else if (!strcmp(argv[0], "oslib")) {
+ tfp = test_oslib;
+ }
+ else {
+ shellUsage(chp, "test rt|oslib");
return;
}
tp = chThdCreateFromHeap(NULL, SHELL_CMD_TEST_WA_SIZE,
"test", chThdGetPriorityX(),
- (tfunc_t)test_execute, chp);
+ tfp, chp);
if (tp == NULL) {
chprintf(chp, "out of memory"SHELL_NEWLINE_STR);
return;
n360'>360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496