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

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

?? gpio.c

?? Stellaris公司推出1美元ARM,這是Stellaris驅動庫源程序
?? 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 920 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一区二区三区免费野_久草精品视频
国产精品123| 国产精品免费av| 欧美aaaaa成人免费观看视频| 91影院在线免费观看| 亚洲欧美在线观看| 国产一区亚洲一区| 国产精品无码永久免费888| 国产精品一二三| 久久婷婷国产综合国色天香| 国产黄色精品视频| 国产精品日产欧美久久久久| 不卡一区二区三区四区| 欧美一区二区成人| 国产精品538一区二区在线| 日本一区二区三级电影在线观看 | 国产精品成人一区二区三区夜夜夜| 国产精品888| 国产精品视频一二| 成人激情免费网站| 偷拍日韩校园综合在线| 日韩三级免费观看| 国产精品自拍av| 亚洲伦理在线精品| 欧美精品123区| 久久国产综合精品| 日韩av网站在线观看| 日韩一级高清毛片| 国产精品一区二区免费不卡| 亚洲免费在线视频一区 二区| 欧美精品久久一区二区三区| 久久国产精品色婷婷| 亚洲欧洲一区二区三区| 欧美日韩在线三区| 精品一区二区在线播放| 欧美变态tickling挠脚心| 成人小视频免费在线观看| 亚洲激情男女视频| 欧美大度的电影原声| av色综合久久天堂av综合| 亚洲午夜一区二区| 久久综合色婷婷| 色视频一区二区| 一区二区三国产精华液| 日韩欧美国产综合| av资源网一区| 日韩电影在线观看电影| 国产精品美女久久久久久久| 欧美性大战久久久久久久蜜臀| 久久国产生活片100| 亚洲日穴在线视频| 精品国产乱码久久久久久老虎 | 欧美这里有精品| 免费欧美在线视频| 亚洲色图一区二区三区| 精品国产一区二区三区av性色| 99热国产精品| 国产一区中文字幕| 石原莉奈在线亚洲三区| 亚洲私人黄色宅男| 欧美精品123区| av激情综合网| 国内成人自拍视频| 三级不卡在线观看| 欧美国产精品一区| 91精品国模一区二区三区| 成人av动漫网站| 国产美女在线观看一区| 亚洲资源中文字幕| 综合电影一区二区三区| 久久亚洲欧美国产精品乐播| 欧美日韩高清不卡| 91看片淫黄大片一级| 国产精品18久久久久久久网站| 日韩精品一卡二卡三卡四卡无卡| 亚洲欧洲av在线| 国产欧美日本一区视频| 欧美哺乳videos| 精品视频999| 欧美性猛片aaaaaaa做受| 成人av电影在线观看| 国产91精品入口| 日本视频中文字幕一区二区三区| 亚洲国产一二三| 一区二区三区色| 一区二区三区精品视频| 亚洲人快播电影网| 综合电影一区二区三区| 中文字幕亚洲一区二区av在线| 中文字幕中文字幕一区二区| 亚洲丝袜自拍清纯另类| 亚洲精品国产a| 日韩国产欧美视频| 国内一区二区视频| 成人av免费网站| 欧美性大战久久久久久久| 欧美福利视频导航| 26uuu亚洲综合色| 国产精品久久久久久久裸模| 亚洲欧美另类久久久精品| 性做久久久久久久免费看| 久久99精品久久久久婷婷| 国产+成+人+亚洲欧洲自线| 色综合久久久久综合体桃花网| 欧美色图在线观看| 精品美女一区二区三区| 国产精品剧情在线亚洲| 亚洲一区二区三区四区在线观看| 日本中文字幕一区| 国产成人av福利| 91国产成人在线| 日韩久久免费av| 国产精品电影院| 日韩av高清在线观看| 国产.欧美.日韩| 欧美精品日韩精品| 国产精品欧美综合在线| 亚洲mv大片欧洲mv大片精品| 精品一二三四在线| 91蝌蚪porny九色| 精品国产亚洲在线| 伊人一区二区三区| 精品亚洲porn| 日本韩国精品在线| 久久亚洲精品小早川怜子| 依依成人精品视频| 国产成人精品免费看| 欧美精品 日韩| 亚洲精品亚洲人成人网| 激情综合亚洲精品| 在线观看91精品国产入口| 久久久久久久久免费| 亚洲第四色夜色| 成人app在线| 久久亚洲精精品中文字幕早川悠里 | 亚洲午夜精品网| 国产成人av电影在线| 91精品在线免费| 一区二区三区四区av| 成人av网站大全| 国产亚洲欧美一级| 日韩和欧美一区二区三区| 97超碰欧美中文字幕| 久久久久久久综合狠狠综合| 日韩精品乱码av一区二区| 成人精品视频网站| 精品国产乱码久久| 视频一区二区三区在线| 欧美三级蜜桃2在线观看| 日韩毛片一二三区| 成人免费视频网站在线观看| 26uuuu精品一区二区| 男人的天堂久久精品| 4438x成人网最大色成网站| 一区二区三区日韩| 色综合色狠狠综合色| 中文字幕一区二区在线播放| 成人理论电影网| 国产视频视频一区| 韩国成人在线视频| 精品电影一区二区| 麻豆精品国产91久久久久久| 欧美二区乱c少妇| 五月综合激情网| 欧美精品日韩综合在线| 三级在线观看一区二区| 91精品国产综合久久久久久久 | 日韩午夜精品电影| 日韩国产高清在线| 69精品人人人人| 另类小说一区二区三区| 欧美成人国产一区二区| 麻豆精品视频在线观看免费| 精品国产3级a| 国产一二精品视频| 国产精品久久一卡二卡| 99久久er热在这里只有精品15 | 欧美va亚洲va香蕉在线| 蜜臀av性久久久久av蜜臀妖精 | 成人免费观看男女羞羞视频| 亚洲国产精品ⅴa在线观看| 成人精品视频一区| 亚洲色图视频免费播放| 欧美亚洲日本一区| 午夜影院久久久| 欧美大片日本大片免费观看| 国产乱人伦偷精品视频不卡 | 久久精品国产第一区二区三区| 精品国产一区二区三区不卡 | 国产欧美一区二区三区沐欲 | 亚洲一区二区视频在线| 91麻豆精品国产91久久久久久| 蜜臀va亚洲va欧美va天堂 | 一区二区视频在线看| 欧美视频一区二区三区四区| 蜜臀av一区二区在线免费观看| 26uuu国产日韩综合| 色先锋aa成人| 美女视频免费一区| 国产精品国产馆在线真实露脸| 欧美私模裸体表演在线观看|