mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-01 20:03:50 -04:00
Revert Portable/Softune Formatting (#886)
* Revert formatting on Softune ports * Fix spelling mistakes --------- Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com> Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
This commit is contained in:
parent
96cdeaa725
commit
92365c9784
6 changed files with 326 additions and 336 deletions
|
@ -30,29 +30,26 @@
|
|||
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
|
||||
/* ELIGIBILITY FOR ANY PURPOSES. */
|
||||
/* (C) Fujitsu Microelectronics Europe GmbH */
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* __STD_LIB_sbrk.C
|
||||
* - Used by heap_3.c for memory allocation and deletion.
|
||||
*
|
||||
* /*---------------------------------------------------------------------------*/
|
||||
__STD_LIB_sbrk.C
|
||||
- Used by heap_3.c for memory allocation and deletion.
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "FreeRTOSConfig.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
static long brk_siz = 0;
|
||||
typedef int _heep_t;
|
||||
#define ROUNDUP( s ) ( ( ( s ) + sizeof( _heep_t ) - 1 ) & ~( sizeof( _heep_t ) - 1 ) )
|
||||
static _heep_t _heep[ ROUNDUP( configTOTAL_HEAP_SIZE ) / sizeof( _heep_t ) ];
|
||||
#define _heep_size ROUNDUP( configTOTAL_HEAP_SIZE )
|
||||
static long brk_siz = 0;
|
||||
typedef int _heep_t;
|
||||
#define ROUNDUP(s) (((s)+sizeof(_heep_t)-1)&~(sizeof(_heep_t)-1))
|
||||
static _heep_t _heep[ROUNDUP(configTOTAL_HEAP_SIZE)/sizeof(_heep_t)];
|
||||
#define _heep_size ROUNDUP(configTOTAL_HEAP_SIZE)
|
||||
|
||||
extern char * sbrk( int size )
|
||||
{
|
||||
if( ( brk_siz + size > _heep_size ) || ( brk_siz + size < 0 ) )
|
||||
extern char *sbrk(int size)
|
||||
{
|
||||
return( ( char * ) -1 );
|
||||
}
|
||||
if (brk_siz + size > _heep_size || brk_siz + size < 0)
|
||||
|
||||
brk_siz += size;
|
||||
return( ( char * ) _heep + brk_siz - size );
|
||||
}
|
||||
return((char*)-1);
|
||||
brk_siz += size;
|
||||
return( (char*)_heep + brk_siz - size);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* 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;
|
||||
|
||||
|
@ -106,12 +106,10 @@ static void prvSetupTimerInterrupt( void );
|
|||
*
|
||||
* See the header file portable.h.
|
||||
*/
|
||||
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
||||
TaskFunction_t pxCode,
|
||||
void * pvParameters )
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
|
||||
{
|
||||
/* Place a few bytes of known values on the bottom of the stack.
|
||||
* This is just useful for debugging. */
|
||||
This is just useful for debugging. */
|
||||
|
||||
*pxTopOfStack = 0x11111111;
|
||||
pxTopOfStack--;
|
||||
|
@ -121,9 +119,9 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
|||
pxTopOfStack--;
|
||||
|
||||
/* This is a redundant push to the stack, it may be required if
|
||||
* in some implementations of the compiler the parameter to the task
|
||||
* is passed on to the stack rather than in R4 register. */
|
||||
*pxTopOfStack = ( StackType_t ) ( pvParameters );
|
||||
in some implementations of the compiler the parameter to the task
|
||||
is passed on to the stack rather than in R4 register. */
|
||||
*pxTopOfStack = (StackType_t)(pvParameters);
|
||||
pxTopOfStack--;
|
||||
|
||||
*pxTopOfStack = ( StackType_t ) 0x00000000; /* RP */
|
||||
|
@ -136,36 +134,36 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
|||
pxTopOfStack--;
|
||||
|
||||
/* In the current implementation of the compiler the first
|
||||
* parameter to the task (or function) is passed via R4 parameter
|
||||
* to the task, hence the pvParameters pointer is copied into the R4
|
||||
* register. See compiler manual section 4.6.2 for more information. */
|
||||
*pxTopOfStack = ( StackType_t ) ( pvParameters ); /* R4 */
|
||||
parameter to the task (or function) is passed via R4 parameter
|
||||
to the task, hence the pvParameters pointer is copied into the R4
|
||||
register. See compiler manual section 4.6.2 for more information. */
|
||||
*pxTopOfStack = ( StackType_t ) (pvParameters); /* R4 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x00003333; /* R3 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00003333; /* R3 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x00002222; /* R2 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00002222; /* R2 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x00001111; /* R1 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00001111; /* R1 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x00000001; /* R0 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00000001; /* R0 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x0000EEEE; /* R14 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0000EEEE; /* R14 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x0000DDDD; /* R13 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0000DDDD; /* R13 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x0000CCCC; /* R12 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0000CCCC; /* R12 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x0000BBBB; /* R11 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0000BBBB; /* R11 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x0000AAAA; /* R10 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x0000AAAA; /* R10 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x00009999; /* R9 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00009999; /* R9 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x00008888; /* R8 */
|
||||
*pxTopOfStack = ( StackType_t ) 0x00008888; /* R8 */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x11110000; /* MDH */
|
||||
*pxTopOfStack = ( StackType_t ) 0x11110000; /* MDH */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) 0x22220000; /* MDL */
|
||||
*pxTopOfStack = ( StackType_t ) 0x22220000; /* MDL */
|
||||
pxTopOfStack--;
|
||||
|
||||
/* The start of the task code. */
|
||||
|
@ -190,8 +188,8 @@ BaseType_t xPortStartScheduler( void )
|
|||
#pragma endasm
|
||||
|
||||
/* 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. */
|
||||
__asm( " reti " );
|
||||
jump to the start of the task the context of which we have just restored. */
|
||||
__asm(" reti ");
|
||||
|
||||
/* Should not get here. */
|
||||
return pdFAIL;
|
||||
|
@ -201,39 +199,39 @@ BaseType_t xPortStartScheduler( void )
|
|||
void vPortEndScheduler( void )
|
||||
{
|
||||
/* Not implemented - unlikely to ever be required as there is nothing to
|
||||
* return to. */
|
||||
return to. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvSetupTimerInterrupt( void )
|
||||
{
|
||||
/* The peripheral clock divided by 32 is used by the timer. */
|
||||
const uint16_t usReloadValue = ( uint16_t ) ( ( ( configPER_CLOCK_HZ / configTICK_RATE_HZ ) / 32UL ) - 1UL );
|
||||
const uint16_t usReloadValue = ( uint16_t ) ( ( ( configPER_CLOCK_HZ / configTICK_RATE_HZ ) / 32UL ) - 1UL );
|
||||
|
||||
/* Setup RLT0 to generate a tick interrupt. */
|
||||
|
||||
TMCSR0_CNTE = 0; /* Count Disable */
|
||||
TMCSR0_CSL = 0x2; /* CLKP/32 */
|
||||
TMCSR0_MOD = 0; /* Software trigger */
|
||||
TMCSR0_RELD = 1; /* Reload */
|
||||
TMCSR0_CNTE = 0; /* Count Disable */
|
||||
TMCSR0_CSL = 0x2; /* CLKP/32 */
|
||||
TMCSR0_MOD = 0; /* Software trigger */
|
||||
TMCSR0_RELD = 1; /* Reload */
|
||||
|
||||
TMCSR0_UF = 0; /* Clear underflow flag */
|
||||
TMCSR0_UF = 0; /* Clear underflow flag */
|
||||
TMRLR0 = usReloadValue;
|
||||
TMCSR0_INTE = 1; /* Interrupt Enable */
|
||||
TMCSR0_CNTE = 1; /* Count Enable */
|
||||
TMCSR0_TRG = 1; /* Trigger */
|
||||
TMCSR0_INTE = 1; /* Interrupt Enable */
|
||||
TMCSR0_CNTE = 1; /* Count Enable */
|
||||
TMCSR0_TRG = 1; /* Trigger */
|
||||
|
||||
PORTEN = 0x3; /* Port Enable */
|
||||
PORTEN = 0x3; /* Port Enable */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if configUSE_PREEMPTION == 1
|
||||
|
||||
/*
|
||||
* Tick ISR for preemptive scheduler. The tick count is incremented
|
||||
* after the context is saved. Then the context is switched if required,
|
||||
* and last the context of the task which is to be resumed is restored.
|
||||
*/
|
||||
/*
|
||||
* Tick ISR for preemptive scheduler. The tick count is incremented
|
||||
* after the context is saved. Then the context is switched if required,
|
||||
* and last the context of the task which is to be resumed is restored.
|
||||
*/
|
||||
|
||||
#pragma asm
|
||||
|
||||
|
@ -259,13 +257,13 @@ static void prvSetupTimerInterrupt( void )
|
|||
|
||||
#pragma endasm
|
||||
|
||||
#else /* if configUSE_PREEMPTION == 1 */
|
||||
#else
|
||||
|
||||
/*
|
||||
* Tick ISR for the cooperative scheduler. All this does is increment the
|
||||
* tick count. We don't need to switch context, this can only be done by
|
||||
* manual calls to taskYIELD();
|
||||
*/
|
||||
/*
|
||||
* Tick ISR for the cooperative scheduler. All this does is increment the
|
||||
* tick count. We don't need to switch context, this can only be done by
|
||||
* manual calls to taskYIELD();
|
||||
*/
|
||||
__interrupt void ReloadTimer0_IRQHandler( void )
|
||||
{
|
||||
/* Clear RLT0 interrupt flag */
|
||||
|
@ -273,7 +271,7 @@ static void prvSetupTimerInterrupt( void )
|
|||
xTaskIncrementTick();
|
||||
}
|
||||
|
||||
#endif /* if configUSE_PREEMPTION == 1 */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Manual context switch. We can use a __nosavereg attribute as the context
|
||||
|
|
|
@ -46,24 +46,24 @@
|
|||
*/
|
||||
|
||||
/* Type definitions. */
|
||||
#define portCHAR char
|
||||
#define portFLOAT float
|
||||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
#define portCHAR char
|
||||
#define portFLOAT float
|
||||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portBASE_TYPE long
|
||||
|
||||
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 ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
|
||||
typedef uint32_t TickType_t;
|
||||
#if( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#else
|
||||
#error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
|
||||
|
@ -74,38 +74,38 @@ typedef unsigned long UBaseType_t;
|
|||
#if configKERNEL_INTERRUPT_PRIORITY != 30
|
||||
#error configKERNEL_INTERRUPT_PRIORITY (set in FreeRTOSConfig.h) must match the ILM value set in the following line - 30 (1Eh) being the default.
|
||||
#endif
|
||||
#define portDISABLE_INTERRUPTS() __asm( " STILM #1Eh " )
|
||||
#define portENABLE_INTERRUPTS() __asm( " STILM #1Fh " )
|
||||
#define portDISABLE_INTERRUPTS() __asm(" STILM #1Eh ")
|
||||
#define portENABLE_INTERRUPTS() __asm(" STILM #1Fh ")
|
||||
|
||||
#define portENTER_CRITICAL() \
|
||||
__asm( " ST PS,@-R15 " ); \
|
||||
__asm( " ANDCCR #0xef " ); \
|
||||
#define portENTER_CRITICAL() \
|
||||
__asm(" ST PS,@-R15 "); \
|
||||
__asm(" ANDCCR #0xef "); \
|
||||
|
||||
|
||||
#define portEXIT_CRITICAL() \
|
||||
__asm( " LD @R15+,PS " ); \
|
||||
#define portEXIT_CRITICAL() \
|
||||
__asm(" LD @R15+,PS "); \
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Architecture specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portNOP() __asm( " nop " );
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portNOP() __asm( " nop " );
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* portYIELD() uses a SW interrupt */
|
||||
#define portYIELD() __asm( " INT #40H " );
|
||||
#define portYIELD() __asm( " INT #40H " );
|
||||
|
||||
/* portYIELD_FROM_ISR() uses delayed interrupt */
|
||||
#define portYIELD_FROM_ISR() DICR_DLYI = 1
|
||||
#define portYIELD_FROM_ISR() DICR_DLYI = 1
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Task function macros as described on the FreeRTOS.org WEB site. */
|
||||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
|
||||
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
||||
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
|
||||
|
||||
#define portMINIMAL_STACK_SIZE configMINIMAL_STACK_SIZE
|
||||
#define portMINIMAL_STACK_SIZE configMINIMAL_STACK_SIZE
|
||||
|
||||
|
||||
#endif /* PORTMACRO_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue