From 700b05269e497d468e095b55bb562659d7b9a7e3 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 9 Jan 2011 10:31:53 +0000 Subject: Posix demo updated and re-tested. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2626 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/Posix-GCC/main.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'demos') diff --git a/demos/Posix-GCC/main.c b/demos/Posix-GCC/main.c index fdce30ffd..0ce59da9d 100644 --- a/demos/Posix-GCC/main.c +++ b/demos/Posix-GCC/main.c @@ -116,16 +116,15 @@ 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 = 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); @@ -139,16 +138,15 @@ 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 = 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); @@ -201,11 +199,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. @@ -216,7 +214,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