From 9057c6c72be213bb7f07929e2ddd1ab1e942a1de Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 18 Jun 2012 16:22:34 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4294 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/chstreams.h | 45 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) (limited to 'os/kernel') diff --git a/os/kernel/include/chstreams.h b/os/kernel/include/chstreams.h index f12c662cd..e55aa53c7 100644 --- a/os/kernel/include/chstreams.h +++ b/os/kernel/include/chstreams.h @@ -46,7 +46,11 @@ /* Stream write buffer method.*/ \ size_t (*write)(void *instance, const uint8_t *bp, size_t n); \ /* Stream read buffer method.*/ \ - size_t (*read)(void *instance, uint8_t *bp, size_t n); + size_t (*read)(void *instance, uint8_t *bp, size_t n); \ + /* Channel put method, blocking.*/ \ + msg_t (*put)(void *instance, uint8_t b); \ + /* Channel get method, blocking.*/ \ + msg_t (*get)(void *instance); \ /** * @brief @p BaseSequentialStream specific data. @@ -85,9 +89,8 @@ typedef struct { * @param[in] bp pointer to the data buffer * @param[in] n the maximum amount of data to be transferred * @return The number of bytes transferred. The return value can - * be less than the specified number of bytes if the - * stream reaches a physical end of file and cannot be - * extended. + * be less than the specified number of bytes if an + * end-of-file condition has been met. * * @api */ @@ -101,12 +104,42 @@ typedef struct { * @param[out] bp pointer to the data buffer * @param[in] n the maximum amount of data to be transferred * @return The number of bytes transferred. The return value can - * be less than the specified number of bytes if the - * stream reaches the end of the available data. + * be less than the specified number of bytes if an + * end-of-file condition has been met. * * @api */ #define chSequentialStreamRead(ip, bp, n) ((ip)->vmt->read(ip, bp, n)) + +/** + * @brief Sequential Stream blocking byte write. + * @details This function writes a byte value to a channel. If the channel + * is not ready to accept data then the calling thread is suspended. + * + * @param[in] ip pointer to a @p BaseChannel or derived class + * @param[in] b the byte value to be written to the channel + * + * @return The operation status. + * @retval Q_OK if the operation succeeded. + * @retval Q_RESET if an end-of-file condition has been met. + * + * @api + */ +#define chSequentialStreamPut(ip, b) ((ip)->vmt->put(ip, b)) + +/** + * @brief Sequential Stream blocking byte read. + * @details This function reads a byte value from a channel. If the data + * is not available then the calling thread is suspended. + * + * @param[in] ip pointer to a @p BaseChannel or derived class + * + * @return A byte value from the queue. + * @retval Q_RESET if an end-of-file condition has been met. + * + * @api + */ +#define chSequentialStreamGet(ip) ((ip)->vmt->get(ip)) /** @} */ #endif /* _CHSTREAMS_H_ */ -- cgit v1.2.3