Skip to content

Commit 9a2ce91

Browse files
Skptakkar-rahul-awsaggarg
authored
Revert formatting on Rowley ports (#884)
Co-authored-by: Rahul Kar <[email protected]> Co-authored-by: Gaurav-Aggarwal-AWS <[email protected]>
1 parent 8d1da77 commit 9a2ce91

File tree

3 files changed

+131
-130
lines changed

3 files changed

+131
-130
lines changed

portable/Rowley/MSP430F449/port.c

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,28 @@
3131
#include "task.h"
3232

3333
/*-----------------------------------------------------------
34-
* Implementation of functions defined in portable.h for the MSP430 port.
35-
*----------------------------------------------------------*/
34+
* Implementation of functions defined in portable.h for the MSP430 port.
35+
*----------------------------------------------------------*/
3636

3737
/* Constants required for hardware setup. The tick ISR runs off the ACLK,
38-
* not the MCLK. */
38+
not the MCLK. */
3939
#define portACLK_FREQUENCY_HZ ( ( TickType_t ) 32768 )
4040
#define portINITIAL_CRITICAL_NESTING ( ( uint16_t ) 10 )
4141
#define portFLAGS_INT_ENABLED ( ( StackType_t ) 0x08 )
4242

4343
/* We require the address of the pxCurrentTCB variable, but don't want to know
44-
* any details of its type. */
44+
any details of its type. */
4545
typedef void TCB_t;
4646
extern volatile TCB_t * volatile pxCurrentTCB;
4747

4848
/* Each task maintains a count of the critical section nesting depth. Each
49-
* time a critical section is entered the count is incremented. Each time a
50-
* critical section is exited the count is decremented - with interrupts only
51-
* being re-enabled if the count is zero.
52-
*
53-
* usCriticalNesting will get set to zero when the scheduler starts, but must
54-
* not be initialised to zero as this will cause problems during the startup
55-
* sequence. */
49+
time a critical section is entered the count is incremented. Each time a
50+
critical section is exited the count is decremented - with interrupts only
51+
being re-enabled if the count is zero.
52+
53+
usCriticalNesting will get set to zero when the scheduler starts, but must
54+
not be initialised to zero as this will cause problems during the startup
55+
sequence. */
5656
volatile uint16_t usCriticalNesting = portINITIAL_CRITICAL_NESTING;
5757
/*-----------------------------------------------------------*/
5858

@@ -70,26 +70,24 @@ void prvSetupTimerInterrupt( void );
7070
*
7171
* See the header file portable.h.
7272
*/
73-
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
74-
TaskFunction_t pxCode,
75-
void * pvParameters )
73+
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
7674
{
7775
/*
78-
* Place a few bytes of known values on the bottom of the stack.
79-
* This is just useful for debugging and can be included if required.
80-
*
81-
* pxTopOfStack = ( StackType_t ) 0x1111;
82-
* pxTopOfStack--;
83-
* pxTopOfStack = ( StackType_t ) 0x2222;
84-
* pxTopOfStack--;
85-
* pxTopOfStack = ( StackType_t ) 0x3333;
86-
* pxTopOfStack--;
87-
*/
76+
Place a few bytes of known values on the bottom of the stack.
77+
This is just useful for debugging and can be included if required.
78+
79+
*pxTopOfStack = ( StackType_t ) 0x1111;
80+
pxTopOfStack--;
81+
*pxTopOfStack = ( StackType_t ) 0x2222;
82+
pxTopOfStack--;
83+
*pxTopOfStack = ( StackType_t ) 0x3333;
84+
pxTopOfStack--;
85+
*/
8886

8987
/* The msp430 automatically pushes the PC then SR onto the stack before
90-
* executing an ISR. We want the stack to look just as if this has happened
91-
* so place a pointer to the start of the task on the stack first - followed
92-
* by the flags we want the task to use when it starts up. */
88+
executing an ISR. We want the stack to look just as if this has happened
89+
so place a pointer to the start of the task on the stack first - followed
90+
by the flags we want the task to use when it starts up. */
9391
*pxTopOfStack = ( StackType_t ) pxCode;
9492
pxTopOfStack--;
9593
*pxTopOfStack = portFLAGS_INT_ENABLED;
@@ -120,25 +118,25 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
120118
pxTopOfStack--;
121119

122120
/* When the task starts is will expect to find the function parameter in
123-
* R15. */
121+
R15. */
124122
*pxTopOfStack = ( StackType_t ) pvParameters;
125123
pxTopOfStack--;
126124

127125
/* A variable is used to keep track of the critical section nesting.
128-
* This variable has to be stored as part of the task context and is
129-
* initially set to zero. */
126+
This variable has to be stored as part of the task context and is
127+
initially set to zero. */
130128
*pxTopOfStack = ( StackType_t ) portNO_CRITICAL_SECTION_NESTING;
131129

132130
/* Return a pointer to the top of the stack we have generated so this can
133-
* be stored in the task control block for the task. */
131+
be stored in the task control block for the task. */
134132
return pxTopOfStack;
135133
}
136134
/*-----------------------------------------------------------*/
137135

138136
void vPortEndScheduler( void )
139137
{
140138
/* It is unlikely that the MSP430 port will get stopped. If required simply
141-
* disable the tick interrupt here. */
139+
disable the tick interrupt here. */
142140
}
143141
/*-----------------------------------------------------------*/
144142

@@ -170,3 +168,6 @@ void prvSetupTimerInterrupt( void )
170168
TACTL |= MC_1;
171169
}
172170
/*-----------------------------------------------------------*/
171+
172+
173+

portable/Rowley/MSP430F449/portasm.h

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -30,51 +30,51 @@
3030
#define PORT_ASM_H
3131

3232
portSAVE_CONTEXT macro
33-
/* Save the remaining registers. */
34-
push r4
35-
push r5
36-
push r6
37-
push r7
38-
push r8
39-
push r9
40-
push r10
41-
push r11
42-
push r12
43-
push r13
44-
push r14
45-
push r15
46-
mov.w &_usCriticalNesting, r14
47-
push r14
48-
mov.w &_pxCurrentTCB, r12
49-
mov.w r1, @r12
50-
endm
33+
/* Save the remaining registers. */
34+
push r4
35+
push r5
36+
push r6
37+
push r7
38+
push r8
39+
push r9
40+
push r10
41+
push r11
42+
push r12
43+
push r13
44+
push r14
45+
push r15
46+
mov.w &_usCriticalNesting, r14
47+
push r14
48+
mov.w &_pxCurrentTCB, r12
49+
mov.w r1, @r12
50+
endm
5151
/*-----------------------------------------------------------*/
5252

5353
portRESTORE_CONTEXT macro
54-
mov.w &_pxCurrentTCB, r12
55-
mov.w @r12, r1
56-
pop r15
57-
mov.w r15, &_usCriticalNesting
58-
pop r15
59-
pop r14
60-
pop r13
61-
pop r12
62-
pop r11
63-
pop r10
64-
pop r9
65-
pop r8
66-
pop r7
67-
pop r6
68-
pop r5
69-
pop r4
54+
mov.w &_pxCurrentTCB, r12
55+
mov.w @r12, r1
56+
pop r15
57+
mov.w r15, &_usCriticalNesting
58+
pop r15
59+
pop r14
60+
pop r13
61+
pop r12
62+
pop r11
63+
pop r10
64+
pop r9
65+
pop r8
66+
pop r7
67+
pop r6
68+
pop r5
69+
pop r4
7070

71-
/* The last thing on the stack will be the status register.
72-
* Ensure the power down bits are clear ready for the next
73-
* time this power down register is popped from the stack. */
74-
bic.w # 0xf0, 0 ( SP )
71+
/* The last thing on the stack will be the status register.
72+
Ensure the power down bits are clear ready for the next
73+
time this power down register is popped from the stack. */
74+
bic.w #0xf0,0(SP)
7575

76-
reti
77-
endm
76+
reti
77+
endm
7878
/*-----------------------------------------------------------*/
7979

80-
#endif /* ifndef PORT_ASM_H */
80+
#endif

portable/Rowley/MSP430F449/portmacro.h

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,24 @@
4040
*/
4141

4242
/* Type definitions. */
43-
#define portCHAR char
44-
#define portFLOAT float
45-
#define portDOUBLE double
46-
#define portLONG long
47-
#define portSHORT int
48-
#define portSTACK_TYPE uint16_t
49-
#define portBASE_TYPE short
50-
51-
typedef portSTACK_TYPE StackType_t;
52-
typedef short BaseType_t;
53-
typedef unsigned short UBaseType_t;
54-
55-
56-
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
57-
typedef uint16_t TickType_t;
58-
#define portMAX_DELAY ( TickType_t ) 0xffff
59-
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
60-
typedef uint32_t TickType_t;
43+
#define portCHAR char
44+
#define portFLOAT float
45+
#define portDOUBLE double
46+
#define portLONG long
47+
#define portSHORT int
48+
#define portSTACK_TYPE uint16_t
49+
#define portBASE_TYPE short
50+
51+
typedef portSTACK_TYPE StackType_t;
52+
typedef short BaseType_t;
53+
typedef unsigned short UBaseType_t;
54+
55+
56+
#if( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
57+
typedef uint16_t TickType_t;
58+
#define portMAX_DELAY ( TickType_t ) 0xffff
59+
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
60+
typedef uint32_t TickType_t;
6161
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
6262
#else
6363
#error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
@@ -71,37 +71,37 @@ typedef unsigned short UBaseType_t;
7171
/*-----------------------------------------------------------*/
7272

7373
/* Critical section control macros. */
74-
#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 )
75-
76-
#define portENTER_CRITICAL() \
77-
{ \
78-
extern volatile uint16_t usCriticalNesting; \
79-
\
80-
portDISABLE_INTERRUPTS(); \
81-
\
82-
/* Now interrupts are disabled usCriticalNesting can be accessed */ \
83-
/* directly. Increment ulCriticalNesting to keep a count of how many */ \
84-
/* times portENTER_CRITICAL() has been called. */ \
85-
usCriticalNesting++; \
86-
}
87-
88-
#define portEXIT_CRITICAL() \
89-
{ \
90-
extern volatile uint16_t usCriticalNesting; \
91-
\
92-
if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \
93-
{ \
94-
/* Decrement the nesting count as we are leaving a critical section. */ \
95-
usCriticalNesting--; \
96-
\
97-
/* If the nesting level has reached zero then interrupts should be */ \
98-
/* re-enabled. */ \
99-
if( usCriticalNesting == portNO_CRITICAL_SECTION_NESTING ) \
100-
{ \
101-
portENABLE_INTERRUPTS(); \
102-
} \
103-
} \
104-
}
74+
#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 )
75+
76+
#define portENTER_CRITICAL() \
77+
{ \
78+
extern volatile uint16_t usCriticalNesting; \
79+
\
80+
portDISABLE_INTERRUPTS(); \
81+
\
82+
/* Now interrupts are disabled usCriticalNesting can be accessed */ \
83+
/* directly. Increment ulCriticalNesting to keep a count of how many */ \
84+
/* times portENTER_CRITICAL() has been called. */ \
85+
usCriticalNesting++; \
86+
}
87+
88+
#define portEXIT_CRITICAL() \
89+
{ \
90+
extern volatile uint16_t usCriticalNesting; \
91+
\
92+
if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \
93+
{ \
94+
/* Decrement the nesting count as we are leaving a critical section. */ \
95+
usCriticalNesting--; \
96+
\
97+
/* If the nesting level has reached zero then interrupts should be */ \
98+
/* re-enabled. */ \
99+
if( usCriticalNesting == portNO_CRITICAL_SECTION_NESTING ) \
100+
{ \
101+
portENABLE_INTERRUPTS(); \
102+
} \
103+
} \
104+
}
105105
/*-----------------------------------------------------------*/
106106

107107
/* Task utilities. */
@@ -110,24 +110,24 @@ typedef unsigned short UBaseType_t;
110110
* Manual context switch called by portYIELD or taskYIELD.
111111
*/
112112
extern void vPortYield( void );
113-
#define portYIELD() vPortYield()
113+
#define portYIELD() vPortYield()
114114
/*-----------------------------------------------------------*/
115115

116116
/* Hardware specifics. */
117-
#define portBYTE_ALIGNMENT 2
118-
#define portSTACK_GROWTH ( -1 )
119-
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
117+
#define portBYTE_ALIGNMENT 2
118+
#define portSTACK_GROWTH ( -1 )
119+
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
120120
#define portNOP()
121121
/*-----------------------------------------------------------*/
122122

123123
/* Task function macros as described on the FreeRTOS.org WEB site. */
124-
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters )
125-
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) __toplevel
124+
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
125+
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) __toplevel
126126

127127
#if configINTERRUPT_EXAMPLE_METHOD == 2
128128

129-
extern void vTaskSwitchContext( void );
130-
#define portYIELD_FROM_ISR( x ) do { if( x ) vTaskSwitchContext( ); } while( 0 )
129+
extern void vTaskSwitchContext( void );
130+
#define portYIELD_FROM_ISR( x ) do { if( x ) vTaskSwitchContext(); } while( 0 )
131131

132132
#endif
133133

0 commit comments

Comments
 (0)