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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gpio.c

?? KEIL驅動 各方面各 你的看法女士的煩惱 方看到你
?? C
?? 第 1 頁 / 共 4 頁
字號:
//*****************************************************************************
//
// gpio.c - API for GPIO ports
//
// 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 gpio_api
//! @{
//
//*****************************************************************************

#include "../hw_gpio.h"
#include "../hw_ints.h"
#include "../hw_memmap.h"
#include "../hw_types.h"
#include "debug.h"
#include "gpio.h"
#include "interrupt.h"

//*****************************************************************************
//
//! \internal
//! Checks a GPIO base address.
//!
//! \param ulPort is the base address of the GPIO port.
//!
//! This function determines if a GPIO port base address is valid.
//!
//! \return Returns \b true if the base address is valid and \b false
//! otherwise.
//
//*****************************************************************************
#ifdef DEBUG
static tBoolean
GPIOBaseValid(unsigned long ulPort)
{
    return((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTA_AHB_BASE) ||
           (ulPort == GPIO_PORTB_BASE) || (ulPort == GPIO_PORTB_AHB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTC_AHB_BASE) ||
           (ulPort == GPIO_PORTD_BASE) || (ulPort == GPIO_PORTD_AHB_BASE) ||
           (ulPort == GPIO_PORTE_BASE) || (ulPort == GPIO_PORTE_AHB_BASE) ||
           (ulPort == GPIO_PORTF_BASE) || (ulPort == GPIO_PORTF_AHB_BASE) ||
           (ulPort == GPIO_PORTG_BASE) || (ulPort == GPIO_PORTG_AHB_BASE) ||
           (ulPort == GPIO_PORTH_BASE) || (ulPort == GPIO_PORTH_AHB_BASE));
}
#endif

//*****************************************************************************
//
//! \internal
//! Gets the GPIO interrupt number.
//!
//! \param ulPort is the base address of the GPIO port.
//!
//! Given a GPIO base address, returns the corresponding interrupt number.
//!
//! \return Returns a GPIO interrupt number, or -1 if \e ulPort is invalid.
//
//*****************************************************************************
static long
GPIOGetIntNumber(unsigned long ulPort)
{
    unsigned int ulInt;

    //
    // Determine the GPIO interrupt number for the given module.
    //
    switch(ulPort)
    {
        case GPIO_PORTA_BASE:
        case GPIO_PORTA_AHB_BASE:
        {
            ulInt = INT_GPIOA;
            break;
        }

        case GPIO_PORTB_BASE:
        case GPIO_PORTB_AHB_BASE:
        {
            ulInt = INT_GPIOB;
            break;
        }

        case GPIO_PORTC_BASE:
        case GPIO_PORTC_AHB_BASE:
        {
            ulInt = INT_GPIOC;
            break;
        }

        case GPIO_PORTD_BASE:
        case GPIO_PORTD_AHB_BASE:
        {
            ulInt = INT_GPIOD;
            break;
        }

        case GPIO_PORTE_BASE:
        case GPIO_PORTE_AHB_BASE:
        {
            ulInt = INT_GPIOE;
            break;
        }

        case GPIO_PORTF_BASE:
        case GPIO_PORTF_AHB_BASE:
        {
            ulInt = INT_GPIOF;
            break;
        }

        case GPIO_PORTG_BASE:
        case GPIO_PORTG_AHB_BASE:
        {
            ulInt = INT_GPIOG;
            break;
        }

        case GPIO_PORTH_BASE:
        case GPIO_PORTH_AHB_BASE:
        {
            ulInt = INT_GPIOH;
            break;
        }

        default:
        {
            return(-1);
        }
    }

    //
    // Return GPIO interrupt number.
    //
    return(ulInt);
}

//*****************************************************************************
//
//! Sets the direction and mode of the specified pin(s).
//!
//! \param ulPort is the base address of the GPIO port
//! \param ucPins is the bit-packed representation of the pin(s).
//! \param ulPinIO is the pin direction and/or mode.
//!
//! This function will set the specified pin(s) on the selected GPIO port
//! as either an input or output under software control, or it will set the
//! pin to be under hardware control.
//!
//! The parameter \e ulPinIO is an enumerated data type that can be one of
//! the following values:
//!
//! - \b GPIO_DIR_MODE_IN
//! - \b GPIO_DIR_MODE_OUT
//! - \b GPIO_DIR_MODE_HW
//!
//! where \b GPIO_DIR_MODE_IN specifies that the pin will be programmed as
//! a software controlled input, \b GPIO_DIR_MODE_OUT specifies that the pin
//! will be programmed as a software controlled output, and
//! \b GPIO_DIR_MODE_HW specifies that the pin will be placed under
//! hardware control.
//!
//! The pin(s) are specified using a bit-packed byte, where each bit that is
//! set identifies the pin to be accessed, and where bit 0 of the byte
//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
//!
//! \return None.
//
//*****************************************************************************
void
GPIODirModeSet(unsigned long ulPort, unsigned char ucPins,
               unsigned long ulPinIO)
{
    //
    // Check the arguments.
    //
    ASSERT(GPIOBaseValid(ulPort));
    ASSERT((ulPinIO == GPIO_DIR_MODE_IN) || (ulPinIO == GPIO_DIR_MODE_OUT) ||
           (ulPinIO == GPIO_DIR_MODE_HW));

    //
    // Set the pin direction and mode.
    //
    HWREG(ulPort + GPIO_O_DIR) = ((ulPinIO & 1) ?
                                  (HWREG(ulPort + GPIO_O_DIR) | ucPins) :
                                  (HWREG(ulPort + GPIO_O_DIR) & ~(ucPins)));
    HWREG(ulPort + GPIO_O_AFSEL) = ((ulPinIO & 2) ?
                                    (HWREG(ulPort + GPIO_O_AFSEL) | ucPins) :
                                    (HWREG(ulPort + GPIO_O_AFSEL) &
                                     ~(ucPins)));
}

//*****************************************************************************
//
//! Gets the direction and mode of a pin.
//!
//! \param ulPort is the base address of the GPIO port.
//! \param ucPin is the pin number.
//!
//! This function gets the direction and control mode for a specified pin on
//! the selected GPIO port.  The pin can be configured as either an input or
//! output under software control, or it can be under hardware control.  The
//! type of control and direction are returned as an enumerated data type.
//!
//! \return Returns one of the enumerated data types described for
//! GPIODirModeSet().
//
//*****************************************************************************
unsigned long
GPIODirModeGet(unsigned long ulPort, unsigned char ucPin)
{
    unsigned long ulDir, ulAFSEL;

    //
    // Check the arguments.
    //
    ASSERT(GPIOBaseValid(ulPort));
    ASSERT(ucPin < 8);

    //
    // Convert from a pin number to a bit position.
    //
    ucPin = 1 << ucPin;

    //
    // Return the pin direction and mode.
    //
    ulDir = HWREG(ulPort + GPIO_O_DIR);
    ulAFSEL = HWREG(ulPort + GPIO_O_AFSEL);
    return(((ulDir & ucPin) ? 1 : 0) | ((ulAFSEL & ucPin) ? 2 : 0));
}

//*****************************************************************************
//
//! Sets the interrupt type for the specified pin(s).
//!
//! \param ulPort is the base address of the GPIO port.
//! \param ucPins is the bit-packed representation of the pin(s).
//! \param ulIntType specifies the type of interrupt trigger mechanism.
//!
//! This function sets up the various interrupt trigger mechanisms for the
//! specified pin(s) on the selected GPIO port.
//!
//! The parameter \e ulIntType is an enumerated data type that can be one of
//! the following values:
//!
//! - \b GPIO_FALLING_EDGE
//! - \b GPIO_RISING_EDGE
//! - \b GPIO_BOTH_EDGES
//! - \b GPIO_LOW_LEVEL
//! - \b GPIO_HIGH_LEVEL
//!
//! where the different values describe the interrupt detection mechanism
//! (edge or level) and the particular triggering event (falling, rising,
//! or both edges for edge detect, low or high for level detect).
//!
//! The pin(s) are specified using a bit-packed byte, where each bit that is
//! set identifies the pin to be accessed, and where bit 0 of the byte
//! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
//!
//! \note In order to avoid any spurious interrupts, the user must
//! ensure that the GPIO inputs remain stable for the duration of
//! this function.
//!
//! \return None.
//
//*****************************************************************************
void
GPIOIntTypeSet(unsigned long ulPort, unsigned char ucPins,
               unsigned long ulIntType)
{
    //
    // Check the arguments.
    //
    ASSERT(GPIOBaseValid(ulPort));
    ASSERT((ulIntType == GPIO_FALLING_EDGE) ||
           (ulIntType == GPIO_RISING_EDGE) || (ulIntType == GPIO_BOTH_EDGES) ||
           (ulIntType == GPIO_LOW_LEVEL) || (ulIntType == GPIO_HIGH_LEVEL));

    //
    // Set the pin interrupt type.
    //
    HWREG(ulPort + GPIO_O_IBE) = ((ulIntType & 1) ?
                                  (HWREG(ulPort + GPIO_O_IBE) | ucPins) :
                                  (HWREG(ulPort + GPIO_O_IBE) & ~(ucPins)));
    HWREG(ulPort + GPIO_O_IS) = ((ulIntType & 2) ?
                                 (HWREG(ulPort + GPIO_O_IS) | ucPins) :
                                 (HWREG(ulPort + GPIO_O_IS) & ~(ucPins)));
    HWREG(ulPort + GPIO_O_IEV) = ((ulIntType & 4) ?
                                  (HWREG(ulPort + GPIO_O_IEV) | ucPins) :
                                  (HWREG(ulPort + GPIO_O_IEV) & ~(ucPins)));
}

//*****************************************************************************
//
//! Gets the interrupt type for a pin.
//!
//! \param ulPort is the base address of the GPIO port.
//! \param ucPin is the pin number.
//!
//! This function gets the interrupt type for a specified pin on the selected
//! GPIO port.  The pin can be configured as a falling edge, rising edge, or
//! both edge detected interrupt, or it can be configured as a low level or
//! high level detected interrupt.  The type of interrupt detection mechanism
//! is returned as an enumerated data type.
//!
//! \return Returns one of the enumerated data types described for
//! GPIOIntTypeSet().
//
//*****************************************************************************
unsigned long
GPIOIntTypeGet(unsigned long ulPort, unsigned char ucPin)
{

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
不卡一区二区中文字幕| 国产精品久久久久影院色老大 | 欧美一卡在线观看| 欧美影院一区二区三区| 91亚洲国产成人精品一区二区三| www.在线成人| www.一区二区| 色美美综合视频| 色婷婷综合久久久中文一区二区| 91免费观看国产| 色老头久久综合| 欧美三级资源在线| 欧美日韩国产在线观看| 欧美一级精品大片| 91精品国产入口在线| 欧美xxx久久| 国产片一区二区| 国产精品国模大尺度视频| 一区在线播放视频| 亚洲美女偷拍久久| 亚洲成人资源在线| 免费久久精品视频| 国内偷窥港台综合视频在线播放| 国产美女精品在线| a亚洲天堂av| 欧美亚洲国产一区在线观看网站 | 91精品在线免费| 精品欧美久久久| 国产精品丝袜黑色高跟| 亚洲丝袜另类动漫二区| 亚洲一区二区三区视频在线 | 国产麻豆91精品| 成人福利视频在线看| 在线视频综合导航| 日韩一区二区三区av| 国产午夜精品久久久久久免费视| 亚洲欧美色图小说| 日本女人一区二区三区| 国产99一区视频免费| 欧美视频在线观看一区二区| 日韩一区二区三区观看| 国产婷婷色一区二区三区在线| 国产精品蜜臀av| 婷婷成人激情在线网| 国产乱淫av一区二区三区| 色婷婷综合久久久中文字幕| 日韩精品一区二| 亚洲视频在线观看三级| 国产一区二区三区国产| 久久综合99re88久久爱| 国产精品灌醉下药二区| 五月激情综合色| 成人一区二区三区在线观看| 欧美体内she精视频| 欧美精品一区二区蜜臀亚洲| 亚洲视频你懂的| 日本中文字幕一区二区有限公司| 成人黄页在线观看| 欧美一区二区三区日韩| 自拍偷拍亚洲综合| 韩国三级中文字幕hd久久精品| 一本在线高清不卡dvd| 欧美大度的电影原声| 亚洲精品ww久久久久久p站| 九九九精品视频| 欧美亚洲动漫精品| 国产欧美精品一区aⅴ影院| 三级不卡在线观看| 99re这里只有精品视频首页| 精品播放一区二区| 性做久久久久久久免费看| 成人免费观看视频| 日韩色在线观看| 一区二区三区四区av| 国产99精品国产| 日韩欧美中文字幕公布| 一区二区三区欧美视频| 成人爱爱电影网址| 国产亚洲一二三区| 免费不卡在线视频| 欧美三级韩国三级日本一级| 中文字幕亚洲精品在线观看| 国产经典欧美精品| 日韩欧美黄色影院| 三级欧美在线一区| 欧美日韩一二三区| 一区二区三区影院| 色哟哟在线观看一区二区三区| 亚洲国产精品传媒在线观看| 精品在线视频一区| 欧美成人猛片aaaaaaa| 日本欧美大码aⅴ在线播放| 欧美三级电影网| 亚洲国产日日夜夜| 欧美亚洲一区二区在线| 亚洲美女视频在线| 91片黄在线观看| 成人欧美一区二区三区| 99热这里都是精品| 国产精品国产a级| 不卡一区二区三区四区| 国产欧美一区二区三区在线老狼| 精久久久久久久久久久| 欧美mv日韩mv| 精品亚洲成a人| 久久久久综合网| 国产91丝袜在线18| 国产日韩欧美精品在线| 国产69精品一区二区亚洲孕妇| 久久精品亚洲精品国产欧美| 国产suv精品一区二区883| 国产欧美一区二区三区沐欲| 成人精品一区二区三区四区| 中文字幕一区三区| 97久久精品人人澡人人爽| 亚洲女女做受ⅹxx高潮| 欧美午夜电影在线播放| 亚洲成人av中文| 91麻豆精品国产综合久久久久久 | 国产一区二区在线免费观看| 亚洲精品在线一区二区| 国产成人自拍高清视频在线免费播放| 久久精品视频一区二区三区| 成人午夜视频免费看| 亚洲欧洲中文日韩久久av乱码| 色婷婷国产精品综合在线观看| 亚洲成a人片在线观看中文| 日韩一级视频免费观看在线| 韩国午夜理伦三级不卡影院| 国产精品短视频| 91麻豆swag| 免费观看在线综合色| 久久久精品蜜桃| 91女厕偷拍女厕偷拍高清| 天堂一区二区在线| 国产偷国产偷精品高清尤物| 99国产麻豆精品| 日韩精品一二区| 国产人成亚洲第一网站在线播放| av毛片久久久久**hd| 午夜精品一区二区三区电影天堂| 欧美成人video| av电影一区二区| 亚洲成a人在线观看| 国产亚洲精品资源在线26u| 99re热这里只有精品免费视频| 丝袜美腿成人在线| 国产日韩欧美一区二区三区综合| 色偷偷88欧美精品久久久| 捆绑调教美女网站视频一区| 国产精品卡一卡二| 在线播放日韩导航| 国产成人午夜99999| 亚洲午夜私人影院| 欧美激情综合网| 欧美日韩在线不卡| 国产不卡视频一区二区三区| 丝袜美腿高跟呻吟高潮一区| 国产精品视频一二三区| 欧美日本一区二区| 粉嫩一区二区三区在线看| 图片区小说区国产精品视频| 国产精品久久久久影院亚瑟 | 国产午夜精品一区二区| 欧美日本乱大交xxxxx| 成人一区二区三区视频在线观看| 午夜激情久久久| 亚洲日韩欧美一区二区在线| 欧美成人精精品一区二区频| 欧美影院午夜播放| 成人av小说网| 精品一二三四区| 天天色天天操综合| 亚洲色图视频免费播放| 久久亚洲综合av| 在线不卡a资源高清| 色婷婷一区二区| 粉嫩aⅴ一区二区三区四区五区| 美国精品在线观看| 亚洲va在线va天堂| 亚洲免费av网站| 中日韩免费视频中文字幕| 久久一区二区视频| 91精品国产色综合久久不卡蜜臀| 色婷婷综合久久久久中文一区二区| 国产精品1区2区| 麻豆久久一区二区| 五月婷婷激情综合网| 一区二区三区不卡视频| 国产精品亲子乱子伦xxxx裸| 久久久三级国产网站| 精品国产污网站| 欧美日本一区二区三区| 欧美在线免费视屏| 日本黄色一区二区| av一区二区三区黑人| 波多野结衣视频一区| 国产成人av电影在线观看| 激情欧美一区二区三区在线观看| 日本美女一区二区|