blob: 12bf0262dec83add19947c88a1629dee1f9802b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include "cy_device_headers.h"
#include "board.h"
#include "uart.h"
#include "cy_systick.h"
#include "cycfg.h"
#define configTOTAL_HEAP_SIZE (24*1024)
/* Allocate the memory for the heap. */
rt_align(RT_ALIGN_SIZE)
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
/**
* This is the timer interrupt service routine.
*
*/
void SysTick_Handler_CB(void)
{
/* enter interrupt */
rt_interrupt_enter();
rt_tick_increase();
/* leave interrupt */
rt_interrupt_leave();
}
void rt_hw_board_init()
{
/* init systick */
init_cycfg_all();
SystemCoreClockUpdate();
Cy_SysTick_Init(CY_SYSTICK_CLOCK_SOURCE_CLK_CPU, SystemCoreClock/RT_TICK_PER_SECOND);
Cy_SysTick_SetCallback(0, SysTick_Handler_CB);
Cy_SysTick_EnableInterrupt();
rt_system_heap_init((void*)ucHeap, (void*)(ucHeap+configTOTAL_HEAP_SIZE));
/* initialize UART device */
rt_hw_uart_init();
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
}
/*@}*/
|