标题:定时器中断问题
作者:0354030w
日期:2010-05-22 17:17
内容:
S3C2440步进电机驱动中用定时器0实现1ms延时,现在延时可以实现,输出波形也比较满意,但是问题是定时器中断过大概40m就停止了
超级终端上提示:Disabling IRQ #26 禁止了定时器中断,不知掉怎么回事?纠结蛋疼中!!!!!!!
程序如下
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define DEVICE_NAME "mytimer"
#define CB_MAJOR 250
MODULE_AUTHOR("0354030w");
MODULE_DESCRIPTION("S3C2440 MOTO Driver");
MODULE_LICENSE("GPL");
/*
#define TCON=(*(volatile unsigned int *)0x51000008)
#define TCNTB0=(*(volatile unsigned int *)0x5100000c)
#define TCMPB0=(*(volatile unsigned int *)0x51000010)
#define MPLLCON=(*(volatile unsigned int *)0x4C000004)
#define CLKDIVN= (*(volatile unsigned int *)0x4C000014)
*/
static bool found=0;
static unsigned char m_step[8]={0xef,0xef,0xdf,0xdf,0xbf,0xbf,0x7f,0x7f};
static unsigned int flag=0;
static int flag_1=7;
static unsigned long arg_1,GPFCON,GPFDAT;
static unsigned int cmd_1;
static unsigned long tmp;
void initial_timer(void)
{
printk("time init is on!");
unsigned long Ftclk; //s3c2440a的默认Fpclk为50MHz
&nb ..
#1 [conciser 06-01 17:24]
static irqreturn_t timer_interrupt(void)
{
printk("Timer0 interrupt occured!\n");
return IRQ_HANDLED;
}
最后一行要返回return IRQ_HANDLED;
#2 [0354030w 06-05 00:32]
呵呵,就是没写返回值,感谢沙发!