Skip to content

Commit ab7af2e

Browse files
author
suzuki
committed
Apply coding rules to indentation.
Other corrections.
1 parent a8fcfde commit ab7af2e

File tree

4 files changed

+127
-143
lines changed

4 files changed

+127
-143
lines changed

portable/Renesas/RL78G2x/ISR_Support.h

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
; */
2727

2828
;/* Variables used by scheduler */
29-
.EXTERN _pxCurrentTCB
30-
.EXTERN _usCriticalNesting
29+
.EXTERN _pxCurrentTCB
30+
.EXTERN _usCriticalNesting
3131

3232
;/*
3333
; * portSAVE_CONTEXT MACRO
@@ -36,30 +36,30 @@
3636
; * of the active Task onto the task stack
3737
; */
3838
portSAVE_CONTEXT .MACRO
39-
; /* Save AX Register to stack. */
40-
PUSH AX
41-
PUSH HL
42-
; /* Save CS register. */
43-
MOV A, CS
44-
XCH A, X
45-
; /* Save ES register. */
46-
MOV A, ES
47-
PUSH AX
48-
; /* Save the remaining general purpose registers from bank 0. */
49-
PUSH DE
50-
PUSH BC
51-
; /* Save the usCriticalNesting value. */
52-
MOVW AX, !_usCriticalNesting
53-
PUSH AX
54-
; /* Save the Stack pointer. */
55-
MOVW AX, !_pxCurrentTCB
56-
MOVW HL, AX
57-
MOVW AX, SP
58-
MOVW [HL], AX
59-
; /* Switch stack pointers. */
60-
; MOVW SP, #LOWW(__STACK_ADDR_START)
39+
; /* Save AX Register to stack. */
40+
PUSH AX
41+
PUSH HL
42+
; /* Save CS register. */
43+
MOV A, CS
44+
XCH A, X
45+
; /* Save ES register. */
46+
MOV A, ES
47+
PUSH AX
48+
; /* Save the remaining general purpose registers from bank 0. */
49+
PUSH DE
50+
PUSH BC
51+
; /* Save the usCriticalNesting value. */
52+
MOVW AX, !_usCriticalNesting
53+
PUSH AX
54+
; /* Save the Stack pointer. */
55+
MOVW AX, !_pxCurrentTCB
56+
MOVW HL, AX
57+
MOVW AX, SP
58+
MOVW [HL], AX
59+
; /* Switch stack pointers. */
60+
; MOVW SP, #LOWW(__STACK_ADDR_START)
6161

62-
.ENDM
62+
.ENDM
6363

6464

6565
;/*
@@ -69,27 +69,27 @@ portSAVE_CONTEXT .MACRO
6969
; * of the selected task from the task stack
7070
; */
7171
portRESTORE_CONTEXT .MACRO
72-
; /* Restore the Stack pointer. */
73-
MOVW AX, !_pxCurrentTCB
74-
MOVW HL, AX
75-
MOVW AX, [HL]
76-
MOVW SP, AX
77-
; /* Restore usCriticalNesting value. */
78-
POP AX
79-
MOVW !_usCriticalNesting, AX
80-
; /* Restore the necessary general purpose registers. */
81-
POP BC
82-
POP DE
83-
; /* Restore the ES register. */
84-
POP AX
85-
MOV ES, A
86-
; /* Restore the CS register. */
87-
XCH A, X
88-
MOV CS, A
89-
; /* Restore general purpose register HL. */
90-
POP HL
91-
; /* Restore AX. */
92-
POP AX
72+
; /* Restore the Stack pointer. */
73+
MOVW AX, !_pxCurrentTCB
74+
MOVW HL, AX
75+
MOVW AX, [HL]
76+
MOVW SP, AX
77+
; /* Restore usCriticalNesting value. */
78+
POP AX
79+
MOVW !_usCriticalNesting, AX
80+
; /* Restore the necessary general purpose registers. */
81+
POP BC
82+
POP DE
83+
; /* Restore the ES register. */
84+
POP AX
85+
MOV ES, A
86+
; /* Restore the CS register. */
87+
XCH A, X
88+
MOV CS, A
89+
; /* Restore general purpose register HL. */
90+
POP HL
91+
; /* Restore AX. */
92+
POP AX
9393

94-
.ENDM
94+
.ENDM
9595

portable/Renesas/RL78G2x/port.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@
3838

3939
/* Initial PSW value allocated to a newly created task.
4040
* 11000110
41-
* ||||||||-------------- Fill byte
42-
* |||||||--------------- Carry Flag cleared
43-
* |||||----------------- In-service priority Flags set to low level
41+
* ||||||||-------------- Carry Flag Cleared
42+
* |||||||--------------- In-service priority Flags set to low level (ISP0)
43+
* |||||----------------- In-service priority Flags set to low level (ISP1)
4444
* ||||------------------ Register bank Select 0 Flag cleared
4545
* |||------------------- Auxiliary Carry Flag cleared
4646
* ||-------------------- Register bank Select 1 Flag cleared
4747
* |--------------------- Zero Flag set
4848
* ---------------------- Global Interrupt Flag set (enabled)
4949
*/
50-
#define portPSW ( 0xc6UL )
50+
#define portPSW ( 0xc6UL )
5151

5252
/* Each task maintains a count of the critical section nesting depth. Each time
5353
a critical section is entered the count is incremented. Each time a critical

portable/Renesas/RL78G2x/portasm.asm

Lines changed: 40 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -28,76 +28,60 @@
2828
;$include "FreeRTOSConfig.h"
2929
$include "ISR_Support.h"
3030

31-
.PUBLIC _vPortYield
32-
.PUBLIC _vPortStartFirstTask
33-
.PUBLIC _vPortTickISR
31+
.PUBLIC _vPortYield
32+
.PUBLIC _vPortStartFirstTask
33+
.PUBLIC _vPortTickISR
3434

35-
.EXTERN _vTaskSwitchContext
36-
.EXTERN _xTaskIncrementTick
35+
.EXTERN _vTaskSwitchContext
36+
.EXTERN _xTaskIncrementTick
3737

38-
.extern _Clear_ITLSFlag
38+
.extern _Clear_ITLSFlag
3939

4040
;/* FreeRTOS yield handler. This is installed as the BRK software interrupt handler. */
41-
.SECTION .text,TEXT
41+
.SECTION .text,TEXT
4242
_vPortYield:
43-
; /* Save the context of the current task. */
44-
portSAVE_CONTEXT
45-
; /* Start multiple interrupts (allow only priority level 0) */
46-
; clr1 psw.1
47-
; set1 psw.2
48-
; ei
49-
; /* Call the scheduler to select the next task. */
50-
call !!_vTaskSwitchContext
51-
; /* Stop multiple interrupts (priority level set to default) */
52-
; di
53-
; set1 psw.1
54-
; set1 psw.2
55-
; /* Restore the context of the next task to run. */
56-
portRESTORE_CONTEXT
57-
retb
43+
; /* Save the context of the current task. */
44+
portSAVE_CONTEXT
45+
; /* Call the scheduler to select the next task. */
46+
call !!_vTaskSwitchContext
47+
; /* Restore the context of the next task to run. */
48+
portRESTORE_CONTEXT
49+
retb
5850

5951

6052
;/* Starts the scheduler by restoring the context of the task that will execute first. */
61-
.SECTION .text,TEXT
53+
.SECTION .text,TEXT
6254
_vPortStartFirstTask:
63-
; /* Restore the context of whichever task will execute first. */
64-
portRESTORE_CONTEXT
65-
; /* An interrupt stack frame is used so the task is started using RETI. */
66-
reti
55+
; /* Restore the context of whichever task will execute first. */
56+
portRESTORE_CONTEXT
57+
; /* An interrupt stack frame is used so the task is started using RETI. */
58+
reti
6759

6860
;/* FreeRTOS tick handler. This is installed as the interval timer interrupt handler. */
69-
.SECTION .text,TEXT
61+
.SECTION .text,TEXT
7062
_vPortTickISR:
71-
; /* Clear the status flag of the interval timer */
72-
push AX
73-
mov a, #0xFE
74-
and a, !0x036B
75-
mov !0x036B, a
76-
pop AX
77-
; /* Save the context of the currently executing task. */
78-
portSAVE_CONTEXT
79-
; /* Start multiple interrupts (allow only priority level 0) */
80-
; clr1 psw.1
81-
; set1 psw.2
82-
; ei
83-
; /* Call the RTOS tick function. */
84-
call !!_xTaskIncrementTick
85-
cmpw ax, #0x00
86-
skz
87-
call !!_vTaskSwitchContext
88-
; /* Stop multiple interrupts (priority level set to default) */
89-
; di
90-
; set1 psw.1
91-
; set1 psw.2
92-
; /* Retore the context of whichever task will run next. */
93-
portRESTORE_CONTEXT
94-
reti
63+
; /* Clear the status flag of the interval timer */
64+
push AX
65+
mov a, #0xFE
66+
and a, !0x036B
67+
mov !0x036B, a
68+
pop AX
69+
; /* Save the context of the currently executing task. */
70+
portSAVE_CONTEXT
71+
; /* Call the RTOS tick function. */
72+
call !!_xTaskIncrementTick
73+
cmpw ax, #0x00
74+
skz
75+
call !!_vTaskSwitchContext
76+
; /* Retore the context of whichever task will run next. */
77+
portRESTORE_CONTEXT
78+
reti
9579

9680
;/* Install the interrupt handlers */
9781

98-
; /* 32bit interval timer */
99-
_vPortTickISR .VECTOR 0x38
82+
; /* 32bit interval timer */
83+
_vPortTickISR .VECTOR 0x38
10084

101-
; /* brk */
102-
_vPortYield .VECTOR 0x7E
85+
; /* brk */
86+
_vPortYield .VECTOR 0x7E
10387

portable/Renesas/RL78G2x/portmacro.h

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#define portDOUBLE double
4646
#define portLONG long
4747
#define portSHORT short
48-
#define portSTACK_TYPE uint16_t
48+
#define portSTACK_TYPE uint16_t
4949
#define portBASE_TYPE short
5050
#define portPOINTER_SIZE_TYPE uint16_t
5151

@@ -54,8 +54,8 @@ typedef short BaseType_t;
5454
typedef unsigned short UBaseType_t;
5555

5656
#if( configUSE_16_BIT_TICKS == 1 )
57-
typedef uint16_t TickType_t;
58-
#define portMAX_DELAY ( TickType_t ) 0xffff
57+
typedef uint16_t TickType_t;
58+
#define portMAX_DELAY ( TickType_t ) 0xffff
5959
#else
6060
typedef uint32_t TickType_t;
6161
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
@@ -64,53 +64,53 @@ typedef uint32_t TickType_t;
6464

6565
/* Interrupt control macros. */
6666
#define portDISABLE_INTERRUPTS() __DI()
67-
#define portENABLE_INTERRUPTS() __EI()
67+
#define portENABLE_INTERRUPTS() __EI()
6868
/*-----------------------------------------------------------*/
6969

7070
/* Critical section control macros. */
71-
#define portNO_CRITICAL_SECTION_NESTING ( ( unsigned short ) 0 )
71+
#define portNO_CRITICAL_SECTION_NESTING ( ( uint16_t ) 0 )
7272

73-
#define portENTER_CRITICAL() \
74-
{ \
75-
extern volatile uint16_t usCriticalNesting; \
76-
\
77-
portDISABLE_INTERRUPTS(); \
78-
\
79-
/* Now interrupts are disabled ulCriticalNesting can be accessed */ \
80-
/* directly. Increment ulCriticalNesting to keep a count of how many */ \
81-
/* times portENTER_CRITICAL() has been called. */ \
82-
usCriticalNesting++; \
73+
#define portENTER_CRITICAL() \
74+
{ \
75+
extern volatile uint16_t usCriticalNesting; \
76+
\
77+
portDISABLE_INTERRUPTS(); \
78+
\
79+
/* Now interrupts are disabled ulCriticalNesting can be accessed */ \
80+
/* directly. Increment ulCriticalNesting to keep a count of how many */ \
81+
/* times portENTER_CRITICAL() has been called. */ \
82+
usCriticalNesting++; \
8383
}
8484

85-
#define portEXIT_CRITICAL() \
86-
{ \
87-
extern volatile uint16_t usCriticalNesting; \
88-
\
89-
if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \
90-
{ \
91-
/* Decrement the nesting count as we are leaving a critical section. */ \
92-
usCriticalNesting--; \
93-
\
94-
/* If the nesting level has reached zero then interrupts should be */ \
95-
/* re-enabled. */ \
96-
if( usCriticalNesting == portNO_CRITICAL_SECTION_NESTING ) \
97-
{ \
98-
portENABLE_INTERRUPTS(); \
99-
} \
100-
} \
85+
#define portEXIT_CRITICAL() \
86+
{ \
87+
extern volatile uint16_t usCriticalNesting; \
88+
\
89+
if( usCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \
90+
{ \
91+
/* Decrement the nesting count as we are leaving a critical section. */ \
92+
usCriticalNesting--; \
93+
\
94+
/* If the nesting level has reached zero then interrupts should be */ \
95+
/* re-enabled. */ \
96+
if( usCriticalNesting == portNO_CRITICAL_SECTION_NESTING ) \
97+
{ \
98+
portENABLE_INTERRUPTS(); \
99+
} \
100+
} \
101101
}
102102
/*-----------------------------------------------------------*/
103103

104104
/* Task utilities. */
105-
#define portYIELD() __brk()
105+
#define portYIELD() __brk()
106106
#define portYIELD_FROM_ISR( xHigherPriorityTaskWoken ) if( xHigherPriorityTaskWoken ) vTaskSwitchContext()
107-
#define portNOP() __nop()
107+
#define portNOP() __nop()
108108
/*-----------------------------------------------------------*/
109109

110110
/* Hardwware specifics. */
111-
#define portBYTE_ALIGNMENT 2
112-
#define portSTACK_GROWTH ( -1 )
113-
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
111+
#define portBYTE_ALIGNMENT 2
112+
#define portSTACK_GROWTH ( -1 )
113+
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
114114
/*-----------------------------------------------------------*/
115115

116116
/* Task function macros as described on the FreeRTOS.org WEB site. */

0 commit comments

Comments
 (0)