Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1227438
  • 博文数量: 479
  • 博客积分: 12240
  • 博客等级: 上将
  • 技术积分: 4999
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-24 17:12
文章分类

全部博文(479)

文章存档

2014年(1)

2013年(1)

2012年(1)

2011年(95)

2010年(177)

2009年(167)

2008年(16)

2007年(21)

分类: LINUX

2010-11-03 10:13:09


如果没有实现底层reboot支持,输入reboot命令不能重启系统,或者会引起系统出错。

需要实现体系结构的arch_reset(char mode)函数。

文件:arch/arm/mach-lpc32xx/include/mach/system.h

static inline void arch_reset(char mode)
{
// cpu_reset(0);
    extern void lpc32xx_watchdog_reset(void);

    switch (mode) {
    case 's':
    case 'h':
        printk(KERN_CRIT "RESET: Rebooting system\n");
        /* Disable interrupts */
        local_irq_disable();
        lpc32xx_watchdog_reset();
        break;

    default:
        /* Do nothing */
        break;
    }

    /* Wait for watchdog to reset system */
    while (1)
        ;
}


可以看到,是通过看门狗实现系统复位的,所以必须实现看门狗的操作。

文件:arch/arm/mach-lpc32xx/arch-lpc32xx.c

/*
 * System reset via the watchdog timer
 */

void lpc32xx_watchdog_reset(void)
{
    /* Make sure WDT clocks are enabled */
    __raw_writel(CLKPWR_PWMCLK_WDOG_EN,
            CLKPWR_TIMER_CLK_CTRL(CLKPWR_IOBASE));

    /* Instant assert of RESETOUT_N with pulse length 1mS */
    __raw_writel(13000, io_p2v(WDTIM_BASE + 0x18));
    __raw_writel(0x70, io_p2v(WDTIM_BASE + 0xC));
}


这样的内核就能使用reboot命令而不会出错了。


阅读(2002) | 评论(1) | 转发(3) |
给主人留下些什么吧!~~

chinaunix网友2010-11-03 16:14:46

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com