diff options
Diffstat (limited to 'demos')
-rw-r--r-- | demos/LPC214x-GCC/chconf.h | 4 | ||||
-rw-r--r-- | demos/Win32-MSVS/ch.vcproj | 7 | ||||
-rw-r--r-- | demos/Win32-MSVS/chconf.h | 8 | ||||
-rw-r--r-- | demos/Win32-MSVS/demo.c | 21 | ||||
-rw-r--r-- | demos/Win32-MinGW/Makefile | 2 | ||||
-rw-r--r-- | demos/Win32-MinGW/chconf.h | 8 | ||||
-rw-r--r-- | demos/Win32-MinGW/chcore.c | 2 | ||||
-rw-r--r-- | demos/Win32-MinGW/chcore2.s | 2 | ||||
-rw-r--r-- | demos/Win32-MinGW/demo.c | 17 |
9 files changed, 56 insertions, 15 deletions
diff --git a/demos/LPC214x-GCC/chconf.h b/demos/LPC214x-GCC/chconf.h index 30670c8fd..da8553399 100644 --- a/demos/LPC214x-GCC/chconf.h +++ b/demos/LPC214x-GCC/chconf.h @@ -63,6 +63,10 @@ * in the kernel.*/
#define CH_USE_SEMAPHORES
+/** Configuration option: if specified then the Semaphores atomic Signal+Wait
+ * APIs are included in the kernel.*/
+#define CH_USE_SEMSW
+
/** Configuration option: if specified then the Semaphores with timeout APIs
* are included in the kernel.
* @note requires \p CH_USE_SEMAPHORES.
diff --git a/demos/Win32-MSVS/ch.vcproj b/demos/Win32-MSVS/ch.vcproj index 185e65dc1..8764f059d 100644 --- a/demos/Win32-MSVS/ch.vcproj +++ b/demos/Win32-MSVS/ch.vcproj @@ -182,6 +182,13 @@ RelativePath="..\..\ports\Win32\simcom.c">
</File>
</Filter>
+ <Filter
+ Name="test"
+ Filter="">
+ <File
+ RelativePath="..\..\test\test.c">
+ </File>
+ </Filter>
</Filter>
<Filter
Name="Header Files"
diff --git a/demos/Win32-MSVS/chconf.h b/demos/Win32-MSVS/chconf.h index 59a13d224..da7fcd266 100644 --- a/demos/Win32-MSVS/chconf.h +++ b/demos/Win32-MSVS/chconf.h @@ -68,6 +68,10 @@ * in the kernel.*/
#define CH_USE_SEMAPHORES
+/** Configuration option: if specified then the Semaphores atomic Signal+Wait
+ * APIs are included in the kernel.*/
+#define CH_USE_SEMSW
+
/** Configuration option: if specified then the Semaphores with timeout APIs
* are included in the kernel.
* @note requires \p CH_USE_SEMAPHORES.
@@ -134,11 +138,11 @@ /** Configuration option: Frequency of the system timer that drives the system
* ticks. This also defines the system time unit.*/
-#define CH_FREQUENCY 100
+#define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
* threads before preemption occurs.*/
-#define CH_TIME_QUANTUM 10
+#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
* global \p currp variable. Caching this variable in a register can greatly
diff --git a/demos/Win32-MSVS/demo.c b/demos/Win32-MSVS/demo.c index d068ca730..077877f8e 100644 --- a/demos/Win32-MSVS/demo.c +++ b/demos/Win32-MSVS/demo.c @@ -31,11 +31,13 @@ static BYTE8 iarea[UserStackSize(2048)]; static ULONG32 cdguard;
static BYTE8 cdarea[UserStackSize(2048)];
static Thread *cdtp;
-
+
static t_msg WatchdogThread(void *arg);
static t_msg ConsoleThread(void *arg);
static t_msg InitThread(void *arg);
+t_msg TestThread(void *p);
+
void InitCore(void);
extern FullDuplexDriver COM1, COM2;
@@ -73,7 +75,7 @@ static t_msg WatchdogThread(void *arg) { printf("Halted by watchdog");
chSysHalt();
}
- chThdSleep(5);
+ chThdSleep(50);
}
return 0;
}
@@ -144,7 +146,7 @@ static t_msg HelloWorldThread(void *arg) { for (i = 0; i < 100; i++) {
PrintLineFDD(sd, "Hello World\r\n");
- c = chFDDGetTimeout(sd, 33);
+ c = chFDDGetTimeout(sd, 333);
switch (c) {
case -1:
continue;
@@ -154,7 +156,7 @@ static t_msg HelloWorldThread(void *arg) { PrintLineFDD(sd, "^C\r\n");
return 0;
default:
- chThdSleep(33);
+ chThdSleep(333);
}
}
return 0;
@@ -202,6 +204,7 @@ static t_msg ShellThread(void *arg) { PrintLineFDD(sd, " exit - Logout from ChibiOS/RT\r\n");
PrintLineFDD(sd, " time - Prints the system timer value\r\n");
PrintLineFDD(sd, " hello - Runs the Hello World demo thread\r\n");
+ PrintLineFDD(sd, " test - Runs the System Test thread\r\n");
}
else if (stricmp(lp, "exit") == 0) {
if (checkend(sd))
@@ -223,6 +226,14 @@ static t_msg ShellThread(void *arg) { if (chThdWait(tp))
break; // Lost connection while executing the hello thread.
}
+ else if (stricmp(lp, "test") == 0) {
+ if (checkend(sd))
+ continue;
+ tp = chThdCreate(NORMALPRIO, 0, tarea, sizeof(tarea),
+ TestThread, arg);
+ if (chThdWait(tp))
+ break; // Lost connection while executing the hello thread.
+ }
else {
PrintLineFDD(sd, lp);
PrintLineFDD(sd, " ?\r\n");
@@ -281,7 +292,7 @@ static void COM2Handler(t_eventid id) { static t_evhandler fhandlers[2] = {
COM1Handler,
COM2Handler
-};
+};
/*
* Init-like thread, it starts the shells and handles their termination.
diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile index 4ab603d8e..9ee9dfb77 100644 --- a/demos/Win32-MinGW/Makefile +++ b/demos/Win32-MinGW/Makefile @@ -57,7 +57,7 @@ UADEFS = # List C source files here
SRC = chcore.c demo.c \
- ../../ports/win32/simcom.c \
+ ../../test/test.c ../../ports/win32/simcom.c \
../../src/chinit.c ../../src/chlists.c ../../src/chdelta.c ../../src/chschd.c \
../../src/chthreads.c ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c \
../../src/chsleep.c ../../src/chqueues.c ../../src/chserial.c
diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 13de9f457..5582ae80a 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -68,6 +68,10 @@ * in the kernel.*/
#define CH_USE_SEMAPHORES
+/** Configuration option: if specified then the Semaphores atomic Signal+Wait
+ * APIs are included in the kernel.*/
+#define CH_USE_SEMSW
+
/** Configuration option: if specified then the Semaphores with timeout APIs
* are included in the kernel.
* @note requires \p CH_USE_SEMAPHORES.
@@ -134,11 +138,11 @@ /** Configuration option: Frequency of the system timer that drives the system
* ticks. This also defines the system time unit.*/
-#define CH_FREQUENCY 100
+#define CH_FREQUENCY 1000
/** Configuration option: This constant is the number of ticks allowed for the
* threads before preemption occurs.*/
-#define CH_TIME_QUANTUM 10
+#define CH_TIME_QUANTUM 20
/** Configuration option: Defines a CPU register to be used as storage for the
* global \p currp variable. Caching this variable in a register can greatly
diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c index d48188b49..77195c44c 100644 --- a/demos/Win32-MinGW/chcore.c +++ b/demos/Win32-MinGW/chcore.c @@ -52,7 +52,7 @@ void InitCore(void) { exit(1);
}
- printf("Win32 ChobiOS/RT simulator\n\n");
+ printf("Win32 ChibiOS/RT simulator\n\n");
printf("Thread structure %d bytes\n", sizeof(Thread));
if (!QueryPerformanceFrequency(&slice)) {
printf("QueryPerformanceFrequency() error");
diff --git a/demos/Win32-MinGW/chcore2.s b/demos/Win32-MinGW/chcore2.s index 80985e3f7..c8260e3e6 100644 --- a/demos/Win32-MinGW/chcore2.s +++ b/demos/Win32-MinGW/chcore2.s @@ -39,5 +39,5 @@ .p2align 4,,15
.globl @threadstart@0
@threadstart@0:
- push %ecx
+ push %eax
call _chThdExit
diff --git a/demos/Win32-MinGW/demo.c b/demos/Win32-MinGW/demo.c index 166923d2c..077877f8e 100644 --- a/demos/Win32-MinGW/demo.c +++ b/demos/Win32-MinGW/demo.c @@ -36,6 +36,8 @@ static t_msg WatchdogThread(void *arg); static t_msg ConsoleThread(void *arg);
static t_msg InitThread(void *arg);
+t_msg TestThread(void *p);
+
void InitCore(void);
extern FullDuplexDriver COM1, COM2;
@@ -73,7 +75,7 @@ static t_msg WatchdogThread(void *arg) { printf("Halted by watchdog");
chSysHalt();
}
- chThdSleep(5);
+ chThdSleep(50);
}
return 0;
}
@@ -144,7 +146,7 @@ static t_msg HelloWorldThread(void *arg) { for (i = 0; i < 100; i++) {
PrintLineFDD(sd, "Hello World\r\n");
- c = chFDDGetTimeout(sd, 33);
+ c = chFDDGetTimeout(sd, 333);
switch (c) {
case -1:
continue;
@@ -154,7 +156,7 @@ static t_msg HelloWorldThread(void *arg) { PrintLineFDD(sd, "^C\r\n");
return 0;
default:
- chThdSleep(33);
+ chThdSleep(333);
}
}
return 0;
@@ -202,6 +204,7 @@ static t_msg ShellThread(void *arg) { PrintLineFDD(sd, " exit - Logout from ChibiOS/RT\r\n");
PrintLineFDD(sd, " time - Prints the system timer value\r\n");
PrintLineFDD(sd, " hello - Runs the Hello World demo thread\r\n");
+ PrintLineFDD(sd, " test - Runs the System Test thread\r\n");
}
else if (stricmp(lp, "exit") == 0) {
if (checkend(sd))
@@ -223,6 +226,14 @@ static t_msg ShellThread(void *arg) { if (chThdWait(tp))
break; // Lost connection while executing the hello thread.
}
+ else if (stricmp(lp, "test") == 0) {
+ if (checkend(sd))
+ continue;
+ tp = chThdCreate(NORMALPRIO, 0, tarea, sizeof(tarea),
+ TestThread, arg);
+ if (chThdWait(tp))
+ break; // Lost connection while executing the hello thread.
+ }
else {
PrintLineFDD(sd, lp);
PrintLineFDD(sd, " ?\r\n");
|