reboot.c

来自「Windows CE 6.0 BSP for VOIPAC Board (PXA」· C语言 代码 · 共 54 行

C
54
字号
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
//------------------------------------------------------------------------------
//
//  File:  reboot.c
//
//  This file implement OMAP730 SoC specific OALIoCtlHalReboot function.
//
#include <windows.h>
#include <ceddk.h>
#include <nkintr.h>
#include <oal.h>
#include <omap730.h>

//------------------------------------------------------------------------------
//
//  Function: OALIoCtlHalReboot
//
//  The code issue CPU reset. Because of internal ROM speed we have first
//  set DPLL module to bypass mode. This will set all clock domain back to base
//  frequency 13MHz.
//
BOOL OALIoCtlHalReboot(
    UINT32 code, VOID *pInpBuffer, UINT32 inpSize, VOID *pOutBuffer, 
    UINT32 outSize, UINT32 *pOutSize
) {
    OMAP730_CLKM_REGS *pCLKMRegs = OALPAtoUA(OMAP730_CLKM_REGS_PA);
    
    OALMSG(OAL_IOCTL&&OAL_FUNC, (L"+OALIoCtlHalReboot\r\n"));

    // Let do reset
    OALMSGS(TRUE, (L"*** RESET ***\r\n"));

    // First we must brake clocks - bypass DPLL & set divider to 1
    CLRREG16(&pCLKMRegs->DPLL1_CTL, DPLL1_CTL_PLL_ENABLE | 3 << 1);

    // Reset
    OUTREG16(&pCLKMRegs->RSTCT1, RSTCT1_SW_RST);
    
    // Should never get to this point...
    OALMSG(OAL_IOCTL&&OAL_FUNC, (L"-OALIoCtlHalReboot\r\n"));
    return TRUE;
}

//------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?