Skip to content

Commit 92365c9

Browse files
Skptakkar-rahul-awsaggarg
authored
Revert Portable/Softune Formatting (#886)
* Revert formatting on Softune ports * Fix spelling mistakes --------- Co-authored-by: Rahul Kar <[email protected]> Co-authored-by: Gaurav-Aggarwal-AWS <[email protected]>
1 parent 96cdeaa commit 92365c9

File tree

6 files changed

+336
-346
lines changed

6 files changed

+336
-346
lines changed

portable/Softune/MB91460/__STD_LIB_sbrk.c

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,26 @@
3030
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
3131
/* ELIGIBILITY FOR ANY PURPOSES. */
3232
/* (C) Fujitsu Microelectronics Europe GmbH */
33-
3433
/*---------------------------------------------------------------------------
35-
* __STD_LIB_sbrk.C
36-
* - Used by heap_3.c for memory allocation and deletion.
37-
*
38-
* /*---------------------------------------------------------------------------*/
34+
__STD_LIB_sbrk.C
35+
- Used by heap_3.c for memory allocation and deletion.
36+
37+
/*---------------------------------------------------------------------------*/
3938

4039
#include "FreeRTOSConfig.h"
4140
#include <stdlib.h>
4241

43-
static long brk_siz = 0;
44-
typedef int _heep_t;
45-
#define ROUNDUP( s ) ( ( ( s ) + sizeof( _heep_t ) - 1 ) & ~( sizeof( _heep_t ) - 1 ) )
46-
static _heep_t _heep[ ROUNDUP( configTOTAL_HEAP_SIZE ) / sizeof( _heep_t ) ];
47-
#define _heep_size ROUNDUP( configTOTAL_HEAP_SIZE )
42+
static long brk_siz = 0;
43+
typedef int _heep_t;
44+
#define ROUNDUP(s) (((s)+sizeof(_heep_t)-1)&~(sizeof(_heep_t)-1))
45+
static _heep_t _heep[ROUNDUP(configTOTAL_HEAP_SIZE)/sizeof(_heep_t)];
46+
#define _heep_size ROUNDUP(configTOTAL_HEAP_SIZE)
4847

49-
extern char * sbrk( int size )
50-
{
51-
if( ( brk_siz + size > _heep_size ) || ( brk_siz + size < 0 ) )
48+
extern char *sbrk(int size)
5249
{
53-
return( ( char * ) -1 );
54-
}
50+
if (brk_siz + size > _heep_size || brk_siz + size < 0)
5551

56-
brk_siz += size;
57-
return( ( char * ) _heep + brk_siz - size );
58-
}
52+
return((char*)-1);
53+
brk_siz += size;
54+
return( (char*)_heep + brk_siz - size);
55+
}

portable/Softune/MB91460/port.c

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/*-----------------------------------------------------------*/
3434

3535
/* We require the address of the pxCurrentTCB variable, but don't want to know
36-
* any details of its type. */
36+
any details of its type. */
3737
typedef void TCB_t;
3838
extern volatile TCB_t * volatile pxCurrentTCB;
3939

@@ -106,12 +106,10 @@ static void prvSetupTimerInterrupt( void );
106106
*
107107
* See the header file portable.h.
108108
*/
109-
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
110-
TaskFunction_t pxCode,
111-
void * pvParameters )
109+
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
112110
{
113111
/* Place a few bytes of known values on the bottom of the stack.
114-
* This is just useful for debugging. */
112+
This is just useful for debugging. */
115113

116114
*pxTopOfStack = 0x11111111;
117115
pxTopOfStack--;
@@ -121,9 +119,9 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
121119
pxTopOfStack--;
122120

123121
/* This is a redundant push to the stack, it may be required if
124-
* in some implementations of the compiler the parameter to the task
125-
* is passed on to the stack rather than in R4 register. */
126-
*pxTopOfStack = ( StackType_t ) ( pvParameters );
122+
in some implementations of the compiler the parameter to the task
123+
is passed on to the stack rather than in R4 register. */
124+
*pxTopOfStack = (StackType_t)(pvParameters);
127125
pxTopOfStack--;
128126

129127
*pxTopOfStack = ( StackType_t ) 0x00000000; /* RP */
@@ -136,36 +134,36 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
136134
pxTopOfStack--;
137135

138136
/* In the current implementation of the compiler the first
139-
* parameter to the task (or function) is passed via R4 parameter
140-
* to the task, hence the pvParameters pointer is copied into the R4
141-
* register. See compiler manual section 4.6.2 for more information. */
142-
*pxTopOfStack = ( StackType_t ) ( pvParameters ); /* R4 */
137+
parameter to the task (or function) is passed via R4 parameter
138+
to the task, hence the pvParameters pointer is copied into the R4
139+
register. See compiler manual section 4.6.2 for more information. */
140+
*pxTopOfStack = ( StackType_t ) (pvParameters); /* R4 */
143141
pxTopOfStack--;
144-
*pxTopOfStack = ( StackType_t ) 0x00003333; /* R3 */
142+
*pxTopOfStack = ( StackType_t ) 0x00003333; /* R3 */
145143
pxTopOfStack--;
146-
*pxTopOfStack = ( StackType_t ) 0x00002222; /* R2 */
144+
*pxTopOfStack = ( StackType_t ) 0x00002222; /* R2 */
147145
pxTopOfStack--;
148-
*pxTopOfStack = ( StackType_t ) 0x00001111; /* R1 */
146+
*pxTopOfStack = ( StackType_t ) 0x00001111; /* R1 */
149147
pxTopOfStack--;
150-
*pxTopOfStack = ( StackType_t ) 0x00000001; /* R0 */
148+
*pxTopOfStack = ( StackType_t ) 0x00000001; /* R0 */
151149
pxTopOfStack--;
152-
*pxTopOfStack = ( StackType_t ) 0x0000EEEE; /* R14 */
150+
*pxTopOfStack = ( StackType_t ) 0x0000EEEE; /* R14 */
153151
pxTopOfStack--;
154-
*pxTopOfStack = ( StackType_t ) 0x0000DDDD; /* R13 */
152+
*pxTopOfStack = ( StackType_t ) 0x0000DDDD; /* R13 */
155153
pxTopOfStack--;
156-
*pxTopOfStack = ( StackType_t ) 0x0000CCCC; /* R12 */
154+
*pxTopOfStack = ( StackType_t ) 0x0000CCCC; /* R12 */
157155
pxTopOfStack--;
158-
*pxTopOfStack = ( StackType_t ) 0x0000BBBB; /* R11 */
156+
*pxTopOfStack = ( StackType_t ) 0x0000BBBB; /* R11 */
159157
pxTopOfStack--;
160-
*pxTopOfStack = ( StackType_t ) 0x0000AAAA; /* R10 */
158+
*pxTopOfStack = ( StackType_t ) 0x0000AAAA; /* R10 */
161159
pxTopOfStack--;
162-
*pxTopOfStack = ( StackType_t ) 0x00009999; /* R9 */
160+
*pxTopOfStack = ( StackType_t ) 0x00009999; /* R9 */
163161
pxTopOfStack--;
164-
*pxTopOfStack = ( StackType_t ) 0x00008888; /* R8 */
162+
*pxTopOfStack = ( StackType_t ) 0x00008888; /* R8 */
165163
pxTopOfStack--;
166-
*pxTopOfStack = ( StackType_t ) 0x11110000; /* MDH */
164+
*pxTopOfStack = ( StackType_t ) 0x11110000; /* MDH */
167165
pxTopOfStack--;
168-
*pxTopOfStack = ( StackType_t ) 0x22220000; /* MDL */
166+
*pxTopOfStack = ( StackType_t ) 0x22220000; /* MDL */
169167
pxTopOfStack--;
170168

171169
/* The start of the task code. */
@@ -190,8 +188,8 @@ BaseType_t xPortStartScheduler( void )
190188
#pragma endasm
191189

192190
/* Simulate a function call end as generated by the compiler. We will now
193-
* jump to the start of the task the context of which we have just restored. */
194-
__asm( " reti " );
191+
jump to the start of the task the context of which we have just restored. */
192+
__asm(" reti ");
195193

196194
/* Should not get here. */
197195
return pdFAIL;
@@ -201,39 +199,39 @@ BaseType_t xPortStartScheduler( void )
201199
void vPortEndScheduler( void )
202200
{
203201
/* Not implemented - unlikely to ever be required as there is nothing to
204-
* return to. */
202+
return to. */
205203
}
206204
/*-----------------------------------------------------------*/
207205

208206
static void prvSetupTimerInterrupt( void )
209207
{
210208
/* The peripheral clock divided by 32 is used by the timer. */
211-
const uint16_t usReloadValue = ( uint16_t ) ( ( ( configPER_CLOCK_HZ / configTICK_RATE_HZ ) / 32UL ) - 1UL );
209+
const uint16_t usReloadValue = ( uint16_t ) ( ( ( configPER_CLOCK_HZ / configTICK_RATE_HZ ) / 32UL ) - 1UL );
212210

213211
/* Setup RLT0 to generate a tick interrupt. */
214212

215-
TMCSR0_CNTE = 0; /* Count Disable */
216-
TMCSR0_CSL = 0x2; /* CLKP/32 */
217-
TMCSR0_MOD = 0; /* Software trigger */
218-
TMCSR0_RELD = 1; /* Reload */
213+
TMCSR0_CNTE = 0; /* Count Disable */
214+
TMCSR0_CSL = 0x2; /* CLKP/32 */
215+
TMCSR0_MOD = 0; /* Software trigger */
216+
TMCSR0_RELD = 1; /* Reload */
219217

220-
TMCSR0_UF = 0; /* Clear underflow flag */
218+
TMCSR0_UF = 0; /* Clear underflow flag */
221219
TMRLR0 = usReloadValue;
222-
TMCSR0_INTE = 1; /* Interrupt Enable */
223-
TMCSR0_CNTE = 1; /* Count Enable */
224-
TMCSR0_TRG = 1; /* Trigger */
220+
TMCSR0_INTE = 1; /* Interrupt Enable */
221+
TMCSR0_CNTE = 1; /* Count Enable */
222+
TMCSR0_TRG = 1; /* Trigger */
225223

226-
PORTEN = 0x3; /* Port Enable */
224+
PORTEN = 0x3; /* Port Enable */
227225
}
228226
/*-----------------------------------------------------------*/
229227

230228
#if configUSE_PREEMPTION == 1
231229

232-
/*
233-
* Tick ISR for preemptive scheduler. The tick count is incremented
234-
* after the context is saved. Then the context is switched if required,
235-
* and last the context of the task which is to be resumed is restored.
236-
*/
230+
/*
231+
* Tick ISR for preemptive scheduler. The tick count is incremented
232+
* after the context is saved. Then the context is switched if required,
233+
* and last the context of the task which is to be resumed is restored.
234+
*/
237235

238236
#pragma asm
239237

@@ -259,21 +257,21 @@ static void prvSetupTimerInterrupt( void )
259257

260258
#pragma endasm
261259

262-
#else /* if configUSE_PREEMPTION == 1 */
260+
#else
263261

264-
/*
265-
* Tick ISR for the cooperative scheduler. All this does is increment the
266-
* tick count. We don't need to switch context, this can only be done by
267-
* manual calls to taskYIELD();
268-
*/
262+
/*
263+
* Tick ISR for the cooperative scheduler. All this does is increment the
264+
* tick count. We don't need to switch context, this can only be done by
265+
* manual calls to taskYIELD();
266+
*/
269267
__interrupt void ReloadTimer0_IRQHandler( void )
270268
{
271269
/* Clear RLT0 interrupt flag */
272270
TMCSR0_UF = 0;
273271
xTaskIncrementTick();
274272
}
275273

276-
#endif /* if configUSE_PREEMPTION == 1 */
274+
#endif
277275

278276
/*
279277
* Manual context switch. We can use a __nosavereg attribute as the context

portable/Softune/MB91460/portmacro.h

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,24 @@
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
65-
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
66-
typedef uint32_t TickType_t;
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
65+
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
66+
typedef uint32_t TickType_t;
6767
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
6868
#else
6969
#error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
@@ -74,38 +74,38 @@ typedef unsigned long UBaseType_t;
7474
#if configKERNEL_INTERRUPT_PRIORITY != 30
7575
#error configKERNEL_INTERRUPT_PRIORITY (set in FreeRTOSConfig.h) must match the ILM value set in the following line - 30 (1Eh) being the default.
7676
#endif
77-
#define portDISABLE_INTERRUPTS() __asm( " STILM #1Eh " )
78-
#define portENABLE_INTERRUPTS() __asm( " STILM #1Fh " )
77+
#define portDISABLE_INTERRUPTS() __asm(" STILM #1Eh ")
78+
#define portENABLE_INTERRUPTS() __asm(" STILM #1Fh ")
7979

80-
#define portENTER_CRITICAL() \
81-
__asm( " ST PS,@-R15 " ); \
82-
__asm( " ANDCCR #0xef " ); \
80+
#define portENTER_CRITICAL() \
81+
__asm(" ST PS,@-R15 "); \
82+
__asm(" ANDCCR #0xef "); \
8383

8484

85-
#define portEXIT_CRITICAL() \
86-
__asm( " LD @R15+,PS " ); \
85+
#define portEXIT_CRITICAL() \
86+
__asm(" LD @R15+,PS "); \
8787

8888
/*-----------------------------------------------------------*/
8989

9090
/* Architecture specifics. */
91-
#define portSTACK_GROWTH ( -1 )
92-
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
93-
#define portBYTE_ALIGNMENT 4
94-
#define portNOP() __asm( " nop " );
91+
#define portSTACK_GROWTH ( -1 )
92+
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
93+
#define portBYTE_ALIGNMENT 4
94+
#define portNOP() __asm( " nop " );
9595
/*-----------------------------------------------------------*/
9696

9797
/* portYIELD() uses a SW interrupt */
98-
#define portYIELD() __asm( " INT #40H " );
98+
#define portYIELD() __asm( " INT #40H " );
9999

100100
/* portYIELD_FROM_ISR() uses delayed interrupt */
101-
#define portYIELD_FROM_ISR() DICR_DLYI = 1
101+
#define portYIELD_FROM_ISR() DICR_DLYI = 1
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 )
106-
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters )
105+
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
106+
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
107107

108-
#define portMINIMAL_STACK_SIZE configMINIMAL_STACK_SIZE
108+
#define portMINIMAL_STACK_SIZE configMINIMAL_STACK_SIZE
109109

110110

111111
#endif /* PORTMACRO_H */

portable/Softune/MB96340/__STD_LIB_sbrk.c

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,26 @@
3030
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
3131
/* ELIGIBILITY FOR ANY PURPOSES. */
3232
/* (C) Fujitsu Microelectronics Europe GmbH */
33-
3433
/*---------------------------------------------------------------------------
35-
* __STD_LIB_sbrk.C
36-
* - Used by heap_3.c for memory allocation and deletion.
37-
*
38-
* /*---------------------------------------------------------------------------*/
34+
__STD_LIB_sbrk.C
35+
- Used by heap_3.c for memory allocation and deletion.
36+
37+
/*---------------------------------------------------------------------------*/
3938

4039
#include "FreeRTOSConfig.h"
4140
#include <stdlib.h>
4241

43-
static long brk_siz = 0;
44-
typedef int _heep_t;
45-
#define ROUNDUP( s ) ( ( ( s ) + sizeof( _heep_t ) - 1 ) & ~( sizeof( _heep_t ) - 1 ) )
46-
static _heep_t _heep[ ROUNDUP( configTOTAL_HEAP_SIZE ) / sizeof( _heep_t ) ];
47-
#define _heep_size ROUNDUP( configTOTAL_HEAP_SIZE )
42+
static long brk_siz = 0;
43+
typedef int _heep_t;
44+
#define ROUNDUP(s) (((s)+sizeof(_heep_t)-1)&~(sizeof(_heep_t)-1))
45+
static _heep_t _heep[ROUNDUP(configTOTAL_HEAP_SIZE)/sizeof(_heep_t)];
46+
#define _heep_size ROUNDUP(configTOTAL_HEAP_SIZE)
4847

49-
extern char * sbrk( int size )
50-
{
51-
if( ( brk_siz + size > _heep_size ) || ( brk_siz + size < 0 ) )
48+
extern char *sbrk(int size)
5249
{
53-
return( ( char * ) -1 );
54-
}
50+
if (brk_siz + size > _heep_size || brk_siz + size < 0)
5551

56-
brk_siz += size;
57-
return( ( char * ) _heep + brk_siz - size );
58-
}
52+
return((char*)-1);
53+
brk_siz += size;
54+
return( (char*)_heep + brk_siz - size);
55+
}

0 commit comments

Comments
 (0)