Timer in Linux Device Driver
来源:互联网 发布:java进销存管理系统 编辑:程序博客网 时间:2024/05/16 18:50
Timer in Linux Device Driver
Recently, I am debugging the Audio driver on Atmel AT91SAM9M10 with Linux-2.6.30 kernel version. The detail information as following.
Hardware: AT91SAM9M10, TLV320AIC3100, interface between them: Atmel SSC (I2S)
Software: Linux 2.6.30
Objective: using software to implement the exchange between headset and speaker
As the hardware design, there is no interrupt line can be connect to CPU, so using polling method to solve it. Then, the linux timer (define in include/linux/time.h) is be used.
The following is the example code:
++++++++++++++++++++++++++++
struct timer_list mytimer;
init_timer(&mytimer);
mytimer.expires = jiffies + HZ/1000; // jiffies define in include/linux/jiffies.h
mytimer.data = (unsigned long) codec;
mytimer.function = headset_det_task;
add_timer(&mytimer);
++++++++++++++++++++++++++++
The "headset_det_task" function as following
++++++++++++++++++++++++++++
int headset_det_task(unsigned long data)
{
... ...
mod_timer(&mytimer, jiffies + HZ); /* re-open the timer */
}
++++++++++++++++++++++++++++
In my mind, this function also can be implemented by kernel thread function. So this need to be go study.
TODO:
- Timer in Linux Device Driver
- NAPI In Linux Network Device Driver
- Linux Device Driver: char device
- How to use IO BAR in linux PCIe device driver
- linux device driver
- Linux device driver
- Linux device driver
- Linux Device Driver
- Linux Device Driver Summarization
- Linux device driver
- linux device driver
- linux device driver Makfile
- Linux Device Driver ---USB
- Linux Audio Device Driver
- linux bus driver device
- Linux I2C device driver
- Linux Audio Device Driver
- Writing a Linux device driver
- ASP.NET验证码攻略,支持中文,字母,数字C#
- int 与Int32
- WinCE获取Wifi的设备名、连接状态和信号强度
- 数据库水平切分的实现原理解析---分库,分表,主从,集群,负载均衡器
- android bitmap翻转180,镜像的简单实现方法
- Timer in Linux Device Driver
- 矩阵的乘法是函数的合成
- Android游戏开发之旅六 自定义View
- 2011 3-15 读http://dreamhead.blogbus.com/ 有感
- C++ explicit关键字应用于构造函数
- u-boot-2010-06在mini2440上的移植(二)
- 解析url
- Android GSM驱动模块详细分析
- ImageMagick 在windows下的安装