这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » uClinux 下time1中断

共1条 1/1 1 跳转至

uClinux 下time1中断

菜鸟
2006-09-04 18:34:38     打赏

cpu为s3c44b0x ,应用Time1定时器中断,

代码如下:

申请与设置中断

static int EVOC_iccard_open(struct inode *inode, struct file *file) {
// int err;
//int i;
//unsigned char b;
int err;
__u32 rw_tmp;
unsigned long flag;
u_int32_t tmod;
if(iccard_device_open) return -EBUSY;
// 判断是否插有卡,如果没有,返回错误。
//if (!UserCardFlag) return NOCARD;

err=request_irq(S3C44B0X_INTERRUPT_TIMER1,etu_irq_handle,0,"my"DEVICE_NAME,NULL);
if(err) return err;
else printk("IRQ %d\n",S3C44B0X_INTERRUPT_TIMER1);
local_irq_save(flag);

tmod=0;
tmod |= S3C44B0X_TCON_T1_MAN_UPDATE;
outl(tmod, S3C44B0X_TCON);

rw_tmp = inl(S3C44B0X_TCFG0);
rw_tmp &= ~0xff;
rw_tmp |= 0x01;
outl(rw_tmp, S3C44B0X_TCFG0); // prescaler = 1/16
rw_tmp = inl(S3C44B0X_TCFG1);
rw_tmp &= ~(0xf<<4);
rw_tmp |= 0<<4;
outl(rw_tmp, S3C44B0X_TCFG1); // mux = 1/2

s3c44b0x_unmask_irq(S3C44B0X_INTERRUPT_TIMER1);

local_irq_restore(flag);

MOD_INC_USE_COUNT;
//setup_timer (etu_time_all);
/* And my own counter too */
iccard_device_open++;
//SAM CARD 复位
//EVOC_iccard_reset( EVOCiccardfifo.buffer, &EVOCiccardfifo.len, SAMCARD);
//判断复位是否成功

//USER CARD 复位
//EVOC_iccard_reset( EVOCiccardfifo.buffer, &EVOCiccardfifo.len, SAMCARD);
//判断复位是否成功
// if (err<0) printk("open err\n");
printk("input EVOC_open 2\n");
#ifdef DEBUG_ICCARD
printk("iccard open\n");
#endif
//for (i=0; i<5; i++)
{
CardTest(CPU_CARD);

}
//CardTest(SAM_CARD);
//TimeTest();
return 0; /* open succeed */
}

打开与关闭中断

u_int32_t tmod;
time_flag = 0;
tmod=0;
outl(etu_time_half,S3C44B0X_TCNTB0);

tmod |= S3C44B0X_TCON_T1_MAN_UPDATE;
tmod |= S3C44B0X_TCON_T1_START;
outl(tmod, S3C44B0X_TCON);
outl(0x00,S3C44B0X_INTCON);

printk("input Delayall\n");
while(time_flag==0);

time_flag=0;

tmod=0;
tmod |= S3C44B0X_TCON_T1_MAN_UPDATE;
tmod &= ~S3C44B0X_TCON_T1_START;
outl(tmod, S3C44B0X_TCON);
s3c44b0x_mask_irq(S3C44B0X_INTERRUPT_TIMER1);
printk("output Delayall\n");

中断程序:

void etu_irq_handle(int irq ,void *dev_id,struct pt_regs *regs)
{
time_flag=1;
printk("time_flag=%d\n",time_flag);
outl(0X1000,S3C44B0X_I_ISPC);
}

执行后出现:

Bad mode in data abort handler detected: mode IRQ_32

Vectors:

Stubs:

Internal error: Oops: 0

CPU: 0

pc : [<00000064>] lr : [<0c0259fc>] Not tainted

sp : 0c337934 ip : 0c33790c fp : 0c337990

r10: 0c7a5ac4 r9 : 00000005 r8 : 0c1ae524

r7 : ffffffff r6 : 60000092 r5 : 0c3379a8 r4 : 0c336000

r3 : 60000013 r2 : 00000001 r1 : 00000001 r0 : 0000000b

Flags: nZCv IRQs off FIQs on Mode IRQ_32 Segment user

Control: 0

请问怎么回事,请高手指点一下,兄弟是新手!!




关键词: uClinux     time1     中断     S3C44B0X    

共1条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]