message_buffer.h
Go to the documentation of this file.
1 /*
2  * FreeRTOS Kernel V10.0.0
3  * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software. If you wish to use our Amazon
14  * FreeRTOS name, please do so in a fair use way that does not cause confusion.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  * http://www.FreeRTOS.org
24  * http://aws.amazon.com/freertos
25  *
26  * 1 tab == 4 spaces!
27  */
28 
29 
30 /*
31  * Message buffers build functionality on top of FreeRTOS stream buffers.
32  * Whereas stream buffers are used to send a continuous stream of data from one
33  * task or interrupt to another, message buffers are used to send variable
34  * length discrete messages from one task or interrupt to another. Their
35  * implementation is light weight, making them particularly suited for interrupt
36  * to task and core to core communication scenarios.
37  *
38  * ***NOTE***: Uniquely among FreeRTOS objects, the stream buffer
39  * implementation (so also the message buffer implementation, as message buffers
40  * are built on top of stream buffers) assumes there is only one task or
41  * interrupt that will write to the buffer (the writer), and only one task or
42  * interrupt that will read from the buffer (the reader). It is safe for the
43  * writer and reader to be different tasks or interrupts, but, unlike other
44  * FreeRTOS objects, it is not safe to have multiple different writers or
45  * multiple different readers. If there are to be multiple different writers
46  * then the application writer must place each call to a writing API function
47  * (such as xMessageBufferSend()) inside a critical section and set the send
48  * block time to 0. Likewise, if there are to be multiple different readers
49  * then the application writer must place each call to a reading API function
50  * (such as xMessageBufferRead()) inside a critical section and set the receive
51  * timeout to 0.
52  *
53  * Message buffers hold variable length messages. To enable that, when a
54  * message is written to the message buffer an additional sizeof( size_t ) bytes
55  * are also written to store the message's length (that happens internally, with
56  * the API function). sizeof( size_t ) is typically 4 bytes on a 32-bit
57  * architecture, so writing a 10 byte message to a message buffer on a 32-bit
58  * architecture will actually reduce the available space in the message buffer
59  * by 14 bytes (10 byte are used by the message, and 4 bytes to hold the length
60  * of the message).
61  */
62 
63 #ifndef FREERTOS_MESSAGE_BUFFER_H
64 #define FREERTOS_MESSAGE_BUFFER_H
65 
66 /* Message buffers are built onto of stream buffers. */
67 #include "stream_buffer.h"
68 
69 #if defined( __cplusplus )
70 extern "C" {
71 #endif
72 
79 typedef void * MessageBufferHandle_t;
80 
81 /*-----------------------------------------------------------*/
82 
139 #define xMessageBufferCreate( xBufferSizeBytes ) ( MessageBufferHandle_t ) xStreamBufferGenericCreate( xBufferSizeBytes, ( size_t ) 0, pdTRUE )
140 
205 #define xMessageBufferCreateStatic( xBufferSizeBytes, pucMessageBufferStorageArea, pxStaticMessageBuffer ) ( MessageBufferHandle_t ) xStreamBufferGenericCreateStatic( xBufferSizeBytes, 0, pdTRUE, pucMessageBufferStorageArea, pxStaticMessageBuffer )
206 
304 #define xMessageBufferSend( xMessageBuffer, pvTxData, xDataLengthBytes, xTicksToWait ) xStreamBufferSend( ( StreamBufferHandle_t ) xMessageBuffer, pvTxData, xDataLengthBytes, xTicksToWait )
305 
408 #define xMessageBufferSendFromISR( xMessageBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken ) xStreamBufferSendFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken )
409 
496 #define xMessageBufferReceive( xMessageBuffer, pvRxData, xBufferLengthBytes, xTicksToWait ) xStreamBufferReceive( ( StreamBufferHandle_t ) xMessageBuffer, pvRxData, xBufferLengthBytes, xTicksToWait )
497 
498 
597 #define xMessageBufferReceiveFromISR( xMessageBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken ) xStreamBufferReceiveFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken )
598 
617 #define vMessageBufferDelete( xMessageBuffer ) vStreamBufferDelete( ( StreamBufferHandle_t ) xMessageBuffer )
618 
634 #define xMessageBufferIsFull( xMessageBuffer ) xStreamBufferIsFull( ( StreamBufferHandle_t ) xMessageBuffer )
635 
650 #define xMessageBufferIsEmpty( xMessageBuffer ) xStreamBufferIsEmpty( ( StreamBufferHandle_t ) xMessageBuffer )
651 
673 #define xMessageBufferReset( xMessageBuffer ) xStreamBufferReset( ( StreamBufferHandle_t ) xMessageBuffer )
674 
675 
695 #define xMessageBufferSpaceAvailable( xMessageBuffer ) xStreamBufferSpacesAvailable( ( StreamBufferHandle_t ) xMessageBuffer )
696 
734 #define xMessageBufferSendCompletedFromISR( xMessageBuffer, pxHigherPriorityTaskWoken ) xStreamBufferSendCompletedFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pxHigherPriorityTaskWoken )
735 
774 #define xMessageBufferReceiveCompletedFromISR( xMessageBuffer, pxHigherPriorityTaskWoken ) xStreamBufferReceiveCompletedFromISR( ( StreamBufferHandle_t ) xMessageBuffer, pxHigherPriorityTaskWoken )
775 
776 #if defined( __cplusplus )
777 } /* extern "C" */
778 #endif
779 
780 #endif /* !defined( FREERTOS_MESSAGE_BUFFER_H ) */
void * MessageBufferHandle_t


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:58