timeout.c

来自「linux2.6驱动模块」· C语言 代码 · 共 57 行

C
57
字号
#include <asm/irq.h>#include "../inc/inc.h"extern MANAGER *Mg_p;void Liid_timer_del(unsigned long data){    printk("deleting the timer\r\n");    del_timer(&Mg_p->Liid_timer_list);}void Liid_timer_alarm(unsigned long data){    struct timeval tv1;    static int time = 0;    int tmp;    Mg_p->Liid_timer_list.expires = jiffies + (10*HZ / 4);    time ++;        if((time % 10) > 4){        *Mg_p->led = ~((1 << (5 - (time%5)))<<4);    }else{        *Mg_p->led = ~((1 << (time%5))<<4);    }    printk("%#x ", time);    //*Mg_p->led = ~((1 << (time%4))<<4);    //memset(Mg_p->video.base_addr, 0xcc, 1*1024*1000);    //writeb(time, Mg_p->video.base_addr + time);    for(tmp = 0; tmp < 1*1024*1000; tmp ++){        *(char *)(Mg_p->video.base_addr + tmp) = jiffies + tmp;        mb();            }    //*(char *)(Mg_p->video.base_addr + time) = time;    del_timer(&Mg_p->Liid_timer_list);    add_timer(&Mg_p->Liid_timer_list);    if(time > 0xf){        Liid_timer_del(0);    }}void Liid_timer_init(unsigned long data){    struct timeval tv1;    static int time;    init_timer(&Mg_p->Liid_timer_list);    Mg_p->Liid_timer_list.expires = jiffies + (2*HZ);    Mg_p->Liid_timer_list.function = Liid_timer_alarm;    printk("begin %x ", time ++);    del_timer(&Mg_p->Liid_timer_list);    add_timer(&Mg_p->Liid_timer_list);}#define	LED4_OFF( ) __raw_writel(__raw_readl(S3C2410_GPFDAT) | 0x80, S3C2410_GPFDAT)		

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?