From 476270c2ab91169a8e731562b0e68b86602e0d77 Mon Sep 17 00:00:00 2001
From: gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>
Date: Tue, 4 Nov 2014 10:51:23 +0000
Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7475
 35acf78f-673a-0410-8e92-d51de3d6d3f4

---
 demos/various/RT-Win32-Simulator/Makefile | 14 ++++++-----
 demos/various/RT-Win32-Simulator/chconf.h |  4 ++--
 demos/various/RT-Win32-Simulator/main.c   | 40 +++++++++++++++----------------
 3 files changed, 30 insertions(+), 28 deletions(-)

(limited to 'demos')

diff --git a/demos/various/RT-Win32-Simulator/Makefile b/demos/various/RT-Win32-Simulator/Makefile
index d6499dd77..7621091b1 100644
--- a/demos/various/RT-Win32-Simulator/Makefile
+++ b/demos/various/RT-Win32-Simulator/Makefile
@@ -60,16 +60,18 @@ CHIBIOS = ../../..
 include $(CHIBIOS)/os/hal/boards/simulator/board.mk
 include ${CHIBIOS}/os/hal/hal.mk
 include ${CHIBIOS}/os/hal/ports/simulator/win32/platform.mk
+include $(CHIBIOS)/os/hal/osal/rt/osal.mk
 include ${CHIBIOS}/os/rt/ports/SIMIA32/compilers/GCC/port.mk
 include ${CHIBIOS}/os/rt/rt.mk
 include ${CHIBIOS}/test/rt/test.mk
 
 # List C source files here
-SRC  = ${PORTSRC} \
-       ${KERNSRC} \
-       ${TESTSRC} \
-       ${HALSRC} \
-       ${PLATFORMSRC} \
+SRC =  $(PORTSRC) \
+       $(KERNSRC) \
+       $(TESTSRC) \
+       $(HALSRC) \
+       $(OSALSRC) \
+       $(PLATFORMSRC) \
        $(BOARDSRC) \
        ${CHIBIOS}/os/various/shell.c \
        ${CHIBIOS}/os/various/memstreams.c \
@@ -81,7 +83,7 @@ ASRC =
 
 # List all user directories here
 UINCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
-          $(HALINC) $(PLATFORMINC) $(BOARDINC) \
+          $(HALINC) $(OSALINC) $(PLATFORMINC) $(BOARDINC) \
           ${CHIBIOS}/os/various
 
 # List the user directory to look for the libraries here
diff --git a/demos/various/RT-Win32-Simulator/chconf.h b/demos/various/RT-Win32-Simulator/chconf.h
index 896f8b437..f38839909 100644
--- a/demos/various/RT-Win32-Simulator/chconf.h
+++ b/demos/various/RT-Win32-Simulator/chconf.h
@@ -56,7 +56,7 @@
  *          The value one is not valid, timeouts are rounded up to
  *          this value.
  */
-#define CH_CFG_ST_TIMEDELTA                 1
+#define CH_CFG_ST_TIMEDELTA                 0
 
 /** @} */
 
@@ -394,7 +394,7 @@
  * @note    This debug option is not currently compatible with the
  *          tickless mode.
  */
-#define CH_DBG_THREADS_PROFILING            FALSE
+#define CH_DBG_THREADS_PROFILING            TRUE
 
 /** @} */
 
diff --git a/demos/various/RT-Win32-Simulator/main.c b/demos/various/RT-Win32-Simulator/main.c
index e904850d5..ccc9aad97 100644
--- a/demos/various/RT-Win32-Simulator/main.c
+++ b/demos/various/RT-Win32-Simulator/main.c
@@ -20,15 +20,15 @@
 #include "shell.h"
 #include "chprintf.h"
 
-#define SHELL_WA_SIZE       THD_WA_SIZE(4096)
-#define CONSOLE_WA_SIZE     THD_WA_SIZE(4096)
-#define TEST_WA_SIZE        THD_WA_SIZE(4096)
+#define SHELL_WA_SIZE       THD_WORKING_AREA_SIZE(4096)
+#define CONSOLE_WA_SIZE     THD_WORKING_AREA_SIZE(4096)
+#define TEST_WA_SIZE        THD_WORKING_AREA_SIZE(4096)
 
 #define cputs(msg) chMsgSend(cdtp, (msg_t)msg)
 
-static Thread *cdtp;
-static Thread *shelltp1;
-static Thread *shelltp2;
+static thread_t *cdtp;
+static thread_t *shelltp1;
+static thread_t *shelltp2;
 
 static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) {
   size_t n, size;
@@ -45,8 +45,8 @@ static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) {
 }
 
 static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
-  static const char *states[] = {THD_STATE_NAMES};
-  Thread *tp;
+  static const char *states[] = {CH_STATE_NAMES};
+  thread_t *tp;
 
   (void)argv;
   if (argc > 0) {
@@ -65,14 +65,14 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
 }
 
 static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
-  Thread *tp;
+  thread_t *tp;
 
   (void)argv;
   if (argc > 0) {
     chprintf(chp, "Usage: test\r\n");
     return;
   }
-  tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(),
+  tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriorityX(),
                            TestThread, chp);
   if (tp == NULL) {
     chprintf(chp, "out of memory\r\n");
@@ -106,11 +106,11 @@ static const ShellConfig shell_cfg2 = {
 static msg_t console_thread(void *arg) {
 
   (void)arg;
-  while (!chThdShouldTerminate()) {
-    Thread *tp = chMsgWait();
+  while (!chThdShouldTerminateX()) {
+    thread_t *tp = chMsgWait();
     puts((char *)chMsgGet(tp));
     fflush(stdout);
-    chMsgRelease(tp, RDY_OK);
+    chMsgRelease(tp, MSG_OK);
   }
   return 0;
 }
@@ -123,7 +123,7 @@ static msg_t console_thread(void *arg) {
 static void termination_handler(eventid_t id) {
 
   (void)id;
-  if (shelltp1 && chThdTerminated(shelltp1)) {
+  if (shelltp1 && chThdTerminatedX(shelltp1)) {
     chThdWait(shelltp1);
     shelltp1 = NULL;
     chThdSleepMilliseconds(10);
@@ -132,7 +132,7 @@ static void termination_handler(eventid_t id) {
     chOQResetI(&SD1.oqueue);
     chSysUnlock();
   }
-  if (shelltp2 && chThdTerminated(shelltp2)) {
+  if (shelltp2 && chThdTerminatedX(shelltp2)) {
     chThdWait(shelltp2);
     shelltp2 = NULL;
     chThdSleepMilliseconds(10);
@@ -143,7 +143,7 @@ static void termination_handler(eventid_t id) {
   }
 }
 
-static EventListener sd1fel, sd2fel;
+static event_listener_t sd1fel, sd2fel;
 
 /**
  * @brief SD1 status change handler.
@@ -151,7 +151,7 @@ static EventListener sd1fel, sd2fel;
  * @param[in] id event id.
  */
 static void sd1_handler(eventid_t id) {
-  flagsmask_t flags;
+  eventflags_t flags;
 
   (void)id;
   flags = chEvtGetAndClearFlags(&sd1fel);
@@ -173,7 +173,7 @@ static void sd1_handler(eventid_t id) {
  * @param[in] id event id.
  */
 static void sd2_handler(eventid_t id) {
-  flagsmask_t flags;
+  eventflags_t flags;
 
   (void)id;
   flags = chEvtGetAndClearFlags(&sd2fel);
@@ -199,7 +199,7 @@ static evhandler_t fhandlers[] = {
  * Simulator main.                                                        *
  *------------------------------------------------------------------------*/
 int main(void) {
-  EventListener tel;
+  event_listener_t tel;
 
   /*
    * System initializations.
@@ -241,7 +241,7 @@ int main(void) {
   /*
    * Events servicing loop.
    */
-  while (!chThdShouldTerminate())
+  while (!chThdShouldTerminateX())
     chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS));
 
   /*
-- 
cgit v1.2.3