• 复位操作


    /*
    ---------------------------------------------------------------
    作    者:温子祺
    联系方式: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);


           转载请注明出处,谢谢!

  • 相关阅读:
    表单重复提交问题
    Win8.1卸载64位Oracle Database 11g的详细图文步骤记录
    A1084. Broken Keyboard (20)
    A1088. Rational Arithmetic (20)
    A1089. Insert or Merge (25)
    A1034. Head of a Gang (30)
    A1013. Battle Over Cities (25)
    A1030. Travel Plan (30)
    A1003. Emergency (25)
    A1076. Forwards on Weibo (30)
  • 原文地址:https://www.cnblogs.com/wenziqi/p/1800762.html
Copyright © 2020-2023  润新知