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

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

?? gpio.c

?? 飛利浦LM3S系列ARM的庫文件,在進行arm開發時所必須的庫文件,直接加到工程中,一般不必修改.
?? 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 687 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.
//
//*****************************************************************************
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);
}

//*****************************************************************************
//
//! 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.
//
//*****************************************************************************
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)));
}

//*****************************************************************************
//
//! 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().
//
//*****************************************************************************
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));
}

//*****************************************************************************
//
//! 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.
//
//*****************************************************************************
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)));
}

//*****************************************************************************
//
//! 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().
//
//*****************************************************************************
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));
}

//*****************************************************************************
//
//! 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜伦欧美伦电影理论片| 欧美激情一区二区| 男人的天堂亚洲一区| 欧美一区二区性放荡片| 美洲天堂一区二卡三卡四卡视频| 欧美日韩1234| 国内久久精品视频| 国产精品不卡一区| 欧美三级中文字幕| 韩国成人精品a∨在线观看| 国产欧美精品国产国产专区| 99riav久久精品riav| 亚洲成人一区在线| 久久久国产精品午夜一区ai换脸| 不卡一区在线观看| 日韩综合一区二区| 久久精品一二三| 欧美亚洲动漫制服丝袜| 激情图片小说一区| 亚洲欧美电影一区二区| 日韩午夜在线观看视频| 粉嫩av亚洲一区二区图片| 亚洲电影一级黄| 亚洲美女在线国产| 日韩欧美色电影| 99re66热这里只有精品3直播| 亚洲成av人片一区二区| 国产亚洲福利社区一区| 欧美理论片在线| 成人黄色软件下载| 麻豆精品精品国产自在97香蕉| 18涩涩午夜精品.www| 精品美女一区二区| 欧美日韩亚洲不卡| 9色porny自拍视频一区二区| 免费成人美女在线观看| 亚洲精品国产精华液| 久久免费电影网| 欧美一区二区三区精品| 91久久香蕉国产日韩欧美9色| 久久99久国产精品黄毛片色诱| 一区二区日韩av| 中国av一区二区三区| 精品国产乱码久久久久久图片 | 日韩av网站免费在线| 国产精品久久久久一区二区三区共| 欧美在线免费观看亚洲| 成人高清av在线| 国产精品白丝jk黑袜喷水| 毛片av一区二区| 午夜精品久久久久影视| 亚洲精品乱码久久久久久黑人| 国产婷婷精品av在线| 26uuu色噜噜精品一区| 欧美一区二区三区在线看| 欧美三级日韩三级国产三级| 91免费观看国产| 成人av免费在线观看| 国产69精品久久99不卡| 国产一区二区三区四区五区美女 | 七七婷婷婷婷精品国产| 亚洲制服丝袜av| 亚洲三级免费电影| 自拍偷自拍亚洲精品播放| 国产精品久久久久影院色老大| 久久久久久99久久久精品网站| 日韩免费高清av| 欧美电视剧免费全集观看| 777亚洲妇女| 777久久久精品| 51精品视频一区二区三区| 欧美丰满高潮xxxx喷水动漫| 欧美影视一区二区三区| 欧美在线啊v一区| 欧美在线免费观看视频| 欧美吞精做爰啪啪高潮| 欧美军同video69gay| 欧美精品国产精品| 日韩一区二区三区三四区视频在线观看| 欧美无砖专区一中文字| 91精品国模一区二区三区| 中文字幕不卡在线观看| 国产精品精品国产色婷婷| 18成人在线观看| 亚洲最大成人综合| 亚洲va欧美va天堂v国产综合| 丝瓜av网站精品一区二区| 久久精品72免费观看| 国内成人免费视频| aaa欧美大片| 欧美日韩精品免费| wwwwxxxxx欧美| 亚洲视频1区2区| 日日夜夜免费精品视频| 国产最新精品免费| 99国产欧美另类久久久精品| 91行情网站电视在线观看高清版| 欧美午夜宅男影院| 亚洲精品在线网站| 亚洲免费av高清| 人人爽香蕉精品| 成熟亚洲日本毛茸茸凸凹| 在线一区二区观看| 欧美xxx久久| 亚洲欧美日韩在线播放| 日本系列欧美系列| 成人激情小说网站| 制服丝袜在线91| 国产欧美日韩亚州综合 | 91精品福利在线一区二区三区 | 成人欧美一区二区三区黑人麻豆| 亚洲国产日韩一区二区| 国产一区二区三区观看| 91国偷自产一区二区三区成为亚洲经典| 91精品蜜臀在线一区尤物| 国产精品免费看片| 毛片av一区二区| 日本道色综合久久| 国产香蕉久久精品综合网| 亚洲成人午夜电影| 成人午夜视频在线观看| 91精品国模一区二区三区| 中文字幕一区二区三区乱码在线| 免费人成网站在线观看欧美高清| 99免费精品在线| 久久久久久久网| 亚洲aaa精品| 91无套直看片红桃| 久久免费偷拍视频| 日本伊人色综合网| 91亚洲国产成人精品一区二区三| 精品美女一区二区三区| 亚洲二区在线观看| 91麻豆视频网站| 国产日本欧美一区二区| 免费精品视频在线| 欧美日韩一区二区三区视频| 中文字幕一区二区视频| 国产一区二区三区日韩| 欧美一区二区三区视频在线观看| 一区二区三区视频在线看| 成人av先锋影音| 久久久蜜桃精品| 看电视剧不卡顿的网站| 欧美喷潮久久久xxxxx| 一区av在线播放| 欧美一级淫片007| 亚洲大型综合色站| 日本电影亚洲天堂一区| 亚洲视频免费在线| 99视频精品在线| 国产精品天美传媒| 国产a精品视频| 久久久久久久久久久电影| 久久精品国产精品亚洲精品| 欧美伦理电影网| 亚洲韩国一区二区三区| 欧美亚洲尤物久久| 亚洲大尺度视频在线观看| 色伊人久久综合中文字幕| 中文字幕一区视频| 91亚洲精品一区二区乱码| 国产精品嫩草久久久久| 波多野结衣一区二区三区| 国产精品成人午夜| 94色蜜桃网一区二区三区| 1000精品久久久久久久久| 色噜噜狠狠成人网p站| 亚洲动漫第一页| 91精品国产91久久久久久一区二区| 日韩电影免费在线| 精品国产免费视频| 国产精品88av| 国产精品三级av| 日本丶国产丶欧美色综合| 亚洲a一区二区| 日韩美女视频一区二区在线观看| 久久精品国产一区二区三区免费看| 欧美xxxx在线观看| 东方欧美亚洲色图在线| 亚洲三级理论片| 欧美日韩激情一区二区三区| 日韩成人一区二区| 国产网站一区二区| 91免费视频观看| 亚洲1区2区3区视频| 精品国产露脸精彩对白| 波多野洁衣一区| 亚洲电影第三页| 久久久三级国产网站| 99国产精品久久| 日本网站在线观看一区二区三区 | 国产精品视频观看| 在线中文字幕不卡| 热久久久久久久| 国产精品免费免费| 在线电影欧美成精品| 国产乱码精品一区二区三区忘忧草 | 久久婷婷综合激情| 91福利区一区二区三区|