|
发表于 2010-10-20 18:11:33
|
显示全部楼层
回复 5# Matrix_Designer 的帖子
这个也和内核的代码有关系。不是说你设置手册上的合理的硬件时钟值,内核就可以运行。内核会对时钟的值有些判断, 代码如下[ arch/arm/mach-s3c2410/time.c ]:
190 clk = clk_get(NULL, "timers");
191 if (IS_ERR(clk))
192 panic("failed to get clock for system timer");
193
194 clk_use(clk);
195 clk_enable(clk);
196
197 pclk = clk_get_rate(clk);
198
199 /* configure clock tick */
200
201 timer_usec_ticks = timer_mask_usec_ticks(6, pclk);
202
203 tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
204 tcfg1 |= S3C2410_TCFG1_MUX4_DIV2;
205
206 tcfg0 &= ~S3C2410_TCFG_PRESCALER1_MASK;
207 tcfg0 |= ((6 - 1) / 2) << S3C2410_TCFG_PRESCALER1_SHIFT;
208
209 tcnt = (pclk / 6) / HZ;
210 }
211
212 /* timers reload after counting zero, so reduce the count by 1 */
213
214 tcnt--;
215
216 printk("timer tcon=%08lx, tcnt %04lx, tcfg %08lx,%08lx, usec %08lx\n",
217 tcon, tcnt, tcfg0, tcfg1, timer_usec_ticks);
218
219 /* check to see if timer is within 16bit range... */
220 if (tcnt > 0xffff) {
221 panic("setup_timer: HZ is too small, cannot configure timer!");
222 return;
223 } |
|