Skip to content

Commit 9e7d7ae

Browse files
authored
Merge pull request #5256 from jhbdream/thead-smart
[fix][libcpu][riscv][t-head] fix rt_hw_interrupt_disable/rt_hw_interupt_enable bug
2 parents 6f44a9c + 7d07c61 commit 9e7d7ae

File tree

2 files changed

+22
-33
lines changed

2 files changed

+22
-33
lines changed

libcpu/risc-v/t-head/e9xx/context_gcc.S

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ rt_hw_context_switch_to:
4545
/* save a0 to to_thread */
4646
la t0, rt_interrupt_to_thread
4747
STORE a0, (t0)
48-
48+
4949
/* save 0 to from_thread */
5050
la t0, rt_interrupt_from_thread
5151
li t1, 0
5252
STORE t1, (t0)
53-
53+
5454
/* set rt_thread_switch_interrupt_flag=1 */
5555
la t0, rt_thread_switch_interrupt_flag
5656
li t1, 1
@@ -97,7 +97,7 @@ rt_hw_context_switch_interrupt:
9797
beq t1, t2, .reswitch
9898
/* set rt_thread_switch_interrupt_flag=1 */
9999
STORE t2, (t0)
100-
100+
101101
/* update from_thread */
102102
la t0, rt_interrupt_from_thread
103103
STORE a0, (t0)
@@ -137,7 +137,7 @@ PendSV_Handler:
137137
la t0, rt_interrupt_from_thread
138138
lw t1, (t0)
139139
beqz t1, .switch_to_thead
140-
140+
141141
/* restore from thread context t0,t1 */
142142
lw t0, (-4)(sp)
143143
lw t1, (-8)(sp)
@@ -328,6 +328,23 @@ PendSV_Handler:
328328

329329
.pendsv_exit:
330330
mret
331-
332331

332+
/*
333+
* rt_base_t rt_hw_interrupt_disable(void);
334+
*/
335+
.globl rt_hw_interrupt_disable
336+
.type rt_hw_interrupt_disable, %function
337+
rt_hw_interrupt_disable:
338+
csrrci a0, mstatus, 8
339+
ret
340+
341+
342+
/*
343+
* void rt_hw_interrupt_enable(rt_base_t level);
344+
*/
345+
.globl rt_hw_interrupt_enable
346+
.type rt_hw_interrupt_enable, %function
347+
rt_hw_interrupt_enable:
348+
csrw mstatus, a0
349+
ret
333350

libcpu/risc-v/t-head/e9xx/cpuport.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -134,34 +134,6 @@ rt_uint8_t *rt_hw_stack_init(void *tentry,
134134
return stk;
135135
}
136136

137-
138-
/**
139-
* This function will disable global interrupt
140-
*
141-
* @param none
142-
*
143-
* @return zero
144-
*/
145-
146-
rt_base_t rt_hw_interrupt_disable(void)
147-
{
148-
__asm volatile("csrrci a0, mstatus, 8");
149-
return;
150-
}
151-
152-
/**
153-
* This function will ennable global interrupt
154-
*
155-
* @param level not used
156-
*
157-
* @return none
158-
*/
159-
/* XXX:rename rt_hw_interrupt_restore? */
160-
void rt_hw_interrupt_enable(rt_base_t level)
161-
{
162-
__asm volatile("csrw mstatus, a0");
163-
}
164-
165137
/** shutdown CPU */
166138
RT_WEAK void rt_hw_cpu_shutdown()
167139
{

0 commit comments

Comments
 (0)