reboot的底層實現

來源:互聯網
上載者:User
如果沒有實現底層reboot支援,輸入reboot命令不能重啟系統,或者會引起系統出錯。 需要實現體繫結構的arch_reset(char mode)函數。 檔案:arch/arm/mach-lpc32xx/include/mach/system.h
 1 static inline void arch_reset(char mode) 2 { 3 // cpu_reset(0); 4     extern void lpc32xx_watchdog_reset(void); 5  6     switch (mode) { 7     case 's': 8     case 'h': 9         printk(KERN_CRIT "RESET: Rebooting system\n");10         /* Disable interrupts */11         local_irq_disable();12         lpc32xx_watchdog_reset();13         break;14 15     default:16         /* Do nothing */17         break;18     }19 20     /* Wait for watchdog to reset system */21     while (1)22         ;23 }
可以看到,是通過看門狗實現系統複位的,所以必須實現看門狗的操作。 檔案: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命令而不會出錯了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.