From 7979de69537f45600e5e926dcdf5e302b09af61b Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Mon, 21 Dec 2015 11:20:33 +0000 Subject: Input buffers queue working now. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8629 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/include/hal_buffers.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'os/hal/include') diff --git a/os/hal/include/hal_buffers.h b/os/hal/include/hal_buffers.h index 28677849f..a256f02e2 100644 --- a/os/hal/include/hal_buffers.h +++ b/os/hal/include/hal_buffers.h @@ -125,6 +125,15 @@ typedef io_buffers_queue_t output_buffers_queue_t; /* Driver macros. */ /*===========================================================================*/ +/** + * @brief Computes the size of a buffers queue buffer size. + * + * @param[in] n sumber of buffers in the queue + * @param[in] size size of the buffers + */ +#define BQ_BUFFER_SIZE(n, size) \ + (((size_t)(size) + sizeof (size_t)) * (size_t)(n)) + /** * @name Macro Functions * @{ @@ -151,6 +160,16 @@ typedef io_buffers_queue_t output_buffers_queue_t; */ #define bqSpaceI(bqp) ((bqp)->bcounter) +/** + * @brief Returns the queue application-defined link. + * + * @param[in] bqp pointer to an @p io_buffers_queue_t structure + * @return The application-defined link. + * + * @special + */ +#define bqGetLinkX(bqp) ((bqp)->link) + /** * @brief Evaluates to @p TRUE if the specified input buffered queue is empty. * @@ -187,6 +206,7 @@ extern "C" { void ibqObjectInit(io_buffers_queue_t *ibqp, uint8_t *bp, size_t size, size_t n, dbnotify_t infy, void *link); + void ibqResetI(input_buffers_queue_t *ibqp); uint8_t *ibqGetEmptyBufferI(input_buffers_queue_t *ibqp); void ibqPostBufferI(input_buffers_queue_t *ibqp, size_t size); msg_t ibqGetDataTimeoutI(input_buffers_queue_t *ibqp, systime_t timeout); -- cgit v1.2.3