zoukankan      html  css  js  c++  java
  • 复位操作

    /*
    ---------------------------------------------------------------
    作    者:温子祺
    联系方式:wenziqi@hotmail.com

    说     明:WINCE复位操作
    ---------------------------------------------------------------
    */


    C:\WINCE600\PLATFORM\Mini2440\src\common\ioctl\reboot


    源码:


     

    代码
    #include <oal.h>


    //------------------------------------------------------------------------------
    //
    // Function: OALIoCtlHalReboot
    //
    //
    BOOL OALIoCtlHalReboot(UINT32 code, VOID *pInpBuffer,
    UINT32 inpSize, VOID
    *pOutBuffer,
    UINT32 outSize, UINT32
    *pOutSize)
    {
    //
    // If the board design supports software-controllable hardware reset logic, it should be
    // used. Because this routine is specific to the S3C2440A CPU, it only uses the watchdog
    // timer to assert reset. One downside to this approach is that nRSTOUT isn't asserted
    // so any board-level logic isn't reset via this method. This routine can be overidden in
    // the specific platform code to control board-level reset logic, should it exist.
    //

    volatile S3C2440A_WATCHDOG_REG *pWDRegs = (volatile S3C2440A_WATCHDOG_REG *)
    OALPAtoVA(S3C2440A_BASE_REG_PA_WATCHDOG, FALSE);

    OALMSG(OAL_IOCTL
    &&OAL_FUNC, (L"+OALIoCtlHalReboot\r\n"));

    // Setup the watchdog.
    //
    pWDRegs->WTDAT = 0;
    pWDRegs
    ->WTCNT = 5; // Load count with low value.
    pWDRegs->WTCON = 0x8021; // Enable watchdog timer...

    // Wait for watchdog reset...
    //
    while(TRUE);

    // Should never get to this point...
    //
    OALMSG(OAL_IOCTL&&OAL_FUNC, (L"-OALIoCtlHalReboot\r\n"));

    return(TRUE);

    }


        在OALIoCtlHalReboot函数中,复位操作很简单,只需要对看门狗相关的寄存器进行配置,然后等待看门狗计数器溢出,看门狗就会复位ARM。

    OALIoCtlHalReboot输入参数如下:

    code

    [in] Set to IOCTL_HAL_REBOOT to support a warm boot of the target device.

    pInpBuffer

    [in] Not used; set to NULL.

    inpSize

    [in] Not used; set to zero.

    pOutBuffer

    [in] Ignored; set to NULL.

    outSize

    [in] Not used; set to zero.

    pOutSize

    [in] Not used; may be set to NULL.

    即OALIoCtlHalReboot(IOCTL_HAL_REBOOT,NULL,0,NULL,0,NULL);


           转载请注明出处,谢谢!

  • 相关阅读:
    社会影响力入门:打造有所作为的公司
    JSP中的include有哪些?有什么差别?
    关于程序猿怎样降低程序Bug的若干建议
    linux文件打开模式
    IntelliJ IDEA 问题总结之中的一个 —— jar包、assets、maven、git
    linux下改动内核參数进行Tcp性能调优 -- 高并发
    思科模拟器配置三层交换机局域网
    MFC调试小技巧
    JAVA基础编程50题(10-12题)具体解释
    加速度传感器的原理和应用-手机翻转、失重检测、运动检测、位置识别
  • 原文地址:https://www.cnblogs.com/wenziqi/p/1800762.html
Copyright © 2011-2022 走看看