summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
authorkyle.hu.gz <[email protected]>2010-04-26 18:49:42 +0000
committerkyle.hu.gz <[email protected]>2010-04-26 18:49:42 +0000
commit2c0f89d99ab0236fdaf58ac68874712befab0e00 (patch)
treeeb09d5f69c9fdb33d6ef9c58aadf48dd1c22836e /libcpu
parent5c2b75cc622dd8e07fc2266fe9732d67d9977fba (diff)
Checks for nested interrupt. Fixed USART TX problem.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@672 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/avr32/uc3/exception.S11
-rw-r--r--libcpu/avr32/uc3/serial.c2
2 files changed, 9 insertions, 4 deletions
diff --git a/libcpu/avr32/uc3/exception.S b/libcpu/avr32/uc3/exception.S
index dabd93d889..3146cc7734 100644
--- a/libcpu/avr32/uc3/exception.S
+++ b/libcpu/avr32/uc3/exception.S
@@ -202,16 +202,21 @@ _int\priority:
call rt_interrupt_enter
icall r12
call rt_interrupt_leave
-_spint\priority:
- lda.w r12, rt_thread_switch_interrupt_flag
+ ssrf AVR32_SR_GM_OFFSET /* Disable global interrupt */
+ lda.w r12, rt_interrupt_nest /* Is nested interrupt? */
+ ld.w r11, r12[0]
+ cp.w r11, 0
+ brne _spint\priority
+ lda.w r12, rt_thread_switch_interrupt_flag /* Is thread switch required? */
ld.w r11, r12[0]
cp.w r11, 1
breq rt_hw_context_switch_interrupt_do
+_spint\priority:
+ csrf AVR32_SR_GM_OFFSET /* Enable global interrupt */
rete // If this was a spurious interrupt (R12 == NULL), return from event handler.
.endr
rt_hw_context_switch_interrupt_do:
- ssrf AVR32_SR_GM_OFFSET /* Disable global interrupt */
mov r11, 0
st.w r12[0], r11 /* Clear rt_thread_switch_interrupt_flag */
stm --sp, r0-r7 /* Push R0-R7 */
diff --git a/libcpu/avr32/uc3/serial.c b/libcpu/avr32/uc3/serial.c
index e68423353f..3cefbd5843 100644
--- a/libcpu/avr32/uc3/serial.c
+++ b/libcpu/avr32/uc3/serial.c
@@ -160,7 +160,7 @@ static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buf
/* write data directly */
while (size)
{
- while (usart_write_char(uart->uart_device, (int) *ptr) != USART_SUCCESS);
+ while (usart_bw_write_char(uart->uart_device, (int) *ptr) != USART_SUCCESS);
++ptr; --size;
}