Style: uncrusitfy

This commit is contained in:
Alfred Gedeon 2020-07-01 22:27:40 -07:00 committed by alfred gedeon
parent a5dbc2b1de
commit 718178c68a
406 changed files with 108795 additions and 106323 deletions

View file

@ -29,23 +29,22 @@
* \brief exception processing for freertos
*/
// #include "embARC.h"
/* #include "embARC.h" */
#include "arc_freertos_exceptions.h"
#ifdef __GNU__
extern void gnu_printf_setup(void);
extern void gnu_printf_setup( void );
#endif
/**
* \brief freertos related cpu exception initialization, all the interrupts handled by freertos must be not
* fast irqs. If fiq is needed, please install the default firq_exc_entry or your own fast irq entry into
* the specific interrupt exception.
*/
void freertos_exc_init(void)
void freertos_exc_init( void )
{
#ifdef __GNU__
gnu_printf_setup();
#endif
#ifdef __GNU__
gnu_printf_setup();
#endif
}

View file

@ -31,14 +31,14 @@
* here, all arc cpu exceptions share the same entry, also for all interrupt
* exceptions
*/
extern void exc_entry_cpu(void); /* cpu exception entry for freertos */
extern void exc_entry_int(void); /* int exception entry for freertos */
extern void exc_entry_cpu( void ); /* cpu exception entry for freertos */
extern void exc_entry_int( void ); /* int exception entry for freertos */
/* task dispatch functions in .s */
extern void start_r(void);
extern void start_r( void );
extern void start_dispatch();
extern void dispatch();
extern void freertos_exc_init(void);
extern void freertos_exc_init( void );
#endif /* ARC_FREERTOS_EXCEPTIONS_H */
#endif /* ARC_FREERTOS_EXCEPTIONS_H */

View file

@ -24,181 +24,213 @@
*
*/
#if defined(__MW__)
#if defined( __MW__ )
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "FreeRTOS.h"
#include "FreeRTOS.h"
#include "queue.h"
#include "semphr.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "task.h"
#include "arc/arc_exception.h"
#include "embARC_toolchain.h"
#include "embARC_debug.h"
#include "arc/arc_exception.h"
#include "embARC_toolchain.h"
#include "embARC_debug.h"
#ifdef ENABLE_FREERTOS_TLS_DEBUG
#define TLS_DEBUG(fmt, ...) EMBARC_PRINTF(fmt, ##__VA_ARGS__)
#else
#define TLS_DEBUG(fmt, ...)
#endif
#ifdef ENABLE_FREERTOS_TLS_DEBUG
#define TLS_DEBUG( fmt, ... ) EMBARC_PRINTF( fmt, ## __VA_ARGS__ )
#else
#define TLS_DEBUG( fmt, ... )
#endif
/*
* Runtime routines to execute constructors and
* destructors for task local storage.
*/
extern void __mw_run_tls_dtor();
extern void __mw_run_tls_ctor();
extern void __mw_run_tls_dtor();
extern void __mw_run_tls_ctor();
/*
* Linker generated symbols to mark .tls section addresses
* first byte .. last byte
*/
extern char _ftls[], _etls[];
#pragma weak _ftls
#pragma weak _etls
extern char _ftls[], _etls[];
#pragma weak _ftls
#pragma weak _etls
void executable_requires_tls_section(void)
{
#if _ARC
for (;;) {
_flag(1);
_nop();
_nop();
_nop();
_nop();
_nop();
}
#endif
}
#pragma off_inline(executable_requires_tls_section);
#pragma alias(executable_requires_tls_section, "executable_requires_.tls_section");
void executable_requires_tls_section( void )
{
#if _ARC
for( ; ; )
{
_flag( 1 );
_nop();
_nop();
_nop();
_nop();
_nop();
}
#endif
}
#pragma off_inline(executable_requires_tls_section);
#pragma alias(executable_requires_tls_section, "executable_requires_.tls_section");
static void* init_task_tls(void)
{
uint32_t len = (uint32_t)(_etls - _ftls);
void *tls = NULL;
static void * init_task_tls( void )
{
uint32_t len = ( uint32_t ) ( _etls - _ftls );
void * tls = NULL;
#if FREERTOS_HEAP_SEL == 3
#warning "FreeRTOS TLS support is not compatible with heap 3 solution(FREERTOS_HEAP_SEL=3)!"
#warning "You can change FREERTOS_HEAP_SEL in freertos.mk to select other heap solution."
#else
tls = pvPortMalloc(len);
#endif
if (tls) {
TLS_DEBUG("Malloc task tls:%dbytes\r\n", len);
memcpy(tls, _ftls, len);
__mw_run_tls_ctor(); // Run constructors
}
return tls;
}
#if FREERTOS_HEAP_SEL == 3
#warning "FreeRTOS TLS support is not compatible with heap 3 solution(FREERTOS_HEAP_SEL=3)!"
#warning "You can change FREERTOS_HEAP_SEL in freertos.mk to select other heap solution."
#else
tls = pvPortMalloc( len );
#endif
static void free_task_tls(void *pxTCB)
{
TaskHandle_t task2free = (TaskHandle_t)pxTCB;
if( tls )
{
TLS_DEBUG( "Malloc task tls:%dbytes\r\n", len );
memcpy( tls, _ftls, len );
__mw_run_tls_ctor(); /* Run constructors */
}
if (task2free != NULL) {
void *tls = pvTaskGetThreadLocalStoragePointer(task2free, 0);
if (tls) {
TLS_DEBUG("Free task tls\r\n");
__mw_run_tls_dtor();
vPortFree(tls);
vTaskSetThreadLocalStoragePointer(task2free, 0, NULL);
}
}
}
return tls;
}
void task_end_hook(void *pxTCB)
{
free_task_tls(pxTCB);
}
static void free_task_tls( void * pxTCB )
{
TaskHandle_t task2free = ( TaskHandle_t ) pxTCB;
static void* get_isr_tls(void)
{
// In an ISR
static int first = 1;
if (_Rarely(first)) {
first = 0;
__mw_run_tls_ctor(); // Run constructors
}
return (void *)_ftls;
}
#pragma off_inline(get_isr_tls)
if( task2free != NULL )
{
void * tls = pvTaskGetThreadLocalStoragePointer( task2free, 0 );
static void* get_task_tls(void)
{
TaskHandle_t cur_task;
if( tls )
{
TLS_DEBUG( "Free task tls\r\n" );
__mw_run_tls_dtor();
vPortFree( tls );
vTaskSetThreadLocalStoragePointer( task2free, 0, NULL );
}
}
}
cur_task = xTaskGetCurrentTaskHandle();
if (cur_task == NULL) return get_isr_tls();
void *tls = pvTaskGetThreadLocalStoragePointer(cur_task, 0);
if (tls == NULL) {
tls = init_task_tls();
if (tls) {
vTaskSetThreadLocalStoragePointer(cur_task, 0, tls);
} else {
tls = get_isr_tls();
}
}
return tls;
}
#pragma off_inline(get_task_tls)
void task_end_hook( void * pxTCB )
{
free_task_tls( pxTCB );
}
#if _ARC /* for ARC XCALLs need to preserve flags */
extern void * _Preserve_flags _mwget_tls(void);
#endif
static void * get_isr_tls( void )
{
/* In an ISR */
static int first = 1;
if( _Rarely( first ) )
{
first = 0;
__mw_run_tls_ctor(); /* Run constructors */
}
return ( void * ) _ftls;
}
#pragma off_inline(get_isr_tls)
static void * get_task_tls( void )
{
TaskHandle_t cur_task;
cur_task = xTaskGetCurrentTaskHandle();
if( cur_task == NULL )
{
return get_isr_tls();
}
void * tls = pvTaskGetThreadLocalStoragePointer( cur_task, 0 );
if( tls == NULL )
{
tls = init_task_tls();
if( tls )
{
vTaskSetThreadLocalStoragePointer( cur_task, 0, tls );
}
else
{
tls = get_isr_tls();
}
}
return tls;
}
#pragma off_inline(get_task_tls)
#if _ARC /* for ARC XCALLs need to preserve flags */
extern void * _Preserve_flags _mwget_tls( void );
#endif
/*
* Back end gens calls to find local data for this task
*/
void* _mwget_tls(void)
{
if (_ftls == (char *)0) {
executable_requires_tls_section();
}
if (exc_sense()) { /* In ISR */
return get_isr_tls();
} else { /* In Task */
return get_task_tls();
}
}
void * _mwget_tls( void )
{
if( _ftls == ( char * ) 0 )
{
executable_requires_tls_section();
}
if( exc_sense() ) /* In ISR */
{
return get_isr_tls();
}
else /* In Task */
{
return get_task_tls();
}
}
// simple interface of thread safe
typedef xSemaphoreHandle _lock_t;
#if configUSE_RECURSIVE_MUTEXES != 1
#error "configUSE_RECURSIVE_MUTEXES in FreeRTOSConfig.h need to 1"
#endif
/* simple interface of thread safe */
typedef xSemaphoreHandle _lock_t;
#if configUSE_RECURSIVE_MUTEXES != 1
#error "configUSE_RECURSIVE_MUTEXES in FreeRTOSConfig.h need to 1"
#endif
void _mwmutex_create(_lock_t *mutex_ptr)
{
*mutex_ptr = xSemaphoreCreateRecursiveMutex();
}
void _mwmutex_create( _lock_t * mutex_ptr )
{
*mutex_ptr = xSemaphoreCreateRecursiveMutex();
}
void _mwmutex_delete(_lock_t *mutex_ptr)
{
if ((*mutex_ptr) != NULL) {
vSemaphoreDelete(*mutex_ptr);
}
}
void _mwmutex_delete( _lock_t * mutex_ptr )
{
if( ( *mutex_ptr ) != NULL )
{
vSemaphoreDelete( *mutex_ptr );
}
}
void _mwmutex_lock(_lock_t mutex)
{
if ((mutex) != NULL) {
while (xSemaphoreTakeRecursive(mutex, portMAX_DELAY) != pdTRUE);
}
}
void _mwmutex_lock( _lock_t mutex )
{
if( ( mutex ) != NULL )
{
while( xSemaphoreTakeRecursive( mutex, portMAX_DELAY ) != pdTRUE )
{
}
}
}
void _mwmutex_unlock(_lock_t mutex)
{
if ((mutex) != NULL) {
xSemaphoreGiveRecursive(mutex);
}
}
void _mwmutex_unlock( _lock_t mutex )
{
if( ( mutex ) != NULL )
{
xSemaphoreGiveRecursive( mutex );
}
}
#else
#else /* if defined( __MW__ ) */
#endif /* __MW__ */

View file

@ -39,40 +39,43 @@
#include "arc_freertos_exceptions.h"
volatile unsigned int ulCriticalNesting = 999UL;
volatile unsigned int context_switch_reqflg; /* task context switch request flag in exceptions and interrupts handling */
volatile unsigned int context_switch_reqflg; /* task context switch request flag in exceptions and interrupts handling */
/* --------------------------------------------------------------------------*/
/**
* @brief kernel tick interrupt handler of freertos
*/
/* ----------------------------------------------------------------------------*/
static void vKernelTick( void *ptr )
static void vKernelTick( void * ptr )
{
/* clear timer interrupt */
timer_int_clear(BOARD_OS_TIMER_ID);
board_timer_update(configTICK_RATE_HZ);
/* clear timer interrupt */
timer_int_clear( BOARD_OS_TIMER_ID );
board_timer_update( configTICK_RATE_HZ );
if (xTaskIncrementTick()) {
portYIELD_FROM_ISR(); /* need to make task switch */
}
if( xTaskIncrementTick() )
{
portYIELD_FROM_ISR(); /* need to make task switch */
}
}
/* --------------------------------------------------------------------------*/
/**
* @brief setup freertos kernel tick
*/
/* ----------------------------------------------------------------------------*/
static void prvSetupTimerInterrupt(void)
static void prvSetupTimerInterrupt( void )
{
unsigned int cyc = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
unsigned int cyc = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
int_disable(BOARD_OS_TIMER_INTNO); /* disable os timer interrupt */
timer_stop(BOARD_OS_TIMER_ID);
timer_start(BOARD_OS_TIMER_ID, TIMER_CTRL_IE | TIMER_CTRL_NH, cyc);
int_disable( BOARD_OS_TIMER_INTNO ); /* disable os timer interrupt */
timer_stop( BOARD_OS_TIMER_ID );
timer_start( BOARD_OS_TIMER_ID, TIMER_CTRL_IE | TIMER_CTRL_NH, cyc );
int_handler_install(BOARD_OS_TIMER_INTNO, (INT_HANDLER_T)vKernelTick);
int_pri_set(BOARD_OS_TIMER_INTNO, INT_PRI_MIN);
int_enable(BOARD_OS_TIMER_INTNO);
int_handler_install( BOARD_OS_TIMER_INTNO, ( INT_HANDLER_T ) vKernelTick );
int_pri_set( BOARD_OS_TIMER_INTNO, INT_PRI_MIN );
int_enable( BOARD_OS_TIMER_INTNO );
}
/*
@ -84,32 +87,35 @@ static void prvSetupTimerInterrupt(void)
* It's not efficient but simple.
*
*/
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
TaskFunction_t pxCode,
void * pvParameters )
{
/* To ensure asserts in tasks.c don't fail, although in this case the assert
is not really required. */
pxTopOfStack--;
/* To ensure asserts in tasks.c don't fail, although in this case the assert
* is not really required. */
pxTopOfStack--;
/* Setup the initial stack of the task. The stack is set exactly as
expected by the portRESTORE_CONTEXT() macro. */
/* Setup the initial stack of the task. The stack is set exactly as
* expected by the portRESTORE_CONTEXT() macro. */
/* When the task starts is will expect to find the function parameter in
R0. */
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
/* When the task starts is will expect to find the function parameter in
* R0. */
*pxTopOfStack = ( StackType_t ) pvParameters; /* R0 */
pxTopOfStack--;
*pxTopOfStack = ( StackType_t ) pxCode; /* function body */
pxTopOfStack--;
*pxTopOfStack = ( StackType_t ) pxCode; /* function body */
/* PC */
pxTopOfStack--;
*pxTopOfStack = ( StackType_t ) start_r; /* dispatch return address */
/* PC */
pxTopOfStack--;
*pxTopOfStack = ( StackType_t ) start_r; /* dispatch return address */
pxTopOfStack--;
*pxTopOfStack = (StackType_t) portNO_CRITICAL_NESTING;
return pxTopOfStack;
pxTopOfStack--;
*pxTopOfStack = ( StackType_t ) portNO_CRITICAL_NESTING;
return pxTopOfStack;
}
/* --------------------------------------------------------------------------*/
/**
* @brief start the freertos scheduler, go to the first task
*
@ -118,67 +124,70 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
/* ----------------------------------------------------------------------------*/
BaseType_t xPortStartScheduler( void )
{
/* Start the timer that generates the tick ISR. */
prvSetupTimerInterrupt();
start_dispatch();
/* Start the timer that generates the tick ISR. */
prvSetupTimerInterrupt();
start_dispatch();
/* Should not get here! */
return 0;
/* Should not get here! */
return 0;
}
/* --------------------------------------------------------------------------*/
/**
* @brief
*/
/* ----------------------------------------------------------------------------*/
void vPortEndScheduler( void )
{
}
/* --------------------------------------------------------------------------*/
/**
* @brief generate a task switch request in ISR
*/
/* ----------------------------------------------------------------------------*/
void vPortYieldFromIsr(void)
void vPortYieldFromIsr( void )
{
unsigned int status32;
unsigned int status32;
status32 = cpu_lock_save();
context_switch_reqflg = true;
cpu_unlock_restore(status32);
status32 = cpu_lock_save();
context_switch_reqflg = true;
cpu_unlock_restore( status32 );
}
/* --------------------------------------------------------------------------*/
/**
* @brief
*/
/* ----------------------------------------------------------------------------*/
void vPortYield(void)
void vPortYield( void )
{
unsigned int status32;
unsigned int status32;
status32 = cpu_lock_save();
dispatch();
cpu_unlock_restore(status32);
status32 = cpu_lock_save();
dispatch();
cpu_unlock_restore( status32 );
}
/* --------------------------------------------------------------------------*/
/**
* @brief
*/
/* ----------------------------------------------------------------------------*/
void vPortEndTask(void)
void vPortEndTask( void )
{
#if ( INCLUDE_vTaskDelete == 1 )
vTaskDelete( NULL ); /* Delete task itself */
#endif
#if ( INCLUDE_vTaskDelete == 1 )
vTaskDelete(NULL); /* Delete task itself */
#endif
while(1) { /* Yield to other task */
vPortYield();
}
while( 1 ) /* Yield to other task */
{
vPortYield();
}
}
#if ARC_FEATURE_STACK_CHECK
@ -189,94 +198,95 @@ void vPortEndTask(void)
* It's a copy from task.c. We need to konw the definition of TCB for the purpose of hardware
* stack check. Pls don't forget to update it when FreeRTOS is updated.
*/
typedef struct tskTaskControlBlock /* The old naming convention is used to prevent breaking kernel aware debuggers. */
{
volatile StackType_t *pxTopOfStack; /*< Points to the location of the last item placed on the tasks stack. THIS MUST BE THE FIRST MEMBER OF THE TCB STRUCT. */
typedef struct tskTaskControlBlock /* The old naming convention is used to prevent breaking kernel aware debuggers. */
{
volatile StackType_t * pxTopOfStack; /*< Points to the location of the last item placed on the tasks stack. THIS MUST BE THE FIRST MEMBER OF THE TCB STRUCT. */
#if ( portUSING_MPU_WRAPPERS == 1 )
xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */
#endif
#if ( portUSING_MPU_WRAPPERS == 1 )
xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */
#endif
ListItem_t xStateListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
ListItem_t xEventListItem; /*< Used to reference a task from an event list. */
UBaseType_t uxPriority; /*< The priority of the task. 0 is the lowest priority. */
StackType_t *pxStack; /*< Points to the start of the stack. */
char pcTaskName[ configMAX_TASK_NAME_LEN ];/*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
ListItem_t xStateListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
ListItem_t xEventListItem; /*< Used to reference a task from an event list. */
UBaseType_t uxPriority; /*< The priority of the task. 0 is the lowest priority. */
StackType_t * pxStack; /*< Points to the start of the stack. */
char pcTaskName[ configMAX_TASK_NAME_LEN ]; /*< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
#if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
StackType_t *pxEndOfStack; /*< Points to the highest valid address for the stack. */
#endif
#if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
StackType_t * pxEndOfStack; /*< Points to the highest valid address for the stack. */
#endif
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
UBaseType_t uxCriticalNesting; /*< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */
#endif
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
UBaseType_t uxCriticalNesting; /*< Holds the critical section nesting depth for ports that do not maintain their own count in the port layer. */
#endif
#if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t uxTCBNumber; /*< Stores a number that increments each time a TCB is created. It allows debuggers to determine when a task has been deleted and then recreated. */
UBaseType_t uxTaskNumber; /*< Stores a number specifically for use by third party trace code. */
#endif
#if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t uxTCBNumber; /*< Stores a number that increments each time a TCB is created. It allows debuggers to determine when a task has been deleted and then recreated. */
UBaseType_t uxTaskNumber; /*< Stores a number specifically for use by third party trace code. */
#endif
#if ( configUSE_MUTEXES == 1 )
UBaseType_t uxBasePriority; /*< The priority last assigned to the task - used by the priority inheritance mechanism. */
UBaseType_t uxMutexesHeld;
#endif
#if ( configUSE_MUTEXES == 1 )
UBaseType_t uxBasePriority; /*< The priority last assigned to the task - used by the priority inheritance mechanism. */
UBaseType_t uxMutexesHeld;
#endif
#if ( configUSE_APPLICATION_TASK_TAG == 1 )
TaskHookFunction_t pxTaskTag;
#endif
#if ( configUSE_APPLICATION_TASK_TAG == 1 )
TaskHookFunction_t pxTaskTag;
#endif
#if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
void *pvThreadLocalStoragePointers[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
#endif
#if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
void * pvThreadLocalStoragePointers[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
#endif
#if( configGENERATE_RUN_TIME_STATS == 1 )
uint32_t ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */
#endif
#if ( configGENERATE_RUN_TIME_STATS == 1 )
uint32_t ulRunTimeCounter; /*< Stores the amount of time the task has spent in the Running state. */
#endif
#if ( configUSE_NEWLIB_REENTRANT == 1 )
/* Allocate a Newlib reent structure that is specific to this task.
Note Newlib support has been included by popular demand, but is not
used by the FreeRTOS maintainers themselves. FreeRTOS is not
responsible for resulting newlib operation. User must be familiar with
newlib and must provide system-wide implementations of the necessary
stubs. Be warned that (at the time of writing) the current newlib design
implements a system-wide malloc() that must be provided with locks. */
struct _reent xNewLib_reent;
#endif
#if ( configUSE_NEWLIB_REENTRANT == 1 )
#if( configUSE_TASK_NOTIFICATIONS == 1 )
volatile uint32_t ulNotifiedValue;
volatile uint8_t ucNotifyState;
#endif
/* Allocate a Newlib reent structure that is specific to this task.
* Note Newlib support has been included by popular demand, but is not
* used by the FreeRTOS maintainers themselves. FreeRTOS is not
* responsible for resulting newlib operation. User must be familiar with
* newlib and must provide system-wide implementations of the necessary
* stubs. Be warned that (at the time of writing) the current newlib design
* implements a system-wide malloc() that must be provided with locks. */
struct _reent xNewLib_reent;
#endif
/* See the comments above the definition of
tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE. */
#if( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 ) /*lint !e731 !e9029 Macro has been consolidated for readability reasons. */
uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the task is a statically allocated to ensure no attempt is made to free the memory. */
#endif
#if ( configUSE_TASK_NOTIFICATIONS == 1 )
volatile uint32_t ulNotifiedValue;
volatile uint8_t ucNotifyState;
#endif
#if( INCLUDE_xTaskAbortDelay == 1 )
uint8_t ucDelayAborted;
#endif
/* See the comments above the definition of
* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE. */
#if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 ) /*lint !e731 !e9029 Macro has been consolidated for readability reasons. */
uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the task is a statically allocated to ensure no attempt is made to free the memory. */
#endif
#if( configUSE_POSIX_ERRNO == 1 )
int iTaskErrno;
#endif
#if ( INCLUDE_xTaskAbortDelay == 1 )
uint8_t ucDelayAborted;
#endif
} tskTCB;
#if ( configUSE_POSIX_ERRNO == 1 )
int iTaskErrno;
#endif
} tskTCB;
void vPortSetStackCheck(TaskHandle_t old, TaskHandle_t new)
{
if (new != NULL) {
#if ARC_FEATURE_SEC_PRESENT
arc_aux_write(AUX_S_KSTACK_BASE, (uint32_t)(new->pxEndOfStack));
arc_aux_write(AUX_S_KSTACK_TOP, (uint32_t)(new->pxStack));
#else
arc_aux_write(AUX_KSTACK_BASE, (uint32_t)(new->pxEndOfStack));
arc_aux_write(AUX_KSTACK_TOP, (uint32_t)(new->pxStack));
#endif
}
}
#endif
void vPortSetStackCheck( TaskHandle_t old,
TaskHandle_t new )
{
if( new != NULL )
{
#if ARC_FEATURE_SEC_PRESENT
arc_aux_write( AUX_S_KSTACK_BASE, ( uint32_t ) ( new->pxEndOfStack ) );
arc_aux_write( AUX_S_KSTACK_TOP, ( uint32_t ) ( new->pxStack ) );
#else
arc_aux_write( AUX_KSTACK_BASE, ( uint32_t ) ( new->pxEndOfStack ) );
arc_aux_write( AUX_KSTACK_TOP, ( uint32_t ) ( new->pxStack ) );
#endif
}
}
#endif /* if ARC_FEATURE_STACK_CHECK */

View file

@ -25,16 +25,16 @@
*/
#ifndef PORTMACRO_H
#define PORTMACRO_H
#define PORTMACRO_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* record stack high address for stack check */
#ifndef configRECORD_STACK_HIGH_ADDRESS
#define configRECORD_STACK_HIGH_ADDRESS 1
#endif
#ifndef configRECORD_STACK_HIGH_ADDRESS
#define configRECORD_STACK_HIGH_ADDRESS 1
#endif
/*-----------------------------------------------------------
* Port specific definitions.
@ -47,111 +47,111 @@ extern "C" {
*/
/* Type definitions. */
#define portCHAR char
#define portFLOAT float
#define portDOUBLE double
#define portLONG long
#define portSHORT short
#define portSTACK_TYPE unsigned int
#define portBASE_TYPE portLONG
#define portCHAR char
#define portFLOAT float
#define portDOUBLE double
#define portLONG long
#define portSHORT short
#define portSTACK_TYPE unsigned int
#define portBASE_TYPE portLONG
#ifndef Inline
#define Inline static __inline__
#endif
#ifndef Asm
#define Asm __asm__ volatile
#endif
#ifndef Inline
#define Inline static __inline__
#endif
#ifndef Asm
#define Asm __asm__ volatile
#endif
/*
* normal constants
*/
#ifndef NULL
#define NULL 0 /* invalid pointer */
#endif /* NULL */
#ifndef NULL
#define NULL 0 /* invalid pointer */
#endif /* NULL */
#ifndef true
#define true 1 /* true */
#endif /* true */
#ifndef true
#define true 1 /* true */
#endif /* true */
#ifndef false
#define false 0 /* false */
#endif /* false */
#ifndef false
#define false 0 /* false */
#endif /* false */
typedef portSTACK_TYPE StackType_t;
typedef long BaseType_t;
typedef unsigned long UBaseType_t;
typedef portSTACK_TYPE StackType_t;
typedef long BaseType_t;
typedef unsigned long UBaseType_t;
#if( configUSE_16_BIT_TICKS == 1 )
typedef uint16_t TickType_t;
#define portMAX_DELAY ( TickType_t ) 0xffff
#else
typedef unsigned int TickType_t;
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
#endif
#if ( configUSE_16_BIT_TICKS == 1 )
typedef uint16_t TickType_t;
#define portMAX_DELAY ( TickType_t ) 0xffff
#else
typedef unsigned int TickType_t;
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
#endif
#define portNO_CRITICAL_NESTING 0x0
#define portSTACK_GROWTH ( -1 )
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
#define portBYTE_ALIGNMENT 8
#define portNOP() Asm( "nop_s" );
#define IPM_ENABLE_ALL 1
#define portNO_CRITICAL_NESTING 0x0
#define portSTACK_GROWTH ( -1 )
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
#define portBYTE_ALIGNMENT 8
#define portNOP() Asm( "nop_s" );
#define IPM_ENABLE_ALL 1
#define portYIELD_FROM_ISR() vPortYieldFromIsr()
#define portYIELD() vPortYield()
#define portYIELD_FROM_ISR() vPortYieldFromIsr()
#define portYIELD() vPortYield()
/* Critical section management. */
#define portDISABLE_INTERRUPTS() \
{ \
Asm("clri"); \
Asm("":::"memory"); \
} \
#define portDISABLE_INTERRUPTS() \
{ \
Asm( "clri" ); \
Asm( "" ::: "memory" ); \
} \
#define portENABLE_INTERRUPTS() \
{ \
Asm("":::"memory"); \
Asm("seti"); \
} \
extern volatile unsigned int ulCriticalNesting;
#define portENTER_CRITICAL() \
{ \
portDISABLE_INTERRUPTS() \
ulCriticalNesting++; \
}
#define portEXIT_CRITICAL() \
{ \
if (ulCriticalNesting > portNO_CRITICAL_NESTING) \
#define portENABLE_INTERRUPTS() \
{ \
ulCriticalNesting--; \
if (ulCriticalNesting == portNO_CRITICAL_NESTING) \
{ \
portENABLE_INTERRUPTS() \
} \
Asm( "" ::: "memory" ); \
Asm( "seti" ); \
} \
}
extern volatile unsigned int ulCriticalNesting;
#define portENTER_CRITICAL() \
{ \
portDISABLE_INTERRUPTS() \
ulCriticalNesting++; \
}
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
#define portEXIT_CRITICAL() \
{ \
if( ulCriticalNesting > portNO_CRITICAL_NESTING ) \
{ \
ulCriticalNesting--; \
if( ulCriticalNesting == portNO_CRITICAL_NESTING ) \
{ \
portENABLE_INTERRUPTS() \
} \
} \
}
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() do {} while (0) /* we use the timer */
#define portALT_GET_RUN_TIME_COUNTER_VALUE(dest) (dest = xTickCount)
#if defined(__MW__)
extern void task_end_hook(void *pxTCB);
#define portCLEAN_UP_TCB( pxTCB ) task_end_hook((void *)pxTCB)
#else
#define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB
#endif
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
void vPortYield(void);
void vPortYieldFromIsr(void);
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() do {} while( 0 ) /* we use the timer */
#define portALT_GET_RUN_TIME_COUNTER_VALUE( dest ) ( dest = xTickCount )
#ifdef __cplusplus
}
#endif
#if defined( __MW__ )
extern void task_end_hook( void * pxTCB );
#define portCLEAN_UP_TCB( pxTCB ) task_end_hook( ( void * ) pxTCB )
#else
#define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB
#endif
#endif /* PORTMACRO_H */
void vPortYield( void );
void vPortYieldFromIsr( void );
#ifdef __cplusplus
}
#endif
#endif /* PORTMACRO_H */