aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include
diff options
context:
space:
mode:
authorgdisirio <gdisirio@110e8d01-0319-4d1e-a829-52ad28d1bb01>2018-09-28 08:20:40 +0000
committergdisirio <gdisirio@110e8d01-0319-4d1e-a829-52ad28d1bb01>2018-09-28 08:20:40 +0000
commit4b23f3b361221f5c57cef31bbf80c70372ab4d35 (patch)
tree75856fdd0cfb67f266bbe4398afb12da580967a5 /os/hal/include
parentccae24379ddc423b8e10cdd0fac527360fedd633 (diff)
downloadChibiOS-4b23f3b361221f5c57cef31bbf80c70372ab4d35.tar.gz
ChibiOS-4b23f3b361221f5c57cef31bbf80c70372ab4d35.tar.bz2
ChibiOS-4b23f3b361221f5c57cef31bbf80c70372ab4d35.zip
New SIO HAL driver model.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12300 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/include')
-rw-r--r--os/hal/include/hal.h9
-rw-r--r--os/hal/include/hal_sio.h49
2 files changed, 56 insertions, 2 deletions
diff --git a/os/hal/include/hal.h b/os/hal/include/hal.h
index 4b2ba597c..26299602b 100644
--- a/os/hal/include/hal.h
+++ b/os/hal/include/hal.h
@@ -94,6 +94,10 @@
#define HAL_USE_SDC FALSE
#endif
+#if !defined(HAL_USE_SIO)
+#define HAL_USE_SPI FALSE
+#endif
+
#if !defined(HAL_USE_SPI)
#define HAL_USE_SPI FALSE
#endif
@@ -150,6 +154,7 @@
#include "hal_rtc.h"
#include "hal_serial.h"
#include "hal_sdc.h"
+#include "hal_sio.h"
#include "hal_spi.h"
#include "hal_trng.h"
#include "hal_uart.h"
@@ -197,12 +202,12 @@
/**
* @brief HAL version string.
*/
-#define HAL_VERSION "6.0.0"
+#define HAL_VERSION "7.0.0"
/**
* @brief HAL version major number.
*/
-#define CH_HAL_MAJOR 6
+#define CH_HAL_MAJOR 7
/**
* @brief HAL version minor number.
diff --git a/os/hal/include/hal_sio.h b/os/hal/include/hal_sio.h
index 4d31940fd..6aedba68a 100644
--- a/os/hal/include/hal_sio.h
+++ b/os/hal/include/hal_sio.h
@@ -77,6 +77,54 @@ typedef enum {
/* Driver macros. */
/*===========================================================================*/
+/**
+ * @brief Reads data from the RX FIFO.
+ * @details This function is non-blocking, data is read if present and the
+ * effective amount is returned.
+ * @note This function can be called from any context but it is meant to
+ * be called from the @p rxne_cb callback handler.
+ *
+ * @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.
+ *
+ * @xclass
+ */
+#define sioReadX(siop, buffer, size) sio_lld_read(siop, buffer, size)
+
+/**
+ * @brief Writes data into the TX FIFO.
+ * @details This function is non-blocking, data is written if there is space
+ * in the FIFO and the effective amount is returned.
+ * @note This function can be called from any context but it is meant to
+ * 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.
+ *
+ * @xclass
+ */
+#define sioWriteX(siop, buffer, size) sio_lld_write(siop, buffer, size)
+
+/**
+ * @brief Control operation on a serial port.
+ *
+ * @param[in] siop pointer to the @p SIODriver object
+ * @param[in] operation control operation code
+ * @param[in,out] arg operation argument
+ *
+ * @return The control operation status.
+ * @retval MSG_OK in case of success.
+ * @retval MSG_TIMEOUT in case of operation timeout.
+ * @retval MSG_RESET in case of operation reset.
+ *
+ * @xclass
+ */
+#define sioControlX(siop, operation, arg) sio_lld_control(siop, operation, arg)
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
@@ -88,6 +136,7 @@ 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