亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? pwm.c

?? KEIL驅(qū)動 各方面各 你的看法女士的煩惱 方看到你
?? C
?? 第 1 頁 / 共 5 頁
字號:
//*****************************************************************************
//
// pwm.c - API for the PWM modules
//
// Copyright (c) 2005-2008 Luminary Micro, Inc.  All rights reserved.
// 
// Software License Agreement
// 
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's microcontroller products.
// 
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  You may not combine
// this software with "viral" open-source software in order to form a larger
// program.  Any use in violation of the foregoing restrictions may subject
// the user to criminal sanctions under applicable laws, as well as to civil
// liability for the breach of the terms and conditions of this license.
// 
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 3223 of the Stellaris Peripheral Driver Library.
//
//*****************************************************************************

//*****************************************************************************
//
//! \addtogroup pwm_api
//! @{
//
//*****************************************************************************

#include "../hw_ints.h"
#include "../hw_memmap.h"
#include "../hw_pwm.h"
#include "../hw_sysctl.h"
#include "../hw_types.h"
#include "debug.h"
#include "interrupt.h"
#include "pwm.h"

//*****************************************************************************
//
// Misc macros for manipulating the encoded generator and output defines used
// by the API.
//
//*****************************************************************************
#define PWM_GEN_BADDR(_mod_, _gen_)                                           \
                                ((_mod_) + (_gen_))
#define PWM_GEN_EXT_BADDR(_mod_, _gen_)                                       \
                                ((_mod_) + PWM_GEN_EXT_0 +                    \
                                 ((_gen_) - PWM_GEN_0) * 2)
#define PWM_OUT_BADDR(_mod_, _out_)                                           \
                                ((_mod_) + ((_out_) & 0xFFFFFFC0))
#define PWM_IS_OUTPUT_ODD(_out_)                                              \
                                ((_out_) & 0x00000001)

//*****************************************************************************
//
//! \internal
//! Checks a PWM generator number.
//!
//! \param ulGen is the generator number.
//!
//! This function determines if a PWM generator number is valid.
//!
//! \return Returnes \b true if the generator number is valid and \b false
//! otherwise.
//
//*****************************************************************************
#ifdef DEBUG
static tBoolean
PWMGenValid(unsigned long ulGen)
{
    return((ulGen == PWM_GEN_0) || (ulGen == PWM_GEN_1) ||
           (ulGen == PWM_GEN_2) || (ulGen == PWM_GEN_3));
}
#endif

//*****************************************************************************
//
//! \internal
//! Checks a PWM output number.
//!
//! \param ulPWMOut is the output number.
//!
//! This function determines if a PWM output number is valid.
//!
//! \return Returns \b true if the output number is valid and \b false
//! otherwise.
//
//*****************************************************************************
#ifdef DEBUG
static tBoolean
PWMOutValid(unsigned long ulPWMOut)
{
    return((ulPWMOut == PWM_OUT_0) || (ulPWMOut == PWM_OUT_1) ||
           (ulPWMOut == PWM_OUT_2) || (ulPWMOut == PWM_OUT_3) ||
           (ulPWMOut == PWM_OUT_4) || (ulPWMOut == PWM_OUT_5) ||
           (ulPWMOut == PWM_OUT_6) || (ulPWMOut == PWM_OUT_7));
}
#endif

//*****************************************************************************
//
//! Configures a PWM generator.
//!
//! \param ulBase is the base address of the PWM module.
//! \param ulGen is the PWM generator to configure.  Must be one of
//! \b PWM_GEN_0, \b PWM_GEN_1, \b PWM_GEN_2, or \b PWM_GEN_3.
//! \param ulConfig is the configuration for the PWM generator.
//!
//! This function is used to set the mode of operation for a PWM generator.
//! The counting mode, synchronization mode, and debug behavior are all
//! configured.  After configuration, the generator is left in the disabled
//! state.
//!
//! A PWM generator can count in two different modes:  count down mode or count
//! up/down mode.  In count down mode, it will count from a value down to zero,
//! and then reset to the preset value.  This will produce left-aligned PWM
//! signals (that is the rising edge of the two PWM signals produced by the
//! generator will occur at the same time).  In count up/down mode, it will
//! count up from zero to the preset value, count back down to zero, and then
//! repeat the process.  This will produce center-aligned PWM signals (that is,
//! the middle of the high/low period of the PWM signals produced by the
//! generator will occur at the same time).
//!
//! When the PWM generator parameters (period and pulse width) are modified,
//! their affect on the output PWM signals can be delayed.  In synchronous
//! mode, the parameter updates are not applied until a synchronization event
//! occurs.  This allows multiple parameters to be modified and take affect
//! simultaneously, instead of one at a time.  Additionally, parameters to
//! multiple PWM generators in synchronous mode can be updated simultaneously,
//! allowing them to be treated as if they were a unified generator.  In
//! non-synchronous mode, the parameter updates are not delayed until a
//! synchronization event.  In either mode, the parameter updates only occur
//! when the counter is at zero to help prevent oddly formed PWM signals during
//! the update (that is, a PWM pulse that is too short or too long).
//!
//! The PWM generator can either pause or continue running when the processor
//! is stopped via the debugger.  If configured to pause, it will continue to
//! count until it reaches zero, at which point it will pause until the
//! processor is restarted.  If configured to continue running, it will keep
//! counting as if nothing had happened.
//!
//! The \e ulConfig parameter contains the desired configuration.  It is the
//! logical OR of the following:
//!
//! - \b PWM_GEN_MODE_DOWN or \b PWM_GEN_MODE_UP_DOWN to specify the counting
//!   mode
//! - \b PWM_GEN_MODE_SYNC or \b PWM_GEN_MODE_NO_SYNC to specify the counter
//!   load and comparator update synchronization mode
//! - \b PWM_GEN_MODE_DBG_RUN or \b PWM_GEN_MODE_DBG_STOP to specify the debug
//!   behavior
//! - \b PWM_GEN_MODE_GEN_NO_SYNC, \b PWM_GEN_MODE_GEN_SYNC_LOCAL, or
//!   \b PWM_GEN_MODE_GEN_SYNC_GLOBAL to specify the update synchronization
//!   mode for generator counting mode changes
//! - \b PWM_GEN_MODE_DB_NO_SYNC, \b PWM_GEN_MODE_DB_SYNC_LOCAL, or
//!   \b PWM_GEN_MODE_DB_SYNC_GLOBAL to specify the deadband parameter
//!   synchronization mode
//! - \b PWM_GEN_MODE_FAULT_LATCHED or \b PWM_GEN_MODE_FAULT_UNLATCHED to
//!   specify whether fault conditions are latched or not
//! - \b PWM_GEN_MODE_FAULT_MINPER or \b PWM_GEN_MODE_FAULT_NO_MINPER to
//!   specify whether minimum fault period support is required
//! - \b PWM_GEN_MODE_FAULT_EXT or \b PWM_GEN_MODE_FAULT_LEGACY to specify
//!   whether extended fault source selection support is enabled or not
//!
//! Setting \b PWM_GEN_MODE_FAULT_MINPER allows an application to set the
//! minimum duration of a PWM fault signal.  Fault will be signalled for at
//! least this time even if the external fault pin deasserts earlier.  Care
//! should be taken when using this mode since during the fault signal period,
//! the fault interrupt from the PWM generator will remain asserted.  The fault
//! interrupt handler may, therefore, reenter immediately if it exits prior to
//! expiration of the fault timer.
//!
//! \note Changes to the counter mode will affect the period of the PWM signals
//! produced.  PWMGenPeriodSet() and PWMPulseWidthSet() should be called after
//! any changes to the counter mode of a generator.
//!
//! \return None.
//
//*****************************************************************************
void
PWMGenConfigure(unsigned long ulBase, unsigned long ulGen,
                unsigned long ulConfig)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == PWM_BASE);
    ASSERT(PWMGenValid(ulGen));

    //
    // Compute the generator's base address.
    //
    ulGen = PWM_GEN_BADDR(ulBase, ulGen);

    //
    // Change the global configuration of the generator.
    //
    HWREG(ulGen + PWM_O_X_CTL) = ((HWREG(ulGen + PWM_O_X_CTL) &
                                   ~(PWM_X_CTL_MODE | PWM_X_CTL_DEBUG |
                                     PWM_X_CTL_LATCH | PWM_X_CTL_MINFLTPER |
                                     PWM_X_CTL_FLTSRC | PWM_X_CTL_DBFALLUPD_M |
                                     PWM_X_CTL_DBRISEUPD_M |
                                     PWM_X_CTL_DBCTLUPD_M |
                                     PWM_X_CTL_GENBUPD_M |
                                     PWM_X_CTL_GENAUPD_M |
                                     PWM_X_CTL_LOADUPD | PWM_X_CTL_CMPAUPD |
                                     PWM_X_CTL_CMPBUPD)) | ulConfig);

    //
    // Set the individual PWM generator controls.
    //
    if(ulConfig & PWM_X_CTL_MODE)
    {
        //
        // In up/down count mode, set the signal high on up count comparison
        // and low on down count comparison (that is, center align the
        // signals).
        //
        HWREG(ulGen + PWM_O_X_GENA) = (PWM_X_GENA_ACTCMPAU_ONE |
                                       PWM_X_GENA_ACTCMPAD_ZERO);
        HWREG(ulGen + PWM_O_X_GENB) = (PWM_X_GENB_ACTCMPBU_ONE |
                                       PWM_X_GENB_ACTCMPBD_ZERO);
    }
    else
    {
        //
        // In down count mode, set the signal high on load and low on count
        // comparison (that is, left align the signals).
        //
        HWREG(ulGen + PWM_O_X_GENA) = (PWM_X_GENA_ACTLOAD_ONE |
                                       PWM_X_GENA_ACTCMPAD_ZERO);
        HWREG(ulGen + PWM_O_X_GENB) = (PWM_X_GENB_ACTLOAD_ONE |
                                       PWM_X_GENB_ACTCMPBD_ZERO);
    }
}

//*****************************************************************************
//
//! Set the period of a PWM generator.
//!
//! \param ulBase is the base address of the PWM module.
//! \param ulGen is the PWM generator to be modified.  Must be one of
//! \b PWM_GEN_0, \b PWM_GEN_1, \b PWM_GEN_2, or \b PWM_GEN_3.
//! \param ulPeriod specifies the period of PWM generator output, measured
//! in clock ticks.
//!
//! This function sets the period of the specified PWM generator block, where
//! the period of the generator block is defined as the number of PWM clock
//! ticks between pulses on the generator block zero signal.
//!
//! \note Any subsequent calls made to this function before an update occurs
//! will cause the previous values to be overwritten.
//!
//! \return None.
//
//*****************************************************************************
void
PWMGenPeriodSet(unsigned long ulBase, unsigned long ulGen,
                unsigned long ulPeriod)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == PWM_BASE);
    ASSERT(PWMGenValid(ulGen));

    //
    // Compute the generator's base address.
    //
    ulGen = PWM_GEN_BADDR(ulBase, ulGen);

    //
    // Set the reload register based on the mode.
    //
    if(HWREG(ulGen + PWM_O_X_CTL) & PWM_X_CTL_MODE)
    {
        //
        // In up/down count mode, set the reload register to half the requested
        // period.
        //
        ASSERT((ulPeriod / 2) < 65536);
        HWREG(ulGen + PWM_O_X_LOAD) = ulPeriod / 2;
    }
    else
    {
        //
        // In down count mode, set the reload register to the requested period
        // minus one.
        //
        ASSERT((ulPeriod <= 65536) && (ulPeriod != 0));
        HWREG(ulGen + PWM_O_X_LOAD) = ulPeriod - 1;
    }
}

//*****************************************************************************
//
//! Gets the period of a PWM generator block.
//!
//! \param ulBase is the base address of the PWM module.
//! \param ulGen is the PWM generator to query.  Must be one of
//! \b PWM_GEN_0, \b PWM_GEN_1, \b PWM_GEN_2, or \b PWM_GEN_3.
//!
//! This function gets the period of the specified PWM generator block.  The
//! period of the generator block is defined as the number of PWM clock ticks
//! between pulses on the generator block zero signal.
//!
//! If the update of the counter for the specified PWM generator has yet
//! to be completed, the value returned may not be the active period.  The
//! value returned is the programmed period, measured in PWM clock ticks.
//!
//! \return Returns the programmed period of the specified generator block
//! in PWM clock ticks.
//
//*****************************************************************************
unsigned long
PWMGenPeriodGet(unsigned long ulBase, unsigned long ulGen)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == PWM_BASE);
    ASSERT(PWMGenValid(ulGen));

    //
    // Compute the generator's base address.
    //
    ulGen = PWM_GEN_BADDR(ulBase, ulGen);

    //
    // Figure out the counter mode.
    //
    if(HWREG(ulGen + PWM_O_X_CTL) & PWM_X_CTL_MODE)
    {
        //

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美老肥妇做.爰bbww视频| 精品亚洲国内自在自线福利| 成人黄色av电影| 国产亚洲欧洲一区高清在线观看| 国产自产高清不卡| 久久久国际精品| 成人午夜av电影| 成人免费在线视频| 在线观看一区二区视频| 亚洲一区二区三区中文字幕在线| 欧美三级乱人伦电影| 婷婷亚洲久悠悠色悠在线播放| 欧美美女直播网站| 日本在线不卡一区| 精品成人在线观看| 成人精品国产一区二区4080| 中文字幕在线不卡一区| 色综合久久久久综合体桃花网| 亚洲国产一区二区视频| 日韩三级视频中文字幕| 国产精品主播直播| 亚洲精品国产a| 欧美久久高跟鞋激| 国产美女在线观看一区| 亚洲欧美另类久久久精品| 欧美无人高清视频在线观看| 麻豆久久久久久| 国产精品色哟哟网站| 欧美性猛片xxxx免费看久爱| 久热成人在线视频| 综合久久综合久久| 欧美一区二区三区色| 成人av影视在线观看| 亚洲国产精品尤物yw在线观看| 精品久久久久99| 91一区二区在线| 久久成人免费网| 洋洋av久久久久久久一区| 日韩免费高清电影| 99国产一区二区三精品乱码| 日韩精品亚洲专区| 国产精品久久综合| 日韩一级大片在线| 色综合色综合色综合| 精品一区二区三区在线观看国产| 亚洲另类在线制服丝袜| 精品国精品国产尤物美女| 色嗨嗨av一区二区三区| 国产福利一区二区三区视频| 亚洲午夜免费电影| 国产精品久久夜| 欧美精品一区二区三区蜜桃 | 国产精品第四页| 日韩三级.com| 欧美日韩成人综合| 久久看人人爽人人| 91精品欧美福利在线观看| 91小视频在线观看| 国产一区二区三区不卡在线观看| 亚洲国产一区二区视频| 亚洲色大成网站www久久九九| 精品少妇一区二区三区视频免付费| 色丁香久综合在线久综合在线观看| 国产福利91精品一区二区三区| 视频一区欧美精品| 亚洲va欧美va天堂v国产综合| 国产精品不卡视频| 亚洲国产成人午夜在线一区 | 欧美日韩久久一区二区| 91美女在线视频| 北岛玲一区二区三区四区| 国产精品一区二区久久不卡| 精品无人区卡一卡二卡三乱码免费卡| 亚洲国产精品久久久久婷婷884| 成人免费一区二区三区在线观看| 久久久高清一区二区三区| 日韩女优av电影| 精品久久久久久无| 亚洲精品在线观| 精品国产乱码久久久久久浪潮| 精品欧美一区二区在线观看| 国产日韩精品一区二区浪潮av | 国产风韵犹存在线视精品| 蜜桃久久久久久久| 青青草国产精品97视觉盛宴| 日本美女视频一区二区| 免费人成网站在线观看欧美高清| 日韩高清不卡在线| 九色综合狠狠综合久久| 久久国产乱子精品免费女| 老色鬼精品视频在线观看播放| 日本不卡视频一二三区| 美女视频黄 久久| 九九精品一区二区| 国产精品资源网| 粉嫩av一区二区三区粉嫩| 成人黄色小视频| 国产欧美一区二区三区鸳鸯浴| 欧美激情在线免费观看| 亚洲欧洲色图综合| 亚洲一区二区三区精品在线| 日韩av电影免费观看高清完整版在线观看 | 九色porny丨国产精品| 国产成人鲁色资源国产91色综| 99久久精品国产一区二区三区| 在线观看区一区二| 日韩欧美高清dvd碟片| 久久精品视频一区二区三区| 综合久久综合久久| 日韩国产欧美在线观看| 国产成人午夜视频| 日本丶国产丶欧美色综合| 日韩欧美激情一区| 中文字幕中文字幕在线一区| 亚洲一区二区三区四区在线免费观看| 亚洲国产一区二区a毛片| 国产嫩草影院久久久久| 亚洲综合丝袜美腿| 亚洲成人精品影院| 久久精品国产免费| 精品亚洲成a人| 成人精品鲁一区一区二区| 一本大道久久a久久综合| 国产成人av电影在线| www.色精品| 99久久99久久精品国产片果冻| 91黄视频在线| 日韩欧美视频在线| 久久午夜羞羞影院免费观看| 国产精品久久久久久久蜜臀| 亚洲麻豆国产自偷在线| 亚洲精品高清在线观看| 午夜不卡在线视频| 国产精品亚洲视频| 色综合婷婷久久| 91精品国产综合久久福利| 精品粉嫩aⅴ一区二区三区四区| 久久久久久久电影| 一区二区三区影院| 久久99深爱久久99精品| 首页国产欧美久久| 九九久久精品视频| 色偷偷久久人人79超碰人人澡| 欧美一级片在线观看| 国产精品青草综合久久久久99| 一区二区三区国产| 亚洲一区二区三区中文字幕 | 亚洲国产精品嫩草影院| 激情av综合网| 欧美午夜影院一区| 国产亚洲视频系列| 一区二区三区欧美激情| 国产美女久久久久| 99久久精品免费观看| 欧美大片在线观看| 依依成人精品视频| 日韩精品一区第一页| 99久久精品国产导航| 欧美三级在线看| 国产精品久久久久久户外露出| 亚洲自拍偷拍九九九| 国产成人亚洲综合a∨婷婷| 欧美日韩国产一二三| 国产午夜精品久久久久久久| 日本一区中文字幕| 99久久精品免费看| 久久精品亚洲精品国产欧美| 日日夜夜免费精品| 色欧美片视频在线观看在线视频| 久久亚洲精精品中文字幕早川悠里| 亚洲成人一区在线| 97久久精品人人做人人爽| 国产日韩欧美精品在线| 久久国内精品视频| 粉嫩蜜臀av国产精品网站| 欧美一区二视频| 五月天精品一区二区三区| 在线观看中文字幕不卡| 国产日韩欧美不卡| 天天免费综合色| 欧美午夜影院一区| 亚洲精品国产一区二区三区四区在线| 国产成人午夜视频| 日韩精品一区国产麻豆| 亚洲激情网站免费观看| 成人性生交大片免费看视频在线| 2023国产精品视频| 久久精品久久精品| 91在线视频播放| 中文字幕一区二区三区在线观看| 国产mv日韩mv欧美| 亚洲国产精品传媒在线观看| 美女一区二区在线观看| 欧美日韩综合在线| 亚洲国产成人av| 欧美精品亚洲二区| 亚洲成人av在线电影| 欧美亚州韩日在线看免费版国语版| 欧美激情自拍偷拍| 色婷婷久久久久swag精品|