2010-03-30 22:14:32 a problem about the timer interrupt
zhang zhihua (CHINA)
Message: 87875
Hi,
我想用定时器timer0来做一个定时器中断,对定时器做了如下配置:
#define TIMEOUT_PERIOD 0x00002000
*pTIMER0_CONFIG |= 0xFD51;//即配置TMODE:01,PULSH_HI:0 ,PERIOD_CNT:0 IRQ_ENA:1 ,TIN_SEL:0 ,
OUT_DIS:0, CLK_SEL:0,TOGGLE:1,EMU_RUN:0
*pTIMER0_PERIOD = TIMEOUT_PERIOD;
*pTIMER0_WIDTH = TIMEOUT_PERIOD/2;
*pTIMER_ENABLE |= 0x0001; //enable the timer0
并且申请了一个中断号为IVG12的中断,如下:
*pSIC_IMASK1 |= 0x00000001; //开启time0
*pSIC_IAR4 |= 0x00000005; //配置time0 到中断IVG12
ret = request_irq (IVG12,my_task3,IRQF_TIMER,TEST_DEVICE_NAME,NULL);
中断处理函数如下:
static irqreturn_t my_task3(int irq,void *dev_id)
{
*pTIMER_STATUS |= 0x00000001; //清除标志位
*pTIMER0_PERIOD = TIMEOUT_PERIOD; //重新装定时器值
*pTIMER0_WIDTH = TIMEOUT_PERIOD/2;
printk("This is the irq_task3!\n");
*pTIMER0_ENABLE |= 0x0001; //重新开启定时器
return IRQ_HANDLED;
}
但是为什么就进入不了我的中断处理函数呢?是我的定时器配置有问题还是申请中断的方法不对呢?谢谢... ...
TranslateQuoteReplyEditDelete
2010-03-30 22:21:24 Re: a problem about the timer interrupt
Mike Frysinger (UNITED STATES)
Message: 87876
you've been told multiple times to not program MMRs directly. if you do, you're completely on your own.
QuoteReplyEditDelete
2010-03-31 13:50:49 Re: a problem about the timer interrupt
Robin Getz (UNITED STATES)
Message: 87930
Zhang:
Are you trying to do this inside Linux? or on a bare metal application?
-Robin
QuoteReplyEditDelete
2010-03-31 21:42:54 Re: a problem about the timer interrupt
zhang zhihua (CHINA)
Message: 87943
Hi,Robin:
I want to do this inside Linux,I add a new driver to the linux for the ST16C2552,so I want to request a timer interrupt for the send data function!But maybe there have some error at set the timer register,I can't enter the interrupt function!
TranslateQuoteReplyEditDelete
2010-04-01 00:49:08 Re: a problem about the timer interrupt
Sonic Zhang (CHINA)
Message: 87948
Use kernel High Resolution timer API other than use a hardware timer directly in your driver.
QuoteReplyEditDelete
2010-04-01 06:28:14 Re: a problem about the timer interrupt
Yi Li (CHINA)
Message: 87979
zhihua,
According to your description, using Linux kernel API like add_timer() should ie OK.
-YI
QuoteReplyEditDelete
2010-04-02 03:23:57 Re: a problem about the timer interrupt
zhang zhihua (CHINA)
Message: 88020
Thanks!