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

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

?? gpio.c

?? FreeRTOS V4.2.1,增加了AVR32 UC3 和 LPC2368 的支持
?? C
?? 第 1 頁 / 共 3 頁
字號:
//*****************************************************************************
//
// gpio.c - API for GPIO ports
//
// Copyright (c) 2005,2006 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 Stellaris Family of microcontroller products.
//
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  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 991 of the Stellaris 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
//! Get GPIO interrupt number.
//!
//! \param ulPort base address of the selected 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.
//
//*****************************************************************************
#if defined(GROUP_getintnumber) || defined(BUILD_ALL)
long
GPIOGetIntNumber(unsigned long ulPort)
{
    unsigned int ulInt;

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

        case GPIO_PORTB_BASE:
        {
            ulInt = INT_GPIOB;
            break;
        }

        case GPIO_PORTC_BASE:
        {
            ulInt = INT_GPIOC;
            break;
        }

        case GPIO_PORTD_BASE:
        {
            ulInt = INT_GPIOD;
            break;
        }

        case GPIO_PORTE_BASE:
        {
            ulInt = INT_GPIOE;
            break;
        }

        default:
        {
            return(-1);
        }
    }

    //
    // Return GPIO interrupt number.
    //
    return(ulInt);
}
#else
extern long GPIOGetIntNumber(unsigned long ulPort);
#endif

//*****************************************************************************
//
//! Sets the direction and mode of the specified pins of the selected
//! GPIO port.
//!
//! \param ulPort base address of the selected GPIO port
//! \param ucPins bit-packed representation of the specified pins
//! \param ulPinIO pin direction and/or mode
//!
//! This function will set the specified pins 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 pins 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, etc.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_dirmodeset) || defined(BUILD_ALL) || defined(DOXYGEN)
void
GPIODirModeSet(unsigned long ulPort, unsigned char ucPins,
               unsigned long ulPinIO)
{
    //
    // Check the arguments.
    //
    ASSERT((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTD_BASE) ||
           (ulPort == GPIO_PORTE_BASE));
    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)));
}
#endif

//*****************************************************************************
//
//! Gets the direction and mode of a specified pin of the selected
//! GPIO port.
//!
//! \param ulPort base address of the selected GPIO port
//! \param ucPin pin number of the specified pin, relative to the selected
//! GPIO port.
//!
//! 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().
//
//*****************************************************************************
#if defined(GROUP_dirmodeget) || defined(BUILD_ALL) || defined(DOXYGEN)
unsigned long
GPIODirModeGet(unsigned long ulPort, unsigned char ucPin)
{
    unsigned long ulDir, ulAFSEL;

    //
    // Check the arguments.
    //
    ASSERT((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTD_BASE) ||
           (ulPort == GPIO_PORTE_BASE));
    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));
}
#endif

//*****************************************************************************
//
//! Sets the interrupt type for the specified pins of the selected GPIO
//! port.
//!
//! \param ulPort base address of the selected GPIO port
//! \param ucPins bit-packed representation of the specified pins
//! \param ulIntType specifies the type of interrupt trigger mechanism
//!
//! This function sets up the various interrupt trigger mechanisms for the
//! specified pins 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 pins 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, etc.
//!
//! \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.
//
//*****************************************************************************
#if defined(GROUP_inttypeset) || defined(BUILD_ALL) || defined(DOXYGEN)
void
GPIOIntTypeSet(unsigned long ulPort, unsigned char ucPins,
               unsigned long ulIntType)
{
    //
    // Check the arguments.
    //
    ASSERT((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTD_BASE) ||
           (ulPort == GPIO_PORTE_BASE));
    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)));
}
#endif

//*****************************************************************************
//
//! Gets the interrupt type for the specified pin of the selected GPIO
//! port.
//!
//! \param ulPort base address of the selected GPIO port
//! \param ucPin pin number of the specified pin, relative to the selected
//! GPIO port.
//!
//! 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().
//
//*****************************************************************************
#if defined(GROUP_inttypeget) || defined(BUILD_ALL) || defined(DOXYGEN)
unsigned long
GPIOIntTypeGet(unsigned long ulPort, unsigned char ucPin)
{
    unsigned long ulIBE, ulIS, ulIEV;

    //
    // Check the arguments.
    //
    ASSERT((ulPort == GPIO_PORTA_BASE) || (ulPort == GPIO_PORTB_BASE) ||
           (ulPort == GPIO_PORTC_BASE) || (ulPort == GPIO_PORTD_BASE) ||
           (ulPort == GPIO_PORTE_BASE));
    ASSERT(ucPin < 8);

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

    //
    // Return the pin interrupt type.
    //
    ulIBE = HWREG(ulPort + GPIO_O_IBE);
    ulIS = HWREG(ulPort + GPIO_O_IS);
    ulIEV = HWREG(ulPort + GPIO_O_IEV);
    return(((ulIBE & ucPin) ? 1 : 0) | ((ulIS & ucPin) ? 2 : 0) |
           ((ulIEV & ucPin) ? 4 : 0));
}
#endif

//*****************************************************************************
//
//! Sets the pad configuration for the specified pins of the selected GPIO
//! port.
//!
//! \param ulPort is the base address of the GPIO port.
//! \param ucPins bit-packed representation of the specified pins.
//! \param ulStrength specifies the output drive strength.
//! \param ulPinType specifies the pin type.
//!
//! This function sets the drive strength and type for the specified pins
//! on the selected GPIO port.  For pins configured as input ports, the
//! pad is configured as requested, but the only real effect on the input
//! is the configuration of the pull-up or pull-down termination.
//!
//! The parameter \e ulStrength can be one of the following values:
//!
//! - \b GPIO_STRENGTH_2MA
//! - \b GPIO_STRENGTH_4MA
//! - \b GPIO_STRENGTH_8MA
//! - \b GPIO_STRENGTH_8MA_SC
//!
//! where \b GPIO_STRENGTH_xMA specifies either 2, 4, or 8 mA output drive
//! strength, and \b GPIO_OUT_STRENGTH_8MA_SC specifies 8 mA output drive with
//! slew control.
//!
//! The parameter \e ulPinType can be one of the following values:
//!
//! - \b GPIO_PIN_TYPE_STD
//! - \b GPIO_PIN_TYPE_STD_WPU
//! - \b GPIO_PIN_TYPE_STD_WPD
//! - \b GPIO_PIN_TYPE_OD
//! - \b GPIO_PIN_TYPE_OD_WPU
//! - \b GPIO_PIN_TYPE_OD_WPD
//! - \b GPIO_PIN_TYPE_ANALOG

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文在线资源观看网站视频免费不卡| 亚洲无人区一区| 亚洲男人的天堂av| 日本欧洲一区二区| 成人性生交大片免费| 欧美日韩国产不卡| 国产精品国产自产拍高清av王其| 麻豆一区二区99久久久久| 99久久久久免费精品国产| 日韩无一区二区| 亚洲一区二区视频在线| 菠萝蜜视频在线观看一区| 日韩午夜av电影| 五月天国产精品| 在线一区二区三区四区五区 | 在线视频亚洲一区| 久久午夜羞羞影院免费观看| 亚洲成人7777| 91小视频在线| 国产精品久久久久久一区二区三区| 久久国产乱子精品免费女| 欧美浪妇xxxx高跟鞋交| 一区二区三区四区视频精品免费 | 欧美影视一区二区三区| 国产精品久久久久一区二区三区共 | 色婷婷综合久久久久中文| 26uuu色噜噜精品一区二区| 五月天一区二区三区| 日本韩国精品在线| 中文字幕在线不卡视频| 粉嫩aⅴ一区二区三区四区| 日本一区二区三区电影| 国产精品一区二区男女羞羞无遮挡| 777久久久精品| 日韩国产高清影视| 日韩一级成人av| 另类欧美日韩国产在线| 欧美大片免费久久精品三p| 日韩电影在线一区二区| 欧美一区二区三区思思人| 婷婷中文字幕综合| 91精品国产黑色紧身裤美女| 美美哒免费高清在线观看视频一区二区| 欧美久久久久久久久中文字幕| 亚洲成人免费影院| 日韩一区二区电影| 国产成人精品免费视频网站| 国产精品女主播在线观看| thepron国产精品| 亚洲少妇最新在线视频| 91成人免费电影| 石原莉奈一区二区三区在线观看 | 一本一道波多野结衣一区二区| 亚洲精品国产视频| 欧美精品123区| 久久精品国产网站| 日本一二三四高清不卡| 日本久久电影网| 免费在线一区观看| 国产精品色婷婷久久58| 欧美在线综合视频| 日本中文字幕一区二区有限公司| 日韩精品在线一区| 99热99精品| 五月激情丁香一区二区三区| 精品少妇一区二区| 91亚洲国产成人精品一区二三| 亚洲成人免费在线| 国产女同性恋一区二区| 欧美午夜理伦三级在线观看| 蜜桃传媒麻豆第一区在线观看| 中文字幕av一区二区三区高| 欧美天天综合网| 国产精品自拍av| 亚洲一区二区三区四区在线观看 | 国产91综合网| 午夜久久久久久| 国产精品无码永久免费888| 欧美综合一区二区| 国产毛片精品国产一区二区三区| 亚洲天堂av老司机| 精品91自产拍在线观看一区| 色爱区综合激月婷婷| 精品在线免费视频| 亚洲成人手机在线| 亚洲色图.com| 久久综合av免费| 欧美片网站yy| 91小视频免费看| 国产99久久久国产精品潘金| 日韩激情一二三区| 一区二区三区中文字幕| 日本一区二区三级电影在线观看| 在线播放欧美女士性生活| 色综合久久中文综合久久97| 国产ts人妖一区二区| 蜜桃久久久久久| 亚洲成人激情av| 中文字幕在线视频一区| 久久亚洲精精品中文字幕早川悠里 | 亚洲成人精品一区| 一区二区三区四区视频精品免费 | 日本伊人色综合网| 一区二区免费视频| 亚洲欧美激情小说另类| 国产精品网站一区| 久久久精品国产99久久精品芒果| 日韩午夜在线观看视频| 555夜色666亚洲国产免| 欧美日韩国产综合草草| 欧美撒尿777hd撒尿| 91传媒视频在线播放| 色欧美日韩亚洲| 一本到不卡精品视频在线观看| 成人h动漫精品一区二区| 国产精品自在在线| 国产成人8x视频一区二区| 国产精品一区在线观看乱码| 国产成人亚洲综合色影视| 国产精一品亚洲二区在线视频| 国产一区二区三区四| 国产电影一区二区三区| 国产白丝网站精品污在线入口| 国产99精品在线观看| 99久久精品一区| 色哟哟一区二区在线观看| 色婷婷av久久久久久久| 欧美日本一区二区| 欧美精品在线观看一区二区| 欧美成人高清电影在线| 久久综合久久99| 国产精品看片你懂得| 亚洲日本免费电影| 午夜精品久久久久久久99水蜜桃| 日韩中文字幕麻豆| 国模冰冰炮一区二区| www..com久久爱| 欧美性受xxxx黑人xyx| 欧美福利视频导航| 久久网站最新地址| 亚洲视频一区二区在线| 亚洲五月六月丁香激情| 狠狠色伊人亚洲综合成人| 成人看片黄a免费看在线| 色菇凉天天综合网| 日韩欧美二区三区| 国产精品久99| 日本在线不卡视频| 床上的激情91.| 欧美色精品在线视频| 欧美tickle裸体挠脚心vk| 国产精品三级在线观看| 亚洲成人av电影在线| 国产成人鲁色资源国产91色综| 色婷婷综合在线| 欧美一级理论片| 亚洲色图一区二区三区| 美女视频黄频大全不卡视频在线播放| 国产一区二区三区美女| 一本久久精品一区二区| 欧美成人精品二区三区99精品| 亚洲欧洲国产日韩| 免费在线欧美视频| 色综合久久天天| 精品国产精品一区二区夜夜嗨| 最新欧美精品一区二区三区| 美女一区二区视频| 色狠狠av一区二区三区| 久久精品在线免费观看| 日韩精品一级中文字幕精品视频免费观看| 国产精品中文字幕一区二区三区| 欧美亚洲综合色| 国产欧美va欧美不卡在线| 蜜臀精品久久久久久蜜臀| 欧美性一二三区| 亚洲婷婷综合色高清在线| 国产福利一区二区三区视频| 欧美一区二区三区喷汁尤物| 一区二区久久久久久| av在线免费不卡| 久久久久久黄色| 奇米色777欧美一区二区| 91麻豆文化传媒在线观看| 中文字幕精品—区二区四季| 国产一区激情在线| 5566中文字幕一区二区电影| 亚洲一区免费在线观看| 97久久人人超碰| 国产精品久久久久久久久久免费看| 极品少妇一区二区| 欧美一区三区四区| 亚洲成av人在线观看| 91在线观看成人| 亚洲天堂2016| 一本到高清视频免费精品| 亚洲激情五月婷婷| 色狠狠一区二区| 亚洲黄色小视频| 色老汉av一区二区三区| 亚洲人吸女人奶水|