board.c 1.4 KB
Newer Older
B
Bernard Xiong 已提交
1
/*
S
shaojinchun 已提交
2
 * Copyright (c) 2006-2018, RT-Thread Development Team
B
Bernard Xiong 已提交
3
 *
S
shaojinchun 已提交
4
 * SPDX-License-Identifier: Apache-2.0
B
Bernard Xiong 已提交
5 6 7 8
 *
 * Change Logs:
 * Date           Author       Notes
 * 2012-11-20     Bernard    the first version
S
shaojinchun 已提交
9 10 11
 * 2018-11-22     Jesven     add rt_hw_spin_lock
 *                           add rt_hw_spin_unlock
 *                           add smp ipi init
B
Bernard Xiong 已提交
12 13 14 15 16 17
 */

#include <rthw.h>
#include <rtthread.h>

#include "board.h"
S
shaojinchun 已提交
18
#include "drv_timer.h"
B
Bernard Xiong 已提交
19

20 21 22 23 24 25 26 27 28
#include <mmu.h>

struct mem_desc platform_mem_desc[] = {
    {0x10000000, 0x50000000, 0x10000000, DEVICE_MEM},
    {0x60000000, 0xe0000000, 0x60000000, NORMAL_MEM}
};

const rt_uint32_t platform_mem_desc_size = sizeof(platform_mem_desc)/sizeof(platform_mem_desc[0]);

B
Bernard Xiong 已提交
29 30
#define SYS_CTRL                        __REG32(REALVIEW_SCTL_BASE)

S
shaojinchun 已提交
31
extern void rt_hw_ipi_handler_install(int ipi_vector, rt_isr_handler_t ipi_isr_handler);
B
Bernard Xiong 已提交
32

B
Bernard Xiong 已提交
33 34 35 36 37
void idle_wfi(void)
{
    asm volatile ("wfi");
}

B
Bernard Xiong 已提交
38 39 40 41 42
/**
 * This function will initialize beaglebone board
 */
void rt_hw_board_init(void)
{
S
shaojinchun 已提交
43
    /* initialize hardware interrupt */
B
Bernard Xiong 已提交
44
    rt_hw_interrupt_init();
S
shaojinchun 已提交
45
    /* initialize system heap */
B
Bernard Xiong 已提交
46 47 48 49 50 51
    rt_system_heap_init(HEAP_BEGIN, HEAP_END);

    rt_components_board_init();
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);

    rt_thread_idle_sethook(idle_wfi);
S
shaojinchun 已提交
52 53

#ifdef RT_USING_SMP
S
shaojinchun 已提交
54 55
    /* install IPI handle */
    rt_hw_ipi_handler_install(RT_SCHEDULE_IPI, rt_scheduler_ipi_handler);
S
shaojinchun 已提交
56
#endif
B
Bernard Xiong 已提交
57
}
mysterywolf's avatar
mysterywolf 已提交
58