aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-01-09 10:31:53 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-01-09 10:31:53 +0000
commit700b05269e497d468e095b55bb562659d7b9a7e3 (patch)
treeae79db422a0d217e805b6c67488189afc2a6024c
parentff333430f1317247299863b592293faa7799e0a4 (diff)
downloadChibiOS-700b05269e497d468e095b55bb562659d7b9a7e3.tar.gz
ChibiOS-700b05269e497d468e095b55bb562659d7b9a7e3.tar.bz2
ChibiOS-700b05269e497d468e095b55bb562659d7b9a7e3.zip
Posix demo updated and re-tested.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2626 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/Posix-GCC/main.c30
-rw-r--r--os/hal/platforms/Posix/serial_lld.c6
-rw-r--r--os/hal/platforms/Posix/serial_lld.h9
-rw-r--r--os/hal/platforms/Win32/serial_lld.h5
4 files changed, 17 insertions, 33 deletions
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;
}
diff --git a/os/hal/platforms/Posix/serial_lld.c b/os/hal/platforms/Posix/serial_lld.c
index 95b654f17..128f3e2fb 100644
--- a/os/hal/platforms/Posix/serial_lld.c
+++ b/os/hal/platforms/Posix/serial_lld.c
@@ -119,7 +119,7 @@ static bool_t connint(SerialDriver *sdp) {
printf("%s: Unable to setup non blocking mode on data socket\n", sdp->com_name);
goto abort;
}
- sdAddFlagsI(sdp, SD_CONNECTED);
+ chIOAddFlagsI(sdp, IO_CONNECTED);
return TRUE;
}
return FALSE;
@@ -145,7 +145,7 @@ static bool_t inint(SerialDriver *sdp) {
case 0:
close(sdp->com_data);
sdp->com_data = INVALID_SOCKET;
- sdAddFlagsI(sdp, SD_DISCONNECTED);
+ chIOAddFlagsI(sdp, IO_DISCONNECTED);
return FALSE;
case INVALID_SOCKET:
if (errno == EWOULDBLOCK)
@@ -179,7 +179,7 @@ static bool_t outint(SerialDriver *sdp) {
case 0:
close(sdp->com_data);
sdp->com_data = INVALID_SOCKET;
- sdAddFlagsI(sdp, SD_DISCONNECTED);
+ chIOAddFlagsI(sdp, IO_DISCONNECTED);
return FALSE;
case INVALID_SOCKET:
if (errno == EWOULDBLOCK)
diff --git a/os/hal/platforms/Posix/serial_lld.h b/os/hal/platforms/Posix/serial_lld.h
index 996af333e..282b68314 100644
--- a/os/hal/platforms/Posix/serial_lld.h
+++ b/os/hal/platforms/Posix/serial_lld.h
@@ -88,11 +88,6 @@
/*===========================================================================*/
/**
- * @brief Serial Driver condition flags type.
- */
-typedef uint32_t sdflags_t;
-
-/**
* @brief Generic Serial Driver configuration structure.
* @details An instance of this structure must be passed to @p sdStart()
* in order to configure and start a serial driver operations.
@@ -114,10 +109,6 @@ typedef struct {
InputQueue iqueue; \
/* Output queue.*/ \
OutputQueue oqueue; \
- /* Status Change @p EventSource.*/ \
- EventSource sevent; \
- /* I/O driver status flags.*/ \
- sdflags_t flags; \
/* Input circular buffer.*/ \
uint8_t ib[SERIAL_BUFFERS_SIZE]; \
/* Output circular buffer.*/ \
diff --git a/os/hal/platforms/Win32/serial_lld.h b/os/hal/platforms/Win32/serial_lld.h
index 5adf63998..fd6bff34d 100644
--- a/os/hal/platforms/Win32/serial_lld.h
+++ b/os/hal/platforms/Win32/serial_lld.h
@@ -84,11 +84,6 @@
/*===========================================================================*/
/**
- * @brief Serial Driver condition flags type.
- */
-typedef uint32_t sdflags_t;
-
-/**
* @brief Generic Serial Driver configuration structure.
* @details An instance of this structure must be passed to @p sdStart()
* in order to configure and start a serial driver operations.