From dd5d6d0affd6ee564836aba9e1429925d7a39d63 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Tue, 29 Aug 2017 11:30:45 +0000 Subject: Added an ioctl()-like function to the serial driver. No specific codes implemented yet. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10505 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/hal_channels.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'os/hal/include/hal_channels.h') diff --git a/os/hal/include/hal_channels.h b/os/hal/include/hal_channels.h index ab1ac314a..748dbe04a 100644 --- a/os/hal/include/hal_channels.h +++ b/os/hal/include/hal_channels.h @@ -36,6 +36,15 @@ #ifndef HAL_CHANNELS_H #define HAL_CHANNELS_H +/** + * @name Default control operation codes. + * @{ + */ +#define CHN_CTL_INVALID 0 /** @brief Invalid operation code. */ +#define CHN_CTL_NOP 1 /** @brief Does nothing. */ +#define CHN_CTL_TX_WAIT 2 /** @brief Wait for TX completion. */ +/** @} */ + /** * @brief @p BaseChannel specific methods. */ @@ -49,7 +58,9 @@ size_t (*writet)(void *instance, const uint8_t *bp, \ size_t n, systime_t time); \ /* Channel read method with timeout specification.*/ \ - size_t (*readt)(void *instance, uint8_t *bp, size_t n, systime_t time); + size_t (*readt)(void *instance, uint8_t *bp, size_t n, systime_t time); \ + /* Channel put method with timeout specification.*/ \ + msg_t (*ctl)(void *instance, unsigned int operation, void *arg); /** * @brief @p BaseChannel specific data. @@ -193,6 +204,22 @@ typedef struct { * @api */ #define chnReadTimeout(ip, bp, n, time) ((ip)->vmt->readt(ip, bp, n, time)) + +/** + * @brief Control operation on a channel. + * + * @param[in] ip pointer to a @p BaseChannel or derived class + * @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. + * + * @api + */ +#define chnControl(sdp, operation, arg) ((ip)->vmt->ctl(ip, operation, arg) /** @} */ /** -- cgit v1.2.3