Skip to content

Commit 8302a72

Browse files
authored
Merge pull request #3913 from Michael0066/master
MIPS:fix the RT_EXCEPTION_MAX value
2 parents 8afb8b1 + ab78ea1 commit 8302a72

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

bsp/ls2kdev/drivers/board.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,36 @@
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
*/
2325
void 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
*/
3340
void 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
/**

bsp/ls2kdev/drivers/ls2k1000.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <mips.h>
55
#include "interrupt.h"
6+
#include <rthw.h>
67

78
#define APB_BASE CKSEG1ADDR(0xbfe00000)
89

@@ -24,6 +25,28 @@
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+
2750
void rt_hw_timer_handler(void);
2851
void rt_hw_uart_init(void);
2952

libcpu/mips/common/exception.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
7878
exception_func_t sys_exception_handlers[RT_EXCEPTION_MAX];
7979

8080
/**

0 commit comments

Comments
 (0)