aboutsummaryrefslogtreecommitdiffstats
path: root/demos/Win32-MSVS/demo.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-11-19 11:09:33 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-11-19 11:09:33 +0000
commitb3361bd0e8ca074dbf7f312a87bbcdbf0019ebc7 (patch)
tree6cb55aa7bf6630b87d07b851ab40b44b662033c6 /demos/Win32-MSVS/demo.c
parente3617bedb28afefa2993c7e2a8a696d5af16a733 (diff)
downloadChibiOS-b3361bd0e8ca074dbf7f312a87bbcdbf0019ebc7.tar.gz
ChibiOS-b3361bd0e8ca074dbf7f312a87bbcdbf0019ebc7.tar.bz2
ChibiOS-b3361bd0e8ca074dbf7f312a87bbcdbf0019ebc7.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@97 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/Win32-MSVS/demo.c')
-rw-r--r--demos/Win32-MSVS/demo.c39
1 files changed, 12 insertions, 27 deletions
diff --git a/demos/Win32-MSVS/demo.c b/demos/Win32-MSVS/demo.c
index 077877f8e..1d4f4aa16 100644
--- a/demos/Win32-MSVS/demo.c
+++ b/demos/Win32-MSVS/demo.c
@@ -25,16 +25,12 @@
static ULONG32 wdguard;
static BYTE8 wdarea[UserStackSize(2048)];
-static ULONG32 iguard;
-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);
@@ -43,34 +39,16 @@ extern FullDuplexDriver COM1, COM2;
#define cprint(msg) chMsgSend(cdtp, (t_msg)msg)
-/*------------------------------------------------------------------------*
- * Simulator main, start here your threads, examples inside. *
- *------------------------------------------------------------------------*/
-int main(void) {
-
- InitCore();
-
- // Startup ChibiOS/RT.
- chSysInit();
- chThdCreate(NORMALPRIO + 2, 0, wdarea, sizeof(wdarea), WatchdogThread, NULL);
- cdtp = chThdCreate(NORMALPRIO + 1, 0, cdarea, sizeof(cdarea), ConsoleThread, NULL);
- chThdCreate(NORMALPRIO, 0, iarea, sizeof(iarea), InitThread, NULL);
- chSysPause();
- return 0;
-}
-
/*
* Watchdog thread, it checks magic values located under the various stack
* areas. The system is halted if something is wrong.
*/
static t_msg WatchdogThread(void *arg) {
wdguard = 0xA51F2E3D;
- iguard = 0xA51F2E3D;
cdguard = 0xA51F2E3D;
while (TRUE) {
if ((wdguard != 0xA51F2E3D) ||
- (iguard != 0xA51F2E3D) ||
(cdguard != 0xA51F2E3D)) {
printf("Halted by watchdog");
chSysHalt();
@@ -294,13 +272,20 @@ static t_evhandler fhandlers[2] = {
COM2Handler
};
-/*
- * Init-like thread, it starts the shells and handles their termination.
- * It is a good example of events usage.
- */
-static t_msg InitThread(void *arg) {
+/*------------------------------------------------------------------------*
+ * Simulator main, start here your threads, examples inside. *
+ *------------------------------------------------------------------------*/
+int main(void) {
EventListener c1fel, c2fel;
+ InitCore();
+
+ // Startup ChibiOS/RT.
+ chSysInit();
+
+ chThdCreate(NORMALPRIO + 2, 0, wdarea, sizeof(wdarea), WatchdogThread, NULL);
+ cdtp = chThdCreate(NORMALPRIO + 1, 0, cdarea, sizeof(cdarea), ConsoleThread, NULL);
+
cprint("Console service started on COM1, COM2\n");
cprint(" - Listening for connections on COM1\n");
chFDDGetAndClearFlags(&COM1);