⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 timer.c

📁 Freescale ARM9系列CPU MX27的WINCE 5.0下的BSP
💻 C
字号:
//
// 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.
//
//-----------------------------------------------------------------------------
//
// Copyright (C) 2004-2006,2007 Freescale Semiconductor, Inc. All Rights Reserved.
// THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
// AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
//
//-----------------------------------------------------------------------------
//
//  Module: timer.c
//
//  This module provides the BSP-specific interfaces required to support
//  the PQOAL timer code.
//
//-----------------------------------------------------------------------------
#include <bsp.h>

//------------------------------------------------------------------------------
// External Variables
extern PBSP_ARGS g_pBSPARGS;        // From debug.c

//-----------------------------------------------------------------------------
//
//  Function: OALTimerGetClkSrc
//
//  This function returns the clock source setting used to program the GPT
//  CLKSOURCE bits.
//
//  Parameters:
//      None.
//
//  Returns:
//      None.
//
//-----------------------------------------------------------------------------
UINT32 OALTimerGetClkSrc(void)
{
    return BSP_OEM_GPT_CLOCK_SRC;
}


//-----------------------------------------------------------------------------
//
//  Function: OALTimerGetClkPrescalar
//
//  This function returns the clock prescalar used to program the GPT
//  PRESCALER bits.
//
//  Parameters:
//      None.
//
//  Returns:
//      None.
//
//-----------------------------------------------------------------------------
UINT32 OALTimerGetClkPrescalar(void)
{
    return ((g_pBSPARGS->clockFreq[DDK_CLOCK_SIGNAL_PERDIV1] / OEM_CLOCK_FREQ) - 1);
}


//-----------------------------------------------------------------------------
//
//  Function: OALTimerGetClkFreq
//
//  This function returns the frequency of the EPIT input clock.
//
//  Parameters:
//      None.
//
//  Returns:
//      None.
//
//-----------------------------------------------------------------------------
UINT32 OALTimerGetClkFreq(void)
{
    return g_pBSPARGS->clockFreq[DDK_CLOCK_SIGNAL_PERDIV1];
}


//-----------------------------------------------------------------------------
//
//  Function: OALCPUIdle
//
//  This function puts the CPU or SOC in idle state. The CPU or SOC 
//  should exit the idle state when an interrupt occurs. This function is 
//  called with interrupts are disabled. When this function returns, interrupts 
//  must be disabled also.
//
//  Parameters:
//      None.
//
//  Returns:
//      None.
//
//-----------------------------------------------------------------------------
VOID OALCPUIdle()
{  

#ifdef OAL_FAKE_IDLE
    CSP_AITC_REGS *pAITC;

    // Get uncached virtual addresses for AITC
    pAITC = (PCSP_AITC_REGS) OALPAtoUA(CSP_BASE_REG_PA_AITC);
    if (pAITC == NULL)
    {
        OALMSG(OAL_ERROR, (L"OALCPUIdle:  AITC null pointer!\r\n"));
        goto cleanUp;
    }
    // Wait until AITC reports an interrupt is pending
    while((!INREG32(&pAITC->NIPNDH)) && (!INREG32(&pAITC->NIPNDL)));

#else
        
    // Use CP15 instruction to execute an ARM wait-for-interrupt
    _MoveToCoprocessor(0, 15, 0, 7, 0, 4);
#endif
    
}

⌨️ 快捷键说明

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