aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include
diff options
context:
space:
mode:
authorgdisirio <gdisirio@110e8d01-0319-4d1e-a829-52ad28d1bb01>2018-09-28 09:10:43 +0000
committergdisirio <gdisirio@110e8d01-0319-4d1e-a829-52ad28d1bb01>2018-09-28 09:10:43 +0000
commite53c5fbf6c8928e416490fa668089541883d40f4 (patch)
treebaed96eea0f31673cdc98738d0a93b4eab0e3fd3 /os/hal/include
parent4b23f3b361221f5c57cef31bbf80c70372ab4d35 (diff)
downloadChibiOS-e53c5fbf6c8928e416490fa668089541883d40f4.tar.gz
ChibiOS-e53c5fbf6c8928e416490fa668089541883d40f4.tar.bz2
ChibiOS-e53c5fbf6c8928e416490fa668089541883d40f4.zip
Improvements to SIO driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12301 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/include')
-rw-r--r--os/hal/include/hal_sio.h76
1 files changed, 70 insertions, 6 deletions
diff --git a/os/hal/include/hal_sio.h b/os/hal/include/hal_sio.h
index 6aedba68a..6999574eb 100644
--- a/os/hal/include/hal_sio.h
+++ b/os/hal/include/hal_sio.h
@@ -63,6 +63,16 @@
/*===========================================================================*/
/**
+ * @brief Type of structure representing a SIO driver.
+ */
+typedef struct hal_sio_driver SIODriver;
+
+/**
+ * @brief Type of structure representing a SIO configuration.
+ */
+typedef struct hal_sio_config SIOConfig;
+
+/**
* @brief Driver state machine possible states.
*/
typedef enum {
@@ -71,6 +81,16 @@ typedef enum {
SIO_READY = 2 /**< Ready. */
} siostate_t;
+/**
+ * @brief Type of a function writing a frame received by SIO.
+ */
+typedef msg_t (*sioput_t)(void *p, uint8_t b);
+
+/**
+ * @brief Type of a function reading a frame to be transmitted by SIO.
+ */
+typedef msg_t (*sioget_t)(void *p);
+
#include "hal_sio_lld.h"
/*===========================================================================*/
@@ -78,6 +98,51 @@ typedef enum {
/*===========================================================================*/
/**
+ * @brief Determines the state of the RX FIFO.
+ *
+ * @param[in] siop pointer to the @p SIODriver object
+ * @return The RX FIFO state.
+ * @retval false if RX FIFO is not empty
+ * @retval true if RX FIFO is empty
+ *
+ * @xclass
+ */
+#define sioRXIsEmptyX(siop) sio_lld_rx_is_empty(siop)
+
+/**
+ * @brief Determines the state of the TX FIFO.
+ *
+ * @param[in] siop pointer to the @p SIODriver object
+ * @return The TX FIFO state.
+ * @retval false if TX FIFO is not full
+ * @retval true if TX FIFO is full
+ *
+ * @xclass
+ */
+#define sioTXIsFullX(siop) sio_lld_tx_is_full(siop)
+
+/**
+ * @brief Returns one frame from the RX FIFO.
+ * @note If the FIFO is empty then the returned value is unpredictable.
+ *
+ * @param[in] siop pointer to the @p SIODriver object
+ * @return The frame from RX FIFO.
+ *
+ * @xclass
+ */
+#define sioRXGetX(siop) sio_lld_rx_get(siop)
+
+/**
+ * @brief Pushes one frame into the TX FIFO.
+ * @note If the FIFO is full then the behavior is unpredictable.
+ *
+ * @param[in] siop pointer to the @p SIODriver object
+ *
+ * @xclass
+ */
+#define sioTXPutX(siop, data) sio_lld_tx_put(siop, data)
+
+/**
* @brief Reads data from the RX FIFO.
* @details This function is non-blocking, data is read if present and the
* effective amount is returned.
@@ -86,8 +151,8 @@ typedef enum {
*
* @param[in] siop pointer to the @p SIODriver object
* @param[in] buffer buffer for the received data
- * @param[in] size maximum number of bytes to read
- * @return The number of received bytes.
+ * @param[in] size maximum number of frames to read
+ * @return The number of received frames.
*
* @xclass
*/
@@ -101,9 +166,9 @@ typedef enum {
* be called from the @p txnf_cb callback handler.
*
* @param[in] siop pointer to the @p SIODriver object
- * @param[out] buffer buffer containing the data to be transmitted
- * @param[in] size maximum number of bytes to read
- * @return The number of transmitted bytes.
+ * @param[out] buffer buffer containing the data to be transmitted
+ * @param[in] size maximum number of frames to read
+ * @return The number of transmitted frames.
*
* @xclass
*/
@@ -136,7 +201,6 @@ extern "C" {
void sioObjectInit(SIODriver *siop);
void sioStart(SIODriver *siop, const SIOConfig *config);
void sioStop(SIODriver *siop);
- msg_t sioControl(SIODriver *siop, unsigned int operation, void *arg);
#ifdef __cplusplus
}
#endif