2013-07-17 13:37:31 +08:00
|
|
|
/*
|
2022-01-18 13:35:13 +08:00
|
|
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
2013-07-17 13:37:31 +08:00
|
|
|
*
|
2021-03-24 15:46:51 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2013-07-17 13:37:31 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
2013-07-17 18:42:19 +08:00
|
|
|
* 2013-7-14 Peng Fan sep6200 implementation
|
2013-07-17 13:37:31 +08:00
|
|
|
*/
|
|
|
|
|
2013-07-17 18:42:19 +08:00
|
|
|
/**
|
2013-07-17 13:37:31 +08:00
|
|
|
* \addtogroup sep6200
|
|
|
|
*/
|
2013-07-17 18:42:19 +08:00
|
|
|
|
2013-07-17 13:37:31 +08:00
|
|
|
/*@{*/
|
|
|
|
|
2022-01-18 13:35:13 +08:00
|
|
|
#define NOINT 0xc0
|
2013-07-17 13:37:31 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* rt_base_t rt_hw_interrupt_disable();
|
|
|
|
*/
|
|
|
|
.globl rt_hw_interrupt_disable
|
|
|
|
.type rt_hw_interrupt_disable, %function
|
|
|
|
rt_hw_interrupt_disable:
|
|
|
|
stw.w r1, [sp-], #4
|
2022-01-18 13:35:13 +08:00
|
|
|
mov r0, asr
|
|
|
|
or r1, r0, #NOINT
|
|
|
|
mov.a asr, r1
|
2013-07-17 13:37:31 +08:00
|
|
|
ldw.w r1, [sp]+, #4
|
2022-01-18 13:35:13 +08:00
|
|
|
mov pc, lr
|
2013-07-17 13:37:31 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* void rt_hw_interrupt_enable(rt_base_t level);
|
|
|
|
*/
|
|
|
|
.globl rt_hw_interrupt_enable
|
|
|
|
.type rt_hw_interrupt_disable, %function
|
|
|
|
rt_hw_interrupt_enable:
|
2022-01-18 13:35:13 +08:00
|
|
|
mov.a asr, r0
|
|
|
|
mov pc, lr
|
2013-07-17 13:37:31 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* void rt_hw_context_switch(rt_uint32 from, rt_uint32 to);
|
|
|
|
* r0 --> from
|
|
|
|
* r1 --> to
|
|
|
|
*/
|
|
|
|
.globl rt_hw_context_switch
|
|
|
|
.type rt_hw_interrupt_disable, %function
|
|
|
|
rt_hw_context_switch:
|
2022-01-18 13:35:13 +08:00
|
|
|
stm.w (lr), [sp-]
|
|
|
|
stm.w (r16, r17, r18, r19, r20, r21, r22, r23, r24, r25, r26, r27, r28, lr), [sp-]
|
|
|
|
stm.w (r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15), [sp-]
|
|
|
|
mov r4, asr
|
|
|
|
stm.w (r4), [sp-]
|
|
|
|
mov r4, bsr
|
|
|
|
stm.w (r4), [sp-]
|
2013-07-17 13:37:31 +08:00
|
|
|
|
2022-01-18 13:35:13 +08:00
|
|
|
stw sp, [r0+]
|
|
|
|
ldw sp, [r1+]
|
2013-07-17 13:37:31 +08:00
|
|
|
|
2022-01-18 13:35:13 +08:00
|
|
|
ldm.w (r4), [sp]+
|
|
|
|
mov.a bsr,r4
|
|
|
|
ldm.w (r4), [sp]+
|
|
|
|
mov.a asr, r4
|
2013-07-17 13:37:31 +08:00
|
|
|
|
2022-01-18 13:35:13 +08:00
|
|
|
ldm.w (r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15), [sp]+
|
|
|
|
ldm.w (r16, r17, r18, r19, r20, r21, r22, r23, r24, r25, r26, r27, r28, lr, pc), [sp]+
|
2013-07-17 13:37:31 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* void rt_hw_context_switch_to(rt_uint32 to);
|
|
|
|
* r0 --> to
|
|
|
|
*/
|
|
|
|
.globl rt_hw_context_switch_to
|
|
|
|
rt_hw_context_switch_to:
|
2022-01-18 13:35:13 +08:00
|
|
|
ldw sp, [r0+]
|
|
|
|
ldm.w (r4), [sp]+
|
|
|
|
mov.a bsr, r4
|
|
|
|
ldm.w (r4), [sp]+
|
|
|
|
mov.a asr, r4
|
|
|
|
ldm.w (r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15), [sp]+
|
|
|
|
ldm.w (r16, r17, r18, r19, r20, r21, r22, r23, r24, r25, r26, r27, r28, lr, pc), [sp]+
|
2013-07-17 13:37:31 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* void rt_hw_context_switch_interrupt(rt_uint32 from, rt_uint32 to);
|
|
|
|
*/
|
|
|
|
.globl rt_thread_switch_interrupt_flag
|
|
|
|
.globl rt_interrupt_from_thread
|
|
|
|
.globl rt_interrupt_to_thread
|
|
|
|
.globl rt_hw_context_switch_interrupt
|
|
|
|
rt_hw_context_switch_interrupt:
|
2022-01-18 13:35:13 +08:00
|
|
|
ldw r2, =rt_thread_switch_interrupt_flag
|
|
|
|
ldw r3, [r2+]
|
|
|
|
cmpsub.a r3, #1
|
|
|
|
beq _reswitch
|
|
|
|
mov r3, #1
|
|
|
|
stw r3, [r2+]
|
|
|
|
ldw r2, =rt_interrupt_from_thread
|
|
|
|
stw r0, [r2+]
|
2013-07-17 13:37:31 +08:00
|
|
|
_reswitch:
|
2022-01-18 13:35:13 +08:00
|
|
|
ldw r2, =rt_interrupt_to_thread
|
|
|
|
stw r1, [r2+]
|
|
|
|
mov pc, lr
|