File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 1616#include "exception.h"
1717#include "drv_uart.h"
1818#include "board.h"
19+ #include "ls2k1000.h"
20+
1921/**
2022 * this function will reset CPU
2123 *
2224 */
2325void rt_hw_cpu_reset (void )
2426{
27+ WDT_EN = 0x01 ;
28+ WDT_TIMER = 0x01 ;
29+ WDT_SET = 0x01 ;
2530 rt_kprintf ("reboot system...\n" );
2631 while (1 );
2732}
33+ MSH_CMD_EXPORT_ALIAS (rt_hw_cpu_reset , reboot , reset cpu );
34+
2835
2936/**
3037 * this function will shutdown CPU
3138 *
3239 */
3340void rt_hw_cpu_shutdown (void )
3441{
42+ PM1_STS &= 0xffffffff ;
43+ PM1_CNT = 0x3c00 ;
3544 rt_kprintf ("shutdown...\n" );
3645
3746 while (1 );
3847}
48+ MSH_CMD_EXPORT_ALIAS (rt_hw_cpu_shutdown , poweroff , shutdown cpu );
3949
4050
4151/**
Original file line number Diff line number Diff line change 33
44#include <mips.h>
55#include "interrupt.h"
6+ #include <rthw.h>
67
78#define APB_BASE CKSEG1ADDR(0xbfe00000)
89
2425
2526#define GEN_CONFIG0_REG (0xFFFFFFFFBfe10420)
2627
28+
29+ /*
30+ * General PM Configuration Register
31+ */
32+ #define PMCON_BASE (APB_BASE | (0x7 << 12))
33+
34+ /*
35+ * Power Management1 Configuration Registers
36+ */
37+ #define PM1_BASE (PMCON_BASE + 0x0C)
38+ #define PM1_STS HWREG32(PM1_BASE)
39+ #define PM1_EN HWREG32(PM1_BASE + 0x04)
40+ #define PM1_CNT HWREG32(PM1_BASE + 0x08)
41+
42+ /*
43+ * Watch Dog Configuration Registers
44+ */
45+ #define WDT_BASE (PMCON_BASE + 0x30)
46+ #define WDT_EN HWREG32(WDT_BASE)
47+ #define WDT_SET HWREG32(WDT_BASE + 0x04)
48+ #define WDT_TIMER HWREG32(WDT_BASE + 0x08)
49+
2750void rt_hw_timer_handler (void );
2851void rt_hw_uart_init (void );
2952
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ void rt_hw_interrupt_enable(rt_base_t level)
7474/**
7575 * exception handle table
7676 */
77- #define RT_EXCEPTION_MAX 31
77+ #define RT_EXCEPTION_MAX 32
7878exception_func_t sys_exception_handlers [RT_EXCEPTION_MAX ];
7979
8080/**
You can’t perform that action at this time.
0 commit comments