aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-05-02 15:39:11 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-05-02 15:39:11 +0000
commitfcd90e0bc8d3c5584607550703fe78f27c21b58e (patch)
tree1c5af7ccd958a2989466783dd8dd34780e59672a
parentea7700c07315100e08e32d5488bf3a1d309f8af6 (diff)
downloadChibiOS-fcd90e0bc8d3c5584607550703fe78f27c21b58e.tar.gz
ChibiOS-fcd90e0bc8d3c5584607550703fe78f27c21b58e.tar.bz2
ChibiOS-fcd90e0bc8d3c5584607550703fe78f27c21b58e.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@935 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--src/include/serial.h145
1 files changed, 143 insertions, 2 deletions
diff --git a/src/include/serial.h b/src/include/serial.h
index 6530fae0d..27ded730e 100644
--- a/src/include/serial.h
+++ b/src/include/serial.h
@@ -27,6 +27,8 @@
#ifndef _SERIAL_H_
#define _SERIAL_H_
+#if CH_USE_SERIAL_FULLDUPLEX
+
/** No pending conditions.*/
#define SD_NO_ERROR 0
/** Connection happened.*/
@@ -43,9 +45,148 @@
#define SD_BREAK_DETECTED 32
/** Serial Driver condition flags type.*/
-typedef uint16_t dflags_t;
+typedef uint8_t dflags_t;
-#if CH_USE_SERIAL_FULLDUPLEX
+/**
+ * @brief @p GenericSerialDriver specific methods.
+ */
+struct _generic_serial_driver_methods {
+};
+
+/**
+ * @brief @p GenericSerialDriver specific data.
+ */
+struct _generic_serial_driver_data {
+ /**
+ * Status Change @p EventSource. This event is generated when one or more
+ * condition flags change.
+ */
+ EventSource sevent;
+ /**
+ * I/O driver status flags. This field should not be read directly but
+ * the @p () function should be used instead.
+ */
+ dflags_t flags;
+};
+
+/**
+ * @brief @p GenericSerialDriver virtual methods table.
+ */
+struct _generic_serial_driver_vmt {
+ /**
+ * @p BaseChannel class inherited methods.
+ */
+ struct _base_channel_methods m0;
+ /**
+ * @p BaseAsynchronousChannel class inherited methods.
+ */
+ struct _base_asynchronous_channel_methods m1;
+ /**
+ * @p GenericSerialDriver specific methods.
+ */
+ struct _generic_serial_driver_methods m2;
+};
+
+/**
+ * @extends BaseAsynchronousChannel
+ *
+ * @brief Generic serial driver class.
+ * @details This class extends @p BaseAsynchronousChannel by adding handling for
+ * serial error events.
+ */
+typedef struct {
+ /**
+ * Virtual Methods Table.
+ */
+ struct _generic_serial_driver_vmt *vmt;
+ /**
+ * @p BaseChannel class inherited data.
+ */
+ struct _base_channel_data d0;
+ /**
+ * @p BaseAsynchronousChannel class inherited data.
+ */
+ struct _base_asynchronous_channel_data d1;
+ /**
+ * @p GenericSerialDriver specific data.
+ */
+ struct _generic_serial_driver_data d2;
+} GenericSerialDriver;
+
+
+/**
+ * @brief @p FullDuplexDriver specific methods.
+ */
+struct _full_duplex_driver_methods {
+};
+
+/**
+ * @brief @p FullDuplexDriver specific data.
+ */
+struct _full_duplex_driver_data {
+ /**
+ * Input queue, incoming data can be read from this input queue by
+ * using the queues APIs.
+ */
+ InputQueue sd_iqueue;
+ /**
+ * Output queue, outgoing data can be written to this output queue by
+ * using the queues APIs.
+ */
+ OutputQueue sd_oqueue;
+};
+
+/**
+ * @brief @p FullDuplexDriver virtual methods table.
+ */
+struct _full_duplex_driver_vmt {
+ /**
+ * @p BaseChannel class inherited methods.
+ */
+ struct _base_channel_methods m0;
+ /**
+ * @p BaseAsynchronousChannel class inherited methods.
+ */
+ struct _base_asynchronous_channel_methods m1;
+ /**
+ * @p GenericSerialDriver specific methods.
+ */
+ struct _generic_serial_driver_methods m2;
+ /**
+ * @p FullDuplexDriver specific methods.
+ */
+ struct _full_duplex_driver_methods m3;
+};
+
+/**
+ * @extends GenericSerialDriver
+ *
+ * @brief Full duplex serial driver class.
+ * @details This class extends @p GenericSerialDriver by adding physical I/O
+ * queues.
+ */
+typedef struct {
+ /**
+ * Virtual Methods Table.
+ */
+ struct _generic_serial_driver_vmt *vmt;
+ /**
+ * @p BaseChannel class inherited data.
+ */
+ struct _base_channel_data d0;
+ /**
+ * @p BaseAsynchronousChannel class inherited data.
+ */
+ struct _base_asynchronous_channel_data d1;
+ /**
+ * @p GenericSerialDriver specific data.
+ */
+ struct _generic_serial_driver_data d2;
+ /**
+ * @p FullDuplexDriver specific data.
+ */
+ struct _full_duplex_driver_data d3;
+} FullDuplexDriver_;
/**
* @brief Full Duplex Serial Driver main structure.