s3c2410 一直触发外部中断5,不知怎么回事?
时间:10-02
整理:3721RD
点击:
我调试s3c2410外部中断5,使用的是博创UP-NETARM2410-S实验箱,不知怎么回事中断一直被触发?读回 SRSPEND 和 INTPND 的值始终为0,而EINTPEND 为0x20,盼帮助解答啊!谢谢。能否给个外部中断5的例子程序。
我的程序:
static void TS_OPEN_INT5(void)
{设置中断
unsigned long temp;
temp=__raw_readl(vGPFCON); //EINT5
temp&=0xf3ff;
temp|=0x800;
__raw_writel(temp,vGPFCON);
temp=__raw_readl(vGPFUP); //上拉
temp&=0xdf;
__raw_writel(temp,vGPFUP);
temp=__raw_readl(vSRCPND);
temp&=0x00000000;
temp |=0x10;
__raw_writel(temp,vSRCPND);
temp=__raw_readl(vINTMSK);
temp &=0xffffffef;
__raw_writel(temp,vINTMSK);
temp=__raw_readl(vINTPND);
__raw_writel(temp,vINTPND);
temp=__raw_readl(vEINTPEND);
temp&=0x000000;
temp |=0x20;
__raw_writel(temp,vEINTPEND);
temp=__raw_readl(vEINTMASK);
temp &=0xffffdf;
__raw_writel(temp,vEINTMASK);
temp=__raw_readl(vEXTINT0);
temp &=0x7f8fffff; //低电平
// temp |=0x1fffff; //高电平
__raw_writel(temp,vEXTINT0);
}
static void TS_CLOSE_INT5(void)
{//清除中断标志
unsigned long temp;
temp=__raw_readl(vSRCPND);
temp&=0x00000000;
temp |=0x10;
__raw_writel(temp,vSRCPND);
temp=__raw_readl(vINTPND);
__raw_writel(temp,vINTPND);
}
static irqreturn_t s3c2410_isr_tc(int irq, void *dev_id)
{//中断服务程序
unsigned int temp;
temp=__raw_readl(vSRCPND);
printk("SRCPND =%x\n",temp);
temp=__raw_readl(vINTPND);
printk("INTPND =%x\n",temp);
temp=__raw_readl(vEINTPEND);
printk("EINTPEND =%x\n",temp);
printk("Occured Touch Screen Interrupt\n");
TS_CLOSE_INT5();
// TS_OPEN_INT5();
return IRQ_RETVAL(1);
}
我的程序:
static void TS_OPEN_INT5(void)
{设置中断
unsigned long temp;
temp=__raw_readl(vGPFCON); //EINT5
temp&=0xf3ff;
temp|=0x800;
__raw_writel(temp,vGPFCON);
temp=__raw_readl(vGPFUP); //上拉
temp&=0xdf;
__raw_writel(temp,vGPFUP);
temp=__raw_readl(vSRCPND);
temp&=0x00000000;
temp |=0x10;
__raw_writel(temp,vSRCPND);
temp=__raw_readl(vINTMSK);
temp &=0xffffffef;
__raw_writel(temp,vINTMSK);
temp=__raw_readl(vINTPND);
__raw_writel(temp,vINTPND);
temp=__raw_readl(vEINTPEND);
temp&=0x000000;
temp |=0x20;
__raw_writel(temp,vEINTPEND);
temp=__raw_readl(vEINTMASK);
temp &=0xffffdf;
__raw_writel(temp,vEINTMASK);
temp=__raw_readl(vEXTINT0);
temp &=0x7f8fffff; //低电平
// temp |=0x1fffff; //高电平
__raw_writel(temp,vEXTINT0);
}
static void TS_CLOSE_INT5(void)
{//清除中断标志
unsigned long temp;
temp=__raw_readl(vSRCPND);
temp&=0x00000000;
temp |=0x10;
__raw_writel(temp,vSRCPND);
temp=__raw_readl(vINTPND);
__raw_writel(temp,vINTPND);
}
static irqreturn_t s3c2410_isr_tc(int irq, void *dev_id)
{//中断服务程序
unsigned int temp;
temp=__raw_readl(vSRCPND);
printk("SRCPND =%x\n",temp);
temp=__raw_readl(vINTPND);
printk("INTPND =%x\n",temp);
temp=__raw_readl(vEINTPEND);
printk("EINTPEND =%x\n",temp);
printk("Occured Touch Screen Interrupt\n");
TS_CLOSE_INT5();
// TS_OPEN_INT5();
return IRQ_RETVAL(1);
}