Classes | Macros | Typedefs | Functions
stream_buffer.c File Reference
#include <stdint.h>
#include <string.h>
#include "FreeRTOS.h"
#include "task.h"
#include "stream_buffer.h"
Include dependency graph for stream_buffer.c:

Go to the source code of this file.

Classes

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)
 
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)
 

Macro Definition Documentation

◆ MPU_WRAPPERS_INCLUDED_FROM_API_FILE

#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE

Definition at line 36 of file stream_buffer.c.

◆ sbBYTES_TO_STORE_MESSAGE_LENGTH

#define sbBYTES_TO_STORE_MESSAGE_LENGTH   ( sizeof( size_t ) )

Definition at line 129 of file stream_buffer.c.

◆ sbFLAGS_IS_MESSAGE_BUFFER

#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. */

Definition at line 132 of file stream_buffer.c.

◆ sbFLAGS_IS_STATICALLY_ALLOCATED

#define sbFLAGS_IS_STATICALLY_ALLOCATED   ( ( uint8_t ) 2 ) /* Set if the stream buffer was created using statically allocated memory. */

Definition at line 133 of file stream_buffer.c.

◆ sbRECEIVE_COMPLETED

#define sbRECEIVE_COMPLETED (   pxStreamBuffer)
Value:
{ \
if( ( pxStreamBuffer )->xTaskWaitingToSend != NULL ) \
{ \
( void ) xTaskNotify( ( pxStreamBuffer )->xTaskWaitingToSend, \
( uint32_t ) 0, \
eNoAction ); \
( pxStreamBuffer )->xTaskWaitingToSend = NULL; \
} \
} \
( void ) xTaskResumeAll();
Definition: task.h:84
void vTaskSuspendAll(void) PRIVILEGED_FUNCTION
Definition: tasks.c:2034
#define NULL
Definition: nm_bsp.h:52
#define xTaskNotify(xTaskToNotify, ulValue, eAction)
Definition: task.h:1767
BaseType_t xTaskResumeAll(void) PRIVILEGED_FUNCTION
Definition: tasks.c:2107

Definition at line 54 of file stream_buffer.c.

◆ sbRECEIVE_COMPLETED_FROM_ISR

#define sbRECEIVE_COMPLETED_FROM_ISR (   pxStreamBuffer,
  pxHigherPriorityTaskWoken 
)
Value:
{ \
UBaseType_t uxSavedInterruptStatus; \
\
uxSavedInterruptStatus = ( UBaseType_t ) portSET_INTERRUPT_MASK_FROM_ISR(); \
{ \
if( ( pxStreamBuffer )->xTaskWaitingToSend != NULL ) \
{ \
( void ) xTaskNotifyFromISR( ( pxStreamBuffer )->xTaskWaitingToSend, \
( uint32_t ) 0, \
pxHigherPriorityTaskWoken ); \
( pxStreamBuffer )->xTaskWaitingToSend = NULL; \
} \
} \
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); \
}
Definition: task.h:84
#define NULL
Definition: nm_bsp.h:52
#define xTaskNotifyFromISR(xTaskToNotify, ulValue, eAction, pxHigherPriorityTaskWoken)
Definition: task.h:1858
unsigned long UBaseType_t
Definition: portmacro.h:58
#define portSET_INTERRUPT_MASK_FROM_ISR()
Definition: FreeRTOS.h:259

Definition at line 69 of file stream_buffer.c.

◆ sbSEND_COMPLETE_FROM_ISR

#define sbSEND_COMPLETE_FROM_ISR (   pxStreamBuffer,
  pxHigherPriorityTaskWoken 
)
Value:
{ \
UBaseType_t uxSavedInterruptStatus; \
\
uxSavedInterruptStatus = ( UBaseType_t ) portSET_INTERRUPT_MASK_FROM_ISR(); \
{ \
if( ( pxStreamBuffer )->xTaskWaitingToReceive != NULL ) \
{ \
( void ) xTaskNotifyFromISR( ( pxStreamBuffer )->xTaskWaitingToReceive, \
( uint32_t ) 0, \
pxHigherPriorityTaskWoken ); \
( pxStreamBuffer )->xTaskWaitingToReceive = NULL; \
} \
} \
portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); \
}
Definition: task.h:84
#define NULL
Definition: nm_bsp.h:52
#define xTaskNotifyFromISR(xTaskToNotify, ulValue, eAction, pxHigherPriorityTaskWoken)
Definition: task.h:1858
unsigned long UBaseType_t
Definition: portmacro.h:58
#define portSET_INTERRUPT_MASK_FROM_ISR()
Definition: FreeRTOS.h:259

Definition at line 108 of file stream_buffer.c.

◆ sbSEND_COMPLETED

#define sbSEND_COMPLETED (   pxStreamBuffer)
Value:
{ \
if( ( pxStreamBuffer )->xTaskWaitingToReceive != NULL ) \
{ \
( void ) xTaskNotify( ( pxStreamBuffer )->xTaskWaitingToReceive, \
( uint32_t ) 0, \
eNoAction ); \
( pxStreamBuffer )->xTaskWaitingToReceive = NULL; \
} \
} \
( void ) xTaskResumeAll();
Definition: task.h:84
void vTaskSuspendAll(void) PRIVILEGED_FUNCTION
Definition: tasks.c:2034
#define NULL
Definition: nm_bsp.h:52
#define xTaskNotify(xTaskToNotify, ulValue, eAction)
Definition: task.h:1767
BaseType_t xTaskResumeAll(void) PRIVILEGED_FUNCTION
Definition: tasks.c:2107

Definition at line 93 of file stream_buffer.c.

Typedef Documentation

◆ StreamBuffer_t

Function Documentation

◆ prvBytesInBuffer()

static size_t prvBytesInBuffer ( const StreamBuffer_t *const  pxStreamBuffer)
static

Definition at line 1118 of file stream_buffer.c.

◆ prvInitialiseNewStreamBuffer()

static void prvInitialiseNewStreamBuffer ( StreamBuffer_t *const  pxStreamBuffer,
uint8_t *const  pucBuffer,
size_t  xBufferSizeBytes,
size_t  xTriggerLevelBytes,
BaseType_t  xIsMessageBuffer 
)
static

Definition at line 1138 of file stream_buffer.c.

◆ prvReadBytesFromBuffer()

static size_t prvReadBytesFromBuffer ( StreamBuffer_t pxStreamBuffer,
uint8_t *  pucData,
size_t  xMaxCount,
size_t  xBytesAvailable 
)
static

Definition at line 1063 of file stream_buffer.c.

◆ prvReadMessageFromBuffer()

static size_t prvReadMessageFromBuffer ( StreamBuffer_t pxStreamBuffer,
void *  pvRxData,
size_t  xBufferLengthBytes,
size_t  xBytesAvailable,
size_t  xBytesToStoreMessageLength 
)
static

Definition at line 849 of file stream_buffer.c.

◆ prvWriteBytesToBuffer()

static size_t prvWriteBytesToBuffer ( StreamBuffer_t *const  pxStreamBuffer,
const uint8_t *  pucData,
size_t  xCount 
)
static

Definition at line 1017 of file stream_buffer.c.

◆ prvWriteMessageToBuffer()

static size_t prvWriteMessageToBuffer ( StreamBuffer_t *const  pxStreamBuffer,
const void *  pvTxData,
size_t  xDataLengthBytes,
size_t  xSpace,
size_t  xRequiredSpace 
)
static

Definition at line 636 of file stream_buffer.c.

◆ vStreamBufferDelete()

void vStreamBufferDelete ( StreamBufferHandle_t  xStreamBuffer)

Definition at line 332 of file stream_buffer.c.

◆ xStreamBufferBytesAvailable()

size_t xStreamBufferBytesAvailable ( StreamBufferHandle_t  xStreamBuffer)

Definition at line 472 of file stream_buffer.c.

◆ xStreamBufferIsEmpty()

BaseType_t xStreamBufferIsEmpty ( StreamBufferHandle_t  xStreamBuffer)

Definition at line 899 of file stream_buffer.c.

◆ xStreamBufferIsFull()

BaseType_t xStreamBufferIsFull ( StreamBufferHandle_t  xStreamBuffer)

Definition at line 922 of file stream_buffer.c.

◆ xStreamBufferReceive()

size_t xStreamBufferReceive ( StreamBufferHandle_t  xStreamBuffer,
void *  pvRxData,
size_t  xBufferLengthBytes,
TickType_t  xTicksToWait 
)

Definition at line 688 of file stream_buffer.c.

◆ xStreamBufferReceiveCompletedFromISR()

BaseType_t xStreamBufferReceiveCompletedFromISR ( StreamBufferHandle_t  xStreamBuffer,
BaseType_t pxHigherPriorityTaskWoken 
)

Definition at line 987 of file stream_buffer.c.

◆ xStreamBufferReceiveFromISR()

size_t xStreamBufferReceiveFromISR ( StreamBufferHandle_t  xStreamBuffer,
void *  pvRxData,
size_t  xBufferLengthBytes,
BaseType_t *const  pxHigherPriorityTaskWoken 
)

Definition at line 792 of file stream_buffer.c.

◆ xStreamBufferReset()

BaseType_t xStreamBufferReset ( StreamBufferHandle_t  xStreamBuffer)

Definition at line 365 of file stream_buffer.c.

◆ xStreamBufferSend()

size_t xStreamBufferSend ( StreamBufferHandle_t  xStreamBuffer,
const void *  pvTxData,
size_t  xDataLengthBytes,
TickType_t  xTicksToWait 
)

Definition at line 484 of file stream_buffer.c.

◆ xStreamBufferSendCompletedFromISR()

BaseType_t xStreamBufferSendCompletedFromISR ( StreamBufferHandle_t  xStreamBuffer,
BaseType_t pxHigherPriorityTaskWoken 
)

Definition at line 957 of file stream_buffer.c.

◆ xStreamBufferSendFromISR()

size_t xStreamBufferSendFromISR ( StreamBufferHandle_t  xStreamBuffer,
const void *  pvTxData,
size_t  xDataLengthBytes,
BaseType_t *const  pxHigherPriorityTaskWoken 
)

Definition at line 585 of file stream_buffer.c.

◆ xStreamBufferSetTriggerLevel()

BaseType_t xStreamBufferSetTriggerLevel ( StreamBufferHandle_t  xStreamBuffer,
size_t  xTriggerLevel 
)

Definition at line 419 of file stream_buffer.c.

◆ xStreamBufferSpacesAvailable()

size_t xStreamBufferSpacesAvailable ( StreamBufferHandle_t  xStreamBuffer)

Definition at line 448 of file stream_buffer.c.



inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:18:00