Skip to content

Commit 5a1de26

Browse files
author
wayne ren
committed
os : remove the code to hanlde the case when no task is ready in FreeRTOS
Becase the exist of idle task , it's impossible that no task is ready in FreeRTOS. So remove the related codes. This fix will make codes simpler and improve the performance a little
1 parent eb39b29 commit 5a1de26

File tree

2 files changed

+0
-89
lines changed

2 files changed

+0
-89
lines changed

os/freertos/portable/Synopsys/ARC/arc_support.s

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -141,54 +141,11 @@ dispatcher:
141141
*/
142142
dispatcher_0:
143143
ld r1, [pxCurrentTCB]
144-
cmp r1, 0 /* if no tasks run, jump to dispatcher_1 */
145-
beq dispatcher_1
146144
ld sp, [r1] /* recover task stack */
147145
POP r0 /* get critical nesting */
148146
st r0, [ulCriticalNesting]
149147
POP r0 /* get return address */
150148
j [r0]
151-
/* when p_runtsk is NULL, some power saving can be done here */
152-
dispatcher_1:
153-
/*
154-
* unlock the CPU, and be ready to switch to non-task context
155-
*/
156-
/* switch to non-task context */
157-
mov sp, _e_stack
158-
dispatcher_2:
159-
/*
160-
* enable all interrupts, run in non-task context to wait for
161-
* interrupts.
162-
*
163-
* the switch to no-task context one hand is to solve the problem
164-
* of which stack the interrupt processing should use, the other
165-
* hand is to prevent task dispatch in the interrupt handlers.
166-
*
167-
* the processing of enable interrupts and wait for interrupts
168-
* must be atomic. If not, at the moment that interrupts are
169-
* enabled, the interrupts may come out, no matter whether a task
170-
* dispatch request exists, the processor will wait for interrupts
171-
* after return. So even if a task dispatch request exists, no real
172-
* task dispatch will happen.
173-
*
174-
* dependent on target, the processor may get into low power mode
175-
* when it is waiting for interrupts.
176-
*
177-
*/
178-
mov r1, 1
179-
st r1, [exc_nest_count] /* exc_nest_count = 1 */
180-
181-
seti /* enable interrupt */
182-
sleep
183-
clri /* disable interrupt */
184-
185-
ld r0, [context_switch_reqflg] /* if context_switch_reqflg is false, jump to dispatcher_2 */
186-
cmp r0, 0
187-
beq dispatcher_2
188-
mov r0, 0
189-
st r0, [context_switch_reqflg] /* context_switch_reqflg = 0 */
190-
st r0, [exc_nest_count] /* exc_nest_count = 0 */
191-
b dispatcher_0
192149

193150
/*
194151
* task startup routine

os/freertos/portable/Synopsys/ARC_EM_SECURESHIELD/arc_support.s

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -139,59 +139,13 @@ dispatcher:
139139
*/
140140
dispatcher_0:
141141
ld r1, [pxCurrentTCB]
142-
cmp r1, 0 /* if no tasks run, jump to dispatcher_1 */
143-
beq dispatcher_1
144142
ld sp, [r1] /* recover task stack */
145143
POP r0 /* get critical nesting */
146144
st r0, [ulCriticalNesting]
147145
RESTORE_CALLEE_REGS
148146
EXCEPTION_EPILOGUE
149147
rtie
150148

151-
/* when p_runtsk is NULL, some power saving can be done here */
152-
dispatcher_1:
153-
/*
154-
* unlock the CPU, and be ready to switch to non-task context
155-
*/
156-
/* switch to non-task context */
157-
mov sp, _e_stack
158-
dispatcher_2:
159-
/*
160-
* enable all interrupts, run in non-task context to wait for
161-
* interrupts.
162-
*
163-
* the switch to no-task context one hand is to solve the problem
164-
* of which stack the interrupt processing should use, the other
165-
* hand is to prevent task dispatch in the interrupt handlers.
166-
*
167-
* the processing of enable interrupts and wait for interrupts
168-
* must be atomic. If not, at the moment that interrupts are
169-
* enabled, the interrupts may come out, no matter whether a task
170-
* dispatch request exists, the processor will wait for interrupts
171-
* after return. So even if a task dispatch request exists, no real
172-
* task dispatch will happen.
173-
*
174-
* dependent on target, the processor may get into low power mode
175-
* when it is waiting for interrupts.
176-
*
177-
*/
178-
mov r1, 1
179-
st r1, [exc_nest_count] /* exc_nest_count = 1 */
180-
181-
seti /* enable interrupt */
182-
sleep
183-
clri /* disable interrupt */
184-
185-
ld r0, [context_switch_reqflg] /* if context_switch_reqflg is false, jump to dispatcher_2 */
186-
cmp r0, 0
187-
beq dispatcher_2
188-
mov r0, 0
189-
st r0, [context_switch_reqflg] /* context_switch_reqflg = 0 */
190-
st r0, [exc_nest_count] /* exc_nest_count = 0 */
191-
b dispatcher_0
192-
193-
194-
195149
/****** exceptions and interrupts handing ******/
196150
/****** entry for exception handling ******/
197151
.global exc_entry_cpu

0 commit comments

Comments
 (0)