tiny6410 驅動程式 定時器

2021-06-10 23:45:22 字數 1022 閱讀 3663

drv_timer.c

/*

* driver timer test

*/ #include #include #include #include static struct timer_list my_timer;

static void timer_func(unsigned long data)

my_timer.expires = jiffies + hz*3;

my_timer.function = timer_func;

my_timer.data = count;

/* add and start timer*/

add_timer(&my_timer);

}static int drv_timer_init(void)

static void drv_timer_exit(void)

module_init(drv_timer_init);

module_exit(drv_timer_exit);

module_license("gpl");

module_description("timer test");

makefile

kerneldir = /sdb/kernel/linux-2.6.38-tiny6410/linux-2.6.38/

pwd := $(shell pwd)

modules:

$(make) -c $(kerneldir) m=$(pwd) modules

clean:

rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions

.phony: modules clean

obj-m := drv_timer.o

結果

基於Tiny6410的LED驅動程式

從電路圖中看出,gpio低電平有效 led亮 gpk共有16個埠,每個埠由三個暫存器控制 控制暫存器 gpkcon 資料暫存器 gpkdat 和上拉暫存器 gpkpud 每個暫存器都是32位,如下圖所示。gpk的控制暫存器分為兩個,gpkcon0控制0 8好埠,gpkcon1控制9 15號埠。控制暫...

tiny6410 按鍵中斷驅動 poll機制

驅動程式key drv int.c include include include include include include include include include include include include include include include include incl...

tiny6410溫度感測器驅動學習1(測試通過)

參考的驅動 如下 include include include include include include include include include define device name temp 裝置名字 static struct cdev cdev struct class tem...