Embedded 版 (精华区)
发信人: snows (花自飘零水自流), 信区: Embedded
标 题: The time_init() Function
发信站: 哈工大紫丁香 (2004年03月16日13:21:10 星期二), 站内信件
The time_init() Function
Time_init() is usually located in arch/<host>/kernel/time.c.
The time_init() function initializes the host's system tick timer hardware. It
installs the timer's interrupt handler, and configures the timer to produce a
periodic tick. The tick interrupt handler is usually called
do_timer_interrupt().
A portion of the Hitachi SH version of time_init() is shown in Figure 7. The
timer interrupt handler timer_interrupt() (which calls do_timer_interrupt())
is installed, then after determining the proper clock frequency (not shown),
the code starts the chip's TMU0 periodic timer.
static struct irqaction irq0 = {timer_interrupt, SA_INTERRUPT, 0,
"timer", NULL, NULL};
void __init time_init(void)
{
unsigned long interval;
...
setup_irq(TIMER_IRQ, &irq0);
...
interval = (module_clock/4 + HZ/2) / HZ;
printk("Interval = %ld\n", interval);
...
/* Start TMU0 */
ctrl_outb(0, TMU_TSTR);
ctrl_outb(TMU_TOCR_INIT, TMU_TOCR);
ctrl_outw(TMU0_TCR_INIT, TMU0_TCR);
ctrl_outl(interval, TMU0_TCOR);
ctrl_outl(interval, TMU0_TCNT);
ctrl_outb(TMU_TSTR_INIT, TMU_TSTR);
}
Figure 7. An excerpt from the Hitachi SH's time_init() function.
--
-
╭────────────────────────────╮
│ 风萧传瑟声,叶落根深处,青阶入野无归途,他乡不知顾 │
│ 泣下问和谁,叹者行已暮,寒眉傲骨今尚在,奈何入凡土 │
╰────────────────────────────╯
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.229.154]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:4.543毫秒