Style: revert more uncrustify files

This commit is contained in:
Alfred Gedeon 2020-08-11 21:46:34 -07:00
parent 949096a861
commit 88e692ff55
4 changed files with 927 additions and 960 deletions

View file

@ -60,31 +60,31 @@
#define portTIMSK TIMSK0
#define portTIFR TIFR0
#endif /* if defined( portUSE_WDTO ) */
#endif
/*-----------------------------------------------------------*/
/* 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;
extern volatile TCB_t * volatile pxCurrentTCB;
/*-----------------------------------------------------------*/
/**
* Enable the watchdog timer, configuring it for expire after
* (value) timeout (which is a combination of the WDP0
* through WDP3 bits).
*
* This function is derived from <avr/wdt.h> but enables only
* the interrupt bit (WDIE), rather than the reset bit (WDE).
*
* Can't find it documented but the WDT, once enabled,
* rolls over and fires a new interrupt each time.
*
* See also the symbolic constants WDTO_15MS et al.
*
* Updated to match avr-libc 2.0.0
Enable the watchdog timer, configuring it for expire after
(value) timeout (which is a combination of the WDP0
through WDP3 bits).
This function is derived from <avr/wdt.h> but enables only
the interrupt bit (WDIE), rather than the reset bit (WDE).
Can't find it documented but the WDT, once enabled,
rolls over and fires a new interrupt each time.
See also the symbolic constants WDTO_15MS et al.
Updated to match avr-libc 2.0.0
*/
#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
* (value) timeout (which is a combination of the WDP0
* through WDP3 bits).
*
* This function is derived from <avr/wdt.h> but enables both
* the reset bit (WDE), and the interrupt bit (WDIE).
*
* This will ensure that if the interrupt is not serviced
* before the second timeout, the AVR will reset.
*
* Servicing the interrupt automatically clears it,
* and ensures the AVR does not reset.
*
* Can't find it documented but the WDT, once enabled,
* rolls over and fires a new interrupt each time.
*
* See also the symbolic constants WDTO_15MS et al.
*
* Updated to match avr-libc 2.0.0
Enable the watchdog timer, configuring it for expire after
(value) timeout (which is a combination of the WDP0
through WDP3 bits).
This function is derived from <avr/wdt.h> but enables both
the reset bit (WDE), and the interrupt bit (WDIE).
This will ensure that if the interrupt is not serviced
before the second timeout, the AVR will reset.
Servicing the interrupt automatically clears it,
and ensures the AVR does not reset.
Can't find it documented but the WDT, once enabled,
rolls over and fires a new interrupt each time.
See also the symbolic constants WDTO_15MS et al.
Updated to match avr-libc 2.0.0
*/
#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" \
"st x+, __tmp_reg__ \n\t" \
);
#else /* if defined( __AVR_3_BYTE_PC__ ) && defined( __AVR_HAVE_RAMPZ__ ) */
#else
/* 2-Byte PC Save */
#define portSAVE_CONTEXT() \
__asm__ __volatile__ ( "push __tmp_reg__ \n\t" \
@ -368,7 +367,7 @@ extern volatile TCB_t * volatile pxCurrentTCB;
"in __tmp_reg__, __SP_H__ \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
@ -468,7 +467,7 @@ extern volatile TCB_t * volatile pxCurrentTCB;
"out __SREG__, __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 */
#define portRESTORE_CONTEXT() \
__asm__ __volatile__ ( "lds r26, pxCurrentTCB \n\t" \
@ -512,7 +511,7 @@ extern volatile TCB_t * volatile pxCurrentTCB;
"out __SREG__, __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.
*/
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
TaskFunction_t pxCode,
void * pvParameters )
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
{
uint16_t usAddress;
/* 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
* it on first. */
it on first. */
usAddress = ( uint16_t ) pxCode;
*pxTopOfStack = ( StackType_t ) ( usAddress & ( uint16_t ) 0x00ff );
pxTopOfStack--;
@ -544,7 +540,6 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
pxTopOfStack--;
#if defined(__AVR_3_BYTE_PC__)
/* 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
* instead of 2 for the other ATmega* chips.
@ -560,16 +555,15 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
#endif
/* Next simulate the stack as if after a call to portSAVE_CONTEXT().
* portSAVE_CONTEXT places the flags on the stack immediately after r0
* to ensure the interrupts get disabled as soon as possible, and so ensuring
* the stack use is minimal should a context switch interrupt occur. */
portSAVE_CONTEXT places the flags on the stack immediately after r0
to ensure the interrupts get disabled as soon as possible, and so ensuring
the stack use is minimal should a context switch interrupt occur. */
*pxTopOfStack = ( StackType_t ) 0x00; /* R0 */
pxTopOfStack--;
*pxTopOfStack = portFLAGS_INT_ENABLED;
pxTopOfStack--;
#if defined(__AVR_3_BYTE_PC__)
/* If we have an ATmega256x, we are also saving the EIND register.
* We should default to 0.
*/
@ -578,7 +572,6 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
#endif
#if defined(__AVR_HAVE_RAMPZ__)
/* We are saving the RAMPZ register.
* We should default to 0.
*/
@ -616,7 +609,7 @@ BaseType_t xPortStartScheduler( void )
portRESTORE_CONTEXT();
/* 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" );
/* Should not get here. */
@ -670,12 +663,10 @@ void vPortYieldFromTick( void ) __attribute__( ( hot, flatten, naked ) );
void vPortYieldFromTick( void )
{
portSAVE_CONTEXT();
if( xTaskIncrementTick() != pdFALSE )
{
vTaskSwitchContext();
}
portRESTORE_CONTEXT();
__asm__ __volatile__ ( "ret" );
@ -683,7 +674,6 @@ void vPortYieldFromTick( void )
/*-----------------------------------------------------------*/
#if defined(portUSE_WDTO)
/*
* Setup WDT to generate a tick interrupt.
*/
@ -697,7 +687,6 @@ void vPortYieldFromTick( void )
}
#elif defined (portUSE_TIMER0)
/*
* Setup Timer0 compare match A to generate a tick interrupt.
*/
@ -707,7 +696,7 @@ void vPortYieldFromTick( void )
uint8_t ucLowByte;
/* 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;
@ -718,7 +707,7 @@ void vPortYieldFromTick( void )
ulCompareMatch -= ( uint32_t ) 1;
/* 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 );
portOCRL = ucLowByte;
@ -733,7 +722,7 @@ void vPortYieldFromTick( void )
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 ISR_NOBLOCK) __attribute__ ((hot, flatten));
*/
ISR(portSCHEDULER_ISR)
@ -756,7 +744,7 @@ void vPortYieldFromTick( void )
vPortYieldFromTick();
__asm__ __volatile__ ( "reti" );
}
#else /* if configUSE_PREEMPTION == 1 */
#else
/*
* 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.
*/
ISR(portSCHEDULER_ISR) __attribute__ ((hot, flatten));
/* ISR(portSCHEDULER_ISR, ISR_NOBLOCK) __attribute__ ((hot, flatten));
*/
ISR(portSCHEDULER_ISR)
{
xTaskIncrementTick();
}
#endif /* if configUSE_PREEMPTION == 1 */
#endif

View file

@ -66,8 +66,7 @@
/* Critical section management. */
#define portENTER_CRITICAL() \
__asm__ __volatile__ ( \
#define portENTER_CRITICAL() __asm__ __volatile__ ( \
"in __tmp_reg__, __SREG__" "\n\t" \
"cli" "\n\t" \
"push __tmp_reg__" "\n\t" \
@ -75,8 +74,7 @@
)
#define portEXIT_CRITICAL() \
__asm__ __volatile__ ( \
#define portEXIT_CRITICAL() __asm__ __volatile__ ( \
"pop __tmp_reg__" "\n\t" \
"out __SREG__, __tmp_reg__" "\n\t" \
::: "memory" \
@ -98,13 +96,13 @@
#define portUSE_WDTO WDTO_15MS /* use the Watchdog Timer for xTaskIncrementTick */
/* Watchdog period options: WDTO_15MS
* WDTO_30MS
* WDTO_60MS
* WDTO_120MS
* WDTO_250MS
* WDTO_500MS
* WDTO_1S
* WDTO_2S
WDTO_30MS
WDTO_60MS
WDTO_120MS
WDTO_250MS
WDTO_500MS
WDTO_1S
WDTO_2S
*/
#else

View file

@ -104,8 +104,7 @@ static portBASE_TYPE xSchedulerEnd = pdFALSE;
static void prvSetupSignalsAndSchedulerPolicy( void );
static void prvSetupTimerInterrupt( void );
static void *prvWaitForStart( void * pvParams );
static void prvSwitchThread( Thread_t * xThreadToResume,
Thread_t * xThreadToSuspend );
static void prvSwitchThread( Thread_t *xThreadToResume, Thread_t *xThreadToSuspend );
static void prvSuspendSelf( void );
static void prvResumeThread( pthread_t xThreadId );
static void vPortSystemTickHandler( int sig );
@ -134,10 +133,8 @@ static void vPortStartFirstTask( void );
extern void *__libc_malloc(size_t);
extern void __libc_free(void *);
extern void * __libc_calloc( size_t,
size_t );
extern void * __libc_realloc( void * ptr,
size_t );
extern void *__libc_calloc(size_t, size_t);
extern void *__libc_realloc(void *ptr, size_t);
void *malloc(size_t size)
{
@ -160,8 +157,7 @@ void free( void * ptr )
pthread_sigmask( SIG_SETMASK, &xSavedSignals, NULL );
}
void * calloc( size_t nmemb,
size_t size )
void *calloc(size_t nmemb, size_t size)
{
sigset_t xSavedSignals;
void *ptr;
@ -173,8 +169,7 @@ void * calloc( size_t nmemb,
return ptr;
}
void * realloc( void * ptr,
size_t size )
void *realloc(void *ptr, size_t size)
{
sigset_t xSavedSignals;
@ -185,8 +180,7 @@ void * realloc( void * ptr,
return ptr;
}
static void prvFatalError( const char * pcCall,
int iErrno )
static void prvFatalError( const char *pcCall, int iErrno )
{
fprintf( stderr, "%s: %s\n", pcCall, strerror( iErrno ) );
abort();
@ -197,8 +191,7 @@ static void prvFatalError( const char * pcCall,
*/
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack,
portSTACK_TYPE *pxEndOfStack,
pdTASK_CODE pxCode,
void * pvParameters )
pdTASK_CODE pxCode, void *pvParameters )
{
Thread_t *thread;
pthread_attr_t xThreadAttributes;
@ -225,7 +218,6 @@ portSTACK_TYPE * pxPortInitialiseStack( portSTACK_TYPE * pxTopOfStack,
iRet = pthread_create( &thread->pthread, &xThreadAttributes,
prvWaitForStart, thread );
if ( iRet )
{
prvFatalError( "pthread_create", iRet );
@ -257,7 +249,7 @@ portBASE_TYPE xPortStartScheduler( void )
hMainThread = pthread_self();
/* Start the timer that generates the tick ISR. Interrupts are disabled
* here already. */
here already. */
prvSetupTimerInterrupt();
/* Start the first task. */
@ -312,7 +304,6 @@ void vPortEnterCritical( void )
{
vPortDisableInterrupts();
}
uxCriticalNesting++;
}
/*-----------------------------------------------------------*/
@ -369,7 +360,7 @@ void vPortEnableInterrupts( void )
portBASE_TYPE xPortSetInterruptMask( void )
{
/* Interrupts are always disabled inside ISRs (signals
* handlers). */
handlers). */
return pdTRUE;
}
/*-----------------------------------------------------------*/
@ -402,7 +393,6 @@ void prvSetupTimerInterrupt( void )
/* Initialise the structure with the current timer information. */
iRet = getitimer( ITIMER_REAL, &itimer );
if ( iRet )
{
prvFatalError( "getitimer", errno );
@ -418,7 +408,6 @@ void prvSetupTimerInterrupt( void )
/* Set-up the timer interrupt. */
iRet = setitimer( ITIMER_REAL, &itimer, NULL );
if ( iRet )
{
prvFatalError( "setitimer", errno );
@ -442,9 +431,7 @@ static void vPortSystemTickHandler( int sig )
* the timer. */
xExpectedTicks = (prvGetTimeNs() - prvStartTimeNs)
/ (portTICK_RATE_MICROSECONDS * 1000);
do
{
do {
xTaskIncrementTick();
prvTickCount++;
} while (prvTickCount < xExpectedTicks);
@ -462,8 +449,7 @@ static void vPortSystemTickHandler( int sig )
}
/*-----------------------------------------------------------*/
void vPortThreadDying( void * pxTaskToDelete,
volatile BaseType_t * pxPendYield )
void vPortThreadDying( void *pxTaskToDelete, volatile BaseType_t *pxPendYield )
{
Thread_t *pxThread = prvGetThreadFromTask( pxTaskToDelete );
@ -517,12 +503,10 @@ static void prvSwitchThread( Thread_t * pxThreadToResume,
uxSavedCriticalNesting = uxCriticalNesting;
prvResumeThread( pxThreadToResume->pthread );
if ( pxThreadToSuspend->xDying )
{
pthread_exit( NULL );
}
prvSuspendSelf();
uxCriticalNesting = uxSavedCriticalNesting;
@ -572,7 +556,6 @@ static void prvSetupSignalsAndSchedulerPolicy( void )
sigemptyset( &xResumeSignals );
sigaddset( &xResumeSignals, SIG_RESUME );
sigfillset( &xAllSignals );
/* Don't block SIGINT so this can be used to break into GDB while
* in a critical section. */
sigdelset( &xAllSignals, SIGINT );
@ -588,7 +571,7 @@ static void prvSetupSignalsAndSchedulerPolicy( void )
&xSchedulerOriginalSignalMask );
/* SIG_RESUME is only used with sigwait() so doesn't need a
* handler. */
handler. */
sigresume.sa_flags = 0;
sigresume.sa_handler = SIG_IGN;
sigfillset( &sigresume.sa_mask );
@ -598,14 +581,12 @@ static void prvSetupSignalsAndSchedulerPolicy( void )
sigfillset( &sigtick.sa_mask );
iRet = sigaction( SIG_RESUME, &sigresume, NULL );
if ( iRet )
{
prvFatalError( "sigaction", errno );
}
iRet = sigaction( SIGALRM, &sigtick, NULL );
if ( iRet )
{
prvFatalError( "sigaction", errno );

View file

@ -103,8 +103,7 @@
/*-----------------------------------------------------------*/
extern void vPortThreadDying( void * pxTaskToDelete,
volatile BaseType_t * pxPendYield );
extern void vPortThreadDying( void *pxTaskToDelete, volatile BaseType_t *pxPendYield );
extern void vPortCancelThread( void *pxTaskToDelete );
#define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) vPortThreadDying( ( pvTaskToDelete ), ( pxPendYield ) )
#define portCLEAN_UP_TCB( pxTCB ) vPortCancelThread( pxTCB )