mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-12 09:07:46 -04:00
Style: revert more uncrustify files
This commit is contained in:
parent
fe9e37ca2b
commit
c272a13203
4 changed files with 927 additions and 960 deletions
119
portable/ThirdParty/GCC/ATmega/port.c
vendored
119
portable/ThirdParty/GCC/ATmega/port.c
vendored
|
@ -60,31 +60,31 @@
|
||||||
#define portTIMSK TIMSK0
|
#define portTIMSK TIMSK0
|
||||||
#define portTIFR TIFR0
|
#define portTIFR TIFR0
|
||||||
|
|
||||||
#endif /* if defined( portUSE_WDTO ) */
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/* We require the address of the pxCurrentTCB variable, but don't want to know
|
/* We require the address of the pxCurrentTCB variable, but don't want to know
|
||||||
* any details of its type. */
|
any details of its type. */
|
||||||
typedef void TCB_t;
|
typedef void TCB_t;
|
||||||
extern volatile TCB_t * volatile pxCurrentTCB;
|
extern volatile TCB_t * volatile pxCurrentTCB;
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable the watchdog timer, configuring it for expire after
|
Enable the watchdog timer, configuring it for expire after
|
||||||
* (value) timeout (which is a combination of the WDP0
|
(value) timeout (which is a combination of the WDP0
|
||||||
* through WDP3 bits).
|
through WDP3 bits).
|
||||||
*
|
|
||||||
* This function is derived from <avr/wdt.h> but enables only
|
This function is derived from <avr/wdt.h> but enables only
|
||||||
* the interrupt bit (WDIE), rather than the reset bit (WDE).
|
the interrupt bit (WDIE), rather than the reset bit (WDE).
|
||||||
*
|
|
||||||
* Can't find it documented but the WDT, once enabled,
|
Can't find it documented but the WDT, once enabled,
|
||||||
* rolls over and fires a new interrupt each time.
|
rolls over and fires a new interrupt each time.
|
||||||
*
|
|
||||||
* See also the symbolic constants WDTO_15MS et al.
|
See also the symbolic constants WDTO_15MS et al.
|
||||||
*
|
|
||||||
* Updated to match avr-libc 2.0.0
|
Updated to match avr-libc 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined( portUSE_WDTO)
|
#if defined( portUSE_WDTO)
|
||||||
|
@ -128,30 +128,29 @@ extern volatile TCB_t * volatile pxCurrentTCB;
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* if defined( portUSE_WDTO ) */
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable the watchdog timer, configuring it for expire after
|
Enable the watchdog timer, configuring it for expire after
|
||||||
* (value) timeout (which is a combination of the WDP0
|
(value) timeout (which is a combination of the WDP0
|
||||||
* through WDP3 bits).
|
through WDP3 bits).
|
||||||
*
|
|
||||||
* This function is derived from <avr/wdt.h> but enables both
|
This function is derived from <avr/wdt.h> but enables both
|
||||||
* the reset bit (WDE), and the interrupt bit (WDIE).
|
the reset bit (WDE), and the interrupt bit (WDIE).
|
||||||
*
|
|
||||||
* This will ensure that if the interrupt is not serviced
|
This will ensure that if the interrupt is not serviced
|
||||||
* before the second timeout, the AVR will reset.
|
before the second timeout, the AVR will reset.
|
||||||
*
|
|
||||||
* Servicing the interrupt automatically clears it,
|
Servicing the interrupt automatically clears it,
|
||||||
* and ensures the AVR does not reset.
|
and ensures the AVR does not reset.
|
||||||
*
|
|
||||||
* Can't find it documented but the WDT, once enabled,
|
Can't find it documented but the WDT, once enabled,
|
||||||
* rolls over and fires a new interrupt each time.
|
rolls over and fires a new interrupt each time.
|
||||||
*
|
|
||||||
* See also the symbolic constants WDTO_15MS et al.
|
See also the symbolic constants WDTO_15MS et al.
|
||||||
*
|
|
||||||
* Updated to match avr-libc 2.0.0
|
Updated to match avr-libc 2.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined( portUSE_WDTO)
|
#if defined( portUSE_WDTO)
|
||||||
|
@ -195,7 +194,7 @@ extern volatile TCB_t * volatile pxCurrentTCB;
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* if defined( portUSE_WDTO ) */
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -322,7 +321,7 @@ extern volatile TCB_t * volatile pxCurrentTCB;
|
||||||
"in __tmp_reg__, __SP_H__ \n\t" \
|
"in __tmp_reg__, __SP_H__ \n\t" \
|
||||||
"st x+, __tmp_reg__ \n\t" \
|
"st x+, __tmp_reg__ \n\t" \
|
||||||
);
|
);
|
||||||
#else /* if defined( __AVR_3_BYTE_PC__ ) && defined( __AVR_HAVE_RAMPZ__ ) */
|
#else
|
||||||
/* 2-Byte PC Save */
|
/* 2-Byte PC Save */
|
||||||
#define portSAVE_CONTEXT() \
|
#define portSAVE_CONTEXT() \
|
||||||
__asm__ __volatile__ ( "push __tmp_reg__ \n\t" \
|
__asm__ __volatile__ ( "push __tmp_reg__ \n\t" \
|
||||||
|
@ -368,7 +367,7 @@ extern volatile TCB_t * volatile pxCurrentTCB;
|
||||||
"in __tmp_reg__, __SP_H__ \n\t" \
|
"in __tmp_reg__, __SP_H__ \n\t" \
|
||||||
"st x+, __tmp_reg__ \n\t" \
|
"st x+, __tmp_reg__ \n\t" \
|
||||||
);
|
);
|
||||||
#endif /* if defined( __AVR_3_BYTE_PC__ ) && defined( __AVR_HAVE_RAMPZ__ ) */
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Opposite to portSAVE_CONTEXT(). Interrupts will have been disabled during
|
* Opposite to portSAVE_CONTEXT(). Interrupts will have been disabled during
|
||||||
|
@ -468,7 +467,7 @@ extern volatile TCB_t * volatile pxCurrentTCB;
|
||||||
"out __SREG__, __tmp_reg__ \n\t" \
|
"out __SREG__, __tmp_reg__ \n\t" \
|
||||||
"pop __tmp_reg__ \n\t" \
|
"pop __tmp_reg__ \n\t" \
|
||||||
);
|
);
|
||||||
#else /* if defined( __AVR_3_BYTE_PC__ ) && defined( __AVR_HAVE_RAMPZ__ ) */
|
#else
|
||||||
/* 2-Byte PC Restore */
|
/* 2-Byte PC Restore */
|
||||||
#define portRESTORE_CONTEXT() \
|
#define portRESTORE_CONTEXT() \
|
||||||
__asm__ __volatile__ ( "lds r26, pxCurrentTCB \n\t" \
|
__asm__ __volatile__ ( "lds r26, pxCurrentTCB \n\t" \
|
||||||
|
@ -512,7 +511,7 @@ extern volatile TCB_t * volatile pxCurrentTCB;
|
||||||
"out __SREG__, __tmp_reg__ \n\t" \
|
"out __SREG__, __tmp_reg__ \n\t" \
|
||||||
"pop __tmp_reg__ \n\t" \
|
"pop __tmp_reg__ \n\t" \
|
||||||
);
|
);
|
||||||
#endif /* if defined( __AVR_3_BYTE_PC__ ) && defined( __AVR_HAVE_RAMPZ__ ) */
|
#endif
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -524,17 +523,14 @@ static void prvSetupTimerInterrupt( void );
|
||||||
/*
|
/*
|
||||||
* See header file for description.
|
* See header file for description.
|
||||||
*/
|
*/
|
||||||
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
|
||||||
TaskFunction_t pxCode,
|
|
||||||
void * pvParameters )
|
|
||||||
{
|
{
|
||||||
uint16_t usAddress;
|
uint16_t usAddress;
|
||||||
|
|
||||||
/* Simulate how the stack would look after a call to vPortYield() generated by
|
/* Simulate how the stack would look after a call to vPortYield() generated by
|
||||||
* the compiler. */
|
the compiler. */
|
||||||
|
|
||||||
/* The start of the task code will be popped off the stack last, so place
|
/* The start of the task code will be popped off the stack last, so place
|
||||||
* it on first. */
|
it on first. */
|
||||||
usAddress = ( uint16_t ) pxCode;
|
usAddress = ( uint16_t ) pxCode;
|
||||||
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
|
@ -544,7 +540,6 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
|
|
||||||
#if defined(__AVR_3_BYTE_PC__)
|
#if defined(__AVR_3_BYTE_PC__)
|
||||||
|
|
||||||
/* The AVR ATmega2560/ATmega2561 have 256KBytes of program memory and a 17-bit
|
/* The AVR ATmega2560/ATmega2561 have 256KBytes of program memory and a 17-bit
|
||||||
* program counter. When a code address is stored on the stack, it takes 3 bytes
|
* program counter. When a code address is stored on the stack, it takes 3 bytes
|
||||||
* instead of 2 for the other ATmega* chips.
|
* instead of 2 for the other ATmega* chips.
|
||||||
|
@ -560,16 +555,15 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Next simulate the stack as if after a call to portSAVE_CONTEXT().
|
/* Next simulate the stack as if after a call to portSAVE_CONTEXT().
|
||||||
* portSAVE_CONTEXT places the flags on the stack immediately after r0
|
portSAVE_CONTEXT places the flags on the stack immediately after r0
|
||||||
* to ensure the interrupts get disabled as soon as possible, and so ensuring
|
to ensure the interrupts get disabled as soon as possible, and so ensuring
|
||||||
* the stack use is minimal should a context switch interrupt occur. */
|
the stack use is minimal should a context switch interrupt occur. */
|
||||||
*pxTopOfStack = ( StackType_t ) 0x00; /* R0 */
|
*pxTopOfStack = ( StackType_t ) 0x00; /* R0 */
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
*pxTopOfStack = portFLAGS_INT_ENABLED;
|
*pxTopOfStack = portFLAGS_INT_ENABLED;
|
||||||
pxTopOfStack--;
|
pxTopOfStack--;
|
||||||
|
|
||||||
#if defined(__AVR_3_BYTE_PC__)
|
#if defined(__AVR_3_BYTE_PC__)
|
||||||
|
|
||||||
/* If we have an ATmega256x, we are also saving the EIND register.
|
/* If we have an ATmega256x, we are also saving the EIND register.
|
||||||
* We should default to 0.
|
* We should default to 0.
|
||||||
*/
|
*/
|
||||||
|
@ -578,7 +572,6 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__AVR_HAVE_RAMPZ__)
|
#if defined(__AVR_HAVE_RAMPZ__)
|
||||||
|
|
||||||
/* We are saving the RAMPZ register.
|
/* We are saving the RAMPZ register.
|
||||||
* We should default to 0.
|
* We should default to 0.
|
||||||
*/
|
*/
|
||||||
|
@ -616,7 +609,7 @@ BaseType_t xPortStartScheduler( void )
|
||||||
portRESTORE_CONTEXT();
|
portRESTORE_CONTEXT();
|
||||||
|
|
||||||
/* Simulate a function call end as generated by the compiler. We will now
|
/* Simulate a function call end as generated by the compiler. We will now
|
||||||
* jump to the start of the task the context of which we have just restored. */
|
jump to the start of the task the context of which we have just restored. */
|
||||||
__asm__ __volatile__ ( "ret" );
|
__asm__ __volatile__ ( "ret" );
|
||||||
|
|
||||||
/* Should not get here. */
|
/* Should not get here. */
|
||||||
|
@ -670,12 +663,10 @@ void vPortYieldFromTick( void ) __attribute__( ( hot, flatten, naked ) );
|
||||||
void vPortYieldFromTick( void )
|
void vPortYieldFromTick( void )
|
||||||
{
|
{
|
||||||
portSAVE_CONTEXT();
|
portSAVE_CONTEXT();
|
||||||
|
|
||||||
if( xTaskIncrementTick() != pdFALSE )
|
if( xTaskIncrementTick() != pdFALSE )
|
||||||
{
|
{
|
||||||
vTaskSwitchContext();
|
vTaskSwitchContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
portRESTORE_CONTEXT();
|
portRESTORE_CONTEXT();
|
||||||
|
|
||||||
__asm__ __volatile__ ( "ret" );
|
__asm__ __volatile__ ( "ret" );
|
||||||
|
@ -683,7 +674,6 @@ void vPortYieldFromTick( void )
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
#if defined(portUSE_WDTO)
|
#if defined(portUSE_WDTO)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup WDT to generate a tick interrupt.
|
* Setup WDT to generate a tick interrupt.
|
||||||
*/
|
*/
|
||||||
|
@ -697,7 +687,6 @@ void vPortYieldFromTick( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined (portUSE_TIMER0)
|
#elif defined (portUSE_TIMER0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup Timer0 compare match A to generate a tick interrupt.
|
* Setup Timer0 compare match A to generate a tick interrupt.
|
||||||
*/
|
*/
|
||||||
|
@ -707,7 +696,7 @@ void vPortYieldFromTick( void )
|
||||||
uint8_t ucLowByte;
|
uint8_t ucLowByte;
|
||||||
|
|
||||||
/* Using 8bit Timer0 to generate the tick. Correct fuses must be
|
/* Using 8bit Timer0 to generate the tick. Correct fuses must be
|
||||||
* selected for the configCPU_CLOCK_HZ clock.*/
|
selected for the configCPU_CLOCK_HZ clock.*/
|
||||||
|
|
||||||
ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
|
ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
|
||||||
|
|
||||||
|
@ -718,7 +707,7 @@ void vPortYieldFromTick( void )
|
||||||
ulCompareMatch -= ( uint32_t ) 1;
|
ulCompareMatch -= ( uint32_t ) 1;
|
||||||
|
|
||||||
/* Setup compare match value for compare match A. Interrupts are disabled
|
/* Setup compare match value for compare match A. Interrupts are disabled
|
||||||
* before this is called so we need not worry here. */
|
before this is called so we need not worry here. */
|
||||||
ucLowByte = ( uint8_t ) ( ulCompareMatch & ( uint32_t ) 0xff );
|
ucLowByte = ( uint8_t ) ( ulCompareMatch & ( uint32_t ) 0xff );
|
||||||
portOCRL = ucLowByte;
|
portOCRL = ucLowByte;
|
||||||
|
|
||||||
|
@ -733,7 +722,7 @@ void vPortYieldFromTick( void )
|
||||||
portTIMSK = ucLowByte;
|
portTIMSK = ucLowByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* if defined( portUSE_WDTO ) */
|
#endif
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -748,7 +737,6 @@ void vPortYieldFromTick( void )
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
ISR(portSCHEDULER_ISR, ISR_NAKED) __attribute__ ((hot, flatten));
|
ISR(portSCHEDULER_ISR, ISR_NAKED) __attribute__ ((hot, flatten));
|
||||||
|
|
||||||
/* ISR(portSCHEDULER_ISR, ISR_NAKED ISR_NOBLOCK) __attribute__ ((hot, flatten));
|
/* ISR(portSCHEDULER_ISR, ISR_NAKED ISR_NOBLOCK) __attribute__ ((hot, flatten));
|
||||||
*/
|
*/
|
||||||
ISR(portSCHEDULER_ISR)
|
ISR(portSCHEDULER_ISR)
|
||||||
|
@ -756,7 +744,7 @@ void vPortYieldFromTick( void )
|
||||||
vPortYieldFromTick();
|
vPortYieldFromTick();
|
||||||
__asm__ __volatile__ ( "reti" );
|
__asm__ __volatile__ ( "reti" );
|
||||||
}
|
}
|
||||||
#else /* if configUSE_PREEMPTION == 1 */
|
#else
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tick ISR for the cooperative scheduler. All this does is increment the
|
* Tick ISR for the cooperative scheduler. All this does is increment the
|
||||||
|
@ -766,11 +754,12 @@ void vPortYieldFromTick( void )
|
||||||
* use ISR_NOBLOCK where there is an important timer running, that should preempt the scheduler.
|
* use ISR_NOBLOCK where there is an important timer running, that should preempt the scheduler.
|
||||||
*/
|
*/
|
||||||
ISR(portSCHEDULER_ISR) __attribute__ ((hot, flatten));
|
ISR(portSCHEDULER_ISR) __attribute__ ((hot, flatten));
|
||||||
|
|
||||||
/* ISR(portSCHEDULER_ISR, ISR_NOBLOCK) __attribute__ ((hot, flatten));
|
/* ISR(portSCHEDULER_ISR, ISR_NOBLOCK) __attribute__ ((hot, flatten));
|
||||||
*/
|
*/
|
||||||
ISR(portSCHEDULER_ISR)
|
ISR(portSCHEDULER_ISR)
|
||||||
{
|
{
|
||||||
xTaskIncrementTick();
|
xTaskIncrementTick();
|
||||||
}
|
}
|
||||||
#endif /* if configUSE_PREEMPTION == 1 */
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
20
portable/ThirdParty/GCC/ATmega/portmacro.h
vendored
20
portable/ThirdParty/GCC/ATmega/portmacro.h
vendored
|
@ -66,8 +66,7 @@
|
||||||
|
|
||||||
/* Critical section management. */
|
/* Critical section management. */
|
||||||
|
|
||||||
#define portENTER_CRITICAL() \
|
#define portENTER_CRITICAL() __asm__ __volatile__ ( \
|
||||||
__asm__ __volatile__ ( \
|
|
||||||
"in __tmp_reg__, __SREG__" "\n\t" \
|
"in __tmp_reg__, __SREG__" "\n\t" \
|
||||||
"cli" "\n\t" \
|
"cli" "\n\t" \
|
||||||
"push __tmp_reg__" "\n\t" \
|
"push __tmp_reg__" "\n\t" \
|
||||||
|
@ -75,8 +74,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
#define portEXIT_CRITICAL() \
|
#define portEXIT_CRITICAL() __asm__ __volatile__ ( \
|
||||||
__asm__ __volatile__ ( \
|
|
||||||
"pop __tmp_reg__" "\n\t" \
|
"pop __tmp_reg__" "\n\t" \
|
||||||
"out __SREG__, __tmp_reg__" "\n\t" \
|
"out __SREG__, __tmp_reg__" "\n\t" \
|
||||||
::: "memory" \
|
::: "memory" \
|
||||||
|
@ -98,13 +96,13 @@
|
||||||
#define portUSE_WDTO WDTO_15MS /* use the Watchdog Timer for xTaskIncrementTick */
|
#define portUSE_WDTO WDTO_15MS /* use the Watchdog Timer for xTaskIncrementTick */
|
||||||
|
|
||||||
/* Watchdog period options: WDTO_15MS
|
/* Watchdog period options: WDTO_15MS
|
||||||
* WDTO_30MS
|
WDTO_30MS
|
||||||
* WDTO_60MS
|
WDTO_60MS
|
||||||
* WDTO_120MS
|
WDTO_120MS
|
||||||
* WDTO_250MS
|
WDTO_250MS
|
||||||
* WDTO_500MS
|
WDTO_500MS
|
||||||
* WDTO_1S
|
WDTO_1S
|
||||||
* WDTO_2S
|
WDTO_2S
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
43
portable/ThirdParty/GCC/Posix/port.c
vendored
43
portable/ThirdParty/GCC/Posix/port.c
vendored
|
@ -104,8 +104,7 @@ static portBASE_TYPE xSchedulerEnd = pdFALSE;
|
||||||
static void prvSetupSignalsAndSchedulerPolicy( void );
|
static void prvSetupSignalsAndSchedulerPolicy( void );
|
||||||
static void prvSetupTimerInterrupt( void );
|
static void prvSetupTimerInterrupt( void );
|
||||||
static void *prvWaitForStart( void * pvParams );
|
static void *prvWaitForStart( void * pvParams );
|
||||||
static void prvSwitchThread( Thread_t * xThreadToResume,
|
static void prvSwitchThread( Thread_t *xThreadToResume, Thread_t *xThreadToSuspend );
|
||||||
Thread_t * xThreadToSuspend );
|
|
||||||
static void prvSuspendSelf( void );
|
static void prvSuspendSelf( void );
|
||||||
static void prvResumeThread( pthread_t xThreadId );
|
static void prvResumeThread( pthread_t xThreadId );
|
||||||
static void vPortSystemTickHandler( int sig );
|
static void vPortSystemTickHandler( int sig );
|
||||||
|
@ -134,10 +133,8 @@ static void vPortStartFirstTask( void );
|
||||||
|
|
||||||
extern void *__libc_malloc(size_t);
|
extern void *__libc_malloc(size_t);
|
||||||
extern void __libc_free(void *);
|
extern void __libc_free(void *);
|
||||||
extern void * __libc_calloc( size_t,
|
extern void *__libc_calloc(size_t, size_t);
|
||||||
size_t );
|
extern void *__libc_realloc(void *ptr, size_t);
|
||||||
extern void * __libc_realloc( void * ptr,
|
|
||||||
size_t );
|
|
||||||
|
|
||||||
void *malloc(size_t size)
|
void *malloc(size_t size)
|
||||||
{
|
{
|
||||||
|
@ -160,8 +157,7 @@ void free( void * ptr )
|
||||||
pthread_sigmask( SIG_SETMASK, &xSavedSignals, NULL );
|
pthread_sigmask( SIG_SETMASK, &xSavedSignals, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
void * calloc( size_t nmemb,
|
void *calloc(size_t nmemb, size_t size)
|
||||||
size_t size )
|
|
||||||
{
|
{
|
||||||
sigset_t xSavedSignals;
|
sigset_t xSavedSignals;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
@ -173,8 +169,7 @@ void * calloc( size_t nmemb,
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * realloc( void * ptr,
|
void *realloc(void *ptr, size_t size)
|
||||||
size_t size )
|
|
||||||
{
|
{
|
||||||
sigset_t xSavedSignals;
|
sigset_t xSavedSignals;
|
||||||
|
|
||||||
|
@ -185,8 +180,7 @@ void * realloc( void * ptr,
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void prvFatalError( const char * pcCall,
|
static void prvFatalError( const char *pcCall, int iErrno )
|
||||||
int iErrno )
|
|
||||||
{
|
{
|
||||||
fprintf( stderr, "%s: %s\n", pcCall, strerror( iErrno ) );
|
fprintf( stderr, "%s: %s\n", pcCall, strerror( iErrno ) );
|
||||||
abort();
|
abort();
|
||||||
|
@ -197,8 +191,7 @@ static void prvFatalError( const char * pcCall,
|
||||||
*/
|
*/
|
||||||
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack,
|
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack,
|
||||||
portSTACK_TYPE *pxEndOfStack,
|
portSTACK_TYPE *pxEndOfStack,
|
||||||
pdTASK_CODE pxCode,
|
pdTASK_CODE pxCode, void *pvParameters )
|
||||||
void * pvParameters )
|
|
||||||
{
|
{
|
||||||
Thread_t *thread;
|
Thread_t *thread;
|
||||||
pthread_attr_t xThreadAttributes;
|
pthread_attr_t xThreadAttributes;
|
||||||
|
@ -225,7 +218,6 @@ portSTACK_TYPE * pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack,
|
||||||
|
|
||||||
iRet = pthread_create( &thread->pthread, &xThreadAttributes,
|
iRet = pthread_create( &thread->pthread, &xThreadAttributes,
|
||||||
prvWaitForStart, thread );
|
prvWaitForStart, thread );
|
||||||
|
|
||||||
if ( iRet )
|
if ( iRet )
|
||||||
{
|
{
|
||||||
prvFatalError( "pthread_create", iRet );
|
prvFatalError( "pthread_create", iRet );
|
||||||
|
@ -257,7 +249,7 @@ portBASE_TYPE xPortStartScheduler( void )
|
||||||
hMainThread = pthread_self();
|
hMainThread = pthread_self();
|
||||||
|
|
||||||
/* Start the timer that generates the tick ISR. Interrupts are disabled
|
/* Start the timer that generates the tick ISR. Interrupts are disabled
|
||||||
* here already. */
|
here already. */
|
||||||
prvSetupTimerInterrupt();
|
prvSetupTimerInterrupt();
|
||||||
|
|
||||||
/* Start the first task. */
|
/* Start the first task. */
|
||||||
|
@ -312,7 +304,6 @@ void vPortEnterCritical( void )
|
||||||
{
|
{
|
||||||
vPortDisableInterrupts();
|
vPortDisableInterrupts();
|
||||||
}
|
}
|
||||||
|
|
||||||
uxCriticalNesting++;
|
uxCriticalNesting++;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -369,7 +360,7 @@ void vPortEnableInterrupts( void )
|
||||||
portBASE_TYPE xPortSetInterruptMask( void )
|
portBASE_TYPE xPortSetInterruptMask( void )
|
||||||
{
|
{
|
||||||
/* Interrupts are always disabled inside ISRs (signals
|
/* Interrupts are always disabled inside ISRs (signals
|
||||||
* handlers). */
|
handlers). */
|
||||||
return pdTRUE;
|
return pdTRUE;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
@ -402,7 +393,6 @@ void prvSetupTimerInterrupt( void )
|
||||||
|
|
||||||
/* Initialise the structure with the current timer information. */
|
/* Initialise the structure with the current timer information. */
|
||||||
iRet = getitimer( ITIMER_REAL, &itimer );
|
iRet = getitimer( ITIMER_REAL, &itimer );
|
||||||
|
|
||||||
if ( iRet )
|
if ( iRet )
|
||||||
{
|
{
|
||||||
prvFatalError( "getitimer", errno );
|
prvFatalError( "getitimer", errno );
|
||||||
|
@ -418,7 +408,6 @@ void prvSetupTimerInterrupt( void )
|
||||||
|
|
||||||
/* Set-up the timer interrupt. */
|
/* Set-up the timer interrupt. */
|
||||||
iRet = setitimer( ITIMER_REAL, &itimer, NULL );
|
iRet = setitimer( ITIMER_REAL, &itimer, NULL );
|
||||||
|
|
||||||
if ( iRet )
|
if ( iRet )
|
||||||
{
|
{
|
||||||
prvFatalError( "setitimer", errno );
|
prvFatalError( "setitimer", errno );
|
||||||
|
@ -442,9 +431,7 @@ static void vPortSystemTickHandler( int sig )
|
||||||
* the timer. */
|
* the timer. */
|
||||||
xExpectedTicks = (prvGetTimeNs() - prvStartTimeNs)
|
xExpectedTicks = (prvGetTimeNs() - prvStartTimeNs)
|
||||||
/ (portTICK_RATE_MICROSECONDS * 1000);
|
/ (portTICK_RATE_MICROSECONDS * 1000);
|
||||||
|
do {
|
||||||
do
|
|
||||||
{
|
|
||||||
xTaskIncrementTick();
|
xTaskIncrementTick();
|
||||||
prvTickCount++;
|
prvTickCount++;
|
||||||
} while (prvTickCount < xExpectedTicks);
|
} while (prvTickCount < xExpectedTicks);
|
||||||
|
@ -462,8 +449,7 @@ static void vPortSystemTickHandler( int sig )
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
void vPortThreadDying( void * pxTaskToDelete,
|
void vPortThreadDying( void *pxTaskToDelete, volatile BaseType_t *pxPendYield )
|
||||||
volatile BaseType_t * pxPendYield )
|
|
||||||
{
|
{
|
||||||
Thread_t *pxThread = prvGetThreadFromTask( pxTaskToDelete );
|
Thread_t *pxThread = prvGetThreadFromTask( pxTaskToDelete );
|
||||||
|
|
||||||
|
@ -517,12 +503,10 @@ static void prvSwitchThread( Thread_t * pxThreadToResume,
|
||||||
uxSavedCriticalNesting = uxCriticalNesting;
|
uxSavedCriticalNesting = uxCriticalNesting;
|
||||||
|
|
||||||
prvResumeThread( pxThreadToResume->pthread );
|
prvResumeThread( pxThreadToResume->pthread );
|
||||||
|
|
||||||
if ( pxThreadToSuspend->xDying )
|
if ( pxThreadToSuspend->xDying )
|
||||||
{
|
{
|
||||||
pthread_exit( NULL );
|
pthread_exit( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
prvSuspendSelf();
|
prvSuspendSelf();
|
||||||
|
|
||||||
uxCriticalNesting = uxSavedCriticalNesting;
|
uxCriticalNesting = uxSavedCriticalNesting;
|
||||||
|
@ -572,7 +556,6 @@ static void prvSetupSignalsAndSchedulerPolicy( void )
|
||||||
sigemptyset( &xResumeSignals );
|
sigemptyset( &xResumeSignals );
|
||||||
sigaddset( &xResumeSignals, SIG_RESUME );
|
sigaddset( &xResumeSignals, SIG_RESUME );
|
||||||
sigfillset( &xAllSignals );
|
sigfillset( &xAllSignals );
|
||||||
|
|
||||||
/* Don't block SIGINT so this can be used to break into GDB while
|
/* Don't block SIGINT so this can be used to break into GDB while
|
||||||
* in a critical section. */
|
* in a critical section. */
|
||||||
sigdelset( &xAllSignals, SIGINT );
|
sigdelset( &xAllSignals, SIGINT );
|
||||||
|
@ -588,7 +571,7 @@ static void prvSetupSignalsAndSchedulerPolicy( void )
|
||||||
&xSchedulerOriginalSignalMask );
|
&xSchedulerOriginalSignalMask );
|
||||||
|
|
||||||
/* SIG_RESUME is only used with sigwait() so doesn't need a
|
/* SIG_RESUME is only used with sigwait() so doesn't need a
|
||||||
* handler. */
|
handler. */
|
||||||
sigresume.sa_flags = 0;
|
sigresume.sa_flags = 0;
|
||||||
sigresume.sa_handler = SIG_IGN;
|
sigresume.sa_handler = SIG_IGN;
|
||||||
sigfillset( &sigresume.sa_mask );
|
sigfillset( &sigresume.sa_mask );
|
||||||
|
@ -598,14 +581,12 @@ static void prvSetupSignalsAndSchedulerPolicy( void )
|
||||||
sigfillset( &sigtick.sa_mask );
|
sigfillset( &sigtick.sa_mask );
|
||||||
|
|
||||||
iRet = sigaction( SIG_RESUME, &sigresume, NULL );
|
iRet = sigaction( SIG_RESUME, &sigresume, NULL );
|
||||||
|
|
||||||
if ( iRet )
|
if ( iRet )
|
||||||
{
|
{
|
||||||
prvFatalError( "sigaction", errno );
|
prvFatalError( "sigaction", errno );
|
||||||
}
|
}
|
||||||
|
|
||||||
iRet = sigaction( SIGALRM, &sigtick, NULL );
|
iRet = sigaction( SIGALRM, &sigtick, NULL );
|
||||||
|
|
||||||
if ( iRet )
|
if ( iRet )
|
||||||
{
|
{
|
||||||
prvFatalError( "sigaction", errno );
|
prvFatalError( "sigaction", errno );
|
||||||
|
|
3
portable/ThirdParty/GCC/Posix/portmacro.h
vendored
3
portable/ThirdParty/GCC/Posix/portmacro.h
vendored
|
@ -103,8 +103,7 @@
|
||||||
|
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
extern void vPortThreadDying( void * pxTaskToDelete,
|
extern void vPortThreadDying( void *pxTaskToDelete, volatile BaseType_t *pxPendYield );
|
||||||
volatile BaseType_t * pxPendYield );
|
|
||||||
extern void vPortCancelThread( void *pxTaskToDelete );
|
extern void vPortCancelThread( void *pxTaskToDelete );
|
||||||
#define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) vPortThreadDying( ( pvTaskToDelete ), ( pxPendYield ) )
|
#define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) vPortThreadDying( ( pvTaskToDelete ), ( pxPendYield ) )
|
||||||
#define portCLEAN_UP_TCB( pxTCB ) vPortCancelThread( pxTCB )
|
#define portCLEAN_UP_TCB( pxTCB ) vPortCancelThread( pxTCB )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue