From 21d32cdb3abe15f495b88cfaa18e1441357137ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=8E=E5=BE=B7=E6=97=A0=E6=95=8C=E8=B5=B5=E6=99=93?= =?UTF-8?q?=E8=96=87?= <1755923166@qq.com> Date: Tue, 18 Jun 2019 20:59:00 +0800 Subject: [PATCH] [libcpu][C28x] Fix bugs of old c28x interrupt api which can not save and restore int status In C28x DSP, interrupt status are stored in ST1 register. Both INTM and DBGM is used for masking interrupt, while the latter one is used in real-time debug mode. The origin function rudely enable and disable the interrupt without considering the recent interrupt status, which not only may cause problem in some situation but also is not in conformity with rt-thread design specifications. The new api will fix this bug. --- libcpu/ti-dsp/c28x/context.s | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libcpu/ti-dsp/c28x/context.s b/libcpu/ti-dsp/c28x/context.s index 2b853a0075..f0555d6d35 100644 --- a/libcpu/ti-dsp/c28x/context.s +++ b/libcpu/ti-dsp/c28x/context.s @@ -73,7 +73,9 @@ RT_CTX_RESTORE .macro ; .asmfunc _rt_hw_interrupt_disable: - DINT + PUSH ST1 + SETC INTM,DBGM + MOV AL, *--SP LRETR .endasmfunc @@ -82,7 +84,8 @@ _rt_hw_interrupt_disable: ; .asmfunc _rt_hw_interrupt_enable: - EINT + MOV *SP++, AL + POP ST1 LRETR .endasmfunc