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

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

?? pio.c

?? Atmel的AT91SAM9263-EK的TFT驅動的源程序
?? C
字號:
/* ----------------------------------------------------------------------------
 *         ATMEL Microcontroller Software Support  -  ROUSSET  -
 * ----------------------------------------------------------------------------
 * Copyright (c) 2006, Atmel Corporation

 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the disclaimer below.
 *
 * - Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the disclaimer below in the documentation and/or
 * other materials provided with the distribution.
 *
 * Atmel's name may not be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * ----------------------------------------------------------------------------
 */

//------------------------------------------------------------------------------
//         Headers
//------------------------------------------------------------------------------

#include "pio.h"
#include <board.h>

//------------------------------------------------------------------------------
//         Internal definitions
//------------------------------------------------------------------------------
/// \internal Returns the current value of a register.
#define READ(peripheral, register)          (peripheral->register)
/// \internal Modifies the current value of a register.
#define WRITE(peripheral, register, value)  (peripheral->register = value)

//------------------------------------------------------------------------------
//         Internal functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// Configures one or more pin(s) of a PIO controller as being controlled by
/// peripheral A. Optionally, the corresponding internal pull-up(s) can be
/// enabled.
/// \param pio  Pointer to a PIO controller.
/// \param mask  Bitmask of one or more pin(s) to configure.
/// \param enablePullUp  Indicates if the pin(s) internal pull-up shall be
///                      configured.
//------------------------------------------------------------------------------
static void PIO_SetPeripheralA(AT91S_PIO *pio,
                               unsigned int mask,
                               unsigned char enablePullUp)
{
    // Disable interrupts on the pin(s)
    WRITE(pio, PIO_IDR, mask);

    // Enable the pull-up(s) if necessary
    if (enablePullUp) {

        WRITE(pio, PIO_PPUER, mask);
    }
    else {

        WRITE(pio, PIO_PPUDR, mask);
    }

    // Configure pin
    WRITE(pio, PIO_ASR, mask);
    WRITE(pio, PIO_PDR, mask);
}

//------------------------------------------------------------------------------
/// Configures one or more pin(s) of a PIO controller as being controlled by
/// peripheral A. Optionally, the corresponding internal pull-up(s) can be
/// enabled.
/// \param pio  Pointer to a PIO controller.
/// \param mask  Bitmask of one or more pin(s) to configure.
/// \param enablePullUp  Indicates if the pin(s) internal pull-up shall be
///                      configured.
//------------------------------------------------------------------------------
static void PIO_SetPeripheralB(AT91S_PIO *pio,
                               unsigned int mask,
                               unsigned char enablePullUp)
{
    // Disable interrupts on the pin(s)
    WRITE(pio, PIO_IDR, mask);

    // Enable the pull-up(s) if necessary
    if (enablePullUp) {

        WRITE(pio, PIO_PPUER, mask);
    }
    else {

        WRITE(pio, PIO_PPUDR, mask);
    }

    // Configure pin
    WRITE(pio, PIO_BSR, mask);
    WRITE(pio, PIO_PDR, mask);
}

//------------------------------------------------------------------------------
/// Configures one or more pin(s) or a PIO controller as inputs. Optionally,
/// the corresponding internal pull-up(s) and glitch filter(s) can be
/// enabled.
/// \param pio  Pointer to a PIO controller.
/// \param mask  Bitmask indicating which pin(s) to configure as input(s).
/// \param enablePullUp  Indicates if the internal pull-up(s) must be enabled.
/// \param enableFilter  Indicates if the glitch filter(s) must be enabled.
//------------------------------------------------------------------------------
static void PIO_SetInput(AT91S_PIO *pio,
                         unsigned int mask,
                         unsigned char enablePullUp,
                         unsigned char enableFilter)
{
    // Disable interrupts
    WRITE(pio, PIO_IDR, mask);

    // Enable pull-up(s) if necessary
    if (enablePullUp) {
    
        WRITE(pio, PIO_PPUER, mask);
    }
    else {
    
        WRITE(pio, PIO_PPUDR, mask);
    }

    // Enable filter(s) if necessary
    if (enableFilter) {
    
        WRITE(pio, PIO_IFER, mask);
    }
    else {
    
        WRITE(pio, PIO_IFDR, mask);
    }

    // Configure pin as input
    WRITE(pio, PIO_ODR, mask);
    WRITE(pio, PIO_PER, mask);
}

//------------------------------------------------------------------------------
/// Configures one or more pin(s) of a PIO controller as outputs, with the
/// given default value. Optionally, the multi-drive feature can be enabled
/// on the pin(s).
/// \param pio  Pointer to a PIO controller.
/// \param mask  Bitmask indicating which pin(s) to configure.
/// \param defaultValue  Default level on the pin(s).
/// \param enableMultiDrive  Indicates if the pin(s) shall be configured as
///                          open-drain.
/// \param enablePullUp  Indicates if the pin shall have its pull-up activated.
//------------------------------------------------------------------------------
static void PIO_SetOutput(AT91S_PIO *pio,
                          unsigned int mask,
                          unsigned char defaultValue,
                          unsigned char enableMultiDrive,
                          unsigned char enablePullUp)
{
    // Disable interrupts
    WRITE(pio, PIO_IDR, mask);

    // Enable pull-up(s) if necessary
    if (enablePullUp) {
    
        WRITE(pio, PIO_PPUER, mask);
    }
    else {
    
        WRITE(pio, PIO_PPUDR, mask);
    }

    // Enable multi-drive if necessary
    if (enableMultiDrive) {
    
        WRITE(pio, PIO_MDER, mask);
    }
    else {
    
        WRITE(pio, PIO_MDDR, mask);
    }

    // Set default value
    if (defaultValue) {

        WRITE(pio, PIO_SODR, mask);
    }
    else {

        WRITE(pio, PIO_CODR, mask);
    }

    // Configure pin(s) as output(s)
    WRITE(pio, PIO_OER, mask);
    WRITE(pio, PIO_PER, mask);
}

//------------------------------------------------------------------------------
//         Exported functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// Configures a list of Pin instances, which can either hold a single pin or a 
/// group of pins, depending on the mask value; all pins are configured by this 
/// function.
/// Returns 1 if the configuration has been performed successfully; otherwise 0.
/// \param list  Pointer to a list of Pin instances.
/// \param size  Size of the Pin list (see <PIO_LISTSIZE>).
//------------------------------------------------------------------------------
unsigned char PIO_Configure(const Pin *list, unsigned int size)
{
    // Configure pins
    while (size > 0) {
    
        switch (list->type) {
    
            case PIO_PERIPH_A:
                PIO_SetPeripheralA(list->pio,
                                   list->mask,
                                   (list->attribute & PIO_PULLUP) ? 1 : 0);
                break;
    
            case PIO_PERIPH_B:
                PIO_SetPeripheralB(list->pio,
                                   list->mask,
                                   (list->attribute & PIO_PULLUP) ? 1 : 0);
                break;
    
            case PIO_INPUT:
                AT91C_BASE_PMC->PMC_PCER = 1 << list->id;
                PIO_SetInput(list->pio,
                             list->mask,
                             (list->attribute & PIO_PULLUP) ? 1 : 0,
                             (list->attribute & PIO_DEGLITCH)? 1 : 0);
                break;
    
            case PIO_OUTPUT_0:
            case PIO_OUTPUT_1:
                PIO_SetOutput(list->pio,
                              list->mask,
                              (list->type == PIO_OUTPUT_1),
                              (list->attribute & PIO_OPENDRAIN) ? 1 : 0,
                              (list->attribute & PIO_PULLUP) ? 1 : 0);
                break;
    
            default: return 0;
        }

        list++;
        size--;
    }

    return 1;
}

//------------------------------------------------------------------------------
/// Sets a high output level on one or more pin(s) (if configured as output(s)).
/// \param pin  Pointer to a Pin instance describing one or more pins.
//------------------------------------------------------------------------------
void PIO_Set(const Pin *pin)
{
    WRITE(pin->pio, PIO_SODR, pin->mask);
}

//------------------------------------------------------------------------------
/// Sets a low output level on one or more pin(s) (if configured as output(s)).
/// \param pin  Pointer to a Pin instance describing one or more pins.
//------------------------------------------------------------------------------
void PIO_Clear(const Pin *pin)
{
    WRITE(pin->pio, PIO_CODR, pin->mask);
}

//------------------------------------------------------------------------------
/// Returns 1 if one or more PIO of the given Pin instance currently have a high
/// level; otherwise returns 0.
/// \param pin  Pointer to a Pin instance describing one or more pins.
//------------------------------------------------------------------------------
unsigned char PIO_Get(const Pin *pin)
{
    unsigned int reg;
    if ((pin->type == PIO_OUTPUT_0) || (pin->type == PIO_OUTPUT_1)) {

        reg = READ(pin->pio, PIO_ODSR);
    }
    else {

        reg = READ(pin->pio, PIO_PDSR);
    }

    if ((reg & pin->mask) == 0) {

        return 0;
    }
    else {

        return 1;
    }
}


//------------------------------------------------------------------------------
/// Returns 1 if one or more PIO of the given Pin data to be driven on the I/O line
/// level; otherwise returns 0.
/// \param pin  Pointer to a Pin instance describing one or more pins.
//------------------------------------------------------------------------------
unsigned char PIO_GetOutputDataStatus(const Pin *pin)
{
    if ((READ(pin->pio, PIO_ODSR) & pin->mask) == 0) {

        return 0;
    }
    else {

        return 1;
    }
}

//------------------------------------------------------------------------------
/// Returns the value of ISR for the PIO controller of the pin.
/// Reading this register acknoledges all the ITs.
/// \param pin  Pointer to a Pin instance describing one or more pins.
//------------------------------------------------------------------------------
unsigned int PIO_GetISR(const Pin *pin)
{
    return (READ(pin->pio, PIO_ISR));
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区国产| 欧美二区三区的天堂| 91久久精品日日躁夜夜躁欧美| 91精品国产91久久久久久一区二区 | 99天天综合性| 日韩一级二级三级| 亚洲国产婷婷综合在线精品| 成人av午夜影院| 2020国产成人综合网| 日韩精品久久理论片| 91网站最新网址| 亚洲一区二区三区中文字幕 | 亚洲第一狼人社区| 丁香婷婷综合色啪| 日韩欧美国产不卡| 五月天一区二区| 日本韩国欧美国产| 中文字幕日韩av资源站| 国内精品视频一区二区三区八戒| 555www色欧美视频| 亚洲国产一区二区a毛片| 色综合久久99| 最新热久久免费视频| 成人黄色片在线观看| 国产无人区一区二区三区| 国内精品视频666| 26uuu久久综合| 国产成人免费视| 中文字幕免费观看一区| 国产精品自拍一区| 久久精品视频在线看| 国产盗摄一区二区三区| 欧美国产日产图区| www.亚洲在线| 中文字幕中文在线不卡住| 成人网页在线观看| 亚洲日本电影在线| 91丝袜美腿高跟国产极品老师 | 日韩一区二区电影网| 免费在线观看视频一区| 欧美一级日韩免费不卡| 蜜桃视频一区二区三区在线观看| 欧美一区二区在线看| 久久精品国产免费看久久精品| 日韩精品一区二区三区在线播放| 久99久精品视频免费观看| 久久久久久久电影| 成人高清视频免费观看| 亚洲色图欧美激情| 欧美日韩国产一区| 激情五月婷婷综合| 国产精品国产三级国产普通话三级| jlzzjlzz亚洲女人18| 亚洲1区2区3区视频| 久久亚洲影视婷婷| av男人天堂一区| 丝袜美腿亚洲色图| 国产午夜久久久久| 在线免费av一区| 久久国产欧美日韩精品| 中文字幕永久在线不卡| 91超碰这里只有精品国产| 国产成人h网站| 一区二区三区视频在线看| 欧美成人一区二区三区| av资源站一区| 免费在线看一区| 亚洲视频资源在线| 精品国产一区二区三区久久影院| 99re成人在线| 日韩av电影免费观看高清完整版在线观看 | 色综合久久综合中文综合网| 日韩中文字幕区一区有砖一区| 欧美mv日韩mv国产网站app| 99久久国产综合精品色伊| 蜜臀a∨国产成人精品| 伊人开心综合网| 久久久不卡影院| 777奇米四色成人影色区| 成人黄色av网站在线| 麻豆成人在线观看| 一区二区三区在线观看欧美| 国产亚洲一二三区| 3751色影院一区二区三区| 91免费版在线| 粉嫩av一区二区三区| 奇米精品一区二区三区在线观看一| 国产精品萝li| 国产日韩欧美精品一区| 91精品国产aⅴ一区二区| 欧美性猛交xxxx黑人交| 91麻豆精品在线观看| 狠狠色综合色综合网络| 日韩主播视频在线| 亚洲一卡二卡三卡四卡无卡久久| 国产精品成人一区二区三区夜夜夜| 日韩欧美在线网站| 欧美精品精品一区| 欧美性生交片4| 一本一本大道香蕉久在线精品| 国产一区二区三区观看| 久久精品999| 日韩不卡一二三区| 亚洲电影激情视频网站| 欧美aaaaa成人免费观看视频| 中文字幕中文字幕一区二区| 国产视频一区在线观看| 久久久久97国产精华液好用吗| 91麻豆精品久久久久蜜臀| 欧美精品自拍偷拍| 欧美日韩午夜在线| 欧美伦理电影网| 91超碰这里只有精品国产| 777奇米四色成人影色区| 91精品国产综合久久久蜜臀粉嫩 | 亚洲一区二区三区中文字幕 | 国产调教视频一区| 国产欧美一二三区| 亚洲国产精华液网站w| 亚洲国产精品传媒在线观看| 中文字幕av一区二区三区| 国产精品久久国产精麻豆99网站| 亚洲国产成人午夜在线一区| 国产精品国产三级国产a| 亚洲欧美怡红院| 亚洲在线观看免费| 天天影视网天天综合色在线播放| 视频在线观看一区二区三区| 日产欧产美韩系列久久99| 精品亚洲国内自在自线福利| 国产精品12区| 91免费看`日韩一区二区| 欧美偷拍一区二区| 欧美日本视频在线| 欧美tickling网站挠脚心| 欧美精品一区在线观看| 中文字幕免费在线观看视频一区| 亚洲免费三区一区二区| 亚洲成av人片| 国产成人亚洲综合a∨婷婷图片| 成人激情开心网| 8x8x8国产精品| 国产日韩一级二级三级| 一区二区三区四区精品在线视频| 日本不卡的三区四区五区| 精品无人码麻豆乱码1区2区 | 91精品国产日韩91久久久久久| 欧美xfplay| 亚洲欧美日韩中文字幕一区二区三区 | 青青草伊人久久| 国产成人午夜视频| 91福利社在线观看| 精品久久久久久久久久久久久久久| 国产午夜精品一区二区三区四区| 亚洲欧美视频在线观看视频| 蜜臀a∨国产成人精品| 成人av高清在线| 欧美一二区视频| 亚洲欧洲成人自拍| 久久国产福利国产秒拍| 在线看日本不卡| 久久精品免费在线观看| 五月婷婷激情综合| av在线不卡观看免费观看| 欧美成人官网二区| 亚洲制服丝袜在线| 成人av资源网站| 精品国产一区二区三区久久影院| 亚洲综合色丁香婷婷六月图片| 国产最新精品精品你懂的| 欧美中文字幕一区| 国产精品拍天天在线| 国内成+人亚洲+欧美+综合在线 | 国产精品18久久久久久vr| 欧美日韩国产综合视频在线观看| 国产精品福利一区二区三区| 久久激情五月激情| 欧美男男青年gay1069videost| 最近日韩中文字幕| 国产99久久久国产精品潘金| 日韩欧美中文字幕制服| 天天操天天干天天综合网| 99re这里都是精品| 中文字幕第一区| 国产suv精品一区二区883| 337p粉嫩大胆噜噜噜噜噜91av| 亚洲成av人片在www色猫咪| 一本一本大道香蕉久在线精品 | 久久视频一区二区| 秋霞av亚洲一区二区三| 欧美日本韩国一区| 亚洲成人你懂的| 欧美日韩精品一区二区天天拍小说| 亚洲日本va午夜在线影院| 成人av在线播放网站| 日韩一区在线播放| 色综合一区二区| 91美女视频网站| 亚洲欧美欧美一区二区三区| eeuss鲁片一区二区三区在线观看|