1 /*
2  * Copyright (c) 2006-2021, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2009-01-05     Bernard      first implementation
9  * 2010-02-04     Magicoe      ported to LPC17xx
10  * 2010-05-02     Aozima       update CMSIS to 130
11  */
12 
13 #include <rthw.h>
14 #include <rtthread.h>
15 
16 #include "uart.h"
17 #include "board.h"
18 #include "LPC17xx.h"
19 
20 /**
21  * @addtogroup LPC17xx
22  */
23 
24 /*@{*/
25 
26 /**
27  * This is the timer interrupt service routine.
28  *
29  */
rt_hw_timer_handler(void)30 void rt_hw_timer_handler(void)
31 {
32     /* enter interrupt */
33     rt_interrupt_enter();
34 
35     rt_tick_increase();
36 
37     /* leave interrupt */
38     rt_interrupt_leave();
39 }
40 
SysTick_Handler(void)41 void SysTick_Handler(void)
42 {
43     rt_hw_timer_handler();
44 }
45 
46 /**
47  * This function will initial LPC17xx board.
48  */
rt_hw_board_init()49 void rt_hw_board_init()
50 {
51     /* NVIC Configuration */
52 #define NVIC_VTOR_MASK              0x3FFFFF80
53 #ifdef  VECT_TAB_RAM
54     /* Set the Vector Table base location at 0x10000000 */
55     SCB->VTOR  = (0x10000000 & NVIC_VTOR_MASK);
56 #else  /* VECT_TAB_FLASH  */
57     /* Set the Vector Table base location at 0x00000000 */
58     SCB->VTOR  = (0x00000000 & NVIC_VTOR_MASK);
59 #endif
60 
61     /* initialize systick */
62     SysTick_Config( SystemCoreClock/RT_TICK_PER_SECOND);
63     /* set pend exception priority */
64     NVIC_SetPriority(PendSV_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
65 
66 #ifdef RT_USING_UART0
67     rt_hw_uart_init();
68     rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
69 #endif
70 }
71 
72 /*@}*/
73