Embededlinux中的节拍驱动

 平台:imx6、3.0.35

节拍驱动:

2.6.21以前内核基于节拍设计,SoC将     linux   移植到芯片上时,会找一个     定时器   ,每个     时钟   节拍时间到会调用     ti   mer_  TI ck函数,引发系统行为

2.6.21以后内核基于无节拍设计,支持高精度定时器,内核配置会使能NO_HZ和HIGH_RES_  TI ME     RS  

无节拍含义:节拍不以周期性产生,而是根据系统运行的情况,以事件驱动动态确定节拍产生时间。

/arch/     arm   /plat-mxc/  TI me.c

void __init mxc_  TI mer_init(struct clk *timer_clk, void __iomem *base, int irq)

->static int __init mxc_clockevent_init(struct clk *timer_clk)

->设置clockevent_mxc

-> static struct clock_event_device clockevent_mxc = {

.name = "mxc_timer1",
.features = CLOCK_EVT_FEAT_ONESHOT,
.shift = 32,
.set_mode = mxc_set_mode,
.set_next_event = mx1_2_set_next_event,
.rating = 200,
};

->static void mxc_set_mode(enum clock_event_mode mode,struct clock_event_device *evt)

//设置定时器的模式以及恢复、关闭等功能,目前采用ONESHOT模式,即一次一次产生终端。

->static int mx1_2_set_next_event(unsigned long evt,

struct clock_event_device *unused)

//evt为linux内核传递给底层定时器的一个差值,是下一次节拍终端产生的硬件定时器中计数器的值相对于当前计数器的差值。将硬件定时器设置为在当前计数器计数值+evt的时刻产生下一次节拍中断。

-> static struct irqaction mxc_timer_irq = {

.name = "i.MX Timer Tick",
.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
.handler = mxc_timer_in     te   rrupt,
};

->static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id)

->evt->event_handler(evt);

//直接调用clock_event_device的event_handler,具体工作也是linux内核根据linux内核配置和运行情况自行设置。



Embededlinux中的节拍驱动_设计制作_模拟技术
37
185
0
82

相关资讯

  1. 1、逆天奇案PK伙计办大事:同是刑侦剧,破案一个靠分析,一个靠脑补4902
  2. 2、《蚁人2》:《复联3》蚁人失踪之谜终于要揭晓了?2865
  3. 3、《先遣连》央一将播演绎最悲壮“士兵突击”1083
  4. 4、《猎鹰与冬兵》新任美队为何不被认可,约翰·沃克真的做错了吗?2969
  5. 5、思必驰加入AI造芯大潮:明知山有虎偏向虎山行?4759
  6. 6、李少红玩砸了?《大宋宫词》片头引争议,观众表示眼晕79
  7. 7、宋喆因职务侵占被判6年,律师晒与王宝强合影,配图:乐开花5057
  8. 8、ips面板的优点有哪些?823
  9. 9、你知道Linux的共享内存与tmpfs文件系统是什么样?2476
  10. 10、研究人员利用卫星来降低人口普查的难度585
全部评论(0)
我也有话说
0
收藏
点赞
顶部