Skip to content

Commit 38d0a81

Browse files
authored
Merge branch 'main' into fixWatcomFormatting
2 parents 4ae98e0 + db5df4b commit 38d0a81

File tree

6 files changed

+245
-256
lines changed

6 files changed

+245
-256
lines changed

portable/CodeWarrior/ColdFire_V1/port.c

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,38 +31,35 @@
3131
#include "task.h"
3232

3333

34-
#define portINITIAL_FORMAT_VECTOR ( ( StackType_t ) 0x4000 )
34+
#define portINITIAL_FORMAT_VECTOR ( ( StackType_t ) 0x4000 )
3535

3636
/* Supervisor mode set. */
37-
#define portINITIAL_STATUS_REGISTER ( ( StackType_t ) 0x2000 )
37+
#define portINITIAL_STATUS_REGISTER ( ( StackType_t ) 0x2000)
3838

3939
/* The clock prescale into the timer peripheral. */
40-
#define portPRESCALE_VALUE ( ( uint8_t ) 10 )
40+
#define portPRESCALE_VALUE ( ( uint8_t ) 10 )
4141

4242
/* The clock frequency into the RTC. */
43-
#define portRTC_CLOCK_HZ ( ( uint32_t ) 1000 )
43+
#define portRTC_CLOCK_HZ ( ( uint32_t ) 1000 )
4444

4545
asm void interrupt VectorNumber_VL1swi vPortYieldISR( void );
4646
static void prvSetupTimerInterrupt( void );
4747

4848
/* Used to keep track of the number of nested calls to taskENTER_CRITICAL(). This
49-
* will be set to 0 prior to the first task being started. */
49+
will be set to 0 prior to the first task being started. */
5050
static uint32_t ulCriticalNesting = 0x9999UL;
5151

5252
/*-----------------------------------------------------------*/
5353

54-
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
55-
TaskFunction_t pxCode,
56-
void * pvParameters )
54+
StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
5755
{
58-
uint32_t ulOriginalA5;
5956

60-
__asm {
61-
MOVE.L A5, ulOriginalA5
62-
};
57+
uint32_t ulOriginalA5;
6358

59+
__asm{ MOVE.L A5, ulOriginalA5 };
6460

65-
*pxTopOfStack = ( StackType_t ) 0xDEADBEEF;
61+
62+
*pxTopOfStack = (StackType_t) 0xDEADBEEF;
6663
pxTopOfStack--;
6764

6865
/* Exception stack frame starts with the return address. */
@@ -73,7 +70,7 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
7370
pxTopOfStack--;
7471

7572
*pxTopOfStack = ( StackType_t ) 0x0; /*FP*/
76-
pxTopOfStack -= 14; /* A5 to D0. */
73+
pxTopOfStack -= 14; /* A5 to D0. */
7774

7875
/* Parameter in A0. */
7976
*( pxTopOfStack + 8 ) = ( StackType_t ) pvParameters;
@@ -87,7 +84,7 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
8784

8885
BaseType_t xPortStartScheduler( void )
8986
{
90-
extern void vPortStartFirstTask( void );
87+
extern void vPortStartFirstTask( void );
9188

9289
ulCriticalNesting = 0UL;
9390

@@ -110,7 +107,7 @@ static void prvSetupTimerInterrupt( void )
110107
RTCMOD = portRTC_CLOCK_HZ / configTICK_RATE_HZ;
111108

112109
/* Enable the RTC to generate interrupts - interrupts are already disabled
113-
* when this code executes. */
110+
when this code executes. */
114111
RTCSC_RTIE = 1;
115112
}
116113
/*-----------------------------------------------------------*/
@@ -126,28 +123,26 @@ void vPortEnterCritical( void )
126123
if( ulCriticalNesting == 0UL )
127124
{
128125
/* Guard against context switches being pended simultaneously with a
129-
* critical section being entered. */
126+
critical section being entered. */
130127
do
131128
{
132129
portDISABLE_INTERRUPTS();
133-
134130
if( INTC_FRC == 0UL )
135131
{
136132
break;
137133
}
138134

139135
portENABLE_INTERRUPTS();
136+
140137
} while( 1 );
141138
}
142-
143139
ulCriticalNesting++;
144140
}
145141
/*-----------------------------------------------------------*/
146142

147143
void vPortExitCritical( void )
148144
{
149145
ulCriticalNesting--;
150-
151146
if( ulCriticalNesting == 0 )
152147
{
153148
portENABLE_INTERRUPTS();
@@ -157,7 +152,7 @@ void vPortExitCritical( void )
157152

158153
void vPortYieldHandler( void )
159154
{
160-
uint32_t ulSavedInterruptMask;
155+
uint32_t ulSavedInterruptMask;
161156

162157
ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR();
163158
{
@@ -171,7 +166,7 @@ void vPortYieldHandler( void )
171166

172167
void interrupt VectorNumber_Vrtc vPortTickISR( void )
173168
{
174-
uint32_t ulSavedInterruptMask;
169+
uint32_t ulSavedInterruptMask;
175170

176171
/* Clear the interrupt. */
177172
RTCSC |= RTCSC_RTIF_MASK;

portable/CodeWarrior/ColdFire_V1/portmacro.h

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -46,34 +46,34 @@
4646
*/
4747

4848
/* Type definitions. */
49-
#define portCHAR char
50-
#define portFLOAT float
51-
#define portDOUBLE double
52-
#define portLONG long
53-
#define portSHORT short
54-
#define portSTACK_TYPE uint32_t
55-
#define portBASE_TYPE long
56-
57-
typedef portSTACK_TYPE StackType_t;
58-
typedef long BaseType_t;
59-
typedef unsigned long UBaseType_t;
60-
61-
62-
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
63-
typedef uint16_t TickType_t;
64-
#define portMAX_DELAY ( TickType_t ) 0xffff
49+
#define portCHAR char
50+
#define portFLOAT float
51+
#define portDOUBLE double
52+
#define portLONG long
53+
#define portSHORT short
54+
#define portSTACK_TYPE uint32_t
55+
#define portBASE_TYPE long
56+
57+
typedef portSTACK_TYPE StackType_t;
58+
typedef long BaseType_t;
59+
typedef unsigned long UBaseType_t;
60+
61+
62+
#if( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
63+
typedef uint16_t TickType_t;
64+
#define portMAX_DELAY ( TickType_t ) 0xffff
6565
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
66-
typedef uint32_t TickType_t;
67-
#define portMAX_DELAY ( TickType_t ) ( 0xFFFFFFFFUL )
66+
typedef uint32_t TickType_t;
67+
#define portMAX_DELAY ( TickType_t ) ( 0xFFFFFFFFUL )
6868
#else
6969
#error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
7070
#endif
7171
/*-----------------------------------------------------------*/
7272

7373
/* Hardware specifics. */
74-
#define portBYTE_ALIGNMENT 4
75-
#define portSTACK_GROWTH -1
76-
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
74+
#define portBYTE_ALIGNMENT 4
75+
#define portSTACK_GROWTH -1
76+
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
7777
/*-----------------------------------------------------------*/
7878

7979
uint32_t ulPortSetIPL( uint32_t );
@@ -83,29 +83,30 @@ uint32_t ulPortSetIPL( uint32_t );
8383

8484
extern void vPortEnterCritical( void );
8585
extern void vPortExitCritical( void );
86-
#define portENTER_CRITICAL() vPortEnterCritical()
87-
#define portEXIT_CRITICAL() vPortExitCritical()
86+
#define portENTER_CRITICAL() vPortEnterCritical()
87+
#define portEXIT_CRITICAL() vPortExitCritical()
8888

8989
extern UBaseType_t uxPortSetInterruptMaskFromISR( void );
9090
extern void vPortClearInterruptMaskFromISR( UBaseType_t );
91-
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY )
92-
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusRegister ) ulPortSetIPL( uxSavedStatusRegister )
91+
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetIPL( configMAX_SYSCALL_INTERRUPT_PRIORITY )
92+
#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusRegister ) ulPortSetIPL( uxSavedStatusRegister )
9393

9494
/*-----------------------------------------------------------*/
9595

9696
/* Task utilities. */
97-
#define portNOP() asm volatile ( "nop" )
97+
#define portNOP() asm volatile ( "nop" )
9898

9999
/* Context switches are requested using the force register. */
100-
#define portYIELD() INTC_SFRC = 0x3E; portNOP(); portNOP(); portNOP(); portNOP(); portNOP()
100+
#define portYIELD() INTC_SFRC = 0x3E; portNOP(); portNOP(); portNOP(); portNOP(); portNOP()
101101

102102
/*-----------------------------------------------------------*/
103103

104104
/* Task function macros as described on the FreeRTOS.org WEB site. */
105-
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) __attribute__( ( noreturn ) )
106-
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
105+
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) __attribute__((noreturn))
106+
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
107107
/*-----------------------------------------------------------*/
108108

109+
109110
#define portEND_SWITCHING_ISR( xSwitchRequired ) \
110111
do \
111112
{ \

portable/CodeWarrior/ColdFire_V2/port.c

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,41 +31,39 @@
3131
#include "task.h"
3232

3333

34-
#define portINITIAL_FORMAT_VECTOR ( ( StackType_t ) 0x4000 )
34+
#define portINITIAL_FORMAT_VECTOR ( ( StackType_t ) 0x4000 )
3535

3636
/* Supervisor mode set. */
37-
#define portINITIAL_STATUS_REGISTER ( ( StackType_t ) 0x2000 )
37+
#define portINITIAL_STATUS_REGISTER ( ( StackType_t ) 0x2000)
3838

3939
/* Used to keep track of the number of nested calls to taskENTER_CRITICAL(). This
40-
* will be set to 0 prior to the first task being started. */
40+
will be set to 0 prior to the first task being started. */
4141
static uint32_t ulCriticalNesting = 0x9999UL;
4242

4343

44-
#define portSAVE_CONTEXT() \
45-
lea.l( -60, % sp ), % sp; \
46-
movem.l % d0 - % fp, ( % sp ); \
47-
move.l pxCurrentTCB, % a0; \
48-
move.l % sp, ( % a0 );
44+
#define portSAVE_CONTEXT() \
45+
lea.l (-60, %sp), %sp; \
46+
movem.l %d0-%fp, (%sp); \
47+
move.l pxCurrentTCB, %a0; \
48+
move.l %sp, (%a0);
4949

50-
#define portRESTORE_CONTEXT() \
51-
move.l pxCurrentTCB, % a0; \
52-
move.l( % a0 ), % sp; \
53-
movem.l( % sp ), % d0 - % fp; \
54-
lea.l % sp@( 60 ), % sp; \
50+
#define portRESTORE_CONTEXT() \
51+
move.l pxCurrentTCB, %a0; \
52+
move.l (%a0), %sp; \
53+
movem.l (%sp), %d0-%fp; \
54+
lea.l %sp@(60), %sp; \
5555
rte
5656

5757

5858

5959
/*-----------------------------------------------------------*/
6060

61-
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
62-
TaskFunction_t pxCode,
63-
void * pvParameters )
61+
StackType_t *pxPortInitialiseStack( StackType_t * pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
6462
{
6563
*pxTopOfStack = ( StackType_t ) pvParameters;
6664
pxTopOfStack--;
6765

68-
*pxTopOfStack = ( StackType_t ) 0xDEADBEEF;
66+
*pxTopOfStack = (StackType_t) 0xDEADBEEF;
6967
pxTopOfStack--;
7068

7169
/* Exception stack frame starts with the return address. */
@@ -76,15 +74,15 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
7674
pxTopOfStack--;
7775

7876
*pxTopOfStack = ( StackType_t ) 0x0; /*FP*/
79-
pxTopOfStack -= 14; /* A5 to D0. */
77+
pxTopOfStack -= 14; /* A5 to D0. */
8078

8179
return pxTopOfStack;
8280
}
8381
/*-----------------------------------------------------------*/
8482

8583
BaseType_t xPortStartScheduler( void )
8684
{
87-
extern void vPortStartFirstTask( void );
85+
extern void vPortStartFirstTask( void );
8886

8987
ulCriticalNesting = 0UL;
9088

@@ -109,28 +107,26 @@ void vPortEnterCritical( void )
109107
if( ulCriticalNesting == 0UL )
110108
{
111109
/* Guard against context switches being pended simultaneously with a
112-
* critical section being entered. */
110+
critical section being entered. */
113111
do
114112
{
115113
portDISABLE_INTERRUPTS();
116-
117114
if( MCF_INTC0_INTFRCH == 0UL )
118115
{
119116
break;
120117
}
121118

122119
portENABLE_INTERRUPTS();
120+
123121
} while( 1 );
124122
}
125-
126123
ulCriticalNesting++;
127124
}
128125
/*-----------------------------------------------------------*/
129126

130127
void vPortExitCritical( void )
131128
{
132129
ulCriticalNesting--;
133-
134130
if( ulCriticalNesting == 0 )
135131
{
136132
portENABLE_INTERRUPTS();
@@ -140,12 +136,12 @@ void vPortExitCritical( void )
140136

141137
void vPortYieldHandler( void )
142138
{
143-
uint32_t ulSavedInterruptMask;
139+
uint32_t ulSavedInterruptMask;
144140

145141
ulSavedInterruptMask = portSET_INTERRUPT_MASK_FROM_ISR();
146-
/* Note this will clear all forced interrupts - this is done for speed. */
147-
MCF_INTC0_INTFRCL = 0;
148-
vTaskSwitchContext();
142+
/* Note this will clear all forced interrupts - this is done for speed. */
143+
MCF_INTC0_INTFRCL = 0;
144+
vTaskSwitchContext();
149145
portCLEAR_INTERRUPT_MASK_FROM_ISR( ulSavedInterruptMask );
150146
}
151147
/*-----------------------------------------------------------*/

0 commit comments

Comments
 (0)