refactor(freertos): Refactor usage of portSTACK_TYPE to StackType_t

portSTACK_TYPE is an internal macro defined by the porting layer. This commit
changes all references to StackType_t which is the official type exposed by
FreeRTOS.
This commit is contained in:
Darian Leung 2023-07-31 16:59:41 +02:00
parent 02f5b9a898
commit 1e51387222
4 changed files with 12 additions and 10 deletions

View File

@ -133,9 +133,10 @@ static void prvFatalError( const char *pcCall, int iErrno )
/*
* See header file for description.
*/
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack,
portSTACK_TYPE *pxEndOfStack,
TaskFunction_t pxCode, void *pvParameters )
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack,
StackType_t *pxEndOfStack,
TaskFunction_t pxCode,
void *pvParameters )
{
Thread_t *thread;
pthread_attr_t xThreadAttributes;
@ -148,7 +149,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack,
* Store the additional thread data at the start of the stack.
*/
thread = (Thread_t *)(pxTopOfStack + 1) - 1;
pxTopOfStack = (portSTACK_TYPE *)thread - 1;
pxTopOfStack = (StackType_t *)thread - 1;
ulStackSize = (pxTopOfStack + 1 - pxEndOfStack) * sizeof(*pxTopOfStack);
thread->pxCode = pxCode;

View File

@ -124,9 +124,10 @@ static void prvFatalError( const char *pcCall, int iErrno )
/*
* See header file for description.
*/
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack,
portSTACK_TYPE *pxEndOfStack,
TaskFunction_t pxCode, void *pvParameters )
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack,
StackType_t *pxEndOfStack,
TaskFunction_t pxCode,
void *pvParameters )
{
Thread_t *thread;
pthread_attr_t xThreadAttributes;
@ -139,7 +140,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack,
* Store the additional thread data at the start of the stack.
*/
thread = (Thread_t *)(pxTopOfStack + 1) - 1;
pxTopOfStack = (portSTACK_TYPE *)thread - 1;
pxTopOfStack = (StackType_t *)thread - 1;
ulStackSize = (pxTopOfStack + 1 - pxEndOfStack) * sizeof(*pxTopOfStack);
thread->pxCode = pxCode;

View File

@ -25,7 +25,7 @@
* pthread has a minimal stack size which currently is 16KB.
* The rest is for additional structures of the POSIX/Linux port.
* This is a magic number since PTHREAD_STACK_MIN seems to not be a constant. */
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) ( 0x4000 + 40 ) / sizeof( portSTACK_TYPE ) )
#define configMINIMAL_STACK_SIZE ( ( StackType_t ) ( 0x4000 + 40 ) / sizeof( StackType_t ) )
/* Currently not used in Linux POSIX simulator */
#define configMAX_API_CALL_INTERRUPT_PRIORITY 0

View File

@ -42,7 +42,7 @@ void another_external_stack_function(void)
TEST_CASE("test printf using shared buffer stack", "[newlib]")
{
portSTACK_TYPE *shared_stack = malloc(SHARED_STACK_SIZE);
StackType_t *shared_stack = malloc(SHARED_STACK_SIZE);
TEST_ASSERT_NOT_NULL(shared_stack);