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

📄 bspgpt.cpp

📁 Microsoft WinCE 6.0 BSP FINAL release source code for use with the i.MX27ADS TO2 WCE600_FINAL_MX27_S
💻 CPP
字号:
//------------------------------------------------------------------------------
//
// Copyright (C) 2006, 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
//
//------------------------------------------------------------------------------

 
//------------------------------------------------------------------------------
//
//  File:  bspgpt.c
//
//  Provides BSP-specific configuration routines for the GPT peripheral.
//
//------------------------------------------------------------------------------
#include <windows.h>
//#include "gpt_priv.h"
#include "gpt.h"
#include "bsp.h"

//------------------------------------------------------------------------------
// External Functions


//------------------------------------------------------------------------------
// External Variables


//------------------------------------------------------------------------------
// Defines
// System timer frequencies
//------------------------------------------------------------------------------
// BSP_OEM_CLOCK_SRC specifies what input clock is used with the system timer
// GPT for i.MX27.
// It must be one of the following:
//  GPT_TCTL_CLKSOURCE_PERCLK1    
//  GPT_TCTL_CLKSOURCE_PERCLK1DIV4
//  GPT_TCTL_CLKSOURCE_TIN        
//  GPT_TCTL_CLKSOURCE_32KCLK     
//------------------------------------------------------------------------------
#define BSP_OEM_CLOCK_SRC       GPT_TCTL_CLKSOURCE_PERCLK1



//------------------------------------------------------------------------------
// Types


//------------------------------------------------------------------------------
// Global Variables


//------------------------------------------------------------------------------
// Local Variables

//------------------------------------------------------------------------------
// Local Functions

//------------------------------------------------------------------------------
//
// Function: BSPGptGetClockSource
//
// This function returns the BSP-specific clock
// source selection value for the GPT.
//
// Parameters:
//      None
//
// Returns:
//      The clock source for the GPT.
//
//------------------------------------------------------------------------------
UINT32 BSPGptGetClockSource()
{
    return BSP_OEM_CLOCK_SRC;
}


//------------------------------------------------------------------------------
//
// Function: BSPGptGetPERCLK1
//
// This function returns the frequency of the PER1
// clock.
//
// Parameters:
//      None
//
// Returns:
//      The frequency of the PER1 clock.
//
//------------------------------------------------------------------------------
UINT32 BSPGptGetPERCLK1()
{
	DDK_CLOCK_SIGNAL signal = DDK_CLOCK_SIGNAL_PERDIV1;
	UINT32 freq;

	DDKClockGetFreq(signal, &freq);

	return freq;
}

//------------------------------------------------------------------------------
//
// Function: BSPGptGet32kHzRefFreq
//
// This function returns the frequency of 32.768kHz
// clock.
//
// Parameters:
//      None
//
// Returns:
//      The frequency of the 32.768kHz clock.
//
//------------------------------------------------------------------------------
UINT32 BSPGptGet32kHzRefFreq()
{
	return BSP_REF_32KHZ_FREQ;
}


//------------------------------------------------------------------------------
//
// Function: BSPGptCrmSetClockGatingMode
//
// This function calls to the CRM module to
// set the clock gating mode, turning on or off
// clocks to the GPT.
//
// Parameters:
//      dwIOBase
//          [in] The IoBase of the GPT in use
//      startClocks
//          [in] If TRUE, turn clocks to GPT on.
//               If FALSE, turn clocks to GPT off
//
// Returns:
//      TRUE if success.
//      FALSE if failure.
//
//------------------------------------------------------------------------------
BOOL BSPGptSetClockGatingMode(DWORD dwIOBase, BOOL startClocks)
{
    DDK_CLOCK_GATE_INDEX index;
    DDK_CLOCK_GATE_MODE mode = startClocks ? DDK_CLOCK_GATE_MODE_ENABLE : DDK_CLOCK_GATE_MODE_DISABLE;

    switch(dwIOBase)
    {

	case CSP_BASE_REG_PA_GPT2:
	     index = DDK_CLOCK_GATE_INDEX_GPT2;
	     break;

	case CSP_BASE_REG_PA_GPT3:
	     index = DDK_CLOCK_GATE_INDEX_GPT3;
	     break;

	case CSP_BASE_REG_PA_GPT4:
	     index = DDK_CLOCK_GATE_INDEX_GPT4;
	     break;

	case CSP_BASE_REG_PA_GPT5:
	     index = DDK_CLOCK_GATE_INDEX_GPT5;
	     break;

	case CSP_BASE_REG_PA_GPT6:
	     index = DDK_CLOCK_GATE_INDEX_GPT6;
	     break;

	default:
	     break;
    }
   
    return DDKClockSetGatingMode(index, mode);
}

⌨️ 快捷键说明

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