mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-11 13:54:16 -04:00
Update demo project for Tensilita - work in progres..
Add support for POSIX style errno - work in progress.
This commit is contained in:
parent
78d20e2854
commit
722ca8fb2b
8 changed files with 279 additions and 328 deletions
|
@ -806,6 +806,10 @@ extern "C" {
|
|||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_POSIX_ERRNO
|
||||
#define configUSE_POSIX_ERRNO 0
|
||||
#endif
|
||||
|
||||
#ifndef portTICK_TYPE_IS_ATOMIC
|
||||
#define portTICK_TYPE_IS_ATOMIC 0
|
||||
#endif
|
||||
|
@ -928,6 +932,10 @@ V8 if desired. */
|
|||
#define pdTASK_CODE TaskFunction_t
|
||||
#define xListItem ListItem_t
|
||||
#define xList List_t
|
||||
|
||||
/* For libraries that break the list data hiding, and access list structure
|
||||
members directly (which is not supposed to be done). */
|
||||
#define pxContainer pvContainer
|
||||
#endif /* configENABLE_BACKWARD_COMPATIBILITY */
|
||||
|
||||
#if( configUSE_ALTERNATIVE_API != 0 )
|
||||
|
@ -1033,7 +1041,9 @@ typedef struct xSTATIC_TCB
|
|||
#if( INCLUDE_xTaskAbortDelay == 1 )
|
||||
uint8_t ucDummy21;
|
||||
#endif
|
||||
|
||||
#if ( configUSE_POSIX_ERRNO == 1 )
|
||||
int iDummy22;
|
||||
#endif
|
||||
} StaticTask_t;
|
||||
|
||||
/*
|
||||
|
|
|
@ -78,6 +78,12 @@ typedef unsigned long UBaseType_t;
|
|||
#define portBYTE_ALIGNMENT 8
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Compiler directives. */
|
||||
#define portWEAK_SYMBOL __attribute__( ( weak ) )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Scheduler utilities. */
|
||||
#define portYIELD() \
|
||||
{ \
|
||||
|
|
|
@ -336,6 +336,10 @@ typedef struct TaskControlBlock_t
|
|||
uint8_t ucDelayAborted;
|
||||
#endif
|
||||
|
||||
#if( configUSE_POSIX_ERRNO == 1 )
|
||||
int iTaskErrno;
|
||||
#endif
|
||||
|
||||
} tskTCB;
|
||||
|
||||
/* The old tskTCB name is maintained above then typedefed to the new TCB_t name
|
||||
|
@ -365,6 +369,12 @@ PRIVILEGED_DATA static List_t xPendingReadyList; /*< Tasks that have been r
|
|||
|
||||
#endif
|
||||
|
||||
/* Global POSIX errno. Its value is changed upon context switching to match
|
||||
the errno of the currently running task. */
|
||||
#if ( configUSE_POSIX_ERRNO == 1 )
|
||||
int FreeRTOS_errno = 0;
|
||||
#endif
|
||||
|
||||
/* Other file private variables. --------------------------------*/
|
||||
PRIVILEGED_DATA static volatile UBaseType_t uxCurrentNumberOfTasks = ( UBaseType_t ) 0U;
|
||||
PRIVILEGED_DATA static volatile TickType_t xTickCount = ( TickType_t ) configINITIAL_TICK_COUNT;
|
||||
|
@ -2919,11 +2929,25 @@ void vTaskSwitchContext( void )
|
|||
/* Check for stack overflow, if configured. */
|
||||
taskCHECK_FOR_STACK_OVERFLOW();
|
||||
|
||||
/* Before the currently running task is switched out, save its errno. */
|
||||
#if( configUSE_POSIX_ERRNO == 1 )
|
||||
{
|
||||
pxCurrentTCB->iTaskErrno = FreeRTOS_errno;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Select a new task to run using either the generic C or port
|
||||
optimised asm code. */
|
||||
taskSELECT_HIGHEST_PRIORITY_TASK(); /*lint !e9079 void * is used as this macro is used with timers and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */
|
||||
traceTASK_SWITCHED_IN();
|
||||
|
||||
/* After the new task is switched in, update the global errno. */
|
||||
#if( configUSE_POSIX_ERRNO == 1 )
|
||||
{
|
||||
FreeRTOS_errno = pxCurrentTCB->iTaskErrno;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ( configUSE_NEWLIB_REENTRANT == 1 )
|
||||
{
|
||||
/* Switch Newlib's _impure_ptr variable to point to the _reent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue