From f1b2e4ed21066d90c19b710d2f748bfd7d8b32c9 Mon Sep 17 00:00:00 2001 From: Bernard Xiong Date: Mon, 24 Dec 2018 09:06:33 +0800 Subject: [PATCH] [bsp][qemu-vexpress] code cleanup. Move idle_wfi to board.c for idle hook. --- bsp/qemu-vexpress-a9/cpu/context_gcc.S | 2 +- bsp/qemu-vexpress-a9/cpu/cpuport.c | 6 ------ bsp/qemu-vexpress-a9/cpu/interrupt.c | 13 +++---------- bsp/qemu-vexpress-a9/drivers/board.c | 7 +++++-- 4 files changed, 9 insertions(+), 19 deletions(-) diff --git a/bsp/qemu-vexpress-a9/cpu/context_gcc.S b/bsp/qemu-vexpress-a9/cpu/context_gcc.S index 694fb96e72..0aad0200d5 100644 --- a/bsp/qemu-vexpress-a9/cpu/context_gcc.S +++ b/bsp/qemu-vexpress-a9/cpu/context_gcc.S @@ -117,7 +117,7 @@ rt_hw_context_switch: ldmfd sp!, {r0-r12, lr, pc}^ @ pop new task r0-r12, lr & pc, copy spsr to cpsr /* - * void rt_hw_context_switch_interrupt(rt_uint32 from, rt_uint32 to); + * void rt_hw_context_switch_interrupt(rt_ubase_t from, rt_ubase_t to); */ .equ Mode_USR, 0x10 .equ Mode_FIQ, 0x11 diff --git a/bsp/qemu-vexpress-a9/cpu/cpuport.c b/bsp/qemu-vexpress-a9/cpu/cpuport.c index 22ba8346da..6b129f89ee 100644 --- a/bsp/qemu-vexpress-a9/cpu/cpuport.c +++ b/bsp/qemu-vexpress-a9/cpu/cpuport.c @@ -60,14 +60,8 @@ void rt_hw_spin_unlock(rt_hw_spinlock_t *lock) lock->tickets.owner++; __asm__ volatile ("dsb ishst\nsev":::"memory"); } - #endif /*RT_USING_SMP*/ -void idle_wfi(void) -{ - asm volatile ("wfi"); -} - /** * @addtogroup ARM CPU */ diff --git a/bsp/qemu-vexpress-a9/cpu/interrupt.c b/bsp/qemu-vexpress-a9/cpu/interrupt.c index d553188e93..d7e9ec08fa 100644 --- a/bsp/qemu-vexpress-a9/cpu/interrupt.c +++ b/bsp/qemu-vexpress-a9/cpu/interrupt.c @@ -25,9 +25,9 @@ struct rt_irq_desc isr_table[MAX_HANDLERS]; #ifndef RT_USING_SMP /* Those varibles will be accessed in ISR, so we need to share them. */ -rt_uint32_t rt_interrupt_from_thread; -rt_uint32_t rt_interrupt_to_thread; -rt_uint32_t rt_thread_switch_interrupt_flag; +rt_uint32_t rt_interrupt_from_thread = 0; +rt_uint32_t rt_interrupt_to_thread = 0; +rt_uint32_t rt_thread_switch_interrupt_flag = 0; #endif const unsigned int VECTOR_BASE = 0x00; @@ -59,13 +59,6 @@ void rt_hw_interrupt_init(void) arm_gic_dist_init(0, gic_dist_base, 0); arm_gic_cpu_init(0, gic_cpu_base); - - /* init interrupt nest, and context in thread sp */ -#ifndef RT_USING_SMP - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrupt_flag = 0; -#endif } /** diff --git a/bsp/qemu-vexpress-a9/drivers/board.c b/bsp/qemu-vexpress-a9/drivers/board.c index 26445d33f1..6ffac7efd7 100644 --- a/bsp/qemu-vexpress-a9/drivers/board.c +++ b/bsp/qemu-vexpress-a9/drivers/board.c @@ -19,9 +19,13 @@ #define SYS_CTRL __REG32(REALVIEW_SCTL_BASE) -extern void idle_wfi(void); extern void rt_hw_ipi_handler_install(int ipi_vector, rt_isr_handler_t ipi_isr_handler); +void idle_wfi(void) +{ + asm volatile ("wfi"); +} + /** * This function will initialize beaglebone board */ @@ -42,4 +46,3 @@ void rt_hw_board_init(void) rt_hw_ipi_handler_install(RT_SCHEDULE_IPI, rt_scheduler_ipi_handler); #endif } -