From 436aa85ab1c30168d6cdd64de2a4eb1ca9fee534 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 13 Dec 2008 09:55:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@539 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 301 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 301 insertions(+) create mode 100644 demos/Win32-MinGW/main.c (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c new file mode 100644 index 000000000..f3d276599 --- /dev/null +++ b/demos/Win32-MinGW/main.c @@ -0,0 +1,301 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include + +#include + +static uint32_t wdguard; +static WorkingArea(wdarea, 2048); + +static uint32_t cdguard; +static WorkingArea(cdarea, 2048); +static Thread *cdtp; + +static msg_t WatchdogThread(void *arg); +static msg_t ConsoleThread(void *arg); + +msg_t TestThread(void *p); + +void InitCore(void); +extern FullDuplexDriver COM1, COM2; + +#define cprint(msg) chMsgSend(cdtp, (msg_t)msg) + +/* + * Watchdog thread, it checks magic values located under the various stack + * areas. The system is halted if something is wrong. + */ +static msg_t WatchdogThread(void *arg) { + wdguard = 0xA51F2E3D; + cdguard = 0xA51F2E3D; + while (TRUE) { + + if ((wdguard != 0xA51F2E3D) || + (cdguard != 0xA51F2E3D)) { + printf("Halted by watchdog"); + chSysHalt(); + } + chThdSleep(50); + } + return 0; +} + +/* + * Console print server done using synchronous messages. This makes the access + * to the C printf() thread safe and the print operation atomic among threads. + * In this example the message is the zero termitated string itself. + */ +static msg_t ConsoleThread(void *arg) { + + while (!chThdShouldTerminate()) { + printf((char *)chMsgWait()); + chMsgRelease(RDY_OK); + } + return 0; +} + +static void PrintLineFDD(FullDuplexDriver *sd, char *msg) { + + while (*msg) + chFDDPut(sd, *msg++); +} + +static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) { + char *p = line; + + while (TRUE) { + short c = chIQGet(&sd->sd_iqueue); + if (c < 0) + return TRUE; + if (c == 4) { + PrintLineFDD(sd, "^D\r\n"); + return TRUE; + } + if (c == 8) { + if (p != line) { + chFDDPut(sd, (uint8_t)c); + chFDDPut(sd, 0x20); + chFDDPut(sd, (uint8_t)c); + p--; + } + continue; + } + if (c == '\r') { + PrintLineFDD(sd, "\r\n"); + *p = 0; + return FALSE; + } + if (c < 0x20) + continue; + if (p < line + size - 1) { + chFDDPut(sd, (uint8_t)c); + *p++ = (uint8_t)c; + } + } +} + +/* + * Example thread, not much to see here. It simulates the CTRL-C but there + * are no real signals involved. + */ +static msg_t HelloWorldThread(void *arg) { + int i; + short c; + FullDuplexDriver *sd = (FullDuplexDriver *)arg; + + for (i = 0; i < 100; i++) { + + PrintLineFDD(sd, "Hello World\r\n"); + c = chFDDGetTimeout(sd, 333); + switch (c) { + case -1: + continue; + case -2: + return 1; + case 3: + PrintLineFDD(sd, "^C\r\n"); + return 0; + default: + chThdSleep(333); + } + } + return 0; +} + +static bool_t checkend(FullDuplexDriver *sd) { + + char * lp = strtok(NULL, " \009"); /* It is not thread safe but this is a demo.*/ + if (lp) { + PrintLineFDD(sd, lp); + PrintLineFDD(sd, " ?\r\n"); + return TRUE; + } + return FALSE; +} + +/* + * Simple command shell thread, the argument is the serial line for the + * standard input and output. It recognizes few simple commands. + */ +static msg_t ShellThread(void *arg) { + FullDuplexDriver *sd = (FullDuplexDriver *)arg; + char *lp, line[64]; + Thread *tp; + WorkingArea(tarea, 2048); + + chIQReset(&sd->sd_iqueue); + chOQReset(&sd->sd_oqueue); + PrintLineFDD(sd, "ChibiOS/RT Command Shell\r\n\n"); + while (TRUE) { + PrintLineFDD(sd, "ch> "); + if (GetLineFDD(sd, line, sizeof(line))) { + PrintLineFDD(sd, "\nlogout"); + break; + } + lp = strtok(line, " \009"); // Note: not thread safe but it is just a demo. + if (lp) { + if ((stricmp(lp, "help") == 0) || + (stricmp(lp, "h") == 0) || + (stricmp(lp, "?") == 0)) { + if (checkend(sd)) + continue; + PrintLineFDD(sd, "Commands:\r\n"); + PrintLineFDD(sd, " help,h,? - This help\r\n"); + 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)) + continue; + PrintLineFDD(sd, "\nlogout"); + break; + } + else if (stricmp(lp, "time") == 0) { + if (checkend(sd)) + continue; + sprintf(line, "Time: %d\r\n", chSysGetTime()); + PrintLineFDD(sd, line); + } + else if (stricmp(lp, "hello") == 0) { + if (checkend(sd)) + continue; + tp = chThdCreate(NORMALPRIO, 0, tarea, sizeof(tarea), + HelloWorldThread, sd); + 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"); + } + } + } + return 0; +} + +static WorkingArea(s1area, 4096); +static Thread *s1; +EventListener s1tel; + +static void COM1Handler(eventid_t id) { + dflags_t flags; + + if (s1 && chThdTerminated(s1)) { + s1 = NULL; + cprint("Init: disconnection on COM1\n"); + } + flags = chFDDGetAndClearFlags(&COM1); + if ((flags & SD_CONNECTED) && (s1 == NULL)) { + cprint("Init: connection on COM1\n"); + s1 = chThdCreate(NORMALPRIO, P_SUSPENDED, s1area, sizeof(s1area), + ShellThread, &COM1); + chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0); + chThdResume(s1); + } + if ((flags & SD_DISCONNECTED) && (s1 != NULL)) + chIQReset(&COM1.sd_iqueue); +} + +static WorkingArea(s2area, 4096); +static Thread *s2; +EventListener s2tel; + +static void COM2Handler(eventid_t id) { + dflags_t flags; + + if (s2 && chThdTerminated(s2)) { + s2 = NULL; + cprint("Init: disconnection on COM2\n"); + } + flags = chFDDGetAndClearFlags(&COM2); + if ((flags & SD_CONNECTED) && (s2 == NULL)) { + cprint("Init: connection on COM2\n"); + s2 = chThdCreate(NORMALPRIO, P_SUSPENDED, s2area, sizeof(s1area), + ShellThread, &COM2); + chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1); + chThdResume(s2); + } + if ((flags & SD_DISCONNECTED) && (s2 != NULL)) + chIQReset(&COM2.sd_iqueue); +} + +static evhandler_t fhandlers[2] = { + COM1Handler, + COM2Handler +}; + +/*------------------------------------------------------------------------* + * 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); + chEvtRegister(&COM1.sd_sevent, &c1fel, 0); + cprint(" - Listening for connections on COM2\n"); + chFDDGetAndClearFlags(&COM2); + chEvtRegister(&COM2.sd_sevent, &c2fel, 1); + while (!chThdShouldTerminate()) + chEvtWait(ALL_EVENTS, fhandlers); + chEvtUnregister(&COM2.sd_sevent, &c2fel); // Never invoked but this is an example... + chEvtUnregister(&COM1.sd_sevent, &c1fel); // Never invoked but this is an example... + return 0; +} -- cgit v1.2.3 From 7f7cdc881e70aa0356eaa647647ab5d4cd2b5d27 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 13 Dec 2008 10:34:39 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@540 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index f3d276599..5de6ee938 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -23,10 +23,10 @@ #include static uint32_t wdguard; -static WorkingArea(wdarea, 2048); +static WORKING_AREA(wdarea, 2048); static uint32_t cdguard; -static WorkingArea(cdarea, 2048); +static WORKING_AREA(cdarea, 2048); static Thread *cdtp; static msg_t WatchdogThread(void *arg); @@ -51,6 +51,7 @@ static msg_t WatchdogThread(void *arg) { if ((wdguard != 0xA51F2E3D) || (cdguard != 0xA51F2E3D)) { printf("Halted by watchdog"); + fflush(stdout); chSysHalt(); } chThdSleep(50); @@ -67,6 +68,7 @@ static msg_t ConsoleThread(void *arg) { while (!chThdShouldTerminate()) { printf((char *)chMsgWait()); + fflush(stdout); chMsgRelease(RDY_OK); } return 0; @@ -159,7 +161,7 @@ static msg_t ShellThread(void *arg) { FullDuplexDriver *sd = (FullDuplexDriver *)arg; char *lp, line[64]; Thread *tp; - WorkingArea(tarea, 2048); + WORKING_AREA(tarea, 2048); chIQReset(&sd->sd_iqueue); chOQReset(&sd->sd_oqueue); @@ -199,16 +201,16 @@ static msg_t ShellThread(void *arg) { else if (stricmp(lp, "hello") == 0) { if (checkend(sd)) continue; - tp = chThdCreate(NORMALPRIO, 0, tarea, sizeof(tarea), - HelloWorldThread, sd); + tp = chThdCreateStatic(tarea, sizeof(tarea), + NORMALPRIO, HelloWorldThread, sd); 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); + tp = chThdCreateStatic(tarea, sizeof(tarea), + NORMALPRIO, TestThread, arg); if (chThdWait(tp)) break; // Lost connection while executing the hello thread. } @@ -221,7 +223,7 @@ static msg_t ShellThread(void *arg) { return 0; } -static WorkingArea(s1area, 4096); +static WORKING_AREA(s1area, 4096); static Thread *s1; EventListener s1tel; @@ -235,8 +237,8 @@ static void COM1Handler(eventid_t id) { flags = chFDDGetAndClearFlags(&COM1); if ((flags & SD_CONNECTED) && (s1 == NULL)) { cprint("Init: connection on COM1\n"); - s1 = chThdCreate(NORMALPRIO, P_SUSPENDED, s1area, sizeof(s1area), - ShellThread, &COM1); + s1 = chThdInit(s1area, sizeof(s1area), + NORMALPRIO, ShellThread, &COM1); chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0); chThdResume(s1); } @@ -244,7 +246,7 @@ static void COM1Handler(eventid_t id) { chIQReset(&COM1.sd_iqueue); } -static WorkingArea(s2area, 4096); +static WORKING_AREA(s2area, 4096); static Thread *s2; EventListener s2tel; @@ -258,8 +260,8 @@ static void COM2Handler(eventid_t id) { flags = chFDDGetAndClearFlags(&COM2); if ((flags & SD_CONNECTED) && (s2 == NULL)) { cprint("Init: connection on COM2\n"); - s2 = chThdCreate(NORMALPRIO, P_SUSPENDED, s2area, sizeof(s1area), - ShellThread, &COM2); + s2 = chThdInit(s2area, sizeof(s1area), + NORMALPRIO, ShellThread, &COM2); chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1); chThdResume(s2); } @@ -283,8 +285,8 @@ int main(void) { // Startup ChibiOS/RT. chSysInit(); - chThdCreate(NORMALPRIO + 2, 0, wdarea, sizeof(wdarea), WatchdogThread, NULL); - cdtp = chThdCreate(NORMALPRIO + 1, 0, cdarea, sizeof(cdarea), ConsoleThread, NULL); + chThdCreateStatic(wdarea, sizeof(wdarea), NORMALPRIO + 2, WatchdogThread, NULL); + cdtp = chThdCreateStatic(cdarea, sizeof(cdarea), NORMALPRIO + 1, ConsoleThread, NULL); cprint("Console service started on COM1, COM2\n"); cprint(" - Listening for connections on COM1\n"); @@ -294,7 +296,7 @@ int main(void) { chFDDGetAndClearFlags(&COM2); chEvtRegister(&COM2.sd_sevent, &c2fel, 1); while (!chThdShouldTerminate()) - chEvtWait(ALL_EVENTS, fhandlers); + chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS)); chEvtUnregister(&COM2.sd_sevent, &c2fel); // Never invoked but this is an example... chEvtUnregister(&COM1.sd_sevent, &c1fel); // Never invoked but this is an example... return 0; -- cgit v1.2.3 From 791d101af5ce38335694b882149449c83f650fda Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Jan 2009 09:42:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@602 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 1 - 1 file changed, 1 deletion(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 5de6ee938..eaf2504dd 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -34,7 +34,6 @@ static msg_t ConsoleThread(void *arg); msg_t TestThread(void *p); -void InitCore(void); extern FullDuplexDriver COM1, COM2; #define cprint(msg) chMsgSend(cdtp, (msg_t)msg) -- cgit v1.2.3 From a9b4e8fc7225e8e2f26554b388f9d069d8f05b5e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 16 Jan 2009 15:41:08 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@621 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index eaf2504dd..a72d7b4da 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -279,8 +279,6 @@ static evhandler_t fhandlers[2] = { int main(void) { EventListener c1fel, c2fel; - InitCore(); - // Startup ChibiOS/RT. chSysInit(); -- cgit v1.2.3 From 1170025270003c5cbbc84bf07de5c83253318b28 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 20 Jan 2009 20:43:09 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@651 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index a72d7b4da..ae06ff841 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -127,9 +127,9 @@ static msg_t HelloWorldThread(void *arg) { PrintLineFDD(sd, "Hello World\r\n"); c = chFDDGetTimeout(sd, 333); switch (c) { - case -1: + case Q_TIMEOUT: continue; - case -2: + case Q_RESET: return 1; case 3: PrintLineFDD(sd, "^C\r\n"); -- cgit v1.2.3 From 2debe881379d58a4fa92a984471a02e7f5de07c4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 20 Jan 2009 21:23:48 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@652 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index ae06ff841..1d80b9d76 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -122,7 +122,7 @@ static msg_t HelloWorldThread(void *arg) { short c; FullDuplexDriver *sd = (FullDuplexDriver *)arg; - for (i = 0; i < 100; i++) { + for (i = 0; i < 10; i++) { PrintLineFDD(sd, "Hello World\r\n"); c = chFDDGetTimeout(sd, 333); -- cgit v1.2.3 From da4f9beaee8f1f8f344012b4d9a122462a6c802e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 10 Mar 2009 15:31:58 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@827 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW/main.c') 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) { -- cgit v1.2.3 From 1f7dd2586a16b6f47ba6214faf954481de6c4086 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 3 May 2009 10:43:54 +0000 Subject: Adjusted LPC214x serial driver and MinGW demo because the latest changes. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@942 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index c2ac24868..68dc4eb06 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -83,7 +83,7 @@ static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) { char *p = line; while (TRUE) { - short c = chIQGet(&sd->sd_iqueue); + short c = chIQGet(&sd->d2.iqueue); if (c < 0) return TRUE; if (c == 4) { @@ -162,8 +162,10 @@ static msg_t ShellThread(void *arg) { Thread *tp; WORKING_AREA(tarea, 2048); - chIQReset(&sd->sd_iqueue); - chOQReset(&sd->sd_oqueue); + chSysLock(); + chIQResetI(&sd->d2.iqueue); + chOQResetI(&sd->d2.oqueue); + chSysUnlock(); PrintLineFDD(sd, "ChibiOS/RT Command Shell\r\n\n"); while (TRUE) { PrintLineFDD(sd, "ch> "); @@ -241,8 +243,11 @@ static void COM1Handler(eventid_t id) { chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0); chThdResume(s1); } - if ((flags & SD_DISCONNECTED) && (s1 != NULL)) - chIQReset(&COM1.sd_iqueue); + if ((flags & SD_DISCONNECTED) && (s1 != NULL)) { + chSysLock(); + chIQResetI(&COM1.d2.iqueue); + chSysUnlock(); + } } static WORKING_AREA(s2area, 4096); @@ -264,8 +269,11 @@ static void COM2Handler(eventid_t id) { chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1); chThdResume(s2); } - if ((flags & SD_DISCONNECTED) && (s2 != NULL)) - chIQReset(&COM2.sd_iqueue); + if ((flags & SD_DISCONNECTED) && (s2 != NULL)) { + chSysLock(); + chIQResetI(&COM2.d2.iqueue); + chSysUnlock(); + } } static evhandler_t fhandlers[2] = { @@ -288,13 +296,13 @@ int main(void) { cprint("Console service started on COM1, COM2\n"); cprint(" - Listening for connections on COM1\n"); chFDDGetAndClearFlags(&COM1); - chEvtRegister(&COM1.sd_sevent, &c1fel, 0); + chEvtRegister(&COM1.d2.sevent, &c1fel, 0); cprint(" - Listening for connections on COM2\n"); chFDDGetAndClearFlags(&COM2); - chEvtRegister(&COM2.sd_sevent, &c2fel, 1); + chEvtRegister(&COM2.d2.sevent, &c2fel, 1); while (!chThdShouldTerminate()) chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS)); - chEvtUnregister(&COM2.sd_sevent, &c2fel); // Never invoked but this is an example... - chEvtUnregister(&COM1.sd_sevent, &c1fel); // Never invoked but this is an example... + chEvtUnregister(&COM2.d2.sevent, &c2fel); // Never invoked but this is an example... + chEvtUnregister(&COM1.d2.sevent, &c1fel); // Never invoked but this is an example... return 0; } -- cgit v1.2.3 From 68a37ee345f3f8f3bdcc8199a73a84a475efae7e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 30 Aug 2009 14:14:09 +0000 Subject: New serial driver for Win32 demo. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1142 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 108 ++++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 53 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 68dc4eb06..bca8af11b 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -21,6 +21,7 @@ #include #include +#include static uint32_t wdguard; static WORKING_AREA(wdarea, 2048); @@ -34,8 +35,6 @@ static msg_t ConsoleThread(void *arg); msg_t TestThread(void *p); -extern FullDuplexDriver COM1, COM2; - #define cprint(msg) chMsgSend(cdtp, (msg_t)msg) /* @@ -73,13 +72,13 @@ static msg_t ConsoleThread(void *arg) { return 0; } -static void PrintLineFDD(FullDuplexDriver *sd, char *msg) { +static void PrintLineSD(SerialDriver *sd, char *msg) { while (*msg) - chFDDPut(sd, *msg++); + sdPut(sd, *msg++); } -static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) { +static bool_t GetLineFDD(SerialDriver *sd, char *line, int size) { char *p = line; while (TRUE) { @@ -87,27 +86,27 @@ static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) { if (c < 0) return TRUE; if (c == 4) { - PrintLineFDD(sd, "^D\r\n"); + PrintLineSD(sd, "^D\r\n"); return TRUE; } if (c == 8) { if (p != line) { - chFDDPut(sd, (uint8_t)c); - chFDDPut(sd, 0x20); - chFDDPut(sd, (uint8_t)c); + sdPut(sd, (uint8_t)c); + sdPut(sd, 0x20); + sdPut(sd, (uint8_t)c); p--; } continue; } if (c == '\r') { - PrintLineFDD(sd, "\r\n"); + PrintLineSD(sd, "\r\n"); *p = 0; return FALSE; } if (c < 0x20) continue; if (p < line + size - 1) { - chFDDPut(sd, (uint8_t)c); + sdPut(sd, (uint8_t)c); *p++ = (uint8_t)c; } } @@ -120,19 +119,19 @@ static bool_t GetLineFDD(FullDuplexDriver *sd, char *line, int size) { static msg_t HelloWorldThread(void *arg) { int i; short c; - FullDuplexDriver *sd = (FullDuplexDriver *)arg; + SerialDriver *sd = (SerialDriver *)arg; for (i = 0; i < 10; i++) { - PrintLineFDD(sd, "Hello World\r\n"); - c = chFDDGetTimeout(sd, 333); + PrintLineSD(sd, "Hello World\r\n"); + c = sdGetTimeout(sd, 333); switch (c) { case Q_TIMEOUT: continue; case Q_RESET: return 1; case 3: - PrintLineFDD(sd, "^C\r\n"); + PrintLineSD(sd, "^C\r\n"); return 0; default: chThdSleep(333); @@ -141,12 +140,12 @@ static msg_t HelloWorldThread(void *arg) { return 0; } -static bool_t checkend(FullDuplexDriver *sd) { +static bool_t checkend(SerialDriver *sd) { char * lp = strtok(NULL, " \009"); /* It is not thread safe but this is a demo.*/ if (lp) { - PrintLineFDD(sd, lp); - PrintLineFDD(sd, " ?\r\n"); + PrintLineSD(sd, lp); + PrintLineSD(sd, " ?\r\n"); return TRUE; } return FALSE; @@ -157,7 +156,7 @@ static bool_t checkend(FullDuplexDriver *sd) { * standard input and output. It recognizes few simple commands. */ static msg_t ShellThread(void *arg) { - FullDuplexDriver *sd = (FullDuplexDriver *)arg; + SerialDriver *sd = (SerialDriver *)arg; char *lp, line[64]; Thread *tp; WORKING_AREA(tarea, 2048); @@ -166,11 +165,11 @@ static msg_t ShellThread(void *arg) { chIQResetI(&sd->d2.iqueue); chOQResetI(&sd->d2.oqueue); chSysUnlock(); - PrintLineFDD(sd, "ChibiOS/RT Command Shell\r\n\n"); + PrintLineSD(sd, "ChibiOS/RT Command Shell\r\n\n"); while (TRUE) { - PrintLineFDD(sd, "ch> "); + PrintLineSD(sd, "ch> "); if (GetLineFDD(sd, line, sizeof(line))) { - PrintLineFDD(sd, "\nlogout"); + PrintLineSD(sd, "\nlogout"); break; } lp = strtok(line, " \009"); // Note: not thread safe but it is just a demo. @@ -180,24 +179,24 @@ static msg_t ShellThread(void *arg) { (stricmp(lp, "?") == 0)) { if (checkend(sd)) continue; - PrintLineFDD(sd, "Commands:\r\n"); - PrintLineFDD(sd, " help,h,? - This help\r\n"); - 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"); + PrintLineSD(sd, "Commands:\r\n"); + PrintLineSD(sd, " help,h,? - This help\r\n"); + PrintLineSD(sd, " exit - Logout from ChibiOS/RT\r\n"); + PrintLineSD(sd, " time - Prints the system timer value\r\n"); + PrintLineSD(sd, " hello - Runs the Hello World demo thread\r\n"); + PrintLineSD(sd, " test - Runs the System Test thread\r\n"); } else if (stricmp(lp, "exit") == 0) { if (checkend(sd)) continue; - PrintLineFDD(sd, "\nlogout"); + PrintLineSD(sd, "\nlogout"); break; } else if (stricmp(lp, "time") == 0) { if (checkend(sd)) continue; sprintf(line, "Time: %d\r\n", chTimeNow()); - PrintLineFDD(sd, line); + PrintLineSD(sd, line); } else if (stricmp(lp, "hello") == 0) { if (checkend(sd)) @@ -216,8 +215,8 @@ static msg_t ShellThread(void *arg) { break; // Lost connection while executing the hello thread. } else { - PrintLineFDD(sd, lp); - PrintLineFDD(sd, " ?\r\n"); + PrintLineSD(sd, lp); + PrintLineSD(sd, " ?\r\n"); } } } @@ -229,23 +228,23 @@ static Thread *s1; EventListener s1tel; static void COM1Handler(eventid_t id) { - dflags_t flags; + sdflags_t flags; if (s1 && chThdTerminated(s1)) { s1 = NULL; - cprint("Init: disconnection on COM1\n"); + cprint("Init: disconnection on SD1\n"); } - flags = chFDDGetAndClearFlags(&COM1); + flags = sdGetAndClearFlags(&SD1); if ((flags & SD_CONNECTED) && (s1 == NULL)) { - cprint("Init: connection on COM1\n"); + cprint("Init: connection on SD1\n"); s1 = chThdInit(s1area, sizeof(s1area), - NORMALPRIO, ShellThread, &COM1); + NORMALPRIO, ShellThread, &SD1); chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0); chThdResume(s1); } if ((flags & SD_DISCONNECTED) && (s1 != NULL)) { chSysLock(); - chIQResetI(&COM1.d2.iqueue); + chIQResetI(&SD1.d2.iqueue); chSysUnlock(); } } @@ -255,23 +254,23 @@ static Thread *s2; EventListener s2tel; static void COM2Handler(eventid_t id) { - dflags_t flags; + sdflags_t flags; if (s2 && chThdTerminated(s2)) { s2 = NULL; - cprint("Init: disconnection on COM2\n"); + cprint("Init: disconnection on SD2\n"); } - flags = chFDDGetAndClearFlags(&COM2); + flags = sdGetAndClearFlags(&SD2); if ((flags & SD_CONNECTED) && (s2 == NULL)) { - cprint("Init: connection on COM2\n"); + cprint("Init: connection on SD2\n"); s2 = chThdInit(s2area, sizeof(s1area), - NORMALPRIO, ShellThread, &COM2); + NORMALPRIO, ShellThread, &SD2); chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1); chThdResume(s2); } if ((flags & SD_DISCONNECTED) && (s2 != NULL)) { chSysLock(); - chIQResetI(&COM2.d2.iqueue); + chIQResetI(&SD2.d2.iqueue); chSysUnlock(); } } @@ -290,19 +289,22 @@ int main(void) { // Startup ChibiOS/RT. chSysInit(); + sdStart(&SD1, NULL); + sdStart(&SD2, NULL); + chThdCreateStatic(wdarea, sizeof(wdarea), NORMALPRIO + 2, WatchdogThread, NULL); cdtp = chThdCreateStatic(cdarea, sizeof(cdarea), NORMALPRIO + 1, ConsoleThread, NULL); - cprint("Console service started on COM1, COM2\n"); - cprint(" - Listening for connections on COM1\n"); - chFDDGetAndClearFlags(&COM1); - chEvtRegister(&COM1.d2.sevent, &c1fel, 0); - cprint(" - Listening for connections on COM2\n"); - chFDDGetAndClearFlags(&COM2); - chEvtRegister(&COM2.d2.sevent, &c2fel, 1); + cprint("Console service started on SD1, SD2\n"); + cprint(" - Listening for connections on SD1\n"); + sdGetAndClearFlags(&SD1); + chEvtRegister(&SD1.d2.sevent, &c1fel, 0); + cprint(" - Listening for connections on SD2\n"); + sdGetAndClearFlags(&SD2); + chEvtRegister(&SD2.d2.sevent, &c2fel, 1); while (!chThdShouldTerminate()) chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS)); - chEvtUnregister(&COM2.d2.sevent, &c2fel); // Never invoked but this is an example... - chEvtUnregister(&COM1.d2.sevent, &c1fel); // Never invoked but this is an example... + chEvtUnregister(&SD1.d2.sevent, &c2fel); // Never invoked but this is an example... + chEvtUnregister(&SD2.d2.sevent, &c1fel); // Never invoked but this is an example... return 0; } -- cgit v1.2.3 From e9d7b9de5705a3b5c0b822077fbd165c86087481 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 17 Oct 2009 11:07:15 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1230 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index bca8af11b..6a2b5367f 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -42,10 +42,11 @@ msg_t TestThread(void *p); * areas. The system is halted if something is wrong. */ static msg_t WatchdogThread(void *arg) { + + (void)arg; wdguard = 0xA51F2E3D; cdguard = 0xA51F2E3D; while (TRUE) { - if ((wdguard != 0xA51F2E3D) || (cdguard != 0xA51F2E3D)) { printf("Halted by watchdog"); @@ -64,6 +65,7 @@ static msg_t WatchdogThread(void *arg) { */ static msg_t ConsoleThread(void *arg) { + (void)arg; while (!chThdShouldTerminate()) { printf((char *)chMsgWait()); fflush(stdout); @@ -230,6 +232,7 @@ EventListener s1tel; static void COM1Handler(eventid_t id) { sdflags_t flags; + (void)id; if (s1 && chThdTerminated(s1)) { s1 = NULL; cprint("Init: disconnection on SD1\n"); @@ -256,6 +259,7 @@ EventListener s2tel; static void COM2Handler(eventid_t id) { sdflags_t flags; + (void)id; if (s2 && chThdTerminated(s2)) { s2 = NULL; cprint("Init: disconnection on SD2\n"); -- cgit v1.2.3 From 31f54b93735bca0ef23b68dc1a1cf735800bbf14 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 Dec 2009 17:44:03 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1398 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 6a2b5367f..7f081c023 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -20,8 +20,8 @@ #include #include -#include -#include +#include "ch.h" +#include "hal.h" static uint32_t wdguard; static WORKING_AREA(wdarea, 2048); -- cgit v1.2.3 From 6d44bd72e3bd586dc84ff0fe65b1218173efa0a7 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 8 Dec 2009 19:12:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1401 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 7f081c023..2b0c5ea15 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -290,7 +290,14 @@ static evhandler_t fhandlers[2] = { int main(void) { EventListener c1fel, c2fel; - // Startup ChibiOS/RT. + /* + * HAL initialization. + */ + halInit(); + + /* + * ChibiOS/RT initialization. + */ chSysInit(); sdStart(&SD1, NULL); -- cgit v1.2.3 From dea70dbc797e0936c2532ae55881437e06e169fa Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 10 Dec 2009 15:44:55 +0000 Subject: Added a small generic command line shell. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1411 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 316 ++++++++++++++--------------------------------- 1 file changed, 94 insertions(+), 222 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 2b0c5ea15..c2ead083e 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -17,53 +17,36 @@ along with this program. If not, see . */ -#include -#include - #include "ch.h" #include "hal.h" +#include "test.h" +#include "shell.h" -static uint32_t wdguard; -static WORKING_AREA(wdarea, 2048); - -static uint32_t cdguard; -static WORKING_AREA(cdarea, 2048); -static Thread *cdtp; - -static msg_t WatchdogThread(void *arg); -static msg_t ConsoleThread(void *arg); - -msg_t TestThread(void *p); +#define SHELL_WA_SIZE THD_WA_SIZE(4096) +#define CONSOLE_WA_SIZE THD_WA_SIZE(4096) #define cprint(msg) chMsgSend(cdtp, (msg_t)msg) -/* - * Watchdog thread, it checks magic values located under the various stack - * areas. The system is halted if something is wrong. - */ -static msg_t WatchdogThread(void *arg) { +static Thread *cdtp; +static Thread *shelltp1; +static Thread *shelltp2; - (void)arg; - wdguard = 0xA51F2E3D; - cdguard = 0xA51F2E3D; - while (TRUE) { - if ((wdguard != 0xA51F2E3D) || - (cdguard != 0xA51F2E3D)) { - printf("Halted by watchdog"); - fflush(stdout); - chSysHalt(); - } - chThdSleep(50); - } - return 0; -} +static const ShellConfig shell_cfg1 = { + (BaseChannel *)&SD1, + NULL +}; + +static const ShellConfig shell_cfg2 = { + (BaseChannel *)&SD2, + NULL +}; /* * Console print server done using synchronous messages. This makes the access * to the C printf() thread safe and the print operation atomic among threads. * In this example the message is the zero termitated string itself. */ -static msg_t ConsoleThread(void *arg) { +static msg_t console_thread(void *arg) { (void)arg; while (!chThdShouldTerminate()) { @@ -74,221 +57,87 @@ static msg_t ConsoleThread(void *arg) { return 0; } -static void PrintLineSD(SerialDriver *sd, char *msg) { - - while (*msg) - sdPut(sd, *msg++); -} - -static bool_t GetLineFDD(SerialDriver *sd, char *line, int size) { - char *p = line; - - while (TRUE) { - short c = chIQGet(&sd->d2.iqueue); - if (c < 0) - return TRUE; - if (c == 4) { - PrintLineSD(sd, "^D\r\n"); - return TRUE; - } - if (c == 8) { - if (p != line) { - sdPut(sd, (uint8_t)c); - sdPut(sd, 0x20); - sdPut(sd, (uint8_t)c); - p--; - } - continue; - } - if (c == '\r') { - PrintLineSD(sd, "\r\n"); - *p = 0; - return FALSE; - } - if (c < 0x20) - continue; - if (p < line + size - 1) { - sdPut(sd, (uint8_t)c); - *p++ = (uint8_t)c; - } - } -} - -/* - * Example thread, not much to see here. It simulates the CTRL-C but there - * are no real signals involved. +/** + * @brief Shell termination handler. + * + * @param[in] id event id. */ -static msg_t HelloWorldThread(void *arg) { - int i; - short c; - SerialDriver *sd = (SerialDriver *)arg; - - for (i = 0; i < 10; i++) { +static void termination_handler(eventid_t id) { - PrintLineSD(sd, "Hello World\r\n"); - c = sdGetTimeout(sd, 333); - switch (c) { - case Q_TIMEOUT: - continue; - case Q_RESET: - return 1; - case 3: - PrintLineSD(sd, "^C\r\n"); - return 0; - default: - chThdSleep(333); - } + (void)id; + if (shelltp1 && chThdTerminated(shelltp1)) { + chThdWait(shelltp1); + shelltp1 = NULL; + cprint("Init: shell on SD1 terminated\n"); + chSysLock(); + chOQResetI(&SD1.d2.oqueue); + chSysUnlock(); } - return 0; -} - -static bool_t checkend(SerialDriver *sd) { - - char * lp = strtok(NULL, " \009"); /* It is not thread safe but this is a demo.*/ - if (lp) { - PrintLineSD(sd, lp); - PrintLineSD(sd, " ?\r\n"); - return TRUE; + if (shelltp2 && chThdTerminated(shelltp2)) { + chThdWait(shelltp2); + shelltp2 = NULL; + cprint("Init: shell on SD2 terminated\n"); + chSysLock(); + chOQResetI(&SD2.d2.oqueue); + chSysUnlock(); } - return FALSE; } -/* - * Simple command shell thread, the argument is the serial line for the - * standard input and output. It recognizes few simple commands. +/** + * @brief SD1 status change handler. + * + * @param[in] id event id. */ -static msg_t ShellThread(void *arg) { - SerialDriver *sd = (SerialDriver *)arg; - char *lp, line[64]; - Thread *tp; - WORKING_AREA(tarea, 2048); - - chSysLock(); - chIQResetI(&sd->d2.iqueue); - chOQResetI(&sd->d2.oqueue); - chSysUnlock(); - PrintLineSD(sd, "ChibiOS/RT Command Shell\r\n\n"); - while (TRUE) { - PrintLineSD(sd, "ch> "); - if (GetLineFDD(sd, line, sizeof(line))) { - PrintLineSD(sd, "\nlogout"); - break; - } - lp = strtok(line, " \009"); // Note: not thread safe but it is just a demo. - if (lp) { - if ((stricmp(lp, "help") == 0) || - (stricmp(lp, "h") == 0) || - (stricmp(lp, "?") == 0)) { - if (checkend(sd)) - continue; - PrintLineSD(sd, "Commands:\r\n"); - PrintLineSD(sd, " help,h,? - This help\r\n"); - PrintLineSD(sd, " exit - Logout from ChibiOS/RT\r\n"); - PrintLineSD(sd, " time - Prints the system timer value\r\n"); - PrintLineSD(sd, " hello - Runs the Hello World demo thread\r\n"); - PrintLineSD(sd, " test - Runs the System Test thread\r\n"); - } - else if (stricmp(lp, "exit") == 0) { - if (checkend(sd)) - continue; - PrintLineSD(sd, "\nlogout"); - break; - } - else if (stricmp(lp, "time") == 0) { - if (checkend(sd)) - continue; - sprintf(line, "Time: %d\r\n", chTimeNow()); - PrintLineSD(sd, line); - } - else if (stricmp(lp, "hello") == 0) { - if (checkend(sd)) - continue; - tp = chThdCreateStatic(tarea, sizeof(tarea), - NORMALPRIO, HelloWorldThread, sd); - if (chThdWait(tp)) - break; // Lost connection while executing the hello thread. - } - else if (stricmp(lp, "test") == 0) { - if (checkend(sd)) - continue; - tp = chThdCreateStatic(tarea, sizeof(tarea), - NORMALPRIO, TestThread, arg); - if (chThdWait(tp)) - break; // Lost connection while executing the hello thread. - } - else { - PrintLineSD(sd, lp); - PrintLineSD(sd, " ?\r\n"); - } - } - } - return 0; -} - -static WORKING_AREA(s1area, 4096); -static Thread *s1; -EventListener s1tel; - -static void COM1Handler(eventid_t id) { +static void sd1_handler(eventid_t id) { sdflags_t flags; (void)id; - if (s1 && chThdTerminated(s1)) { - s1 = NULL; - cprint("Init: disconnection on SD1\n"); - } flags = sdGetAndClearFlags(&SD1); - if ((flags & SD_CONNECTED) && (s1 == NULL)) { + if ((flags & SD_CONNECTED) && (shelltp1 == NULL)) { cprint("Init: connection on SD1\n"); - s1 = chThdInit(s1area, sizeof(s1area), - NORMALPRIO, ShellThread, &SD1); - chEvtRegister(chThdGetExitEventSource(s1), &s1tel, 0); - chThdResume(s1); + shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO + 1); } - if ((flags & SD_DISCONNECTED) && (s1 != NULL)) { + if (flags & SD_DISCONNECTED) { + cprint("Init: disconnection on SD1\n"); chSysLock(); chIQResetI(&SD1.d2.iqueue); chSysUnlock(); } } -static WORKING_AREA(s2area, 4096); -static Thread *s2; -EventListener s2tel; - -static void COM2Handler(eventid_t id) { +/** + * @brief SD2 status change handler. + * + * @param[in] id event id. + */ +static void sd2_handler(eventid_t id) { sdflags_t flags; (void)id; - if (s2 && chThdTerminated(s2)) { - s2 = NULL; - cprint("Init: disconnection on SD2\n"); - } flags = sdGetAndClearFlags(&SD2); - if ((flags & SD_CONNECTED) && (s2 == NULL)) { + if ((flags & SD_CONNECTED) && (shelltp2 == NULL)) { cprint("Init: connection on SD2\n"); - s2 = chThdInit(s2area, sizeof(s1area), - NORMALPRIO, ShellThread, &SD2); - chEvtRegister(chThdGetExitEventSource(s2), &s2tel, 1); - chThdResume(s2); + shelltp2 = shellCreate(&shell_cfg2, SHELL_WA_SIZE, NORMALPRIO + 10); } - if ((flags & SD_DISCONNECTED) && (s2 != NULL)) { + if (flags & SD_DISCONNECTED) { + cprint("Init: disconnection on SD2\n"); chSysLock(); chIQResetI(&SD2.d2.iqueue); chSysUnlock(); } } -static evhandler_t fhandlers[2] = { - COM1Handler, - COM2Handler +static evhandler_t fhandlers[] = { + termination_handler, + sd1_handler, + sd2_handler }; /*------------------------------------------------------------------------* - * Simulator main, start here your threads, examples inside. * + * Simulator main. * *------------------------------------------------------------------------*/ int main(void) { - EventListener c1fel, c2fel; + EventListener sd1fel, sd2fel, tel; /* * HAL initialization. @@ -300,22 +149,45 @@ int main(void) { */ chSysInit(); + /* + * Serial ports (simulated) initialization. + */ sdStart(&SD1, NULL); sdStart(&SD2, NULL); - chThdCreateStatic(wdarea, sizeof(wdarea), NORMALPRIO + 2, WatchdogThread, NULL); - cdtp = chThdCreateStatic(cdarea, sizeof(cdarea), NORMALPRIO + 1, ConsoleThread, NULL); + /* + * Shell manager initialization. + */ + shellInit(); + chEvtRegister(&shell_terminated, &tel, 0); + + /* + * Console thread started. + */ + cdtp = chThdCreateFromHeap(NULL, CONSOLE_WA_SIZE, NORMALPRIO + 1, + console_thread, NULL); - cprint("Console service started on SD1, SD2\n"); + /* + * Initializing connection/disconnection events. + */ + cprint("Shell service started on SD1, SD2\n"); cprint(" - Listening for connections on SD1\n"); - sdGetAndClearFlags(&SD1); - chEvtRegister(&SD1.d2.sevent, &c1fel, 0); + (void) sdGetAndClearFlags(&SD1); + chEvtRegister(&SD1.d2.sevent, &sd1fel, 1); cprint(" - Listening for connections on SD2\n"); - sdGetAndClearFlags(&SD2); - chEvtRegister(&SD2.d2.sevent, &c2fel, 1); + (void) sdGetAndClearFlags(&SD2); + chEvtRegister(&SD2.d2.sevent, &sd2fel, 2); + + /* + * Events servicing loop. + */ while (!chThdShouldTerminate()) chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS)); - chEvtUnregister(&SD1.d2.sevent, &c2fel); // Never invoked but this is an example... - chEvtUnregister(&SD2.d2.sevent, &c1fel); // Never invoked but this is an example... + + /* + * Clean simulator exit. + */ + chEvtUnregister(&SD1.d2.sevent, &sd1fel); + chEvtUnregister(&SD2.d2.sevent, &sd2fel); return 0; } -- cgit v1.2.3 From 4bb9e7735d4a84e6ddee2b5778906e6cd54db577 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 10 Dec 2009 21:05:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1412 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index c2ead083e..22ea086c3 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -24,6 +24,7 @@ #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 cprint(msg) chMsgSend(cdtp, (msg_t)msg) @@ -31,14 +32,33 @@ static Thread *cdtp; static Thread *shelltp1; static Thread *shelltp2; +void cmd_test(BaseChannel *chp, int argc, char *argv[]) { + Thread *tp; + + (void)argv; + if (argc > 0) { + shellPrintLine(chp, "Usage: test"); + return; + } + tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(), + TestThread, chp); + chThdWait(tp); +// TestThread(chp); +} + +static const ShellCommand commands[] = { + {"test", cmd_test}, + {NULL, NULL} +}; + static const ShellConfig shell_cfg1 = { (BaseChannel *)&SD1, - NULL + commands }; static const ShellConfig shell_cfg2 = { (BaseChannel *)&SD2, - NULL + commands }; /* -- cgit v1.2.3 From d980d7e3e434af2cd17ee2b04deaab65164204ce Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 10 Dec 2009 22:26:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1413 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 22ea086c3..140f3bd79 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -42,8 +42,11 @@ void cmd_test(BaseChannel *chp, int argc, char *argv[]) { } tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(), TestThread, chp); + if (tp == NULL) { + shellPrintLine(chp, "out of memory"); + return; + } chThdWait(tp); -// TestThread(chp); } static const ShellCommand commands[] = { -- cgit v1.2.3 From 0f8d30486bffb71cd431e67084fcc502411236b9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 11 Dec 2009 16:15:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1417 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 140f3bd79..01ca7cad9 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -91,6 +91,7 @@ static void termination_handler(eventid_t id) { if (shelltp1 && chThdTerminated(shelltp1)) { chThdWait(shelltp1); shelltp1 = NULL; + chThdSleepMilliseconds(10); cprint("Init: shell on SD1 terminated\n"); chSysLock(); chOQResetI(&SD1.d2.oqueue); @@ -99,6 +100,7 @@ static void termination_handler(eventid_t id) { if (shelltp2 && chThdTerminated(shelltp2)) { chThdWait(shelltp2); shelltp2 = NULL; + chThdSleepMilliseconds(10); cprint("Init: shell on SD2 terminated\n"); chSysLock(); chOQResetI(&SD2.d2.oqueue); -- cgit v1.2.3 From 5d22110eeb4b5a9999ae259b7384a4608e725490 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 24 Dec 2009 09:57:44 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1465 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 01ca7cad9..009ec4a89 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -26,7 +26,7 @@ #define CONSOLE_WA_SIZE THD_WA_SIZE(4096) #define TEST_WA_SIZE THD_WA_SIZE(4096) -#define cprint(msg) chMsgSend(cdtp, (msg_t)msg) +#define cputs(msg) chMsgSend(cdtp, (msg_t)msg) static Thread *cdtp; static Thread *shelltp1; @@ -73,7 +73,7 @@ static msg_t console_thread(void *arg) { (void)arg; while (!chThdShouldTerminate()) { - printf((char *)chMsgWait()); + puts((char *)chMsgWait()); fflush(stdout); chMsgRelease(RDY_OK); } @@ -92,7 +92,7 @@ static void termination_handler(eventid_t id) { chThdWait(shelltp1); shelltp1 = NULL; chThdSleepMilliseconds(10); - cprint("Init: shell on SD1 terminated\n"); + cputs("Init: shell on SD1 terminated"); chSysLock(); chOQResetI(&SD1.d2.oqueue); chSysUnlock(); @@ -101,7 +101,7 @@ static void termination_handler(eventid_t id) { chThdWait(shelltp2); shelltp2 = NULL; chThdSleepMilliseconds(10); - cprint("Init: shell on SD2 terminated\n"); + cputs("Init: shell on SD2 terminated"); chSysLock(); chOQResetI(&SD2.d2.oqueue); chSysUnlock(); @@ -119,11 +119,11 @@ static void sd1_handler(eventid_t id) { (void)id; flags = sdGetAndClearFlags(&SD1); if ((flags & SD_CONNECTED) && (shelltp1 == NULL)) { - cprint("Init: connection on SD1\n"); + cputs("Init: connection on SD1"); shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO + 1); } if (flags & SD_DISCONNECTED) { - cprint("Init: disconnection on SD1\n"); + cputs("Init: disconnection on SD1"); chSysLock(); chIQResetI(&SD1.d2.iqueue); chSysUnlock(); @@ -141,11 +141,11 @@ static void sd2_handler(eventid_t id) { (void)id; flags = sdGetAndClearFlags(&SD2); if ((flags & SD_CONNECTED) && (shelltp2 == NULL)) { - cprint("Init: connection on SD2\n"); + cputs("Init: connection on SD2"); shelltp2 = shellCreate(&shell_cfg2, SHELL_WA_SIZE, NORMALPRIO + 10); } if (flags & SD_DISCONNECTED) { - cprint("Init: disconnection on SD2\n"); + cputs("Init: disconnection on SD2"); chSysLock(); chIQResetI(&SD2.d2.iqueue); chSysUnlock(); @@ -195,11 +195,11 @@ int main(void) { /* * Initializing connection/disconnection events. */ - cprint("Shell service started on SD1, SD2\n"); - cprint(" - Listening for connections on SD1\n"); + cputs("Shell service started on SD1, SD2"); + cputs(" - Listening for connections on SD1"); (void) sdGetAndClearFlags(&SD1); chEvtRegister(&SD1.d2.sevent, &sd1fel, 1); - cprint(" - Listening for connections on SD2\n"); + cputs(" - Listening for connections on SD2"); (void) sdGetAndClearFlags(&SD2); chEvtRegister(&SD2.d2.sevent, &sd2fel, 2); -- cgit v1.2.3 From bedb87c1e7cc9741c57c299d81d6e24c5e9c59c5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Jan 2010 13:35:55 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1495 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 009ec4a89..8acfda91d 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -94,7 +94,7 @@ static void termination_handler(eventid_t id) { chThdSleepMilliseconds(10); cputs("Init: shell on SD1 terminated"); chSysLock(); - chOQResetI(&SD1.d2.oqueue); + chOQResetI(&SD1.sd.oqueue); chSysUnlock(); } if (shelltp2 && chThdTerminated(shelltp2)) { @@ -103,7 +103,7 @@ static void termination_handler(eventid_t id) { chThdSleepMilliseconds(10); cputs("Init: shell on SD2 terminated"); chSysLock(); - chOQResetI(&SD2.d2.oqueue); + chOQResetI(&SD2.sd.oqueue); chSysUnlock(); } } @@ -125,7 +125,7 @@ static void sd1_handler(eventid_t id) { if (flags & SD_DISCONNECTED) { cputs("Init: disconnection on SD1"); chSysLock(); - chIQResetI(&SD1.d2.iqueue); + chIQResetI(&SD1.sd.iqueue); chSysUnlock(); } } @@ -147,7 +147,7 @@ static void sd2_handler(eventid_t id) { if (flags & SD_DISCONNECTED) { cputs("Init: disconnection on SD2"); chSysLock(); - chIQResetI(&SD2.d2.iqueue); + chIQResetI(&SD2.sd.iqueue); chSysUnlock(); } } @@ -198,10 +198,10 @@ int main(void) { cputs("Shell service started on SD1, SD2"); cputs(" - Listening for connections on SD1"); (void) sdGetAndClearFlags(&SD1); - chEvtRegister(&SD1.d2.sevent, &sd1fel, 1); + chEvtRegister(&SD1.sd.sevent, &sd1fel, 1); cputs(" - Listening for connections on SD2"); (void) sdGetAndClearFlags(&SD2); - chEvtRegister(&SD2.d2.sevent, &sd2fel, 2); + chEvtRegister(&SD2.sd.sevent, &sd2fel, 2); /* * Events servicing loop. @@ -212,7 +212,7 @@ int main(void) { /* * Clean simulator exit. */ - chEvtUnregister(&SD1.d2.sevent, &sd1fel); - chEvtUnregister(&SD2.d2.sevent, &sd2fel); + chEvtUnregister(&SD1.sd.sevent, &sd1fel); + chEvtUnregister(&SD2.sd.sevent, &sd2fel); return 0; } -- cgit v1.2.3 From 11215c3bcb0b0cbe5794cfc92d0c20de6c8696d9 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 22 Jan 2010 14:51:54 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1539 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 8acfda91d..11123bffb 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -94,7 +94,7 @@ static void termination_handler(eventid_t id) { chThdSleepMilliseconds(10); cputs("Init: shell on SD1 terminated"); chSysLock(); - chOQResetI(&SD1.sd.oqueue); + chOQResetI(&SD1.oqueue); chSysUnlock(); } if (shelltp2 && chThdTerminated(shelltp2)) { @@ -103,7 +103,7 @@ static void termination_handler(eventid_t id) { chThdSleepMilliseconds(10); cputs("Init: shell on SD2 terminated"); chSysLock(); - chOQResetI(&SD2.sd.oqueue); + chOQResetI(&SD2.oqueue); chSysUnlock(); } } @@ -125,7 +125,7 @@ static void sd1_handler(eventid_t id) { if (flags & SD_DISCONNECTED) { cputs("Init: disconnection on SD1"); chSysLock(); - chIQResetI(&SD1.sd.iqueue); + chIQResetI(&SD1.iqueue); chSysUnlock(); } } @@ -147,7 +147,7 @@ static void sd2_handler(eventid_t id) { if (flags & SD_DISCONNECTED) { cputs("Init: disconnection on SD2"); chSysLock(); - chIQResetI(&SD2.sd.iqueue); + chIQResetI(&SD2.iqueue); chSysUnlock(); } } @@ -198,10 +198,10 @@ int main(void) { cputs("Shell service started on SD1, SD2"); cputs(" - Listening for connections on SD1"); (void) sdGetAndClearFlags(&SD1); - chEvtRegister(&SD1.sd.sevent, &sd1fel, 1); + chEvtRegister(&SD1.sevent, &sd1fel, 1); cputs(" - Listening for connections on SD2"); (void) sdGetAndClearFlags(&SD2); - chEvtRegister(&SD2.sd.sevent, &sd2fel, 2); + chEvtRegister(&SD2.sevent, &sd2fel, 2); /* * Events servicing loop. @@ -212,7 +212,7 @@ int main(void) { /* * Clean simulator exit. */ - chEvtUnregister(&SD1.sd.sevent, &sd1fel); - chEvtUnregister(&SD2.sd.sevent, &sd2fel); + chEvtUnregister(&SD1.sevent, &sd1fel); + chEvtUnregister(&SD2.sevent, &sd2fel); return 0; } -- cgit v1.2.3 From 217d1529c1a126054fbdb9e071cd103194fd499e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 3 Feb 2010 18:40:10 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1564 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 11123bffb..b43ad24db 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -32,7 +32,60 @@ static Thread *cdtp; static Thread *shelltp1; static Thread *shelltp2; -void cmd_test(BaseChannel *chp, int argc, char *argv[]) { +static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) { + size_t n, size; + char buf[52]; + + (void)argv; + if (argc > 0) { + shellPrintLine(chp, "Usage: mem"); + return; + } + n = chHeapStatus(NULL, &size); + sprintf(buf, "core free memory : %i bytes", chCoreFree()); + shellPrintLine(chp, buf); + sprintf(buf, "heap fragments : %i", n); + shellPrintLine(chp, buf); + sprintf(buf, "heap free total : %i bytes", size); + shellPrintLine(chp, buf); +} + +static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { + static const char *states[] = { + "READY", + "CURRENT", + "SUSPENDED", + "WTSEM", + "WTMTX", + "WTCOND", + "SLEEPING", + "WTEXIT", + "WTOREVT", + "WTANDEVT", + "SNDMSG", + "WTMSG", + "FINAL" + }; + Thread *tp; + char buf[60]; + + (void)argv; + if (argc > 0) { + shellPrintLine(chp, "Usage: threads"); + return; + } + shellPrintLine(chp, " addr stack prio refs state time"); + tp = chRegFirstThread(); + do { + sprintf(buf, "%8p %8p %4i %4i %9s %i", + tp, tp->p_ctx.esp, tp->p_prio, tp->p_refs - 1, + states[tp->p_state], tp->p_time); + shellPrintLine(chp, buf); + tp = chRegNextThread(tp); + } while (tp != NULL); +} + +static void cmd_test(BaseChannel *chp, int argc, char *argv[]) { Thread *tp; (void)argv; @@ -50,6 +103,8 @@ void cmd_test(BaseChannel *chp, int argc, char *argv[]) { } static const ShellCommand commands[] = { + {"mem", cmd_mem}, + {"threads", cmd_threads}, {"test", cmd_test}, {NULL, NULL} }; -- cgit v1.2.3 From 157b6f9695e7f72f2d54b231c19cb4045710ed01 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 21 Feb 2010 07:24:53 +0000 Subject: Updated license dates. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1646 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index b43ad24db..1418b70ec 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -137,8 +137,8 @@ static msg_t console_thread(void *arg) { /** * @brief Shell termination handler. - * - * @param[in] id event id. + * + * @param[in] id event id. */ static void termination_handler(eventid_t id) { @@ -230,25 +230,25 @@ int main(void) { chSysInit(); /* - * Serial ports (simulated) initialization. + * Serial ports (simulated) initialization. */ sdStart(&SD1, NULL); sdStart(&SD2, NULL); /* - * Shell manager initialization. + * Shell manager initialization. */ shellInit(); chEvtRegister(&shell_terminated, &tel, 0); /* - * Console thread started. + * Console thread started. */ cdtp = chThdCreateFromHeap(NULL, CONSOLE_WA_SIZE, NORMALPRIO + 1, console_thread, NULL); /* - * Initializing connection/disconnection events. + * Initializing connection/disconnection events. */ cputs("Shell service started on SD1, SD2"); cputs(" - Listening for connections on SD1"); @@ -259,13 +259,13 @@ int main(void) { chEvtRegister(&SD2.sevent, &sd2fel, 2); /* - * Events servicing loop. + * Events servicing loop. */ while (!chThdShouldTerminate()) chEvtDispatch(fhandlers, chEvtWaitOne(ALL_EVENTS)); /* - * Clean simulator exit. + * Clean simulator exit. */ chEvtUnregister(&SD1.sevent, &sd1fel); chEvtUnregister(&SD2.sevent, &sd2fel); -- cgit v1.2.3 From bc9d319ddb279f973404c2b1abf15ec1091bd891 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 4 May 2010 12:31:05 +0000 Subject: Improved code coverage. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1902 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 1418b70ec..aa6d29716 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -42,7 +42,7 @@ static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) { return; } n = chHeapStatus(NULL, &size); - sprintf(buf, "core free memory : %i bytes", chCoreFree()); + sprintf(buf, "core free memory : %i bytes", chCoreStatus()); shellPrintLine(chp, buf); sprintf(buf, "heap fragments : %i", n); shellPrintLine(chp, buf); -- cgit v1.2.3 From e3a932e0e64d54c083e534541ac1ab36c4b82046 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 19 Dec 2010 11:20:30 +0000 Subject: Win32 simulator updated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2505 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index aa6d29716..9ce9b284a 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -220,13 +220,13 @@ int main(void) { EventListener sd1fel, sd2fel, tel; /* - * HAL initialization. + * System initializations. + * - HAL initialization, this also initializes the configured device drivers + * and performs the board-specific initializations. + * - Kernel initialization, the main() function becomes a thread and the + * RTOS is active. */ halInit(); - - /* - * ChibiOS/RT initialization. - */ chSysInit(); /* -- cgit v1.2.3 From ff333430f1317247299863b592293faa7799e0a4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 9 Jan 2011 10:10:39 +0000 Subject: Serial driver changes, bug 3153550 fixed. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2625 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 9ce9b284a..cbdfc100d 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -172,12 +172,12 @@ static void sd1_handler(eventid_t id) { sdflags_t flags; (void)id; - flags = sdGetAndClearFlags(&SD1); - if ((flags & SD_CONNECTED) && (shelltp1 == NULL)) { + flags = chIOGetAndClearFlags(&SD1); + if ((flags & IO_CONNECTED) && (shelltp1 == NULL)) { cputs("Init: connection on SD1"); shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO + 1); } - if (flags & SD_DISCONNECTED) { + if (flags & IO_DISCONNECTED) { cputs("Init: disconnection on SD1"); chSysLock(); chIQResetI(&SD1.iqueue); @@ -194,12 +194,12 @@ static void sd2_handler(eventid_t id) { sdflags_t flags; (void)id; - flags = sdGetAndClearFlags(&SD2); - if ((flags & SD_CONNECTED) && (shelltp2 == NULL)) { + flags = chIOGetAndClearFlags(&SD2); + if ((flags & IO_CONNECTED) && (shelltp2 == NULL)) { cputs("Init: connection on SD2"); shelltp2 = shellCreate(&shell_cfg2, SHELL_WA_SIZE, NORMALPRIO + 10); } - if (flags & SD_DISCONNECTED) { + if (flags & IO_DISCONNECTED) { cputs("Init: disconnection on SD2"); chSysLock(); chIQResetI(&SD2.iqueue); @@ -252,11 +252,11 @@ int main(void) { */ cputs("Shell service started on SD1, SD2"); cputs(" - Listening for connections on SD1"); - (void) sdGetAndClearFlags(&SD1); - chEvtRegister(&SD1.sevent, &sd1fel, 1); + (void) chIOGetAndClearFlags(&SD1); + chEvtRegister(chIOGetEventSource(&SD1), &sd1fel, 1); cputs(" - Listening for connections on SD2"); - (void) sdGetAndClearFlags(&SD2); - chEvtRegister(&SD2.sevent, &sd2fel, 2); + (void) chIOGetAndClearFlags(&SD2); + chEvtRegister(chIOGetEventSource(&SD2), &sd2fel, 2); /* * Events servicing loop. @@ -267,7 +267,7 @@ int main(void) { /* * Clean simulator exit. */ - chEvtUnregister(&SD1.sevent, &sd1fel); - chEvtUnregister(&SD2.sevent, &sd2fel); + chEvtUnregister(chIOGetEventSource(&SD1), &sd1fel); + chEvtUnregister(chIOGetEventSource(&SD2), &sd2fel); return 0; } -- cgit v1.2.3 From b4319d0aab553542c83bafad69f4224065cc6142 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 9 Jan 2011 10:39:16 +0000 Subject: Removed some instances of sdflags_t. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2627 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index cbdfc100d..d2effad35 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -169,7 +169,7 @@ static void termination_handler(eventid_t id) { * @param[in] id event id. */ static void sd1_handler(eventid_t id) { - sdflags_t flags; + ioflags_t flags; (void)id; flags = chIOGetAndClearFlags(&SD1); @@ -191,7 +191,7 @@ static void sd1_handler(eventid_t id) { * @param[in] id event id. */ static void sd2_handler(eventid_t id) { - sdflags_t flags; + ioflags_t flags; (void)id; flags = chIOGetAndClearFlags(&SD2); -- cgit v1.2.3 From 6f6e1a6401eda000dce198150937c7919b4c9855 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 23 Feb 2011 18:59:39 +0000 Subject: Improved messages subsystem. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2759 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index d2effad35..0830ab149 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -122,15 +122,16 @@ static const ShellConfig shell_cfg2 = { /* * Console print server done using synchronous messages. This makes the access * to the C printf() thread safe and the print operation atomic among threads. - * In this example the message is the zero termitated string itself. + * In this example the message is the zero terminated string itself. */ static msg_t console_thread(void *arg) { (void)arg; while (!chThdShouldTerminate()) { - puts((char *)chMsgWait()); + Thread *tp = chMsgWait(); + puts((char *)chMsgGet(tp)); fflush(stdout); - chMsgRelease(RDY_OK); + chMsgRelease(tp, RDY_OK); } return 0; } -- cgit v1.2.3 From e7e79a6ccb4f3e320b2b8b7bad1b14d65218641d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 18 Mar 2011 18:38:08 +0000 Subject: License updated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2827 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 0830ab149..8540afed5 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From 698e37b41c08fd2a3b250ba3d0737c942af14f19 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 15 Aug 2011 08:49:20 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3236 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 8540afed5..a735dfa0c 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -22,6 +22,7 @@ #include "hal.h" #include "test.h" #include "shell.h" +#include "chprintf.h" #define SHELL_WA_SIZE THD_WA_SIZE(4096) #define CONSOLE_WA_SIZE THD_WA_SIZE(4096) @@ -35,20 +36,16 @@ static Thread *shelltp2; static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) { size_t n, size; - char buf[52]; (void)argv; if (argc > 0) { - shellPrintLine(chp, "Usage: mem"); + chprintf(chp, "Usage: mem\r\n"); return; } n = chHeapStatus(NULL, &size); - sprintf(buf, "core free memory : %i bytes", chCoreStatus()); - shellPrintLine(chp, buf); - sprintf(buf, "heap fragments : %i", n); - shellPrintLine(chp, buf); - sprintf(buf, "heap free total : %i bytes", size); - shellPrintLine(chp, buf); + chprintf(chp, "core free memory : %u bytes\r\n", chCoreStatus()); + chprintf(chp, "heap fragments : %u\r\n", n); + chprintf(chp, "heap free total : %u bytes\r\n", size); } static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { @@ -63,25 +60,26 @@ static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { "WTEXIT", "WTOREVT", "WTANDEVT", + "SNDMSGQ", "SNDMSG", "WTMSG", + "WTQUEUE", "FINAL" }; Thread *tp; - char buf[60]; (void)argv; if (argc > 0) { - shellPrintLine(chp, "Usage: threads"); + chprintf(chp, "Usage: threads\r\n"); return; } - shellPrintLine(chp, " addr stack prio refs state time"); + chprintf(chp, " addr stack prio refs state time\r\n"); tp = chRegFirstThread(); do { - sprintf(buf, "%8p %8p %4i %4i %9s %i", - tp, tp->p_ctx.esp, tp->p_prio, tp->p_refs - 1, - states[tp->p_state], tp->p_time); - shellPrintLine(chp, buf); + chprintf(chp, "%.8lx %.8lx %4lu %4lu %9s %lu\r\n", + (uint32_t)tp, (uint32_t)tp->p_ctx.r13, + (uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1), + states[tp->p_state], (uint32_t)tp->p_time); tp = chRegNextThread(tp); } while (tp != NULL); } @@ -91,13 +89,13 @@ static void cmd_test(BaseChannel *chp, int argc, char *argv[]) { (void)argv; if (argc > 0) { - shellPrintLine(chp, "Usage: test"); + chprintf(chp, "Usage: test\r\n"); return; } tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(), TestThread, chp); if (tp == NULL) { - shellPrintLine(chp, "out of memory"); + chprintf(chp, "out of memory\r\n"); return; } chThdWait(tp); -- cgit v1.2.3 From 309b1e411426e8d36d9a552ef2870da3db912a80 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 23 Oct 2011 11:39:45 +0000 Subject: Improvements to the USB driver, first phase. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3449 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index a735dfa0c..d4cc554ce 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -49,23 +49,7 @@ static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) { } static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { - static const char *states[] = { - "READY", - "CURRENT", - "SUSPENDED", - "WTSEM", - "WTMTX", - "WTCOND", - "SLEEPING", - "WTEXIT", - "WTOREVT", - "WTANDEVT", - "SNDMSGQ", - "SNDMSG", - "WTMSG", - "WTQUEUE", - "FINAL" - }; + static const char *states[] = {THD_STATE_NAMES}; Thread *tp; (void)argv; -- cgit v1.2.3 From 58f1fe92ee9c68ffd08bccd19f67eafbbc968a71 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 11 Jan 2012 18:02:20 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3788 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index d4cc554ce..61abfb093 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -61,7 +61,7 @@ static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { tp = chRegFirstThread(); do { chprintf(chp, "%.8lx %.8lx %4lu %4lu %9s %lu\r\n", - (uint32_t)tp, (uint32_t)tp->p_ctx.r13, + (uint32_t)tp, (uint32_t)tp->p_ctx.esp, (uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1), states[tp->p_state], (uint32_t)tp->p_time); tp = chRegNextThread(tp); -- cgit v1.2.3 From de5dcbba856524599a8f06d3a9bdbf1b01db44c2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 21 Jan 2012 14:29:42 +0000 Subject: License text updated with new year. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3846 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 61abfb093..d42ee770d 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From ecfab096a90b19280078d84c53c13099672303b2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 22 Jul 2012 08:18:58 +0000 Subject: Win32 simulator fixed. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4474 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index d42ee770d..dc6e3685a 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -34,7 +34,7 @@ static Thread *cdtp; static Thread *shelltp1; static Thread *shelltp2; -static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) { +static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) { size_t n, size; (void)argv; @@ -48,7 +48,7 @@ static void cmd_mem(BaseChannel *chp, int argc, char *argv[]) { chprintf(chp, "heap free total : %u bytes\r\n", size); } -static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { +static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) { static const char *states[] = {THD_STATE_NAMES}; Thread *tp; @@ -68,7 +68,7 @@ static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) { } while (tp != NULL); } -static void cmd_test(BaseChannel *chp, int argc, char *argv[]) { +static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) { Thread *tp; (void)argv; @@ -93,12 +93,12 @@ static const ShellCommand commands[] = { }; static const ShellConfig shell_cfg1 = { - (BaseChannel *)&SD1, + (BaseSequentialStream *)&SD1, commands }; static const ShellConfig shell_cfg2 = { - (BaseChannel *)&SD2, + (BaseSequentialStream *)&SD2, commands }; @@ -153,15 +153,15 @@ static void termination_handler(eventid_t id) { * @param[in] id event id. */ static void sd1_handler(eventid_t id) { - ioflags_t flags; + chnflags_t flags; (void)id; - flags = chIOGetAndClearFlags(&SD1); - if ((flags & IO_CONNECTED) && (shelltp1 == NULL)) { + flags = chnGetAndClearFlags(&SD1); + if ((flags & CHN_CONNECTED) && (shelltp1 == NULL)) { cputs("Init: connection on SD1"); shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO + 1); } - if (flags & IO_DISCONNECTED) { + if (flags & CHN_DISCONNECTED) { cputs("Init: disconnection on SD1"); chSysLock(); chIQResetI(&SD1.iqueue); @@ -175,15 +175,15 @@ static void sd1_handler(eventid_t id) { * @param[in] id event id. */ static void sd2_handler(eventid_t id) { - ioflags_t flags; + chnflags_t flags; (void)id; - flags = chIOGetAndClearFlags(&SD2); - if ((flags & IO_CONNECTED) && (shelltp2 == NULL)) { + flags = chnGetAndClearFlags(&SD2); + if ((flags & CHN_CONNECTED) && (shelltp2 == NULL)) { cputs("Init: connection on SD2"); shelltp2 = shellCreate(&shell_cfg2, SHELL_WA_SIZE, NORMALPRIO + 10); } - if (flags & IO_DISCONNECTED) { + if (flags & CHN_DISCONNECTED) { cputs("Init: disconnection on SD2"); chSysLock(); chIQResetI(&SD2.iqueue); @@ -236,11 +236,11 @@ int main(void) { */ cputs("Shell service started on SD1, SD2"); cputs(" - Listening for connections on SD1"); - (void) chIOGetAndClearFlags(&SD1); - chEvtRegister(chIOGetEventSource(&SD1), &sd1fel, 1); + (void) chnGetAndClearFlags(&SD1); + chEvtRegister(chnGetEventSource(&SD1), &sd1fel, 1); cputs(" - Listening for connections on SD2"); - (void) chIOGetAndClearFlags(&SD2); - chEvtRegister(chIOGetEventSource(&SD2), &sd2fel, 2); + (void) chnGetAndClearFlags(&SD2); + chEvtRegister(chnGetEventSource(&SD2), &sd2fel, 2); /* * Events servicing loop. @@ -251,7 +251,7 @@ int main(void) { /* * Clean simulator exit. */ - chEvtUnregister(chIOGetEventSource(&SD1), &sd1fel); - chEvtUnregister(chIOGetEventSource(&SD2), &sd2fel); + chEvtUnregister(chnGetEventSource(&SD1), &sd1fel); + chEvtUnregister(chnGetEventSource(&SD2), &sd2fel); return 0; } -- cgit v1.2.3 From f90a0f37906a9363a6e702d8ac1c4c8257370efa Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 16 Sep 2012 09:08:43 +0000 Subject: Removed flags handling in BaseAsynchronousChannel. Modified serial drivers to use the new event flags. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4671 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index dc6e3685a..7514faebf 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -147,16 +147,18 @@ static void termination_handler(eventid_t id) { } } +static EventListener sd1fel, sd2fel; + /** * @brief SD1 status change handler. * * @param[in] id event id. */ static void sd1_handler(eventid_t id) { - chnflags_t flags; + flagsmask_t flags; (void)id; - flags = chnGetAndClearFlags(&SD1); + flags = chEvtGetAndClearFlags(&sd1fel); if ((flags & CHN_CONNECTED) && (shelltp1 == NULL)) { cputs("Init: connection on SD1"); shelltp1 = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO + 1); @@ -175,10 +177,10 @@ static void sd1_handler(eventid_t id) { * @param[in] id event id. */ static void sd2_handler(eventid_t id) { - chnflags_t flags; + flagsmask_t flags; (void)id; - flags = chnGetAndClearFlags(&SD2); + flags = chEvtGetAndClearFlags(&sd2fel); if ((flags & CHN_CONNECTED) && (shelltp2 == NULL)) { cputs("Init: connection on SD2"); shelltp2 = shellCreate(&shell_cfg2, SHELL_WA_SIZE, NORMALPRIO + 10); @@ -201,7 +203,7 @@ static evhandler_t fhandlers[] = { * Simulator main. * *------------------------------------------------------------------------*/ int main(void) { - EventListener sd1fel, sd2fel, tel; + EventListener tel; /* * System initializations. @@ -236,10 +238,8 @@ int main(void) { */ cputs("Shell service started on SD1, SD2"); cputs(" - Listening for connections on SD1"); - (void) chnGetAndClearFlags(&SD1); chEvtRegister(chnGetEventSource(&SD1), &sd1fel, 1); cputs(" - Listening for connections on SD2"); - (void) chnGetAndClearFlags(&SD2); chEvtRegister(chnGetEventSource(&SD2), &sd2fel, 2); /* -- cgit v1.2.3 From 184a71345c6a36a9a8664eda8fbcc3ea728267a8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Feb 2013 10:58:09 +0000 Subject: Updated license years. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5102 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 7514faebf..04d615611 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From 853216256ad4cdacf5f94edb7d6b738c6be165a1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 30 Mar 2013 10:32:37 +0000 Subject: Relicensing parts of the tree under the Apache 2.0 license. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5521 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Win32-MinGW/main.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'demos/Win32-MinGW/main.c') diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c index 04d615611..0d5dab844 100644 --- a/demos/Win32-MinGW/main.c +++ b/demos/Win32-MinGW/main.c @@ -1,21 +1,17 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio - This file is part of ChibiOS/RT. + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at - ChibiOS/RT is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. + http://www.apache.org/licenses/LICENSE-2.0 - ChibiOS/RT is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. */ #include "ch.h" -- cgit v1.2.3