#include <stdint.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "stream_buffer.h"
Data Structures | |
struct | xSTREAM_BUFFER |
Macros | |
#define | MPU_WRAPPERS_INCLUDED_FROM_API_FILE |
#define | sbBYTES_TO_STORE_MESSAGE_LENGTH ( sizeof( size_t ) ) |
#define | sbFLAGS_IS_MESSAGE_BUFFER ( ( uint8_t ) 1 ) /* Set if the stream buffer was created as a message buffer, in which case it holds discrete messages rather than a stream. */ |
#define | sbFLAGS_IS_STATICALLY_ALLOCATED ( ( uint8_t ) 2 ) /* Set if the stream buffer was created using statically allocated memory. */ |
#define | sbRECEIVE_COMPLETED(pxStreamBuffer) |
#define | sbRECEIVE_COMPLETED_FROM_ISR(pxStreamBuffer,pxHigherPriorityTaskWoken) |
#define | sbSEND_COMPLETE_FROM_ISR(pxStreamBuffer, pxHigherPriorityTaskWoken) |
#define | sbSEND_COMPLETED(pxStreamBuffer) |
Typedefs | |
typedef struct xSTREAM_BUFFER | StreamBuffer_t |
Functions | |
static size_t | prvBytesInBuffer (const StreamBuffer_t *const pxStreamBuffer) PRIVILEGED_FUNCTION |
static PRIVILEGED_FUNCTION void | prvInitialiseNewStreamBuffer (StreamBuffer_t *const pxStreamBuffer, uint8_t *const pucBuffer, size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer) PRIVILEGED_FUNCTION |
static size_t | prvReadBytesFromBuffer (StreamBuffer_t *pxStreamBuffer, uint8_t *pucData, size_t xMaxCount, size_t xBytesAvailable) |
static size_t | prvReadMessageFromBuffer (StreamBuffer_t *pxStreamBuffer, void *pvRxData, size_t xBufferLengthBytes, size_t xBytesAvailable, size_t xBytesToStoreMessageLength) PRIVILEGED_FUNCTION |
static size_t | prvWriteBytesToBuffer (StreamBuffer_t *const pxStreamBuffer, const uint8_t *pucData, size_t xCount) PRIVILEGED_FUNCTION |
static size_t | prvWriteMessageToBuffer (StreamBuffer_t *const pxStreamBuffer, const void *pvTxData, size_t xDataLengthBytes, size_t xSpace, size_t xRequiredSpace) PRIVILEGED_FUNCTION |
void | vStreamBufferDelete (StreamBufferHandle_t xStreamBuffer) |
size_t | xStreamBufferBytesAvailable (StreamBufferHandle_t xStreamBuffer) |
StreamBufferHandle_t | xStreamBufferGenericCreate (size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer) |
BaseType_t | xStreamBufferIsEmpty (StreamBufferHandle_t xStreamBuffer) |
BaseType_t | xStreamBufferIsFull (StreamBufferHandle_t xStreamBuffer) |
size_t | xStreamBufferReceive (StreamBufferHandle_t xStreamBuffer, void *pvRxData, size_t xBufferLengthBytes, TickType_t xTicksToWait) |
BaseType_t | xStreamBufferReceiveCompletedFromISR (StreamBufferHandle_t xStreamBuffer, BaseType_t *pxHigherPriorityTaskWoken) |
size_t | xStreamBufferReceiveFromISR (StreamBufferHandle_t xStreamBuffer, void *pvRxData, size_t xBufferLengthBytes, BaseType_t *const pxHigherPriorityTaskWoken) |
BaseType_t | xStreamBufferReset (StreamBufferHandle_t xStreamBuffer) |
size_t | xStreamBufferSend (StreamBufferHandle_t xStreamBuffer, const void *pvTxData, size_t xDataLengthBytes, TickType_t xTicksToWait) |
BaseType_t | xStreamBufferSendCompletedFromISR (StreamBufferHandle_t xStreamBuffer, BaseType_t *pxHigherPriorityTaskWoken) |
size_t | xStreamBufferSendFromISR (StreamBufferHandle_t xStreamBuffer, const void *pvTxData, size_t xDataLengthBytes, BaseType_t *const pxHigherPriorityTaskWoken) |
BaseType_t | xStreamBufferSetTriggerLevel (StreamBufferHandle_t xStreamBuffer, size_t xTriggerLevel) |
size_t | xStreamBufferSpacesAvailable (StreamBufferHandle_t xStreamBuffer) |
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE |
#define sbBYTES_TO_STORE_MESSAGE_LENGTH ( sizeof( size_t ) ) |
#define sbFLAGS_IS_MESSAGE_BUFFER ( ( uint8_t ) 1 ) /* Set if the stream buffer was created as a message buffer, in which case it holds discrete messages rather than a stream. */ |
#define sbFLAGS_IS_STATICALLY_ALLOCATED ( ( uint8_t ) 2 ) /* Set if the stream buffer was created using statically allocated memory. */ |
Referenced by vStreamBufferDelete().
#define sbRECEIVE_COMPLETED | ( | pxStreamBuffer | ) |
Referenced by xStreamBufferReceive().
#define sbRECEIVE_COMPLETED_FROM_ISR | ( | pxStreamBuffer, | |
pxHigherPriorityTaskWoken | |||
) |
Referenced by xStreamBufferReceiveFromISR().
#define sbSEND_COMPLETE_FROM_ISR | ( | pxStreamBuffer, | |
pxHigherPriorityTaskWoken | |||
) |
Referenced by xStreamBufferSendFromISR().
#define sbSEND_COMPLETED | ( | pxStreamBuffer | ) |
Referenced by xStreamBufferSend().
typedef struct xSTREAM_BUFFER StreamBuffer_t |
|
static |
|
static |
References configASSERT, pdFALSE, xSTREAM_BUFFER::pucBuffer, sbFLAGS_IS_MESSAGE_BUFFER, xSTREAM_BUFFER::ucFlags, xSTREAM_BUFFER::xLength, and xSTREAM_BUFFER::xTriggerLevelBytes.
Referenced by xStreamBufferGenericCreate(), and xStreamBufferReset().
|
static |
References configASSERT, configMIN, mtCOVERAGE_TEST_MARKER, xSTREAM_BUFFER::pucBuffer, xSTREAM_BUFFER::xLength, and xSTREAM_BUFFER::xTail.
Referenced by prvReadMessageFromBuffer().
|
static |
References mtCOVERAGE_TEST_MARKER, prvReadBytesFromBuffer(), and xSTREAM_BUFFER::xTail.
Referenced by xStreamBufferReceive(), and xStreamBufferReceiveFromISR().
|
static |
References configASSERT, configMIN, mtCOVERAGE_TEST_MARKER, xSTREAM_BUFFER::pucBuffer, xSTREAM_BUFFER::xHead, and xSTREAM_BUFFER::xLength.
Referenced by prvWriteMessageToBuffer().
|
static |
References configMIN, pdFALSE, pdTRUE, prvWriteBytesToBuffer(), sbBYTES_TO_STORE_MESSAGE_LENGTH, sbFLAGS_IS_MESSAGE_BUFFER, and xSTREAM_BUFFER::ucFlags.
Referenced by xStreamBufferSend(), and xStreamBufferSendFromISR().
void vStreamBufferDelete | ( | StreamBufferHandle_t | xStreamBuffer | ) |
size_t xStreamBufferBytesAvailable | ( | StreamBufferHandle_t | xStreamBuffer | ) |
References configASSERT, and prvBytesInBuffer().
StreamBufferHandle_t xStreamBufferGenericCreate | ( | size_t | xBufferSizeBytes, |
size_t | xTriggerLevelBytes, | ||
BaseType_t | xIsMessageBuffer | ||
) |
BaseType_t xStreamBufferIsEmpty | ( | StreamBufferHandle_t | xStreamBuffer | ) |
References configASSERT, pdFALSE, pdTRUE, xSTREAM_BUFFER::xHead, and xSTREAM_BUFFER::xTail.
BaseType_t xStreamBufferIsFull | ( | StreamBufferHandle_t | xStreamBuffer | ) |
size_t xStreamBufferReceive | ( | StreamBufferHandle_t | xStreamBuffer, |
void * | pvRxData, | ||
size_t | xBufferLengthBytes, | ||
TickType_t | xTicksToWait | ||
) |
References configASSERT, mtCOVERAGE_TEST_MARKER, prvBytesInBuffer(), prvReadMessageFromBuffer(), sbBYTES_TO_STORE_MESSAGE_LENGTH, sbFLAGS_IS_MESSAGE_BUFFER, sbRECEIVE_COMPLETED, taskENTER_CRITICAL, taskEXIT_CRITICAL, traceBLOCKING_ON_STREAM_BUFFER_RECEIVE, traceSTREAM_BUFFER_RECEIVE, traceSTREAM_BUFFER_RECEIVE_FAILED, xSTREAM_BUFFER::ucFlags, xTaskGetCurrentTaskHandle(), xTaskNotifyStateClear(), xTaskNotifyWait(), and xSTREAM_BUFFER::xTaskWaitingToReceive.
BaseType_t xStreamBufferReceiveCompletedFromISR | ( | StreamBufferHandle_t | xStreamBuffer, |
BaseType_t * | pxHigherPriorityTaskWoken | ||
) |
size_t xStreamBufferReceiveFromISR | ( | StreamBufferHandle_t | xStreamBuffer, |
void * | pvRxData, | ||
size_t | xBufferLengthBytes, | ||
BaseType_t *const | pxHigherPriorityTaskWoken | ||
) |
BaseType_t xStreamBufferReset | ( | StreamBufferHandle_t | xStreamBuffer | ) |
References configASSERT, pdFAIL, pdFALSE, pdPASS, pdTRUE, prvInitialiseNewStreamBuffer(), xSTREAM_BUFFER::pucBuffer, sbFLAGS_IS_MESSAGE_BUFFER, traceSTREAM_BUFFER_RESET, xSTREAM_BUFFER::ucFlags, xSTREAM_BUFFER::xLength, xSTREAM_BUFFER::xTaskWaitingToReceive, xSTREAM_BUFFER::xTaskWaitingToSend, and xSTREAM_BUFFER::xTriggerLevelBytes.
size_t xStreamBufferSend | ( | StreamBufferHandle_t | xStreamBuffer, |
const void * | pvTxData, | ||
size_t | xDataLengthBytes, | ||
TickType_t | xTicksToWait | ||
) |
References configASSERT, mtCOVERAGE_TEST_MARKER, pdFALSE, prvBytesInBuffer(), prvWriteMessageToBuffer(), sbBYTES_TO_STORE_MESSAGE_LENGTH, sbFLAGS_IS_MESSAGE_BUFFER, sbSEND_COMPLETED, taskENTER_CRITICAL, taskEXIT_CRITICAL, traceBLOCKING_ON_STREAM_BUFFER_SEND, traceSTREAM_BUFFER_SEND, traceSTREAM_BUFFER_SEND_FAILED, xSTREAM_BUFFER::ucFlags, vTaskSetTimeOutState(), xStreamBufferSpacesAvailable(), xTaskCheckForTimeOut(), xTaskGetCurrentTaskHandle(), xTaskNotifyStateClear(), xTaskNotifyWait(), xSTREAM_BUFFER::xTaskWaitingToSend, and xSTREAM_BUFFER::xTriggerLevelBytes.
BaseType_t xStreamBufferSendCompletedFromISR | ( | StreamBufferHandle_t | xStreamBuffer, |
BaseType_t * | pxHigherPriorityTaskWoken | ||
) |
size_t xStreamBufferSendFromISR | ( | StreamBufferHandle_t | xStreamBuffer, |
const void * | pvTxData, | ||
size_t | xDataLengthBytes, | ||
BaseType_t *const | pxHigherPriorityTaskWoken | ||
) |
References configASSERT, mtCOVERAGE_TEST_MARKER, prvBytesInBuffer(), prvWriteMessageToBuffer(), sbBYTES_TO_STORE_MESSAGE_LENGTH, sbFLAGS_IS_MESSAGE_BUFFER, sbSEND_COMPLETE_FROM_ISR, traceSTREAM_BUFFER_SEND_FROM_ISR, xSTREAM_BUFFER::ucFlags, xStreamBufferSpacesAvailable(), and xSTREAM_BUFFER::xTriggerLevelBytes.
BaseType_t xStreamBufferSetTriggerLevel | ( | StreamBufferHandle_t | xStreamBuffer, |
size_t | xTriggerLevel | ||
) |
References configASSERT, pdFALSE, pdPASS, and xSTREAM_BUFFER::xTriggerLevelBytes.
size_t xStreamBufferSpacesAvailable | ( | StreamBufferHandle_t | xStreamBuffer | ) |
References configASSERT, mtCOVERAGE_TEST_MARKER, xSTREAM_BUFFER::xHead, xSTREAM_BUFFER::xLength, and xSTREAM_BUFFER::xTail.
Referenced by xStreamBufferIsFull(), xStreamBufferSend(), and xStreamBufferSendFromISR().