100s,硬件定时器配置好寄存器后,一直不产生中断,这是什么原因,大家帮忙看看,非常感谢1
-
100s芯片内置的硬件定时器,配置了相关寄存器后,一直不触发中断,是哪里的问题,各位大佬帮忙看看,下面是部分驱动代码:
static irqreturn_t timer_handler(int irq, void *dev_id) { printk("%s %d %s\n",__FILE__,__LINE__,__FUNCTION__); writel(readl(TIMER_IRQ_ST_Register)|(1<<1), TIMER_IRQ_ST_Register);//清pending return IRQ_HANDLED; } static ssize_t hw_timer_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos) { int val; copy_from_user(&val, buf, count); // copy_to_user(); writel(val, TIMER1_INTVAL_Rigster);//12000为定时1ms // printk("%x\n",readl(TIMER0_INTVAL_Rigster)); // printk("%x\n",readl(TIMER0_CNTVAL_Rigster)); /*24M,Single mode,2 precale*/ writel(0x94, TIMER1_CTRL_Rister); writel(readl(TIMER1_CTRL_Rister)|(1<<1), TIMER1_CTRL_Rister); while((readl(TIMER1_CTRL_Rister)>>1)&1); writel(readl(TIMER1_CTRL_Rister)|(1<<0), TIMER1_CTRL_Rister);//使能定时器 } static struct file_operations hw_timer_fops = { .owner = THIS_MODULE, /* 这是一个宏,推向编译模块时自动创建的__this_module变量 */ .open = hw_timer_open, .write = hw_timer_write, .read = hw_timer_read, }; int major; int init_timer_module(void) { int ret; major = register_chrdev(0, "hw_timer", &hw_timer_fops); hwtimerdrv_cls = class_create(THIS_MODULE, "hw_timer"); hwtimercls_device = device_create(hwtimerdrv_cls, NULL, MKDEV(major, 0), NULL, "timer0"); /* /dev/buttons */ TIMER_IRQ_EN_Register = (volatile unsigned long *)ioremap(TIMER_BASE+TIMER_IRQ_EN_REG,4); TIMER_IRQ_ST_Register = (volatile unsigned long *)ioremap(TIMER_BASE+TIMER_IRQ_ST_REG,4); TIMER1_CTRL_Rister = (volatile unsigned long *)ioremap(TIMER_BASE+TIMER_CTL_REG(1),4); TIMER1_INTVAL_Rigster = (volatile unsigned long *)ioremap(TIMER_BASE+TIMER_INTVAL_REG(1),4); TIMER1_CNTVAL_Rigster = (volatile unsigned long *)ioremap(TIMER_BASE+TIMER_CNTVAL_REG(1),4); // writel(1200000, TIMER0_INTVAL_Rigster);// writel(readl(TIMER_IRQ_EN_Register)|(1<<1), TIMER_IRQ_EN_Register);//使能定时器1中断 /*申请中断*/ if (request_irq(14, (irq_handler_t )timer_handler, 0,"sunxi_timer1", NULL)) { printk("irq request failure\n"); return -1; } return 0; }
-
现在使能了INTC_EN_REG0寄存器,现在中断有响应,但是提醒没有中断处理函数,这是什么原因?
writel(readl(INTC_EN_REG0)|(1<<14), INTC_EN_REG0);
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号