aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/serial.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-01-22 14:51:54 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-01-22 14:51:54 +0000
commit11215c3bcb0b0cbe5794cfc92d0c20de6c8696d9 (patch)
treeb8e85145673bfaee0bd0e3444e1d640b3a5be155 /os/hal/include/serial.h
parent11a6a2bf6476beda7a3a6d8504aa74c03c3b9731 (diff)
downloadChibiOS-11215c3bcb0b0cbe5794cfc92d0c20de6c8696d9.tar.gz
ChibiOS-11215c3bcb0b0cbe5794cfc92d0c20de6c8696d9.tar.bz2
ChibiOS-11215c3bcb0b0cbe5794cfc92d0c20de6c8696d9.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1539 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/include/serial.h')
-rw-r--r--os/hal/include/serial.h64
1 files changed, 17 insertions, 47 deletions
diff --git a/os/hal/include/serial.h b/os/hal/include/serial.h
index a2d75713e..15593b681 100644
--- a/os/hal/include/serial.h
+++ b/os/hal/include/serial.h
@@ -104,29 +104,14 @@ typedef struct _SerialDriver SerialDriver;
/**
* @brief @p SerialDriver specific methods.
*/
-struct _serial_driver_methods {
-};
+#define _serial_driver_methods \
+ _base_asynchronous_channel_methods
/**
* @brief @p SerialDriver virtual methods table.
*/
struct SerialDriverVMT {
- /**
- * @p BaseSequentialStream class inherited methods.
- */
- struct _base_sequental_stream_methods bss;
- /**
- * @p BaseChannel class inherited methods.
- */
- struct _base_channel_methods bc;
- /**
- * @p BaseAsynchronousChannel class inherited methods.
- */
- struct _base_asynchronous_channel_methods bac;
- /**
- * @p SerialDriver specific methods.
- */
- struct _serial_driver_methods sd;
+ _serial_driver_methods;
};
/**
@@ -141,22 +126,7 @@ struct _SerialDriver {
* Virtual Methods Table.
*/
const struct SerialDriverVMT *vmt;
- /**
- * @p BaseSequentialStream class inherited data.
- */
- struct _base_sequental_stream_data bss;
- /**
- * @p BaseChannel class inherited data.
- */
- struct _base_channel_data bc;
- /**
- * @p BaseAsynchronousChannel class inherited data.
- */
- struct _base_asynchronous_channel_data bac;
- /**
- * @p SerialDriver specific data.
- */
- struct _serial_driver_data sd;
+ _serial_driver_data;
};
/*===========================================================================*/
@@ -170,7 +140,7 @@ struct _SerialDriver {
* be used to check different channels implementations.
* @see chIOPutWouldBlock()
*/
-#define sdPutWouldBlock(sdp) chOQIsFull(&(sdp)->sd.oqueue)
+#define sdPutWouldBlock(sdp) chOQIsFull(&(sdp)->oqueue)
/**
* @brief Direct input check on a @p SerialDriver.
@@ -179,7 +149,7 @@ struct _SerialDriver {
* be used to check different channels implementations.
* @see chIOGetWouldBlock()
*/
-#define sdGetWouldBlock(sdp) chIQIsEmpty(&(sdp)->sd.iqueue)
+#define sdGetWouldBlock(sdp) chIQIsEmpty(&(sdp)->iqueue)
/**
* @brief Direct write to a @p SerialDriver.
@@ -188,7 +158,7 @@ struct _SerialDriver {
* be used to write to different channels implementations.
* @see chIOPut()
*/
-#define sdPut(sdp, b) chOQPut(&(sdp)->sd.oqueue, b)
+#define sdPut(sdp, b) chOQPut(&(sdp)->oqueue, b)
/**
* @brief Direct write to a @p SerialDriver with timeout specification.
@@ -197,7 +167,7 @@ struct _SerialDriver {
* be used to write to different channels implementations.
* @see chIOPutTimeout()
*/
-#define sdPutTimeout(sdp, b, t) chOQPutTimeout(&(sdp)->sd.iqueue, b, t)
+#define sdPutTimeout(sdp, b, t) chOQPutTimeout(&(sdp)->iqueue, b, t)
/**
* @brief Direct read from a @p SerialDriver.
@@ -206,7 +176,7 @@ struct _SerialDriver {
* be used to read from different channels implementations.
* @see chIOGet()
*/
-#define sdGet(sdp) chIQGet(&(sdp)->sd.iqueue)
+#define sdGet(sdp) chIQGet(&(sdp)->iqueue)
/**
* @brief Direct read from a @p SerialDriver with timeout specification.
@@ -215,7 +185,7 @@ struct _SerialDriver {
* be used to read from different channels implementations.
* @see chIOGetTimeout()
*/
-#define sdGetTimeout(sdp, t) chIQGetTimeout(&(sdp)->sd.iqueue, t)
+#define sdGetTimeout(sdp, t) chIQGetTimeout(&(sdp)->iqueue, t)
/**
* @brief Direct blocking write to a @p SerialDriver.
@@ -225,7 +195,7 @@ struct _SerialDriver {
* @see chIOWriteTimeout()
*/
#define sdWrite(sdp, b, n) \
- chOQWriteTimeout(&(sdp)->sd.oqueue, b, n, TIME_INFINITE)
+ chOQWriteTimeout(&(sdp)->oqueue, b, n, TIME_INFINITE)
/**
* @brief Direct blocking write to a @p SerialDriver with timeout
@@ -236,7 +206,7 @@ struct _SerialDriver {
* @see chIOWriteTimeout()
*/
#define sdWriteTimeout(sdp, b, n, t) \
- chOQWriteTimeout(&(sdp)->sd.oqueue, b, n, t)
+ chOQWriteTimeout(&(sdp)->oqueue, b, n, t)
/**
* @brief Direct non-blocking write to a @p SerialDriver.
@@ -246,7 +216,7 @@ struct _SerialDriver {
* @see chIOWriteTimeout()
*/
#define sdAsynchronousWrite(sdp, b, n) \
- chOQWriteTimeout(&(sdp)->sd.oqueue, b, n, TIME_IMMEDIATE)
+ chOQWriteTimeout(&(sdp)->oqueue, b, n, TIME_IMMEDIATE)
/**
* @brief Direct blocking read from a @p SerialDriver.
@@ -256,7 +226,7 @@ struct _SerialDriver {
* @see chIOReadTimeout()
*/
#define sdRead(sdp, b, n) \
- chIQReadTimeout(&(sdp)->sd.iqueue, b, n, TIME_INFINITE)
+ chIQReadTimeout(&(sdp)->iqueue, b, n, TIME_INFINITE)
/**
* @brief Direct blocking read from a @p SerialDriver with timeout
@@ -267,7 +237,7 @@ struct _SerialDriver {
* @see chIOReadTimeout()
*/
#define sdReadTimeout(sdp, b, n, t) \
- chIQReadTimeout(&(sdp)->sd.iqueue, b, n, t)
+ chIQReadTimeout(&(sdp)->iqueue, b, n, t)
/**
* @brief Direct non-blocking read from a @p SerialDriver.
@@ -277,7 +247,7 @@ struct _SerialDriver {
* @see chIOReadTimeout()
*/
#define sdAsynchronousRead(sdp, b, n) \
- chIQReadTimeout(&(sdp)->sd.iqueue, b, n, TIME_IMMEDIATE)
+ chIQReadTimeout(&(sdp)->iqueue, b, n, TIME_IMMEDIATE)
/**
* @brief Returns the status change event source.
@@ -288,7 +258,7 @@ struct _SerialDriver {
* @param[in] ip pointer to a @p SerialDriver object
* @return A pointer to an @p EventSource object.
*/
-#define sdGetStatusChangeEventSource(ip) (&((ip)->vmt->sd.sevent))
+#define sdGetStatusChangeEventSource(ip) (&((ip)->vmt->sevent))
/*===========================================================================*/
/* External declarations. */