1 /*
2  * Copyright (C) 2015-2017 Alibaba Group Holding Limited
3  */
4 #include "rec_sys.h"
5 #include "sys_api.h"
6 
rec_delayms(volatile int timesMS)7 void rec_delayms(volatile int timesMS)
8 {
9 	DelayMs(timesMS);
10 }
11 
rec_hal_init()12 void rec_hal_init()
13 {
14     rec_uart_init();
15     rec_flash_init();
16 }
17 
rec_err_print(void * errinfo)18 void rec_err_print(void *errinfo)
19 {
20     printf("rec Exception.\r\n");
21 }
22 
rec_reboot(void)23 void rec_reboot(void)
24 {
25 	printf("begin reboot!\n");
26 	/* Set processor clock to default(2: 31.25MHz) before system reset */
27 	HAL_WRITE32(SYSTEM_CTRL_BASE, REG_SYS_CLK_CTRL1, 0x00000021);
28 	DelayUs(100*1000);
29 
30 	/*  Cortex-M3 SCB->AIRCR */
31 	SCB->AIRCR  = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) |	// VECTKEY
32 		(SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |		// PRIGROUP
33 		SCB_AIRCR_SYSRESETREQ_Msk);					// SYSRESETREQ
34 }
35 
36