Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
SummerGao.
rt-thread
提交
c1b60064
R
rt-thread
项目概览
SummerGao.
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c1b60064
编写于
3月 31, 2013
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #56 from aozima/aozima
Modify the interrupt interface implementations.
上级
a667da55
2ccb3c75
变更
30
显示空白变更内容
内联
并排
Showing
30 changed file
with
399 addition
and
295 deletion
+399
-295
bsp/dev3210/rtconfig.h
bsp/dev3210/rtconfig.h
+1
-0
bsp/dev3210/uart.c
bsp/dev3210/uart.c
+3
-3
bsp/jz47xx/board.c
bsp/jz47xx/board.c
+1
-1
bsp/jz47xx/uart.c
bsp/jz47xx/uart.c
+1
-1
bsp/lpc2148/drivers/board.c
bsp/lpc2148/drivers/board.c
+7
-7
bsp/lpc2148/drivers/serial.c
bsp/lpc2148/drivers/serial.c
+27
-23
bsp/lpc2478/drivers/board.c
bsp/lpc2478/drivers/board.c
+1
-1
bsp/lpc2478/drivers/serial.c
bsp/lpc2478/drivers/serial.c
+4
-29
bsp/ls1bdev/drivers/uart.c
bsp/ls1bdev/drivers/uart.c
+2
-2
bsp/ls1bdev/rtconfig.h
bsp/ls1bdev/rtconfig.h
+2
-0
bsp/mini2440/board.c
bsp/mini2440/board.c
+11
-11
bsp/mini2440/dm9000.c
bsp/mini2440/dm9000.c
+2
-2
bsp/mini2440/rtconfig.h
bsp/mini2440/rtconfig.h
+2
-0
bsp/mini4020/drivers/board.c
bsp/mini4020/drivers/board.c
+6
-5
bsp/mini4020/drivers/dm9161.c
bsp/mini4020/drivers/dm9161.c
+3
-3
bsp/mini4020/rtconfig.h
bsp/mini4020/rtconfig.h
+1
-0
bsp/mini4020/template.Uv2
bsp/mini4020/template.Uv2
+2
-2
bsp/sam7x/drivers/board.c
bsp/sam7x/drivers/board.c
+1
-1
libcpu/arm/AT91SAM7X/interrupt.c
libcpu/arm/AT91SAM7X/interrupt.c
+4
-3
libcpu/arm/AT91SAM7X/trap.c
libcpu/arm/AT91SAM7X/trap.c
+3
-3
libcpu/arm/lpc214x/cpuport.c
libcpu/arm/lpc214x/cpuport.c
+46
-24
libcpu/arm/lpc24xx/interrupt.c
libcpu/arm/lpc24xx/interrupt.c
+6
-4
libcpu/arm/lpc24xx/trap.c
libcpu/arm/lpc24xx/trap.c
+2
-2
libcpu/arm/s3c24x0/interrupt.c
libcpu/arm/s3c24x0/interrupt.c
+47
-32
libcpu/arm/s3c24x0/trap.c
libcpu/arm/s3c24x0/trap.c
+21
-14
libcpu/arm/sep4020/interrupt.c
libcpu/arm/sep4020/interrupt.c
+50
-36
libcpu/arm/sep4020/trap.c
libcpu/arm/sep4020/trap.c
+29
-21
libcpu/mips/jz47xx/interrupt.c
libcpu/mips/jz47xx/interrupt.c
+6
-0
libcpu/mips/loongson/interrupt.c
libcpu/mips/loongson/interrupt.c
+69
-47
libcpu/mips/loongson_1b/interrupt.c
libcpu/mips/loongson_1b/interrupt.c
+39
-18
未找到文件。
bsp/dev3210/rtconfig.h
浏览文件 @
c1b60064
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
/* Thread Debug */
/* Thread Debug */
#define RT_DEBUG
#define RT_DEBUG
#define RT_USING_OVERFLOW_CHECK
#define RT_USING_OVERFLOW_CHECK
#define RT_USING_INTERRUPT_INFO
/* Using Hook */
/* Using Hook */
#define RT_USING_HOOK
#define RT_USING_HOOK
...
...
bsp/dev3210/uart.c
浏览文件 @
c1b60064
...
@@ -59,7 +59,7 @@ struct rt_uart_soc3210
...
@@ -59,7 +59,7 @@ struct rt_uart_soc3210
rt_uint8_t
rx_buffer
[
RT_UART_RX_BUFFER_SIZE
];
rt_uint8_t
rx_buffer
[
RT_UART_RX_BUFFER_SIZE
];
}
uart_device
;
}
uart_device
;
static
void
rt_uart_irqhandler
(
int
irqno
)
static
void
rt_uart_irqhandler
(
int
irqno
,
void
*
param
)
{
{
rt_ubase_t
level
;
rt_ubase_t
level
;
rt_uint8_t
isr
;
rt_uint8_t
isr
;
...
@@ -142,7 +142,7 @@ static rt_err_t rt_uart_open(rt_device_t dev, rt_uint16_t oflag)
...
@@ -142,7 +142,7 @@ static rt_err_t rt_uart_open(rt_device_t dev, rt_uint16_t oflag)
UART_IER
(
uart
->
hw_base
)
|=
UARTIER_IRXE
;
UART_IER
(
uart
->
hw_base
)
|=
UARTIER_IRXE
;
/* install interrupt */
/* install interrupt */
rt_hw_interrupt_install
(
uart
->
irq
,
rt_uart_irqhandler
,
RT_NULL
);
rt_hw_interrupt_install
(
uart
->
irq
,
rt_uart_irqhandler
,
RT_NULL
,
"UART"
);
rt_hw_interrupt_umask
(
uart
->
irq
);
rt_hw_interrupt_umask
(
uart
->
irq
);
}
}
return
RT_EOK
;
return
RT_EOK
;
...
...
bsp/jz47xx/board.c
浏览文件 @
c1b60064
...
@@ -39,7 +39,7 @@ void rt_hw_timer_handler(int vector, void* param)
...
@@ -39,7 +39,7 @@ void rt_hw_timer_handler(int vector, void* param)
/**
/**
* This function will initial OS timer
* This function will initial OS timer
*/
*/
void
rt_hw_timer_init
()
void
rt_hw_timer_init
(
void
)
{
{
rt_uint32_t
val
;
rt_uint32_t
val
;
...
...
bsp/jz47xx/uart.c
浏览文件 @
c1b60064
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
/*@{*/
/*@{*/
#if defined(RT_USING_UART) && defined(RT_USING_DEVICE)
#if defined(RT_USING_UART) && defined(RT_USING_DEVICE)
#define UART_BAUDRATE
1152
00
#define UART_BAUDRATE
576
00
#define DEV_CLK 12000000
#define DEV_CLK 12000000
/*
/*
...
...
bsp/lpc2148/drivers/board.c
浏览文件 @
c1b60064
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
* This is the timer interrupt service routine.
* This is the timer interrupt service routine.
* @param vector the irq number for timer
* @param vector the irq number for timer
*/
*/
void
rt_hw_timer_handler
(
int
vector
)
void
rt_hw_timer_handler
(
int
vector
,
void
*
param
)
{
{
rt_tick_increase
();
rt_tick_increase
();
...
@@ -82,7 +82,7 @@ void rt_hw_console_init()
...
@@ -82,7 +82,7 @@ void rt_hw_console_init()
/**
/**
* This function will initial sam7x256 board.
* This function will initial sam7x256 board.
*/
*/
void
rt_hw_board_init
()
void
rt_hw_board_init
(
void
)
{
{
/* console init */
/* console init */
rt_hw_console_init
();
rt_hw_console_init
();
...
@@ -99,7 +99,7 @@ void rt_hw_board_init()
...
@@ -99,7 +99,7 @@ void rt_hw_board_init()
T0TCR
=
1
;
T0TCR
=
1
;
/* install timer handler */
/* install timer handler */
rt_hw_interrupt_install
(
TIMER0_INT
,
rt_hw_timer_handler
,
RT_NULL
);
rt_hw_interrupt_install
(
TIMER0_INT
,
rt_hw_timer_handler
,
RT_NULL
,
"TIMER0"
);
rt_hw_interrupt_umask
(
TIMER0_INT
);
rt_hw_interrupt_umask
(
TIMER0_INT
);
}
}
...
...
bsp/lpc2148/drivers/serial.c
浏览文件 @
c1b60064
...
@@ -113,7 +113,7 @@ void rt_hw_uart_isr(struct rt_lpcserial* lpc_serial)
...
@@ -113,7 +113,7 @@ void rt_hw_uart_isr(struct rt_lpcserial* lpc_serial)
}
}
#ifdef RT_USING_UART1
#ifdef RT_USING_UART1
void
rt_hw_uart_isr_1
(
int
irqno
)
void
rt_hw_uart_isr_1
(
int
irqno
,
void
*
param
)
{
{
/* get lpc serial device */
/* get lpc serial device */
rt_hw_uart_isr
(
&
serial1
);
rt_hw_uart_isr
(
&
serial1
);
...
@@ -121,7 +121,7 @@ void rt_hw_uart_isr_1(int irqno)
...
@@ -121,7 +121,7 @@ void rt_hw_uart_isr_1(int irqno)
#endif
#endif
#ifdef RT_USING_UART2
#ifdef RT_USING_UART2
void
rt_hw_uart_isr_2
(
int
irqno
)
void
rt_hw_uart_isr_2
(
int
irqno
,
void
*
param
)
{
{
/* get lpc serial device */
/* get lpc serial device */
rt_hw_uart_isr
(
&
serial2
);
rt_hw_uart_isr
(
&
serial2
);
...
@@ -153,13 +153,15 @@ static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag)
...
@@ -153,13 +153,15 @@ static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag)
if
(
lpc_serial
->
irqno
==
UART0_INT
)
if
(
lpc_serial
->
irqno
==
UART0_INT
)
{
{
#ifdef RT_USING_UART1
#ifdef RT_USING_UART1
rt_hw_interrupt_install
(
lpc_serial
->
irqno
,
rt_hw_uart_isr_1
,
RT_NULL
);
rt_hw_interrupt_install
(
lpc_serial
->
irqno
,
rt_hw_uart_isr_1
,
&
serial1
,
"UART1"
);
#endif
#endif
}
}
else
else
{
{
#ifdef RT_USING_UART2
#ifdef RT_USING_UART2
rt_hw_interrupt_install
(
lpc_serial
->
irqno
,
rt_hw_uart_isr_2
,
RT_NULL
);
rt_hw_interrupt_install
(
lpc_serial
->
irqno
,
rt_hw_uart_isr_2
,
&
serial2
,
"UART2"
);
#endif
#endif
}
}
...
@@ -334,6 +336,7 @@ void rt_hw_serial_init(void)
...
@@ -334,6 +336,7 @@ void rt_hw_serial_init(void)
/* DLAB = 0 */
/* DLAB = 0 */
UART_LCR
(
lpc_serial
->
hw_base
)
=
0x03
;
UART_LCR
(
lpc_serial
->
hw_base
)
=
0x03
;
lpc_serial
->
parent
.
type
=
RT_Device_Class_Char
;
lpc_serial
->
parent
.
init
=
rt_serial_init
;
lpc_serial
->
parent
.
init
=
rt_serial_init
;
lpc_serial
->
parent
.
open
=
rt_serial_open
;
lpc_serial
->
parent
.
open
=
rt_serial_open
;
lpc_serial
->
parent
.
close
=
rt_serial_close
;
lpc_serial
->
parent
.
close
=
rt_serial_close
;
...
@@ -371,6 +374,7 @@ void rt_hw_serial_init(void)
...
@@ -371,6 +374,7 @@ void rt_hw_serial_init(void)
/* DLAB = 0 */
/* DLAB = 0 */
UART_LCR
(
lpc_serial
->
hw_base
)
=
0x03
;
UART_LCR
(
lpc_serial
->
hw_base
)
=
0x03
;
lpc_serial
->
parent
.
type
=
RT_Device_Class_Char
;
lpc_serial
->
parent
.
init
=
rt_serial_init
;
lpc_serial
->
parent
.
init
=
rt_serial_init
;
lpc_serial
->
parent
.
open
=
rt_serial_open
;
lpc_serial
->
parent
.
open
=
rt_serial_open
;
lpc_serial
->
parent
.
close
=
rt_serial_close
;
lpc_serial
->
parent
.
close
=
rt_serial_close
;
...
...
bsp/lpc2478/drivers/board.c
浏览文件 @
c1b60064
...
@@ -37,7 +37,7 @@ void rt_timer_handler(int vector, void* param)
...
@@ -37,7 +37,7 @@ void rt_timer_handler(int vector, void* param)
/**
/**
* This function will init LPC2478 board
* This function will init LPC2478 board
*/
*/
void
rt_hw_board_init
()
void
rt_hw_board_init
(
void
)
{
{
#if defined(RT_USING_DEVICE) && defined(RT_USING_UART1)
#if defined(RT_USING_DEVICE) && defined(RT_USING_UART1)
rt_hw_serial_init
();
rt_hw_serial_init
();
...
...
bsp/lpc2478/drivers/serial.c
浏览文件 @
c1b60064
...
@@ -64,9 +64,10 @@ void rt_hw_serial_init(void);
...
@@ -64,9 +64,10 @@ void rt_hw_serial_init(void);
#define U0PINS 0x00000005
#define U0PINS 0x00000005
void
rt_hw_uart_isr
(
struct
rt_lpcserial
*
lpc_serial
)
void
rt_hw_uart_isr
(
int
irqno
,
void
*
param
)
{
{
UNUSED
rt_uint32_t
iir
;
UNUSED
rt_uint32_t
iir
;
struct
rt_lpcserial
*
lpc_serial
=
(
struct
rt_lpcserial
*
)
param
;
RT_ASSERT
(
lpc_serial
!=
RT_NULL
)
RT_ASSERT
(
lpc_serial
!=
RT_NULL
)
...
@@ -112,21 +113,6 @@ void rt_hw_uart_isr(struct rt_lpcserial* lpc_serial)
...
@@ -112,21 +113,6 @@ void rt_hw_uart_isr(struct rt_lpcserial* lpc_serial)
VICVectAddr
=
0
;
VICVectAddr
=
0
;
}
}
#ifdef RT_USING_UART1
void
rt_hw_uart_isr_1
(
int
irqno
,
void
*
param
)
{
/* get lpc serial device */
rt_hw_uart_isr
(
&
serial1
);
}
#endif
#ifdef RT_USING_UART2
void
rt_hw_uart_isr_2
(
int
irqno
,
void
*
param
)
{
/* get lpc serial device */
rt_hw_uart_isr
(
&
serial2
);
}
#endif
/**
/**
* @addtogroup LPC214x
* @addtogroup LPC214x
...
@@ -150,19 +136,8 @@ static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag)
...
@@ -150,19 +136,8 @@ static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag)
UART_IER
(
lpc_serial
->
hw_base
)
=
0x01
;
UART_IER
(
lpc_serial
->
hw_base
)
=
0x01
;
/* install ISR */
/* install ISR */
if
(
lpc_serial
->
irqno
==
UART0_INT
)
rt_hw_interrupt_install
(
lpc_serial
->
irqno
,
{
rt_hw_uart_isr
,
lpc_serial
,
RT_NULL
);
#ifdef RT_USING_UART1
rt_hw_interrupt_install
(
lpc_serial
->
irqno
,
rt_hw_uart_isr_1
,
RT_NULL
,
"uart1"
);
#endif
}
else
{
#ifdef RT_USING_UART2
rt_hw_interrupt_install
(
lpc_serial
->
irqno
,
rt_hw_uart_isr_2
,
RT_NULL
,
"uart2"
);
#endif
}
rt_hw_interrupt_umask
(
lpc_serial
->
irqno
);
rt_hw_interrupt_umask
(
lpc_serial
->
irqno
);
}
}
...
...
bsp/ls1bdev/drivers/uart.c
浏览文件 @
c1b60064
...
@@ -37,7 +37,7 @@ struct rt_uart_ls1b
...
@@ -37,7 +37,7 @@ struct rt_uart_ls1b
rt_uint8_t
rx_buffer
[
RT_UART_RX_BUFFER_SIZE
];
rt_uint8_t
rx_buffer
[
RT_UART_RX_BUFFER_SIZE
];
}
uart_device
;
}
uart_device
;
static
void
rt_uart_irqhandler
(
int
irqno
)
static
void
rt_uart_irqhandler
(
int
irqno
,
void
*
param
)
{
{
rt_ubase_t
level
;
rt_ubase_t
level
;
rt_uint8_t
isr
;
rt_uint8_t
isr
;
...
@@ -121,7 +121,7 @@ static rt_err_t rt_uart_open(rt_device_t dev, rt_uint16_t oflag)
...
@@ -121,7 +121,7 @@ static rt_err_t rt_uart_open(rt_device_t dev, rt_uint16_t oflag)
UART_IER
(
uart
->
hw_base
)
|=
UARTIER_IRXE
;
UART_IER
(
uart
->
hw_base
)
|=
UARTIER_IRXE
;
/* install interrupt */
/* install interrupt */
rt_hw_interrupt_install
(
uart
->
irq
,
rt_uart_irqhandler
,
RT_NULL
);
rt_hw_interrupt_install
(
uart
->
irq
,
rt_uart_irqhandler
,
RT_NULL
,
"UART"
);
rt_hw_interrupt_umask
(
uart
->
irq
);
rt_hw_interrupt_umask
(
uart
->
irq
);
}
}
return
RT_EOK
;
return
RT_EOK
;
...
...
bsp/ls1bdev/rtconfig.h
浏览文件 @
c1b60064
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
// #define RT_THREAD_DEBUG
// #define RT_THREAD_DEBUG
// <bool name="RT_USING_OVERFLOW_CHECK" description="Thread stack over flow detect" default="true" />
// <bool name="RT_USING_OVERFLOW_CHECK" description="Thread stack over flow detect" default="true" />
#define RT_USING_OVERFLOW_CHECK
#define RT_USING_OVERFLOW_CHECK
// <bool name="RT_USING_INTERRUPT_INFO" description="Show more interrupt description" default="true" />
#define RT_USING_INTERRUPT_INFO
// </section>
// </section>
// <bool name="RT_USING_HOOK" description="Using hook functions" default="true" />
// <bool name="RT_USING_HOOK" description="Using hook functions" default="true" />
...
...
bsp/mini2440/board.c
浏览文件 @
c1b60064
...
@@ -58,7 +58,7 @@ struct rt_device uart2_device;
...
@@ -58,7 +58,7 @@ struct rt_device uart2_device;
/**
/**
* This function will handle rtos timer
* This function will handle rtos timer
*/
*/
static
void
rt_timer_handler
(
int
vector
)
static
void
rt_timer_handler
(
int
vector
,
void
*
param
)
{
{
rt_tick_increase
();
rt_tick_increase
();
}
}
...
@@ -66,7 +66,7 @@ static void rt_timer_handler(int vector)
...
@@ -66,7 +66,7 @@ static void rt_timer_handler(int vector)
/**
/**
* This function will handle serial
* This function will handle serial
*/
*/
static
void
rt_serial0_handler
(
int
vector
)
static
void
rt_serial0_handler
(
int
vector
,
void
*
param
)
{
{
INTSUBMSK
|=
(
BIT_SUB_RXD0
);
INTSUBMSK
|=
(
BIT_SUB_RXD0
);
...
@@ -81,7 +81,7 @@ static void rt_serial0_handler(int vector)
...
@@ -81,7 +81,7 @@ static void rt_serial0_handler(int vector)
/**
/**
* This function will handle serial
* This function will handle serial
*/
*/
static
void
rt_serial2_handler
(
int
vector
)
static
void
rt_serial2_handler
(
int
vector
,
void
*
param
)
{
{
INTSUBMSK
|=
(
BIT_SUB_RXD2
);
INTSUBMSK
|=
(
BIT_SUB_RXD2
);
...
@@ -142,17 +142,17 @@ static void rt_hw_uart_init(void)
...
@@ -142,17 +142,17 @@ static void rt_hw_uart_init(void)
/* install uart2 isr */
/* install uart2 isr */
INTSUBMSK
&=
~
(
BIT_SUB_RXD2
);
INTSUBMSK
&=
~
(
BIT_SUB_RXD2
);
rt_hw_interrupt_install
(
INTUART0
,
rt_serial0_handler
,
RT_NULL
);
rt_hw_interrupt_install
(
INTUART0
,
rt_serial0_handler
,
RT_NULL
,
"UART0"
);
rt_hw_interrupt_umask
(
INTUART0
);
rt_hw_interrupt_umask
(
INTUART0
);
rt_hw_interrupt_install
(
INTUART2
,
rt_serial2_handler
,
RT_NULL
);
rt_hw_interrupt_install
(
INTUART2
,
rt_serial2_handler
,
RT_NULL
,
"UART2"
);
rt_hw_interrupt_umask
(
INTUART2
);
rt_hw_interrupt_umask
(
INTUART2
);
}
}
/**
/**
* This function will init timer4 for system ticks
* This function will init timer4 for system ticks
*/
*/
static
void
rt_hw_timer_init
()
static
void
rt_hw_timer_init
(
void
)
{
{
/* timer4, pre = 15+1 */
/* timer4, pre = 15+1 */
TCFG0
&=
0xffff00ff
;
TCFG0
&=
0xffff00ff
;
...
@@ -165,7 +165,7 @@ static void rt_hw_timer_init()
...
@@ -165,7 +165,7 @@ static void rt_hw_timer_init()
/* manual update */
/* manual update */
TCON
=
TCON
&
(
~
(
0x0f
<<
20
))
|
(
0x02
<<
20
);
TCON
=
TCON
&
(
~
(
0x0f
<<
20
))
|
(
0x02
<<
20
);
/* install interrupt handler */
/* install interrupt handler */
rt_hw_interrupt_install
(
INTTIMER4
,
rt_timer_handler
,
RT_NULL
);
rt_hw_interrupt_install
(
INTTIMER4
,
rt_timer_handler
,
RT_NULL
,
"tick"
);
rt_hw_interrupt_umask
(
INTTIMER4
);
rt_hw_interrupt_umask
(
INTTIMER4
);
/* start timer4, reload */
/* start timer4, reload */
...
@@ -175,7 +175,7 @@ static void rt_hw_timer_init()
...
@@ -175,7 +175,7 @@ static void rt_hw_timer_init()
/**
/**
* This function will init s3ceb2410 board
* This function will init s3ceb2410 board
*/
*/
void
rt_hw_board_init
()
void
rt_hw_board_init
(
void
)
{
{
/* initialize the system clock */
/* initialize the system clock */
rt_hw_clock_init
();
rt_hw_clock_init
();
...
...
bsp/mini2440/dm9000.c
浏览文件 @
c1b60064
...
@@ -572,7 +572,7 @@ __error_retry:
...
@@ -572,7 +572,7 @@ __error_retry:
#define B4_Tacp 0x0
#define B4_Tacp 0x0
#define B4_PMC 0x0
#define B4_PMC 0x0
void
INTEINT4_7_handler
(
int
irqno
)
void
INTEINT4_7_handler
(
int
irqno
,
void
*
param
)
{
{
rt_uint32_t
eint_pend
;
rt_uint32_t
eint_pend
;
...
@@ -637,7 +637,7 @@ void rt_hw_dm9000_init()
...
@@ -637,7 +637,7 @@ void rt_hw_dm9000_init()
eth_device_init
(
&
(
dm9000_device
.
parent
),
"e0"
);
eth_device_init
(
&
(
dm9000_device
.
parent
),
"e0"
);
/* instal interrupt */
/* instal interrupt */
rt_hw_interrupt_install
(
INTEINT4_7
,
INTEINT4_7_handler
,
RT_NULL
);
rt_hw_interrupt_install
(
INTEINT4_7
,
INTEINT4_7_handler
,
RT_NULL
,
"EINT4_7"
);
rt_hw_interrupt_umask
(
INTEINT4_7
);
rt_hw_interrupt_umask
(
INTEINT4_7
);
}
}
...
...
bsp/mini2440/rtconfig.h
浏览文件 @
c1b60064
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
// #define RT_THREAD_DEBUG
// #define RT_THREAD_DEBUG
// <bool name="RT_USING_OVERFLOW_CHECK" description="Thread stack over flow detect" default="true" />
// <bool name="RT_USING_OVERFLOW_CHECK" description="Thread stack over flow detect" default="true" />
#define RT_USING_OVERFLOW_CHECK
#define RT_USING_OVERFLOW_CHECK
// <bool name="RT_USING_INTERRUPT_INFO" description="Show more interrupt description" default="true" />
#define RT_USING_INTERRUPT_INFO
// </section>
// </section>
// <bool name="RT_USING_HOOK" description="Using hook functions" default="true" />
// <bool name="RT_USING_HOOK" description="Using hook functions" default="true" />
...
...
bsp/mini4020/drivers/board.c
浏览文件 @
c1b60064
...
@@ -34,7 +34,7 @@ struct serial_device uart0 =
...
@@ -34,7 +34,7 @@ struct serial_device uart0 =
/**
/**
* This function will handle rtos timer
* This function will handle rtos timer
*/
*/
void
rt_timer_handler
(
int
vector
)
void
rt_timer_handler
(
int
vector
,
void
*
param
)
{
{
rt_uint32_t
clear_int
;
rt_uint32_t
clear_int
;
rt_tick_increase
();
rt_tick_increase
();
...
@@ -47,7 +47,7 @@ void rt_timer_handler(int vector)
...
@@ -47,7 +47,7 @@ void rt_timer_handler(int vector)
/**
/**
* This function will handle serial
* This function will handle serial
*/
*/
void
rt_serial_handler
(
int
vector
)
void
rt_serial_handler
(
int
vector
,
void
*
param
)
{
{
//rt_kprintf("in rt_serial_handler\n");
//rt_kprintf("in rt_serial_handler\n");
rt_int32_t
stat
=
*
(
RP
)
UART0_IIR
;
rt_int32_t
stat
=
*
(
RP
)
UART0_IIR
;
...
@@ -78,16 +78,17 @@ static void rt_hw_board_led_init(void)
...
@@ -78,16 +78,17 @@ static void rt_hw_board_led_init(void)
*
(
RP
)
GPIO_PORTE_DATA
&=
~
0x38
;
/* low */
*
(
RP
)
GPIO_PORTE_DATA
&=
~
0x38
;
/* low */
}
}
/**
/**
* This function will init timer4 for system ticks
* This function will init timer4 for system ticks
*/
*/
void
rt_hw_timer_init
(
void
)
void
rt_hw_timer_init
(
void
)
{
{
/*Set timer1*/
/*Set timer1*/
*
(
RP
)
TIMER_T1LCR
=
880000
;
*
(
RP
)
TIMER_T1LCR
=
880000
;
*
(
RP
)
TIMER_T1CR
=
0x06
;
*
(
RP
)
TIMER_T1CR
=
0x06
;
rt_hw_interrupt_install
(
INTSRC_TIMER1
,
rt_timer_handler
,
RT_NULL
);
rt_hw_interrupt_install
(
INTSRC_TIMER1
,
rt_timer_handler
,
RT_NULL
,
"tick"
);
rt_hw_interrupt_umask
(
INTSRC_TIMER1
);
rt_hw_interrupt_umask
(
INTSRC_TIMER1
);
/*Enable timer1*/
/*Enable timer1*/
...
@@ -119,7 +120,7 @@ void rt_hw_uart_init(void)
...
@@ -119,7 +120,7 @@ void rt_hw_uart_init(void)
/*Disable tx interrupt*/
/*Disable tx interrupt*/
*
(
RP
)(
UART0_IER
)
&=
~
(
0x1
<<
1
);
*
(
RP
)(
UART0_IER
)
&=
~
(
0x1
<<
1
);
rt_hw_interrupt_install
(
INTSRC_UART0
,
rt_serial_handler
,
RT_NULL
);
rt_hw_interrupt_install
(
INTSRC_UART0
,
rt_serial_handler
,
RT_NULL
,
"UART0"
);
rt_hw_interrupt_umask
(
INTSRC_UART0
);
rt_hw_interrupt_umask
(
INTSRC_UART0
);
/* register uart0 */
/* register uart0 */
rt_hw_serial_register
(
&
uart0_device
,
"uart0"
,
rt_hw_serial_register
(
&
uart0_device
,
"uart0"
,
...
...
bsp/mini4020/drivers/dm9161.c
浏览文件 @
c1b60064
...
@@ -81,7 +81,7 @@ struct rt_dm9161_eth
...
@@ -81,7 +81,7 @@ struct rt_dm9161_eth
static
struct
rt_dm9161_eth
dm9161_device
;
static
struct
rt_dm9161_eth
dm9161_device
;
static
struct
rt_semaphore
sem_ack
,
sem_lock
;
static
struct
rt_semaphore
sem_ack
,
sem_lock
;
void
rt_dm9161_isr
(
int
irqno
);
void
rt_dm9161_isr
(
int
irqno
,
void
*
param
);
static
void
udelay
(
unsigned
long
ns
)
static
void
udelay
(
unsigned
long
ns
)
{
{
...
@@ -201,7 +201,7 @@ static void read_phy(unsigned char phy_addr, unsigned char address, unsigned int
...
@@ -201,7 +201,7 @@ static void read_phy(unsigned char phy_addr, unsigned char address, unsigned int
}
}
/* interrupt service routine */
/* interrupt service routine */
void
rt_dm9161_isr
(
int
irqno
)
void
rt_dm9161_isr
(
int
irqno
,
void
*
param
)
{
{
unsigned
long
intstatus
;
unsigned
long
intstatus
;
rt_uint32_t
address
;
rt_uint32_t
address
;
...
@@ -469,7 +469,7 @@ static rt_err_t rt_dm9161_open(rt_device_t dev, rt_uint16_t oflag)
...
@@ -469,7 +469,7 @@ static rt_err_t rt_dm9161_open(rt_device_t dev, rt_uint16_t oflag)
*
(
volatile
unsigned
long
*
)
GPIO_PORTA_INTRCLR
|=
0x0080
;
//清除中断
*
(
volatile
unsigned
long
*
)
GPIO_PORTA_INTRCLR
|=
0x0080
;
//清除中断
*
(
volatile
unsigned
long
*
)
GPIO_PORTA_INTRCLR
=
0x0000
;
//清除中断
*
(
volatile
unsigned
long
*
)
GPIO_PORTA_INTRCLR
=
0x0000
;
//清除中断
rt_hw_interrupt_install
(
INTSRC_MAC
,
rt_dm9161_isr
,
RT_NULL
);
rt_hw_interrupt_install
(
INTSRC_MAC
,
rt_dm9161_isr
,
RT_NULL
,
"EMAC"
);
enable_irq
(
INTSRC_EXINT7
);
enable_irq
(
INTSRC_EXINT7
);
...
...
bsp/mini4020/rtconfig.h
浏览文件 @
c1b60064
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
/* #define RT_THREAD_DEBUG */
/* #define RT_THREAD_DEBUG */
#define RT_USING_OVERFLOW_CHECK
#define RT_USING_OVERFLOW_CHECK
#define RT_USING_INTERRUPT_INFO
/* Using Hook */
/* Using Hook */
#define RT_USING_HOOK
#define RT_USING_HOOK
...
...
bsp/mini4020/template.Uv2
浏览文件 @
c1b60064
...
@@ -31,14 +31,14 @@ Options 1,0,0 // Target 'RT-Thread_Mini4020'
...
@@ -31,14 +31,14 @@ Options 1,0,0 // Target 'RT-Thread_Mini4020'
EnvReg ()
EnvReg ()
OrgReg ()
OrgReg ()
TgStat=16
TgStat=16
OutDir (.\)
OutDir (.\
build\
)
OutName (rtthread-mini4020)
OutName (rtthread-mini4020)
GenApp=1
GenApp=1
GenLib=0
GenLib=0
GenHex=0
GenHex=0
Debug=1
Debug=1
Browse=0
Browse=0
LstDir (.\)
LstDir (.\
build\
)
HexSel=1
HexSel=1
MG32K=0
MG32K=0
TGMORE=0
TGMORE=0
...
...
bsp/sam7x/drivers/board.c
浏览文件 @
c1b60064
...
@@ -154,7 +154,7 @@ static void rt_hw_console_init()
...
@@ -154,7 +154,7 @@ static void rt_hw_console_init()
/**
/**
* This function will initial sam7x board.
* This function will initial sam7x board.
*/
*/
void
rt_hw_board_init
()
void
rt_hw_board_init
(
void
)
{
{
extern
void
rt_serial_init
(
void
);
extern
void
rt_serial_init
(
void
);
...
...
libcpu/arm/AT91SAM7X/interrupt.c
浏览文件 @
c1b60064
...
@@ -10,8 +10,10 @@
...
@@ -10,8 +10,10 @@
* Change Logs:
* Change Logs:
* Date Author Notes
* Date Author Notes
* 2006-08-23 Bernard first version
* 2006-08-23 Bernard first version
* 2013-03-29 aozima Modify the interrupt interface implementations.
*/
*/
#include <rtthread.h>
#include <rthw.h>
#include <rthw.h>
#include "AT91SAM7X256.h"
#include "AT91SAM7X256.h"
...
@@ -30,7 +32,7 @@ rt_uint32_t rt_thread_switch_interrupt_flag;
...
@@ -30,7 +32,7 @@ rt_uint32_t rt_thread_switch_interrupt_flag;
*/
*/
/*@{*/
/*@{*/
void
rt_hw_interrupt_handler
(
int
vector
)
static
void
rt_hw_interrupt_handler
(
int
vector
,
void
*
param
)
{
{
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
}
}
...
@@ -38,7 +40,7 @@ void rt_hw_interrupt_handler(int vector)
...
@@ -38,7 +40,7 @@ void rt_hw_interrupt_handler(int vector)
/**
/**
* This function will initialize hardware interrupt
* This function will initialize hardware interrupt
*/
*/
void
rt_hw_interrupt_init
()
void
rt_hw_interrupt_init
(
void
)
{
{
rt_base_t
index
;
rt_base_t
index
;
...
@@ -96,7 +98,6 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
...
@@ -96,7 +98,6 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
void
*
param
,
char
*
name
)
void
*
param
,
char
*
name
)
{
{
rt_isr_handler_t
old_handler
=
RT_NULL
;
rt_isr_handler_t
old_handler
=
RT_NULL
;
if
(
vector
>=
0
&&
vector
<
MAX_HANDLERS
)
if
(
vector
>=
0
&&
vector
<
MAX_HANDLERS
)
{
{
old_handler
=
irq_desc
[
vector
].
handler
;
old_handler
=
irq_desc
[
vector
].
handler
;
...
...
libcpu/arm/AT91SAM7X/trap.c
浏览文件 @
c1b60064
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
*/
*/
/*@{*/
/*@{*/
void
rt_hw_trap_irq
()
void
rt_hw_trap_irq
(
void
)
{
{
int
irqno
;
int
irqno
;
extern
struct
rt_irq_desc
irq_desc
[];
extern
struct
rt_irq_desc
irq_desc
[];
...
@@ -37,13 +37,13 @@ void rt_hw_trap_irq()
...
@@ -37,13 +37,13 @@ void rt_hw_trap_irq()
AT91C_BASE_AIC
->
AIC_EOICR
=
0
;
AT91C_BASE_AIC
->
AIC_EOICR
=
0
;
}
}
void
rt_hw_trap_fiq
()
void
rt_hw_trap_fiq
(
void
)
{
{
rt_kprintf
(
"fast interrupt request
\n
"
);
rt_kprintf
(
"fast interrupt request
\n
"
);
}
}
extern
struct
rt_thread
*
rt_current_thread
;
extern
struct
rt_thread
*
rt_current_thread
;
void
rt_hw_trap_abort
()
void
rt_hw_trap_abort
(
void
)
{
{
rt_kprintf
(
"Abort occured!!! Thread [%s] suspended.
\n
"
,
rt_current_thread
->
name
);
rt_kprintf
(
"Abort occured!!! Thread [%s] suspended.
\n
"
,
rt_current_thread
->
name
);
rt_thread_suspend
(
rt_current_thread
);
rt_thread_suspend
(
rt_current_thread
);
...
...
libcpu/arm/lpc214x/cpuport.c
浏览文件 @
c1b60064
...
@@ -10,9 +10,11 @@
...
@@ -10,9 +10,11 @@
* Change Logs:
* Change Logs:
* Date Author Notes
* Date Author Notes
* 2011-06-15 aozima the first version for lpc214x
* 2011-06-15 aozima the first version for lpc214x
* 2013-03-29 aozima Modify the interrupt interface implementations.
*/
*/
#include <rtthread.h>
#include <rtthread.h>
#include <rthw.h>
#include "lpc214x.h"
#include "lpc214x.h"
#define MAX_HANDLERS 32
#define MAX_HANDLERS 32
...
@@ -20,6 +22,9 @@
...
@@ -20,6 +22,9 @@
extern
rt_uint32_t
rt_interrupt_nest
;
extern
rt_uint32_t
rt_interrupt_nest
;
/* exception and interrupt handler table */
struct
rt_irq_desc
irq_desc
[
MAX_HANDLERS
];
/**
/**
* @addtogroup LPC214x
* @addtogroup LPC214x
*/
*/
...
@@ -71,7 +76,7 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
...
@@ -71,7 +76,7 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
rt_uint32_t
rt_interrupt_from_thread
,
rt_interrupt_to_thread
;
rt_uint32_t
rt_interrupt_from_thread
,
rt_interrupt_to_thread
;
rt_uint32_t
rt_thread_switch_interrupt_flag
;
rt_uint32_t
rt_thread_switch_interrupt_flag
;
void
rt_hw_interrupt_handler
(
int
vector
)
void
rt_hw_interrupt_handler
(
int
vector
,
void
*
param
)
{
{
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
}
}
...
@@ -79,7 +84,7 @@ void rt_hw_interrupt_handler(int vector)
...
@@ -79,7 +84,7 @@ void rt_hw_interrupt_handler(int vector)
/**
/**
* This function will initialize hardware interrupt
* This function will initialize hardware interrupt
*/
*/
void
rt_hw_interrupt_init
()
void
rt_hw_interrupt_init
(
void
)
{
{
rt_base_t
index
;
rt_base_t
index
;
rt_uint32_t
*
vect_addr
,
*
vect_ctl
;
rt_uint32_t
*
vect_addr
,
*
vect_ctl
;
...
@@ -90,12 +95,15 @@ void rt_hw_interrupt_init()
...
@@ -90,12 +95,15 @@ void rt_hw_interrupt_init()
/* set all to IRQ */
/* set all to IRQ */
VICIntSelect
=
0
;
VICIntSelect
=
0
;
rt_memset
(
irq_desc
,
0x00
,
sizeof
(
irq_desc
));
for
(
index
=
0
;
index
<
MAX_HANDLERS
;
index
++
)
for
(
index
=
0
;
index
<
MAX_HANDLERS
;
index
++
)
{
{
irq_desc
[
index
].
handler
=
rt_hw_interrupt_handler
;
vect_addr
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x100
+
(
index
<<
2
));
vect_addr
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x100
+
(
index
<<
2
));
vect_ctl
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x200
+
(
index
<<
2
));
vect_ctl
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x200
+
(
index
<<
2
));
*
vect_addr
=
(
rt_uint32_t
)
rt_hw_interrupt_handler
;
*
vect_addr
=
(
rt_uint32_t
)
&
irq_desc
[
index
]
;
*
vect_ctl
=
0xF
;
*
vect_ctl
=
0xF
;
}
}
...
@@ -127,30 +135,39 @@ void rt_hw_interrupt_umask(int vector)
...
@@ -127,30 +135,39 @@ void rt_hw_interrupt_umask(int vector)
/**
/**
* This function will install a interrupt service routine to a interrupt.
* This function will install a interrupt service routine to a interrupt.
* @param vector the interrupt number
* @param vector the interrupt number
* @param new_handler the interrupt service routine to be installed
* @param handler the interrupt service routine to be installed
* @param old_handler the old interrupt service routine
* @param param the interrupt service function parameter
* @param name the interrupt name
* @return old handler
*/
*/
void
rt_hw_interrupt_install
(
int
vector
,
rt_isr_handler_t
new_handler
,
rt_isr_handler_t
*
old_handler
)
rt_isr_handler_t
rt_hw_interrupt_install
(
int
vector
,
rt_isr_handler_t
handler
,
void
*
param
,
char
*
name
)
{
{
rt_isr_handler_t
old_handler
=
RT_NULL
;
if
(
vector
>=
0
&&
vector
<
MAX_HANDLERS
)
if
(
vector
>=
0
&&
vector
<
MAX_HANDLERS
)
{
{
/* get VIC address */
rt_uint32_t
*
vect_addr
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x100
+
(
vector
<<
2
));
rt_uint32_t
*
vect_ctl
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x200
+
(
vector
<<
2
));
rt_uint32_t
*
vect_ctl
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x200
+
(
vector
<<
2
));
/* assign IRQ slot and enable this slot */
/* assign IRQ slot and enable this slot */
*
vect_ctl
=
0x20
|
(
vector
&
0x1F
);
*
vect_ctl
=
0x20
|
(
vector
&
0x1F
);
if
(
old_handler
!=
RT_NULL
)
*
old_handler
=
(
rt_isr_handler_t
)
*
vect_addr
;
old_handler
=
irq_desc
[
vector
].
handler
;
if
(
new_handler
!=
RT_NULL
)
*
vect_addr
=
(
rt_uint32_t
)
new_handler
;
if
(
handler
!=
RT_NULL
)
{
irq_desc
[
vector
].
handler
=
handler
;
irq_desc
[
vector
].
param
=
param
;
}
}
}
return
old_handler
;
}
}
/**
/**
* this function will reset CPU
* this function will reset CPU
*
*
*/
*/
void
rt_hw_cpu_reset
()
void
rt_hw_cpu_reset
(
void
)
{
{
}
}
...
@@ -165,18 +182,23 @@ void rt_hw_cpu_shutdown()
...
@@ -165,18 +182,23 @@ void rt_hw_cpu_shutdown()
while
(
1
);
while
(
1
);
}
}
void
rt_hw_trap_irq
()
void
rt_hw_trap_irq
(
void
)
{
{
rt_isr_handler_t
isr_func
;
int
irqno
;
struct
rt_irq_desc
*
irq
;
extern
struct
rt_irq_desc
irq_desc
[];
irq
=
(
struct
rt_irq_desc
*
)
VICVectAddr
;
irqno
=
((
rt_uint32_t
)
irq
-
(
rt_uint32_t
)
&
irq_desc
[
0
])
/
sizeof
(
struct
rt_irq_desc
);
isr_func
=
(
rt_isr_handler_t
)
VICVectAddr
;
/* invoke isr */
i
sr_func
(
0
);
i
rq
->
handler
(
irqno
,
irq
->
param
);
/* acknowledge Interrupt */
/* acknowledge Interrupt */
// VICVectAddr = 0;
// VICVectAddr = 0;
}
}
void
rt_hw_trap_fiq
()
void
rt_hw_trap_fiq
(
void
)
{
{
rt_kprintf
(
"fast interrupt request
\n
"
);
rt_kprintf
(
"fast interrupt request
\n
"
);
}
}
...
...
libcpu/arm/lpc24xx/interrupt.c
浏览文件 @
c1b60064
...
@@ -10,8 +10,10 @@
...
@@ -10,8 +10,10 @@
* Change Logs:
* Change Logs:
* Date Author Notes
* Date Author Notes
* 2008-12-11 XuXinming first version
* 2008-12-11 XuXinming first version
* 2013-03-29 aozima Modify the interrupt interface implementations.
*/
*/
#include <rtthread.h>
#include <rthw.h>
#include <rthw.h>
#include "LPC24xx.h"
#include "LPC24xx.h"
...
@@ -35,7 +37,7 @@ void rt_hw_interrupt_handler(int vector, void *param)
...
@@ -35,7 +37,7 @@ void rt_hw_interrupt_handler(int vector, void *param)
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
}
}
void
rt_hw_interrupt_init
()
void
rt_hw_interrupt_init
(
void
)
{
{
register
int
i
;
register
int
i
;
...
@@ -47,10 +49,10 @@ void rt_hw_interrupt_init()
...
@@ -47,10 +49,10 @@ void rt_hw_interrupt_init()
VICIntSelect
=
0
;
VICIntSelect
=
0
;
/* init exceptions table */
/* init exceptions table */
rt_memset
(
irq_desc
,
0x00
,
sizeof
(
irq_desc
));
for
(
i
=
0
;
i
<
MAX_HANDLERS
;
i
++
)
for
(
i
=
0
;
i
<
MAX_HANDLERS
;
i
++
)
{
{
irq_desc
[
i
].
handler
=
(
rt_isr_handler_t
)
rt_hw_interrupt_handler
;
irq_desc
[
i
].
handler
=
rt_hw_interrupt_handler
;
irq_desc
[
i
].
param
=
RT_NULL
;
vect_addr
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x100
+
i
*
4
);
vect_addr
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x100
+
i
*
4
);
vect_cntl
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x200
+
i
*
4
);
vect_cntl
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x200
+
i
*
4
);
...
@@ -94,7 +96,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
...
@@ -94,7 +96,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
old_handler
=
irq_desc
[
vector
].
handler
;
old_handler
=
irq_desc
[
vector
].
handler
;
if
(
handler
!=
RT_NULL
)
if
(
handler
!=
RT_NULL
)
{
{
irq_desc
[
vector
].
handler
=
(
rt_isr_handler_t
)
handler
;
irq_desc
[
vector
].
handler
=
handler
;
irq_desc
[
vector
].
param
=
param
;
irq_desc
[
vector
].
param
=
param
;
}
}
}
}
...
...
libcpu/arm/lpc24xx/trap.c
浏览文件 @
c1b60064
...
@@ -126,7 +126,7 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
...
@@ -126,7 +126,7 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
}
}
extern
rt_isr_handler_t
isr_table
[];
extern
rt_isr_handler_t
isr_table
[];
void
rt_hw_trap_irq
()
void
rt_hw_trap_irq
(
void
)
{
{
int
irqno
;
int
irqno
;
struct
rt_irq_desc
*
irq
;
struct
rt_irq_desc
*
irq
;
...
@@ -139,7 +139,7 @@ void rt_hw_trap_irq()
...
@@ -139,7 +139,7 @@ void rt_hw_trap_irq()
irq
->
handler
(
irqno
,
irq
->
param
);
irq
->
handler
(
irqno
,
irq
->
param
);
}
}
void
rt_hw_trap_fiq
()
void
rt_hw_trap_fiq
(
void
)
{
{
rt_kprintf
(
"fast interrupt request
\n
"
);
rt_kprintf
(
"fast interrupt request
\n
"
);
}
}
...
...
libcpu/arm/s3c24x0/interrupt.c
浏览文件 @
c1b60064
...
@@ -10,9 +10,11 @@
...
@@ -10,9 +10,11 @@
* Change Logs:
* Change Logs:
* Date Author Notes
* Date Author Notes
* 2006-03-13 Bernard first version
* 2006-03-13 Bernard first version
* 2013-03-29 aozima Modify the interrupt interface implementations.
*/
*/
#include <rtthread.h>
#include <rtthread.h>
#include <rthw.h>
#include "s3c24x0.h"
#include "s3c24x0.h"
#define MAX_HANDLERS 32
#define MAX_HANDLERS 32
...
@@ -20,7 +22,7 @@
...
@@ -20,7 +22,7 @@
extern
rt_uint32_t
rt_interrupt_nest
;
extern
rt_uint32_t
rt_interrupt_nest
;
/* exception and interrupt handler table */
/* exception and interrupt handler table */
rt_isr_handler_t
isr_table
[
MAX_HANDLERS
];
struct
rt_irq_desc
isr_table
[
MAX_HANDLERS
];
rt_uint32_t
rt_interrupt_from_thread
,
rt_interrupt_to_thread
;
rt_uint32_t
rt_interrupt_from_thread
,
rt_interrupt_to_thread
;
rt_uint32_t
rt_thread_switch_interrupt_flag
;
rt_uint32_t
rt_thread_switch_interrupt_flag
;
...
@@ -29,10 +31,9 @@ rt_uint32_t rt_thread_switch_interrupt_flag;
...
@@ -29,10 +31,9 @@ rt_uint32_t rt_thread_switch_interrupt_flag;
*/
*/
/*@{*/
/*@{*/
rt_isr_handler_t
rt_hw_interrupt_handle
(
rt_uint32_t
vector
)
static
void
rt_hw_interrupt_handle
(
int
vector
,
void
*
param
)
{
{
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
return
RT_NULL
;
}
}
/**
/**
...
@@ -61,9 +62,10 @@ void rt_hw_interrupt_init(void)
...
@@ -61,9 +62,10 @@ void rt_hw_interrupt_init(void)
INTPND
=
BIT_ALLMSK
;
INTPND
=
BIT_ALLMSK
;
/* init exceptions table */
/* init exceptions table */
rt_memset
(
isr_table
,
0x00
,
sizeof
(
isr_table
));
for
(
idx
=
0
;
idx
<
MAX_HANDLERS
;
idx
++
)
for
(
idx
=
0
;
idx
<
MAX_HANDLERS
;
idx
++
)
{
{
isr_table
[
idx
]
=
(
rt_isr_handler_t
)
rt_hw_interrupt_handle
;
isr_table
[
idx
].
handler
=
rt_hw_interrupt_handle
;
}
}
/* init interrupt nest, and context in thread sp */
/* init interrupt nest, and context in thread sp */
...
@@ -105,13 +107,26 @@ void rt_hw_interrupt_umask(int vector)
...
@@ -105,13 +107,26 @@ void rt_hw_interrupt_umask(int vector)
* @param new_handler the interrupt service routine to be installed
* @param new_handler the interrupt service routine to be installed
* @param old_handler the old interrupt service routine
* @param old_handler the old interrupt service routine
*/
*/
void
rt_hw_interrupt_install
(
int
vector
,
rt_isr_handler_t
new_handler
,
rt_isr_handler_t
*
old_handler
)
rt_isr_handler_t
rt_hw_interrupt_install
(
int
vector
,
rt_isr_handler_t
handler
,
void
*
param
,
char
*
name
)
{
{
rt_isr_handler_t
old_handler
=
RT_NULL
;
if
(
vector
<
MAX_HANDLERS
)
if
(
vector
<
MAX_HANDLERS
)
{
{
if
(
old_handler
!=
RT_NULL
)
*
old_handler
=
isr_table
[
vector
];
old_handler
=
isr_table
[
vector
].
handler
;
if
(
new_handler
!=
RT_NULL
)
isr_table
[
vector
]
=
new_handler
;
if
(
handler
!=
RT_NULL
)
{
#ifdef RT_USING_INTERRUPT_INFO
rt_strncpy
(
isr_table
[
vector
].
name
,
name
,
RT_NAME_MAX
);
#endif
/* RT_USING_INTERRUPT_INFO */
isr_table
[
vector
].
handler
=
handler
;
isr_table
[
vector
].
param
=
param
;
}
}
}
return
old_handler
;
}
}
/*@}*/
/*@}*/
libcpu/arm/s3c24x0/trap.c
浏览文件 @
c1b60064
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
* 2006-03-13 Bernard first version
* 2006-03-13 Bernard first version
* 2006-05-27 Bernard add skyeye support
* 2006-05-27 Bernard add skyeye support
* 2007-11-19 Yi.Qiu fix rt_hw_trap_irq function
* 2007-11-19 Yi.Qiu fix rt_hw_trap_irq function
* 2013-03-29 aozima Modify the interrupt interface implementations.
*/
*/
#include <rtthread.h>
#include <rtthread.h>
...
@@ -140,29 +141,35 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
...
@@ -140,29 +141,35 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
rt_hw_cpu_shutdown
();
rt_hw_cpu_shutdown
();
}
}
extern
rt_isr_handler_t
isr_table
[];
extern
struct
rt_irq_desc
isr_table
[];
void
rt_hw_trap_irq
()
void
rt_hw_trap_irq
(
void
)
{
{
unsigned
long
intstat
;
unsigned
long
irq
;
rt_isr_handler_t
isr_func
;
rt_isr_handler_t
isr_func
;
void
*
param
;
intstat
=
INTOFFSET
;
irq
=
INTOFFSET
;
if
(
intstat
==
INTGLOBAL
)
return
;
if
(
irq
==
INTGLOBAL
)
return
;
/* get interrupt service routine */
/* get interrupt service routine */
isr_func
=
isr_table
[
intstat
];
isr_func
=
isr_table
[
irq
].
handler
;
param
=
isr_table
[
irq
].
param
;
/* turn to interrupt service routine */
/* turn to interrupt service routine */
isr_func
(
intstat
);
isr_func
(
irq
,
param
);
/* clear pending register */
/* clear pending register */
/* note: must be the last, if not, may repeat*/
/* note: must be the last, if not, may repeat*/
ClearPending
(
1
<<
intstat
);
ClearPending
(
1
<<
irq
);
#ifdef RT_USING_INTERRUPT_INFO
isr_table
[
irq
].
counter
++
;
#endif
/* RT_USING_INTERRUPT_INFO */
}
}
void
rt_hw_trap_fiq
()
void
rt_hw_trap_fiq
(
void
)
{
{
rt_kprintf
(
"fast interrupt request
\n
"
);
rt_kprintf
(
"fast interrupt request
\n
"
);
}
}
...
...
libcpu/arm/sep4020/interrupt.c
浏览文件 @
c1b60064
...
@@ -10,9 +10,11 @@
...
@@ -10,9 +10,11 @@
* Change Logs:
* Change Logs:
* Date Author Notes
* Date Author Notes
* 2006-03-13 Bernard first version
* 2006-03-13 Bernard first version
* 2013-03-29 aozima Modify the interrupt interface implementations.
*/
*/
#include <rtthread.h>
#include <rtthread.h>
#include <rthw.h>
#include <sep4020.h>
#include <sep4020.h>
#define MAX_HANDLERS 32
#define MAX_HANDLERS 32
...
@@ -20,7 +22,7 @@
...
@@ -20,7 +22,7 @@
extern
rt_uint32_t
rt_interrupt_nest
;
extern
rt_uint32_t
rt_interrupt_nest
;
/* exception and interrupt handler table */
/* exception and interrupt handler table */
rt_isr_handler_t
isr_table
[
MAX_HANDLERS
];
struct
rt_irq_desc
isr_table
[
MAX_HANDLERS
];
rt_uint32_t
rt_interrupt_from_thread
,
rt_interrupt_to_thread
;
rt_uint32_t
rt_interrupt_from_thread
,
rt_interrupt_to_thread
;
rt_uint32_t
rt_thread_switch_interrupt_flag
;
rt_uint32_t
rt_thread_switch_interrupt_flag
;
...
@@ -38,7 +40,7 @@ rt_isr_handler_t rt_hw_interrupt_handle(rt_uint32_t vector)
...
@@ -38,7 +40,7 @@ rt_isr_handler_t rt_hw_interrupt_handle(rt_uint32_t vector)
/**
/**
* This function will initialize hardware interrupt
* This function will initialize hardware interrupt
*/
*/
void
rt_hw_interrupt_init
()
void
rt_hw_interrupt_init
(
void
)
{
{
register
rt_uint32_t
idx
;
register
rt_uint32_t
idx
;
...
@@ -66,9 +68,10 @@ void rt_hw_interrupt_init()
...
@@ -66,9 +68,10 @@ void rt_hw_interrupt_init()
*
(
RP
)(
INTC_IPLR
)
=
0x0
;
*
(
RP
)(
INTC_IPLR
)
=
0x0
;
/* init exceptions table */
/* init exceptions table */
rt_memset
(
isr_table
,
0x00
,
sizeof
(
isr_table
));
for
(
idx
=
0
;
idx
<
MAX_HANDLERS
;
idx
++
)
for
(
idx
=
0
;
idx
<
MAX_HANDLERS
;
idx
++
)
{
{
isr_table
[
idx
]
=
(
rt_isr_handler_t
)
rt_hw_interrupt_handle
;
isr_table
[
idx
].
handler
=
rt_hw_interrupt_handle
;
}
}
/* init interrupt nest, and context in thread sp */
/* init interrupt nest, and context in thread sp */
...
@@ -108,15 +111,26 @@ void rt_hw_interrupt_umask(rt_uint32_t vector)
...
@@ -108,15 +111,26 @@ void rt_hw_interrupt_umask(rt_uint32_t vector)
* @param new_handler the interrupt service routine to be installed
* @param new_handler the interrupt service routine to be installed
* @param old_handler the old interrupt service routine
* @param old_handler the old interrupt service routine
*/
*/
void
rt_hw_interrupt_install
(
rt_uint32_t
vector
,
rt_isr_handler_t
new_handler
,
rt_isr_handler_t
*
old_handler
)
rt_isr_handler_t
rt_hw_interrupt_install
(
int
vector
,
rt_isr_handler_t
handler
,
void
*
param
,
char
*
name
)
{
{
rt_isr_handler_t
old_handler
=
RT_NULL
;
if
(
vector
<
MAX_HANDLERS
)
if
(
vector
<
MAX_HANDLERS
)
{
{
if
(
*
old_handler
!=
RT_NULL
)
old_handler
=
isr_table
[
vector
].
handler
;
*
old_handler
=
isr_table
[
vector
];
if
(
new_handler
!=
RT_NULL
)
if
(
handler
!=
RT_NULL
)
isr_table
[
vector
]
=
new_handler
;
{
#ifdef RT_USING_INTERRUPT_INFO
rt_strncpy
(
isr_table
[
vector
].
name
,
name
,
RT_NAME_MAX
);
#endif
/* RT_USING_INTERRUPT_INFO */
isr_table
[
vector
].
handler
=
handler
;
isr_table
[
vector
].
param
=
param
;
}
}
}
return
old_handler
;
}
}
/*@}*/
/*@}*/
libcpu/arm/sep4020/trap.c
浏览文件 @
c1b60064
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
* 2006-03-13 Bernard first version
* 2006-03-13 Bernard first version
* 2006-05-27 Bernard add skyeye support
* 2006-05-27 Bernard add skyeye support
* 2007-11-19 Yi.Qiu fix rt_hw_trap_irq function
* 2007-11-19 Yi.Qiu fix rt_hw_trap_irq function
* 2013-03-29 aozima Modify the interrupt interface implementations.
*/
*/
#include <rtthread.h>
#include <rtthread.h>
...
@@ -131,13 +132,14 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
...
@@ -131,13 +132,14 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
rt_hw_cpu_shutdown
();
rt_hw_cpu_shutdown
();
}
}
extern
rt_isr_handler_t
isr_table
[];
extern
struct
rt_irq_desc
isr_table
[];
void
rt_hw_trap_irq
()
void
rt_hw_trap_irq
(
void
)
{
{
unsigned
long
intstat
;
unsigned
long
intstat
;
rt_uint32_t
i
=
0
;
rt_uint32_t
irq
=
0
;
rt_isr_handler_t
isr_func
;
rt_isr_handler_t
isr_func
;
void
*
param
;
/*Get the final intrrupt source*/
/*Get the final intrrupt source*/
intstat
=
*
(
RP
)(
INTC_IFSR
);;
intstat
=
*
(
RP
)(
INTC_IFSR
);;
...
@@ -146,16 +148,22 @@ void rt_hw_trap_irq()
...
@@ -146,16 +148,22 @@ void rt_hw_trap_irq()
while
(
intstat
!=
1
)
while
(
intstat
!=
1
)
{
{
intstat
=
intstat
>>
1
;
intstat
=
intstat
>>
1
;
i
++
;
irq
++
;
}
}
/* get interrupt service routine */
/* get interrupt service routine */
isr_func
=
isr_table
[
i
];
isr_func
=
isr_table
[
irq
].
isr_handle
;
param
=
isr_table
[
irq
].
param
;
/* turn to interrupt service routine */
/* turn to interrupt service routine */
isr_func
(
i
);
isr_func
(
irq
,
param
);
#ifdef RT_USING_INTERRUPT_INFO
isr_table
[
irq
].
counter
++
;
#endif
/* RT_USING_INTERRUPT_INFO */
}
}
void
rt_hw_trap_fiq
()
void
rt_hw_trap_fiq
(
void
)
{
{
rt_kprintf
(
"fast interrupt request
\n
"
);
rt_kprintf
(
"fast interrupt request
\n
"
);
}
}
...
...
libcpu/mips/jz47xx/interrupt.c
浏览文件 @
c1b60064
...
@@ -90,7 +90,9 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector,
...
@@ -90,7 +90,9 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector,
{
{
old_handler
=
irq_handle_table
[
vector
].
handler
;
old_handler
=
irq_handle_table
[
vector
].
handler
;
#ifdef RT_USING_INTERRUPT_INFO
rt_strncpy
(
irq_handle_table
[
vector
].
name
,
name
,
RT_NAME_MAX
);
rt_strncpy
(
irq_handle_table
[
vector
].
name
,
name
,
RT_NAME_MAX
);
#endif
/* RT_USING_INTERRUPT_INFO */
irq_handle_table
[
vector
].
handler
=
handler
;
irq_handle_table
[
vector
].
handler
=
handler
;
irq_handle_table
[
vector
].
param
=
param
;
irq_handle_table
[
vector
].
param
=
param
;
}
}
...
@@ -118,6 +120,10 @@ void rt_interrupt_dispatch(void *ptreg)
...
@@ -118,6 +120,10 @@ void rt_interrupt_dispatch(void *ptreg)
/* do interrupt */
/* do interrupt */
(
*
irq_func
)(
i
,
irq_handle_table
[
i
].
param
);
(
*
irq_func
)(
i
,
irq_handle_table
[
i
].
param
);
#ifdef RT_USING_INTERRUPT_INFO
irq_handle_table
[
i
].
counter
++
;
#endif
/* RT_USING_INTERRUPT_INFO */
/* ack interrupt */
/* ack interrupt */
INTC_IPR
=
(
1
<<
i
);
INTC_IPR
=
(
1
<<
i
);
}
}
...
...
libcpu/mips/loongson/interrupt.c
浏览文件 @
c1b60064
...
@@ -10,8 +10,11 @@
...
@@ -10,8 +10,11 @@
* Change Logs:
* Change Logs:
* Date Author Notes
* Date Author Notes
* 2010-10-15 Bernard first version
* 2010-10-15 Bernard first version
* 2013-03-29 aozima Modify the interrupt interface implementations.
*/
*/
#include <rtthread.h>
#include <rtthread.h>
#include <rthw.h>
#include "soc3210.h"
#include "soc3210.h"
#define MAX_INTR 32
#define MAX_INTR 32
...
@@ -20,7 +23,7 @@ extern rt_uint32_t rt_interrupt_nest;
...
@@ -20,7 +23,7 @@ extern rt_uint32_t rt_interrupt_nest;
rt_uint32_t
rt_interrupt_from_thread
,
rt_interrupt_to_thread
;
rt_uint32_t
rt_interrupt_from_thread
,
rt_interrupt_to_thread
;
rt_uint32_t
rt_thread_switch_interrupt_flag
;
rt_uint32_t
rt_thread_switch_interrupt_flag
;
static
rt_isr_handler_t
irq_handle_table
[
MAX_INTR
];
static
struct
rt_irq_desc
irq_handle_table
[
MAX_INTR
];
void
rt_interrupt_dispatch
(
void
*
ptreg
);
void
rt_interrupt_dispatch
(
void
*
ptreg
);
void
rt_hw_timer_handler
();
void
rt_hw_timer_handler
();
...
@@ -30,7 +33,7 @@ void rt_hw_timer_handler();
...
@@ -30,7 +33,7 @@ void rt_hw_timer_handler();
/*@{*/
/*@{*/
void
rt_hw_interrupt_handler
(
int
vector
)
static
void
rt_hw_interrupt_handler
(
int
vector
,
void
*
param
)
{
{
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
}
}
...
@@ -40,11 +43,12 @@ void rt_hw_interrupt_handler(int vector)
...
@@ -40,11 +43,12 @@ void rt_hw_interrupt_handler(int vector)
*/
*/
void
rt_hw_interrupt_init
(
void
)
void
rt_hw_interrupt_init
(
void
)
{
{
rt_int32_t
i
nde
x
;
rt_int32_t
i
d
x
;
for
(
index
=
0
;
index
<
MAX_INTR
;
index
++
)
rt_memset
(
irq_handle_table
,
0x00
,
sizeof
(
irq_handle_table
));
for
(
idx
=
0
;
idx
<
MAX_INTR
;
idx
++
)
{
{
irq_handle_table
[
i
ndex
]
=
(
rt_isr_handler_t
)
rt_hw_interrupt_handler
;
irq_handle_table
[
i
dx
].
handler
=
rt_hw_interrupt_handler
;
}
}
/* init interrupt nest, and context in thread sp */
/* init interrupt nest, and context in thread sp */
...
@@ -79,20 +83,32 @@ void rt_hw_interrupt_umask(int vector)
...
@@ -79,20 +83,32 @@ void rt_hw_interrupt_umask(int vector)
* @param new_handler the interrupt service routine to be installed
* @param new_handler the interrupt service routine to be installed
* @param old_handler the old interrupt service routine
* @param old_handler the old interrupt service routine
*/
*/
void
rt_hw_interrupt_install
(
int
vector
,
rt_isr_handler_t
new_handler
,
rt_isr_handler_t
*
old_handler
)
rt_isr_handler_t
rt_hw_interrupt_install
(
int
vector
,
rt_isr_handler_t
handler
,
void
*
param
,
char
*
name
)
{
{
if
(
vector
>=
0
&&
vector
<
MAX_INTR
)
rt_isr_handler_t
old_handler
=
RT_NULL
;
if
(
vector
<
MAX_INTR
)
{
old_handler
=
irq_handle_table
[
vector
].
handler
;
if
(
handler
!=
RT_NULL
)
{
{
if
(
old_handler
!=
RT_NULL
)
#ifdef RT_USING_INTERRUPT_INFO
*
old_handler
=
irq_handle_table
[
vector
];
rt_strncpy
(
irq_handle_table
[
vector
].
name
,
name
,
RT_NAME_MAX
);
if
(
new_handler
!=
RT_NULL
)
#endif
/* RT_USING_INTERRUPT_INFO */
irq_handle_table
[
vector
]
=
(
rt_isr_handler_t
)
new_handler
;
irq_handle_table
[
vector
].
handler
=
handler
;
irq_handle_table
[
vector
].
param
=
param
;
}
}
}
return
old_handler
;
}
}
void
rt_interrupt_dispatch
(
void
*
ptreg
)
void
rt_interrupt_dispatch
(
void
*
ptreg
)
{
{
int
i
;
int
irq
;
void
*
param
;
rt_isr_handler_t
irq_func
;
rt_isr_handler_t
irq_func
;
static
rt_uint32_t
status
=
0
;
static
rt_uint32_t
status
=
0
;
rt_uint32_t
c0_status
;
rt_uint32_t
c0_status
;
...
@@ -110,18 +126,24 @@ void rt_interrupt_dispatch(void *ptreg)
...
@@ -110,18 +126,24 @@ void rt_interrupt_dispatch(void *ptreg)
status
|=
INT_ISR
;
status
|=
INT_ISR
;
if
(
!
status
)
return
;
if
(
!
status
)
return
;
for
(
i
=
MAX_INTR
;
i
>
0
;
--
i
)
for
(
irq
=
MAX_INTR
;
irq
>
0
;
--
irq
)
{
{
if
((
status
&
(
1
<<
i
)))
if
((
status
&
(
1
<<
irq
)))
{
{
status
&=
~
(
1
<<
i
);
status
&=
~
(
1
<<
irq
);
irq_func
=
irq_handle_table
[
i
];
irq_func
=
irq_handle_table
[
irq
].
handler
;
param
=
irq_handle_table
[
irq
].
param
;
/* do interrupt */
/* do interrupt */
(
*
irq_func
)(
i
);
(
*
irq_func
)(
irq
,
param
);
#ifdef RT_USING_INTERRUPT_INFO
irq_handle_table
[
irq
].
counter
++
;
#endif
/* RT_USING_INTERRUPT_INFO */
/* ack interrupt */
/* ack interrupt */
INT_CLR
=
(
1
<<
i
);
INT_CLR
=
(
1
<<
irq
);
}
}
}
}
}
}
...
...
libcpu/mips/loongson_1b/interrupt.c
浏览文件 @
c1b60064
...
@@ -11,9 +11,11 @@
...
@@ -11,9 +11,11 @@
* Date Author Notes
* Date Author Notes
* 2010-10-15 Bernard first version
* 2010-10-15 Bernard first version
* 2010-10-15 lgnq modified for LS1B
* 2010-10-15 lgnq modified for LS1B
* 2013-03-29 aozima Modify the interrupt interface implementations.
*/
*/
#include <rtthread.h>
#include <rtthread.h>
#include <rthw.h>
#include "ls1b.h"
#include "ls1b.h"
#define MAX_INTR 32
#define MAX_INTR 32
...
@@ -23,7 +25,7 @@ rt_uint32_t rt_interrupt_from_thread;
...
@@ -23,7 +25,7 @@ rt_uint32_t rt_interrupt_from_thread;
rt_uint32_t
rt_interrupt_to_thread
;
rt_uint32_t
rt_interrupt_to_thread
;
rt_uint32_t
rt_thread_switch_interrupt_flag
;
rt_uint32_t
rt_thread_switch_interrupt_flag
;
static
rt_isr_handler_t
irq_handle_table
[
MAX_INTR
];
static
struct
rt_irq_desc
irq_handle_table
[
MAX_INTR
];
void
rt_interrupt_dispatch
(
void
*
ptreg
);
void
rt_interrupt_dispatch
(
void
*
ptreg
);
void
rt_hw_timer_handler
();
void
rt_hw_timer_handler
();
...
@@ -36,7 +38,7 @@ static struct ls1b_intc_regs volatile *ls1b_hw0_icregs
...
@@ -36,7 +38,7 @@ static struct ls1b_intc_regs volatile *ls1b_hw0_icregs
/*@{*/
/*@{*/
void
rt_hw_interrupt_handler
(
int
vector
)
static
void
rt_hw_interrupt_handler
(
int
vector
,
void
*
param
)
{
{
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
}
}
...
@@ -46,7 +48,7 @@ void rt_hw_interrupt_handler(int vector)
...
@@ -46,7 +48,7 @@ void rt_hw_interrupt_handler(int vector)
*/
*/
void
rt_hw_interrupt_init
(
void
)
void
rt_hw_interrupt_init
(
void
)
{
{
rt_int32_t
i
nde
x
;
rt_int32_t
i
d
x
;
/* pci active low */
/* pci active low */
ls1b_hw0_icregs
->
int_pol
=
-
1
;
//must be done here 20110802 lgnq
ls1b_hw0_icregs
->
int_pol
=
-
1
;
//must be done here 20110802 lgnq
...
@@ -55,9 +57,10 @@ void rt_hw_interrupt_init(void)
...
@@ -55,9 +57,10 @@ void rt_hw_interrupt_init(void)
/* mask all interrupts */
/* mask all interrupts */
(
ls1b_hw0_icregs
+
0
)
->
int_clr
=
0xffffffff
;
(
ls1b_hw0_icregs
+
0
)
->
int_clr
=
0xffffffff
;
for
(
index
=
0
;
index
<
MAX_INTR
;
index
++
)
rt_memset
(
irq_handle_table
,
0x00
,
sizeof
(
irq_handle_table
));
for
(
idx
=
0
;
idx
<
MAX_INTR
;
idx
++
)
{
{
irq_handle_table
[
i
ndex
]
=
(
rt_isr_handler_t
)
rt_hw_interrupt_handler
;
irq_handle_table
[
i
dx
].
handler
=
rt_hw_interrupt_handler
;
}
}
/* init interrupt nest, and context in thread sp */
/* init interrupt nest, and context in thread sp */
...
@@ -92,20 +95,32 @@ void rt_hw_interrupt_umask(int vector)
...
@@ -92,20 +95,32 @@ void rt_hw_interrupt_umask(int vector)
* @param new_handler the interrupt service routine to be installed
* @param new_handler the interrupt service routine to be installed
* @param old_handler the old interrupt service routine
* @param old_handler the old interrupt service routine
*/
*/
void
rt_hw_interrupt_install
(
int
vector
,
rt_isr_handler_t
new_handler
,
rt_isr_handler_t
*
old_handler
)
rt_isr_handler_t
rt_hw_interrupt_install
(
int
vector
,
rt_isr_handler_t
handler
,
void
*
param
,
char
*
name
)
{
{
rt_isr_handler_t
old_handler
=
RT_NULL
;
if
(
vector
>=
0
&&
vector
<
MAX_INTR
)
if
(
vector
>=
0
&&
vector
<
MAX_INTR
)
{
{
if
(
old_handler
!=
RT_NULL
)
old_handler
=
irq_handle_table
[
vector
].
handler
;
*
old_handler
=
irq_handle_table
[
vector
];
if
(
new_handler
!=
RT_NULL
)
if
(
handler
!=
RT_NULL
)
irq_handle_table
[
vector
]
=
(
rt_isr_handler_t
)
new_handler
;
{
#ifdef RT_USING_INTERRUPT_INFO
rt_strncpy
(
irq_handle_table
[
vector
].
name
,
name
,
RT_NAME_MAX
);
#endif
/* RT_USING_INTERRUPT_INFO */
irq_handle_table
[
vector
].
handler
=
handler
;
irq_handle_table
[
vector
].
param
=
param
;
}
}
}
return
old_handler
;
}
}
void
rt_interrupt_dispatch
(
void
*
ptreg
)
void
rt_interrupt_dispatch
(
void
*
ptreg
)
{
{
int
i
;
int
irq
;
void
*
param
;
rt_isr_handler_t
irq_func
;
rt_isr_handler_t
irq_func
;
static
rt_uint32_t
status
=
0
;
static
rt_uint32_t
status
=
0
;
rt_uint32_t
c0_status
;
rt_uint32_t
c0_status
;
...
@@ -134,18 +149,24 @@ void rt_interrupt_dispatch(void *ptreg)
...
@@ -134,18 +149,24 @@ void rt_interrupt_dispatch(void *ptreg)
if
(
!
status
)
if
(
!
status
)
return
;
return
;
for
(
i
=
MAX_INTR
;
i
>
0
;
--
i
)
for
(
i
rq
=
MAX_INTR
;
irq
>
0
;
--
irq
)
{
{
if
((
status
&
(
1
<<
i
)))
if
((
status
&
(
1
<<
irq
)))
{
{
status
&=
~
(
1
<<
i
);
status
&=
~
(
1
<<
irq
);
irq_func
=
irq_handle_table
[
i
];
irq_func
=
irq_handle_table
[
irq
].
handler
;
param
=
irq_handle_table
[
irq
].
param
;
/* do interrupt */
/* do interrupt */
(
*
irq_func
)(
i
);
(
*
irq_func
)(
irq
,
param
);
#ifdef RT_USING_INTERRUPT_INFO
irq_handle_table
[
irq
].
counter
++
;
#endif
/* RT_USING_INTERRUPT_INFO */
/* ack interrupt */
/* ack interrupt */
ls1b_hw0_icregs
->
int_clr
|=
(
1
<<
i
);
ls1b_hw0_icregs
->
int_clr
|=
(
1
<<
i
rq
);
}
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录