aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/serial.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/include/serial.h')
-rw-r--r--os/hal/include/serial.h100
1 files changed, 56 insertions, 44 deletions
diff --git a/os/hal/include/serial.h b/os/hal/include/serial.h
index 932f81030..1d45a1601 100644
--- a/os/hal/include/serial.h
+++ b/os/hal/include/serial.h
@@ -18,8 +18,9 @@
*/
/**
- * @file serial.h
- * @brief Serial Driver macros and structures.
+ * @file serial.h
+ * @brief Serial Driver macros and structures.
+ *
* @addtogroup SERIAL
* @{
*/
@@ -55,7 +56,7 @@
/*===========================================================================*/
/**
- * @brief Default bit rate.
+ * @brief Default bit rate.
* @details Configuration parameter, this is the baud rate selected for the
* default configuration.
*/
@@ -64,10 +65,11 @@
#endif
/**
- * @brief Serial buffers size.
+ * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application.
- * @note The default is 64 bytes for both the transmission and receive buffers.
+ * @note The default is 64 bytes for both the transmission and receive
+ * buffers.
*/
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_BUFFERS_SIZE 64
@@ -89,26 +91,26 @@
* @brief Driver state machine possible states.
*/
typedef enum {
- SD_UNINIT = 0, /**< @brief Not initialized. */
- SD_STOP = 1, /**< @brief Stopped. */
- SD_READY = 2 /**< @brief Ready. */
+ SD_UNINIT = 0, /**< @brief Not initialized. */
+ SD_STOP = 1, /**< @brief Stopped. */
+ SD_READY = 2 /**< @brief Ready. */
} sdstate_t;
/**
- * @brief Structure representing a serial driver.
+ * @brief Structure representing a serial driver.
*/
typedef struct _SerialDriver SerialDriver;
#include "serial_lld.h"
/**
- * @brief @p SerialDriver specific methods.
+ * @brief @p SerialDriver specific methods.
*/
#define _serial_driver_methods \
_base_asynchronous_channel_methods
/**
- * @brief @p SerialDriver virtual methods table.
+ * @brief @p SerialDriver virtual methods table.
*/
struct SerialDriverVMT {
_serial_driver_methods;
@@ -117,14 +119,12 @@ struct SerialDriverVMT {
/**
* @extends BaseAsynchronousChannel
*
- * @brief Full duplex serial driver class.
+ * @brief Full duplex serial driver class.
* @details This class extends @p BaseAsynchronousChannel by adding physical
* I/O queues.
*/
struct _SerialDriver {
- /**
- * Virtual Methods Table.
- */
+ /** @brief Virtual Methods Table.*/
const struct SerialDriverVMT *vmt;
_serial_driver_data
};
@@ -134,129 +134,141 @@ struct _SerialDriver {
/*===========================================================================*/
/**
- * @brief Direct output check on a @p SerialDriver.
+ * @brief Direct output check on a @p SerialDriver.
* @details This function bypasses the indirect access to the channel and
* checks directly the output queue. This is faster but cannot
* be used to check different channels implementations.
- * @see chIOPutWouldBlock()
+ *
+ * @see chIOPutWouldBlock()
*/
#define sdPutWouldBlock(sdp) chOQIsFull(&(sdp)->oqueue)
/**
- * @brief Direct input check on a @p SerialDriver.
+ * @brief Direct input check on a @p SerialDriver.
* @details This function bypasses the indirect access to the channel and
* checks directly the input queue. This is faster but cannot
* be used to check different channels implementations.
- * @see chIOGetWouldBlock()
+ *
+ * @see chIOGetWouldBlock()
*/
#define sdGetWouldBlock(sdp) chIQIsEmpty(&(sdp)->iqueue)
/**
- * @brief Direct write to a @p SerialDriver.
+ * @brief Direct write to a @p SerialDriver.
* @details This function bypasses the indirect access to the channel and
* writes directly on the output queue. This is faster but cannot
* be used to write to different channels implementations.
- * @see chIOPut()
+ *
+ * @see chIOPut()
*/
#define sdPut(sdp, b) chOQPut(&(sdp)->oqueue, b)
/**
- * @brief Direct write to a @p SerialDriver with timeout specification.
+ * @brief Direct write to a @p SerialDriver with timeout specification.
* @details This function bypasses the indirect access to the channel and
* writes directly on the output queue. This is faster but cannot
* be used to write to different channels implementations.
- * @see chIOPutTimeout()
+ *
+ * @see chIOPutTimeout()
*/
#define sdPutTimeout(sdp, b, t) chOQPutTimeout(&(sdp)->iqueue, b, t)
/**
- * @brief Direct read from a @p SerialDriver.
+ * @brief Direct read from a @p SerialDriver.
* @details This function bypasses the indirect access to the channel and
* reads directly from the input queue. This is faster but cannot
* be used to read from different channels implementations.
- * @see chIOGet()
+ *
+ * @see chIOGet()
*/
#define sdGet(sdp) chIQGet(&(sdp)->iqueue)
/**
- * @brief Direct read from a @p SerialDriver with timeout specification.
+ * @brief Direct read from a @p SerialDriver with timeout specification.
* @details This function bypasses the indirect access to the channel and
* reads directly from the input queue. This is faster but cannot
* be used to read from different channels implementations.
- * @see chIOGetTimeout()
+ *
+ * @see chIOGetTimeout()
*/
#define sdGetTimeout(sdp, t) chIQGetTimeout(&(sdp)->iqueue, t)
/**
- * @brief Direct blocking write to a @p SerialDriver.
+ * @brief Direct blocking write to a @p SerialDriver.
* @details This function bypasses the indirect access to the channel and
* writes directly to the output queue. This is faster but cannot
* be used to write from different channels implementations.
- * @see chIOWriteTimeout()
+ *
+ * @see chIOWriteTimeout()
*/
#define sdWrite(sdp, b, n) \
chOQWriteTimeout(&(sdp)->oqueue, b, n, TIME_INFINITE)
/**
- * @brief Direct blocking write to a @p SerialDriver with timeout
- * specification.
+ * @brief Direct blocking write to a @p SerialDriver with timeout
+ * specification.
* @details This function bypasses the indirect access to the channel and
* writes directly to the output queue. This is faster but cannot
* be used to write from different channels implementations.
- * @see chIOWriteTimeout()
+ *
+ * @see chIOWriteTimeout()
*/
#define sdWriteTimeout(sdp, b, n, t) \
chOQWriteTimeout(&(sdp)->oqueue, b, n, t)
/**
- * @brief Direct non-blocking write to a @p SerialDriver.
+ * @brief Direct non-blocking write to a @p SerialDriver.
* @details This function bypasses the indirect access to the channel and
* writes directly to the output queue. This is faster but cannot
* be used to write from different channels implementations.
- * @see chIOWriteTimeout()
+ *
+ * @see chIOWriteTimeout()
*/
#define sdAsynchronousWrite(sdp, b, n) \
chOQWriteTimeout(&(sdp)->oqueue, b, n, TIME_IMMEDIATE)
/**
- * @brief Direct blocking read from a @p SerialDriver.
+ * @brief Direct blocking read from a @p SerialDriver.
* @details This function bypasses the indirect access to the channel and
* reads directly from the input queue. This is faster but cannot
* be used to read from different channels implementations.
- * @see chIOReadTimeout()
+ *
+ * @see chIOReadTimeout()
*/
#define sdRead(sdp, b, n) \
chIQReadTimeout(&(sdp)->iqueue, b, n, TIME_INFINITE)
/**
- * @brief Direct blocking read from a @p SerialDriver with timeout
- * specification.
+ * @brief Direct blocking read from a @p SerialDriver with timeout
+ * specification.
* @details This function bypasses the indirect access to the channel and
* reads directly from the input queue. This is faster but cannot
* be used to read from different channels implementations.
- * @see chIOReadTimeout()
+ *
+ * @see chIOReadTimeout()
*/
#define sdReadTimeout(sdp, b, n, t) \
chIQReadTimeout(&(sdp)->iqueue, b, n, t)
/**
- * @brief Direct non-blocking read from a @p SerialDriver.
+ * @brief Direct non-blocking read from a @p SerialDriver.
* @details This function bypasses the indirect access to the channel and
* reads directly from the input queue. This is faster but cannot
* be used to read from different channels implementations.
- * @see chIOReadTimeout()
+ *
+ * @see chIOReadTimeout()
*/
#define sdAsynchronousRead(sdp, b, n) \
chIQReadTimeout(&(sdp)->iqueue, b, n, TIME_IMMEDIATE)
/**
- * @brief Returns the status change event source.
+ * @brief Returns the status change event source.
* @details The status change event source is broadcasted when the channel
* status is updated, the status flags can then be fetched and
* cheared by using @p sdGetAndClearFlags().
*
- * @param[in] ip pointer to a @p SerialDriver object
- * @return A pointer to an @p EventSource object.
+ * @param[in] ip pointer to a @p SerialDriver object
+ * @return A pointer to an @p EventSource object.
*/
#define sdGetStatusChangeEventSource(ip) (&((ip)->vmt->sevent))