Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wwsmg1
rt-thread
提交
608074de
R
rt-thread
项目概览
wwsmg1
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
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,发现更多精彩内容 >>
提交
608074de
编写于
3月 30, 2013
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update to interrupt description
上级
aaf01868
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
92 addition
and
61 deletion
+92
-61
bsp/lpc2478/drivers/board.c
bsp/lpc2478/drivers/board.c
+2
-2
bsp/lpc2478/drivers/serial.c
bsp/lpc2478/drivers/serial.c
+4
-4
bsp/sam7x/applications/startup.c
bsp/sam7x/applications/startup.c
+1
-1
bsp/sam7x/drivers/board.c
bsp/sam7x/drivers/board.c
+2
-2
bsp/sam7x/drivers/sam7x_emac.c
bsp/sam7x/drivers/sam7x_emac.c
+2
-2
bsp/sam7x/drivers/serial.c
bsp/sam7x/drivers/serial.c
+3
-18
libcpu/arm/AT91SAM7X/interrupt.c
libcpu/arm/AT91SAM7X/interrupt.c
+28
-6
libcpu/arm/AT91SAM7X/trap.c
libcpu/arm/AT91SAM7X/trap.c
+7
-2
libcpu/arm/lpc24xx/interrupt.c
libcpu/arm/lpc24xx/interrupt.c
+35
-19
libcpu/arm/lpc24xx/trap.c
libcpu/arm/lpc24xx/trap.c
+8
-5
未找到文件。
bsp/lpc2478/drivers/board.c
浏览文件 @
608074de
...
...
@@ -27,7 +27,7 @@ extern void rt_hw_serial_init(void);
*/
/*@{*/
void
rt_timer_handler
(
int
vector
)
void
rt_timer_handler
(
int
vector
,
void
*
param
)
{
T0IR
|=
0x01
;
/* clear interrupt flag */
rt_tick_increase
();
...
...
@@ -49,7 +49,7 @@ void rt_hw_board_init()
T0MCR
=
0x03
;
T0MR0
=
(
DATA_COUNT
);
rt_hw_interrupt_install
(
TIMER0_INT
,
rt_timer_handler
,
RT_NULL
);
rt_hw_interrupt_install
(
TIMER0_INT
,
rt_timer_handler
,
RT_NULL
,
"tick"
);
rt_hw_interrupt_umask
(
TIMER0_INT
);
T0TCR
=
0x01
;
//enable timer0 counter
...
...
bsp/lpc2478/drivers/serial.c
浏览文件 @
608074de
...
...
@@ -113,7 +113,7 @@ void rt_hw_uart_isr(struct rt_lpcserial* lpc_serial)
}
#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 */
rt_hw_uart_isr
(
&
serial1
);
...
...
@@ -121,7 +121,7 @@ void rt_hw_uart_isr_1(int irqno)
#endif
#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 */
rt_hw_uart_isr
(
&
serial2
);
...
...
@@ -153,13 +153,13 @@ static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag)
if
(
lpc_serial
->
irqno
==
UART0_INT
)
{
#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
,
RT_NULL
,
"uart1"
);
#endif
}
else
{
#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
,
RT_NULL
,
"uart2"
);
#endif
}
...
...
bsp/sam7x/applications/startup.c
浏览文件 @
608074de
...
...
@@ -97,7 +97,7 @@ void rtthread_startup(void)
#elif __ICCARM__
rt_system_heap_init
(
__segment_end
(
"HEAP"
),
(
void
*
)
0x00210000
);
#else
rt_system_heap_init
(
&
__bss_end
,
0x00210000
);
rt_system_heap_init
(
&
__bss_end
,
(
void
*
)
0x00210000
);
#endif
#endif
...
...
bsp/sam7x/drivers/board.c
浏览文件 @
608074de
...
...
@@ -33,7 +33,7 @@ static void rt_hw_board_led_init(void);
* This is the timer interrupt service routine.
* @param vector the irq number for timer
*/
void
rt_hw_timer_handler
(
int
vector
)
void
rt_hw_timer_handler
(
int
vector
,
void
*
param
)
{
if
(
AT91C_BASE_PITC
->
PITC_PISR
&
0x01
)
{
...
...
@@ -168,7 +168,7 @@ void rt_hw_board_init()
AT91C_BASE_PITC
->
PITC_PIMR
=
(
1
<<
25
)
|
(
1
<<
24
)
|
PIV
;
/* install timer handler */
rt_hw_interrupt_install
(
AT91C_ID_SYS
,
rt_hw_timer_handler
,
RT_NULL
);
rt_hw_interrupt_install
(
AT91C_ID_SYS
,
rt_hw_timer_handler
,
RT_NULL
,
"tick"
);
AT91C_BASE_AIC
->
AIC_SMR
[
AT91C_ID_SYS
]
=
0
;
rt_hw_interrupt_umask
(
AT91C_ID_SYS
);
}
...
...
bsp/sam7x/drivers/sam7x_emac.c
浏览文件 @
608074de
...
...
@@ -120,7 +120,7 @@ rt_inline void sam7xether_reset_tx_desc(void)
/* interrupt service routing */
static
void
sam7xether_isr
(
int
irq
)
static
void
sam7xether_isr
(
int
irq
,
void
*
param
)
{
/* Variable definitions can be made now. */
volatile
rt_uint32_t
isr
,
rsr
;
...
...
@@ -377,7 +377,7 @@ rt_err_t sam7xether_init(rt_device_t dev)
AT91C_BASE_EMAC
->
EMAC_IER
=
AT91C_EMAC_RCOMP
|
AT91C_EMAC_TCOMP
;
/* setup interrupt */
rt_hw_interrupt_install
(
AT91C_ID_EMAC
,
sam7xether_isr
,
RT_NULL
);
rt_hw_interrupt_install
(
AT91C_ID_EMAC
,
sam7xether_isr
,
RT_NULL
,
"emac"
);
*
(
volatile
unsigned
int
*
)(
0xFFFFF000
+
AT91C_ID_EMAC
*
4
)
=
AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL
|
5
;
// AT91C_AIC_SMR(AT91C_ID_EMAC) = AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL | 5;
rt_hw_interrupt_umask
(
AT91C_ID_EMAC
);
...
...
bsp/sam7x/drivers/serial.c
浏览文件 @
608074de
...
...
@@ -76,27 +76,12 @@ struct rt_at91serial serial1;
struct
rt_at91serial
serial2
;
#endif
static
void
rt_hw_serial_isr
(
int
irqno
)
static
void
rt_hw_serial_isr
(
int
irqno
,
void
*
param
)
{
rt_base_t
level
;
struct
rt_device
*
device
;
struct
rt_at91serial
*
serial
=
RT_NULL
;
struct
rt_at91serial
*
serial
=
(
struct
rt_at91serial
*
)
param
;
#ifdef RT_USING_UART1
if
(
irqno
==
AT91C_ID_US0
)
{
/* serial 1 */
serial
=
&
serial1
;
}
#endif
#ifdef RT_USING_UART2
if
(
irqno
==
AT91C_ID_US1
)
{
/* serial 2 */
serial
=
&
serial2
;
}
#endif
RT_ASSERT
(
serial
!=
RT_NULL
);
/* get generic device object */
...
...
@@ -202,7 +187,7 @@ static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag)
//serial->hw_base->US_IMR |= 1 << 0; /* umask RxReady interrupt */
/* install UART handler */
rt_hw_interrupt_install
(
serial
->
peripheral_id
,
rt_hw_serial_isr
,
RT_NULL
);
rt_hw_interrupt_install
(
serial
->
peripheral_id
,
rt_hw_serial_isr
,
serial
,
"uart"
);
// SAM7X Datasheet 30.5.3:
// It is notrecommended to use the USART interrupt line in edge sensitive mode
//AT91C_AIC_SMR(serial->peripheral_id) = 5 | (0x01 << 5);
...
...
libcpu/arm/AT91SAM7X/interrupt.c
浏览文件 @
608074de
...
...
@@ -12,11 +12,14 @@
* 2006-08-23 Bernard first version
*/
#include <rt
thread
.h>
#include <rt
hw
.h>
#include "AT91SAM7X256.h"
#define MAX_HANDLERS 32
/* exception and interrupt handler table */
struct
rt_irq_desc
irq_desc
[
MAX_HANDLERS
];
extern
rt_uint32_t
rt_interrupt_nest
;
rt_uint32_t
rt_interrupt_from_thread
,
rt_interrupt_to_thread
;
...
...
@@ -39,6 +42,13 @@ void rt_hw_interrupt_init()
{
rt_base_t
index
;
/* init exceptions table */
for
(
index
=
0
;
index
<
MAX_HANDLERS
;
index
++
)
{
irq_desc
[
index
].
handler
=
(
rt_isr_handler_t
)
rt_hw_interrupt_handler
;
irq_desc
[
index
].
param
=
RT_NULL
;
}
for
(
index
=
0
;
index
<
MAX_HANDLERS
;
index
++
)
{
AT91C_BASE_AIC
->
AIC_SVR
[
index
]
=
(
rt_uint32_t
)
rt_hw_interrupt_handler
;
...
...
@@ -76,16 +86,28 @@ void rt_hw_interrupt_umask(int vector)
/**
* This function will install a interrupt service routine to a interrupt.
* @param vector the interrupt number
* @param new_handler the interrupt service routine to be installed
* @param old_handler the old interrupt service routine
* @param handler the interrupt service routine to be installed
* @param param the parameter for interrupt service routine
* @name unused.
*
* @return the 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
(
old_handler
!=
RT_NULL
)
*
old_handler
=
(
rt_isr_handler_t
)
AT91C_BASE_AIC
->
AIC_SVR
[
vector
];
if
(
new_handler
!=
RT_NULL
)
AT91C_BASE_AIC
->
AIC_SVR
[
vector
]
=
(
rt_uint32_t
)
new_handler
;
old_handler
=
irq_desc
[
vector
].
handler
;
if
(
handler
!=
RT_NULL
)
{
irq_desc
[
vector
].
handler
=
(
rt_isr_handler_t
)
handler
;
irq_desc
[
vector
].
param
=
param
;
}
}
return
old_handler
;
}
/*@}*/
libcpu/arm/AT91SAM7X/trap.c
浏览文件 @
608074de
...
...
@@ -24,9 +24,14 @@
void
rt_hw_trap_irq
()
{
rt_isr_handler_t
hander
=
(
rt_isr_handler_t
)
AT91C_BASE_AIC
->
AIC_IVR
;
int
irqno
;
extern
struct
rt_irq_desc
irq_desc
[];
hander
(
AT91C_BASE_AIC
->
AIC_ISR
);
/* get interrupt number */
irqno
=
AT91C_BASE_AIC
->
AIC_ISR
;
/* invoke isr with parameters */
irq_desc
[
irqno
].
handler
(
irqno
,
irq_desc
[
irqno
].
param
);
/* end of interrupt */
AT91C_BASE_AIC
->
AIC_EOICR
=
0
;
...
...
libcpu/arm/lpc24xx/interrupt.c
浏览文件 @
608074de
...
...
@@ -12,24 +12,25 @@
* 2008-12-11 XuXinming first version
*/
#include <rt
thread
.h>
#include <rt
hw
.h>
#include "LPC24xx.h"
#define MAX_HANDLERS 32
/* exception and interrupt handler table */
struct
rt_irq_desc
irq_desc
[
MAX_HANDLERS
];
extern
rt_uint32_t
rt_interrupt_nest
;
/* exception and interrupt handler table */
rt_uint32_t
rt_interrupt_from_thread
,
rt_interrupt_to_thread
;
rt_uint32_t
rt_thread_switch_interrupt_flag
;
/**
* @addtogroup LPC2478
*/
/*@{*/
void
rt_hw_interrupt_handle
(
int
vector
)
void
rt_hw_interrupt_handler
(
int
vector
,
void
*
param
)
{
rt_kprintf
(
"Unhandled interrupt %d occured!!!
\n
"
,
vector
);
}
...
...
@@ -45,11 +46,15 @@ void rt_hw_interrupt_init()
VICVectAddr
=
0
;
VICIntSelect
=
0
;
for
(
i
=
0
;
i
<
32
;
i
++
)
/* init exceptions table */
for
(
i
=
0
;
i
<
MAX_HANDLERS
;
i
++
)
{
vect_addr
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x100
+
i
*
4
);
vect_cntl
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x200
+
i
*
4
);
*
vect_addr
=
0x0
;
irq_desc
[
i
].
handler
=
(
rt_isr_handler_t
)
rt_hw_interrupt_handler
;
irq_desc
[
i
].
param
=
RT_NULL
;
vect_addr
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x100
+
i
*
4
);
vect_cntl
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x200
+
i
*
4
);
*
vect_addr
=
(
rt_uint32_t
)
&
irq_desc
[
i
];
*
vect_cntl
=
0xF
;
}
...
...
@@ -70,20 +75,31 @@ void rt_hw_interrupt_umask(int vector)
VICIntEnable
=
(
1
<<
vector
);
}
void
rt_hw_interrupt_install
(
int
vector
,
rt_isr_handler_t
new_handler
,
rt_isr_handler_t
*
old_handler
)
/**
* This function will install a interrupt service routine to a interrupt.
* @param vector the interrupt number
* @param handler the interrupt service routine to be installed
* @param param the parameter for interrupt service routine
* @name unused.
*
* @return the old handler
*/
rt_isr_handler_t
rt_hw_interrupt_install
(
int
vector
,
rt_isr_handler_t
handler
,
void
*
param
,
char
*
name
)
{
rt_uint32_t
*
vect_addr
;
if
(
vector
<
MAX_HANDLERS
)
{
/* find first un-assigned VIC address for the handler */
vect_addr
=
(
rt_uint32_t
*
)(
VIC_BASE_ADDR
+
0x100
+
vector
*
4
);
rt_isr_handler_t
old_handler
=
RT_NULL
;
/* get old handler */
if
(
old_handler
!=
RT_NULL
)
*
old_handler
=
(
rt_isr_handler_t
)
*
vect_addr
;
*
vect_addr
=
(
rt_uint32_t
)
new_handler
;
/* set interrupt vector */
if
(
vector
>=
0
&&
vector
<
MAX_HANDLERS
)
{
old_handler
=
irq_desc
[
vector
].
handler
;
if
(
handler
!=
RT_NULL
)
{
irq_desc
[
vector
].
handler
=
(
rt_isr_handler_t
)
handler
;
irq_desc
[
vector
].
param
=
param
;
}
}
return
old_handler
;
}
/*@}*/
libcpu/arm/lpc24xx/trap.c
浏览文件 @
608074de
...
...
@@ -128,12 +128,15 @@ void rt_hw_trap_resv(struct rt_hw_register *regs)
extern
rt_isr_handler_t
isr_table
[];
void
rt_hw_trap_irq
()
{
rt_isr_handler_t
isr_func
;
isr_func
=
(
rt_isr_handler_t
)
VICVectAddr
;
int
irqno
;
struct
rt_irq_desc
*
irq
;
extern
struct
rt_irq_desc
irq_desc
[]
;
/* fixme, how to get interrupt number */
isr_func
(
0
);
irq
=
(
struct
rt_irq_desc
*
)
VICVectAddr
;
irqno
=
((
rt_uint32_t
)
irq
-
(
rt_uint32_t
)
&
irq_desc
[
0
])
/
sizeof
(
struct
rt_irq_desc
);
/* invoke isr */
irq
->
handler
(
irqno
,
irq
->
param
);
}
void
rt_hw_trap_fiq
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录