当前位置:首页 > 嵌入式 > 嵌入式软件
[导读]#include#include#include#include#include#include#include #include #include #includestatic struct delayed_work my_work;//static int watercount=0;volatile unsigne

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

static struct delayed_work my_work;

//static int watercount=0;

volatile unsigned long *gph0con = NULL;

volatile unsigned long *gph0dat = NULL;

static void waterfun(void)

{

static int watercount=0;

*gph0dat = 0x1 << ((watercount++)%4);//流水灯

//printk("waterfun:watercount:%d\n",watercount);

schedule_delayed_work(&my_work,msecs_to_jiffies(1000));

}

static int __init waterinit(void)

{

int ret;

gph0con = (volatile unsigned long *)ioremap(0xE0200c00, 16);

gph0dat = gph0con + 1;

*gph0con |=0x1111 ;

*gph0con &=~0xf;

INIT_DELAYED_WORK(&my_work,waterfun);

ret = schedule_delayed_work(&my_work,msecs_to_jiffies(1000));

printk("water init:ret:%d\n",ret);

return 0;

}

static void __exit waterexit(void)

{

cancel_delayed_work(&my_work);

//destroy_wor(my_work);

//_work(&my_work);

iounmap(gph0con);

}

module_init(waterinit);

module_exit(waterexit);

MODULE_LICENSE("GPL");

本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除( 邮箱:macysun@21ic.com )。
换一批
延伸阅读
关闭