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

📄 bsppwm.c

📁 Microsoft WinCE 6.0 BSP FINAL release source code for use with the i.MX27ADS TO2 WCE600_FINAL_MX27_S
💻 C
字号:
//-----------------------------------------------------------------------------
//
//  Copyright (C) 2004, Motorola Inc. All Rights Reserved
//
//-----------------------------------------------------------------------------
//
//  Copyright (C) 2004-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:  bsppwm.c
//
//   This file implements the BSP specific functions for PWM.
//
//-----------------------------------------------------------------------------
#include <windows.h>
#include "bsp.h"

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

//-----------------------------------------------------------------------------
// Defines
//------------------------------------------------------------------------------

// This will define the choice of clock source in PWMCR register
#define PWM_CLKSRC_VAL    PWM_PWMCR_CLKSRC_IPG_CLK_32K

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

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

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

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

//------------------------------------------------------------------------------
//
// Function: BSPSetClockSource
//
// This function returns the BSP-specific clock
// source selection value for the PWM.
//
// Parameters:
//      None
//
// Returns:
//      The clock source for the PWM.
//
//------------------------------------------------------------------------------
UINT32 BSPSetPWMClockSource(void)
{
     return PWM_CLKSRC_VAL;
}

//------------------------------------------------------------------------------
//
// Function: BSPPwmSetClockGatingMode
//
// This function enable or disable CRM clock for PWM.
//
// Parameters:
//      startClocks
//          [in] boolean variable to enable or disable CRM clock
//
// Returns:
//      Return TRUE.
//
//------------------------------------------------------------------------------
BOOL BSPPwmSetClockGatingMode(BOOL startClocks)
{

    if (startClocks)
    {
        DDKClockSetGatingMode(DDK_CLOCK_GATE_INDEX_PWM, 
            DDK_CLOCK_GATE_MODE_ENABLE);
    }
    else
    {
        DDKClockSetGatingMode(DDK_CLOCK_GATE_INDEX_PWM, 
            DDK_CLOCK_GATE_MODE_DISABLE);
    }
    return TRUE;

}

//------------------------------------------------------------------------------
//
// Function: BSPPwmIomuxSetPin
//
// This function configures gpio for PWM.
//
// Parameters:
//      None
//
// Returns:
//      None
//
//------------------------------------------------------------------------------
void BSPPwmIomuxSetPin(void)
{
	DDK_GPIO_CFG  cfg;

	DDK_GPIO_SET_CONFIG(cfg, PWMO);
    DDKGpioEnable(&cfg);

}

⌨️ 快捷键说明

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