Add configUSE_STREAM_BUFFERS macro in MPU wrapper files

This commit is contained in:
Rahul Kar 2024-02-14 18:17:28 +00:00
parent 57d6dbac67
commit 3db6620d18
2 changed files with 515 additions and 424 deletions

View file

@ -2139,6 +2139,7 @@
#endif /* #if ( configUSE_EVENT_GROUPS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
const void * pvTxData,
size_t xDataLengthBytes,
@ -2164,8 +2165,10 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
size_t MPU_xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
{
size_t xReturn;
@ -2188,8 +2191,10 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
size_t MPU_xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer,
void * pvRxData,
size_t xBufferLengthBytes,
@ -2215,8 +2220,10 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
void MPU_vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
{
if( portIS_PRIVILEGED() == pdFALSE )
@ -2235,8 +2242,10 @@
vStreamBufferDelete( xStreamBuffer );
}
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
BaseType_t MPU_xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
{
BaseType_t xReturn;
@ -2259,8 +2268,10 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
BaseType_t MPU_xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
{
BaseType_t xReturn;
@ -2283,8 +2294,10 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
BaseType_t MPU_xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
{
BaseType_t xReturn;
@ -2307,8 +2320,10 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
size_t MPU_xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
{
size_t xReturn;
@ -2330,8 +2345,10 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
size_t MPU_xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
{
size_t xReturn;
@ -2354,8 +2371,10 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
BaseType_t MPU_xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer,
size_t xTriggerLevel ) /* FREERTOS_SYSTEM_CALL */
{
@ -2379,9 +2398,10 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
#if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_STREAM_BUFFERS == 1 ) )
StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes,
size_t xTriggerLevelBytes,
BaseType_t xIsMessageBuffer,
@ -2432,10 +2452,10 @@
return xReturn;
}
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
#endif /* #if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_STREAM_BUFFERS == 1 ) ) */
/*-----------------------------------------------------------*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_STREAM_BUFFERS == 1 ) )
StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
size_t xTriggerLevelBytes,
BaseType_t xIsMessageBuffer,
@ -2492,7 +2512,7 @@
return xReturn;
}
#endif /* configSUPPORT_STATIC_ALLOCATION */
#endif /* #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_STREAM_BUFFERS == 1 ) ) */
/*-----------------------------------------------------------*/

View file

@ -225,6 +225,7 @@
#endif /* #if ( configUSE_EVENT_GROUPS == 1 ) */
#if ( configUSE_STREAM_BUFFERS == 1 )
/*
* Wrappers to keep all the casting in one place for Stream Buffer APIs.
*/
@ -232,6 +233,8 @@
#define MPU_GetStreamBufferHandleAtIndex( lIndex ) ( StreamBufferHandle_t ) MPU_GetHandleAtIndex( ( lIndex ), KERNEL_OBJECT_TYPE_STREAM_BUFFER )
#define MPU_GetIndexForStreamBufferHandle( xHandle ) MPU_GetIndexForHandle( ( OpaqueObjectHandle_t ) ( xHandle ), KERNEL_OBJECT_TYPE_STREAM_BUFFER )
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
#if ( configUSE_TIMERS == 1 )
/*
* Wrappers to keep all the casting in one place for Timer APIs.
@ -4342,6 +4345,8 @@
/* MPU wrappers for stream buffer APIs. */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
size_t MPU_xStreamBufferSendImpl( StreamBufferHandle_t xStreamBuffer,
const void * pvTxData,
size_t xDataLengthBytes,
@ -4387,8 +4392,12 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
size_t MPU_xStreamBufferReceiveImpl( StreamBufferHandle_t xStreamBuffer,
void * pvRxData,
size_t xBufferLengthBytes,
@ -4434,8 +4443,12 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
BaseType_t MPU_xStreamBufferIsFullImpl( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xStreamBufferIsFullImpl( StreamBufferHandle_t xStreamBuffer ) /* PRIVILEGED_FUNCTION */
@ -4464,8 +4477,12 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
BaseType_t MPU_xStreamBufferIsEmptyImpl( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xStreamBufferIsEmptyImpl( StreamBufferHandle_t xStreamBuffer ) /* PRIVILEGED_FUNCTION */
@ -4494,8 +4511,12 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
size_t MPU_xStreamBufferSpacesAvailableImpl( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
size_t MPU_xStreamBufferSpacesAvailableImpl( StreamBufferHandle_t xStreamBuffer ) /* PRIVILEGED_FUNCTION */
@ -4524,8 +4545,12 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
size_t MPU_xStreamBufferBytesAvailableImpl( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
size_t MPU_xStreamBufferBytesAvailableImpl( StreamBufferHandle_t xStreamBuffer ) /* PRIVILEGED_FUNCTION */
@ -4554,8 +4579,12 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
BaseType_t MPU_xStreamBufferSetTriggerLevelImpl( StreamBufferHandle_t xStreamBuffer,
size_t xTriggerLevel ) PRIVILEGED_FUNCTION;
@ -4586,8 +4615,12 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
size_t MPU_xStreamBufferNextMessageLengthBytesImpl( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
size_t MPU_xStreamBufferNextMessageLengthBytesImpl( StreamBufferHandle_t xStreamBuffer ) /* PRIVILEGED_FUNCTION */
@ -4616,6 +4649,8 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
/* Privileged only wrappers for Stream Buffer APIs. These are needed so that
@ -4623,7 +4658,7 @@
* with all the APIs. */
/*-----------------------------------------------------------*/
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
#if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_STREAM_BUFFERS == 1 ) )
StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes,
size_t xTriggerLevelBytes,
@ -4675,10 +4710,10 @@
return xExternalStreamBufferHandle;
}
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
#endif /* #if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_STREAM_BUFFERS == 1 ) ) */
/*-----------------------------------------------------------*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_STREAM_BUFFERS == 1 ) )
StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
size_t xTriggerLevelBytes,
@ -4734,9 +4769,11 @@
return xExternalStreamBufferHandle;
}
#endif /* configSUPPORT_STATIC_ALLOCATION */
#endif /* #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_STREAM_BUFFERS == 1 ) ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
void MPU_vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) /* PRIVILEGED_FUNCTION */
{
StreamBufferHandle_t xInternalStreamBufferHandle = NULL;
@ -4756,8 +4793,12 @@
MPU_SetIndexFreeInKernelObjectPool( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
}
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
BaseType_t MPU_xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) /* PRIVILEGED_FUNCTION */
{
BaseType_t xReturn = pdFALSE;
@ -4778,9 +4819,11 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_STREAM_BUFFERS == 1 ) )
BaseType_t MPU_xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffers,
uint8_t * ppucStreamBufferStorageArea,
@ -4805,9 +4848,11 @@
return xReturn;
}
#endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
#endif /* #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_STREAM_BUFFERS == 1 ) ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
size_t MPU_xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer,
const void * pvTxData,
size_t xDataLengthBytes,
@ -4831,8 +4876,12 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
size_t MPU_xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer,
void * pvRxData,
size_t xBufferLengthBytes,
@ -4856,8 +4905,12 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
BaseType_t MPU_xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer,
BaseType_t * pxHigherPriorityTaskWoken ) /* PRIVILEGED_FUNCTION */
{
@ -4879,8 +4932,12 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
#if ( configUSE_STREAM_BUFFERS == 1 )
BaseType_t MPU_xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer,
BaseType_t * pxHigherPriorityTaskWoken ) /*PRIVILEGED_FUNCTION */
{
@ -4903,6 +4960,8 @@
return xReturn;
}
#endif /* #if ( configUSE_STREAM_BUFFERS == 1 ) */
/*-----------------------------------------------------------*/
/* Functions that the application writer wants to execute in privileged mode
@ -5154,6 +5213,7 @@
( UBaseType_t ) 0, /* SYSTEM_CALL_vEventGroupSetNumber. */
#endif
#if ( configUSE_STREAM_BUFFERS == 1 )
( UBaseType_t ) MPU_xStreamBufferSendImpl, /* SYSTEM_CALL_xStreamBufferSend. */
( UBaseType_t ) MPU_xStreamBufferReceiveImpl, /* SYSTEM_CALL_xStreamBufferReceive. */
( UBaseType_t ) MPU_xStreamBufferIsFullImpl, /* SYSTEM_CALL_xStreamBufferIsFull. */
@ -5162,6 +5222,17 @@
( UBaseType_t ) MPU_xStreamBufferBytesAvailableImpl, /* SYSTEM_CALL_xStreamBufferBytesAvailable. */
( UBaseType_t ) MPU_xStreamBufferSetTriggerLevelImpl, /* SYSTEM_CALL_xStreamBufferSetTriggerLevel. */
( UBaseType_t ) MPU_xStreamBufferNextMessageLengthBytesImpl /* SYSTEM_CALL_xStreamBufferNextMessageLengthBytes. */
#else
( UBaseType_t ) 0, /* SYSTEM_CALL_xStreamBufferSend. */
( UBaseType_t ) 0, /* SYSTEM_CALL_xStreamBufferReceive. */
( UBaseType_t ) 0, /* SYSTEM_CALL_xStreamBufferIsFull. */
( UBaseType_t ) 0, /* SYSTEM_CALL_xStreamBufferIsEmpty. */
( UBaseType_t ) 0, /* SYSTEM_CALL_xStreamBufferSpacesAvailable. */
( UBaseType_t ) 0, /* SYSTEM_CALL_xStreamBufferBytesAvailable. */
( UBaseType_t ) 0, /* SYSTEM_CALL_xStreamBufferSetTriggerLevel. */
( UBaseType_t ) 0, /* SYSTEM_CALL_xStreamBufferNextMessageLengthBytes. */
#endif
};
/*-----------------------------------------------------------*/