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

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

?? pio.c

?? iso7816 interface for at91sam9263ek,其中編輯環境為keil for arm mdk
?? C
字號:
/* ----------------------------------------------------------------------------
 *         ATMEL Microcontroller Software Support 
 * ----------------------------------------------------------------------------
 * Copyright (c) 2008, 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.
 *
 * 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>

//------------------------------------------------------------------------------
//         Local 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)
    pio->PIO_IDR = mask;

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

        pio->PIO_PPUER = mask;
    }
    else {

        pio->PIO_PPUDR = mask;
    }

    // Configure pin
    pio->PIO_ASR = mask;
    pio->PIO_PDR = mask;
}

//------------------------------------------------------------------------------
/// Configures one or more pin(s) of a PIO controller as being controlled by
/// peripheral B. 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)
    pio->PIO_IDR = mask;

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

        pio->PIO_PPUER = mask;
    }
    else {

        pio->PIO_PPUDR = mask;
    }

    // Configure pin
    pio->PIO_BSR = mask;
    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
    pio->PIO_IDR = mask;

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

    // Enable filter(s) if necessary
    if (enableFilter) {
    
        pio->PIO_IFER = mask;
    }
    else {
    
        pio->PIO_IFDR = mask;
    }

    // Configure pin as input
    pio->PIO_ODR = mask;
    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
    pio->PIO_IDR = mask;

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

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

    // Set default value
    if (defaultValue) {

        pio->PIO_SODR = mask;
    }
    else {

        pio->PIO_CODR = mask;
    }

    // Configure pin(s) as output(s)
    pio->PIO_OER = mask;
    pio->PIO_PER = mask;
}

//------------------------------------------------------------------------------
//         Global Functions
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
/// Configures a list of Pin instances, each of which can either hold a single
/// pin or a group of pins, depending on the mask value; all pins are configured
/// by this function. The size of the array must also be provided and is easily
/// computed using PIO_LISTSIZE whenever its length is not known in advance.
/// \param list  Pointer to a list of Pin instances.
/// \param size  Size of the Pin list (calculated using PIO_LISTSIZE).
/// \return 1 if the pins have been configured properly; otherwise 0.
//------------------------------------------------------------------------------
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 all the PIOs defined in the given Pin instance.
/// This has no immediate effects on PIOs that are not output, but the PIO
/// controller will memorize the value they are changed to outputs.
/// \param pin  Pointer to a Pin instance describing one or more pins.
//------------------------------------------------------------------------------
void PIO_Set(const Pin *pin)
{
    pin->pio->PIO_SODR = pin->mask;
}

//------------------------------------------------------------------------------
/// Sets a low output level on all the PIOs defined in the given Pin instance.
/// This has no immediate effects on PIOs that are not output, but the PIO
/// controller will memorize the value they are changed to outputs.
/// \param pin  Pointer to a Pin instance describing one or more pins.
//------------------------------------------------------------------------------
void PIO_Clear(const Pin *pin)
{
    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. This method returns the actual value that is
/// being read on the pin. To return the supposed output value of a pin, use
/// PIO_GetOutputDataStatus() instead.
/// \param pin  Pointer to a Pin instance describing one or more pins.
/// \return 1 if the Pin instance contains at least one PIO that currently has
/// a high level; otherwise 0.
//------------------------------------------------------------------------------
unsigned char PIO_Get(const Pin *pin)
{
    unsigned int reg;
    if ((pin->type == PIO_OUTPUT_0) || (pin->type == PIO_OUTPUT_1)) {

        reg = pin->pio->PIO_ODSR;
    }
    else {

        reg = 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 are configured to output a
/// high level (even if they are not output).
/// To get the actual value of the pin, use PIO_Get() instead.
/// \param pin  Pointer to a Pin instance describing one or more pins.
/// \return 1 if the Pin instance contains at least one PIO that is configured
/// to output a high level; otherwise 0.
//------------------------------------------------------------------------------
unsigned char PIO_GetOutputDataStatus(const Pin *pin)
{
    if ((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 (pin->pio->PIO_ISR);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
狠狠色狠狠色综合| 色视频欧美一区二区三区| av不卡在线播放| 精品久久久网站| 婷婷亚洲久悠悠色悠在线播放| 风间由美中文字幕在线看视频国产欧美| 欧美日韩精品欧美日韩精品 | 日韩精品中文字幕一区二区三区| 成人免费视频在线观看| 国产在线观看一区二区| 欧美日韩电影在线播放| 国产精品大尺度| 激情五月婷婷综合| 日韩一区二区三区电影在线观看| 亚洲日本青草视频在线怡红院 | 天堂精品中文字幕在线| 99r精品视频| ●精品国产综合乱码久久久久| 国模一区二区三区白浆| 日韩一区二区三免费高清| 亚洲丰满少妇videoshd| 91国偷自产一区二区三区观看| 一区二区中文视频| 粉嫩aⅴ一区二区三区四区五区| 久久久久一区二区三区四区| 久久99热99| 亚洲精品在线三区| 国产精品一品二品| 久久精品人人做人人爽人人| 国产一区福利在线| 国产精品无人区| 99re这里都是精品| 一区二区三区免费看视频| 欧美无砖专区一中文字| 日韩精品电影一区亚洲| 欧美一级片免费看| 蜜桃91丨九色丨蝌蚪91桃色| 精品av久久707| 成人午夜视频免费看| 亚洲欧美日韩电影| 欧美日韩一区二区三区免费看| 午夜精品在线视频一区| 日韩精品影音先锋| 国产精品香蕉一区二区三区| 国产精品二三区| 在线免费观看一区| 久久国产乱子精品免费女| 久久久三级国产网站| 成人app在线观看| 亚洲激情av在线| 欧美一区二区三区啪啪| 国产麻豆午夜三级精品| 亚洲欧美日韩国产一区二区三区 | 国产亚洲欧美色| 白白色 亚洲乱淫| 日韩高清一区在线| 久久久综合视频| 色婷婷av一区二区三区大白胸 | 亚洲a一区二区| 2021久久国产精品不只是精品| 97精品国产露脸对白| 午夜精品一区在线观看| 久久精品人人爽人人爽| 欧美在线制服丝袜| 国产成人免费视频一区| 亚洲综合免费观看高清完整版在线| 欧美国产日本视频| 精品视频一区 二区 三区| 国产成人在线色| 亚洲一区二区偷拍精品| www亚洲一区| 欧美日韩激情在线| 福利91精品一区二区三区| 午夜精品一区二区三区电影天堂 | 精品制服美女丁香| 亚洲美女免费在线| 欧美www视频| 在线不卡中文字幕| 成人黄色av电影| 久久成人综合网| 一区二区免费看| 国产资源精品在线观看| 日韩精品一区二区三区视频在线观看| 成人污污视频在线观看| 美女视频免费一区| 一区二区三区不卡视频| 欧美激情资源网| 精品国产一区二区精华| 91麻豆精品国产91久久久久久久久 | 亚洲免费高清视频在线| 久久久三级国产网站| 在线播放亚洲一区| 欧美在线你懂得| 91亚洲精品乱码久久久久久蜜桃| 狠狠色丁香久久婷婷综合丁香| 亚洲成人av福利| 一区二区三区加勒比av| 中文字幕在线观看不卡视频| 欧美va亚洲va香蕉在线| 欧美一区二区三区在| 美腿丝袜亚洲综合| 亚洲日本乱码在线观看| 国产精品入口麻豆九色| 久久久国产精品午夜一区ai换脸| 欧美一级精品大片| 日韩一区二区麻豆国产| 日韩午夜激情免费电影| 在线不卡中文字幕| 91精品国产91久久久久久最新毛片| 欧美午夜精品久久久久久超碰| 欧美亚洲另类激情小说| 日本韩国欧美一区二区三区| 91久久线看在观草草青青| 99国产精品国产精品毛片| 色综合激情五月| 欧美日韩在线播放| 欧美日韩国产综合久久| 777a∨成人精品桃花网| 日韩欧美国产一二三区| 精品国产免费一区二区三区四区 | 色婷婷综合久久久久中文一区二区| 成人黄色网址在线观看| av一区二区不卡| 91精品1区2区| 欧美一卡2卡3卡4卡| 久久久亚洲精华液精华液精华液| 国产校园另类小说区| 中文字幕日韩一区| 一区二区三区不卡视频在线观看| 婷婷六月综合亚洲| 狠狠色丁香九九婷婷综合五月| 国产福利91精品一区| 91色在线porny| 欧美日高清视频| 久久久噜噜噜久久人人看 | 国产日韩综合av| 国产精品毛片高清在线完整版| 亚洲天堂成人网| 天天综合色天天综合| 激情久久五月天| 91亚洲男人天堂| 日韩一区二区电影| 中文一区在线播放| 亚洲一区二区三区四区五区黄| 精品一区二区在线看| 99久久精品国产观看| 91精品国产综合久久婷婷香蕉| 久久尤物电影视频在线观看| 亚洲欧洲制服丝袜| 精品夜夜嗨av一区二区三区| 91性感美女视频| 日韩精品中午字幕| 综合久久久久久久| 麻豆高清免费国产一区| 色综合久久久久久久久| 精品久久人人做人人爱| 一区二区三区四区不卡在线| 久久精品国产99| 欧美三级午夜理伦三级中视频| 国产欧美精品一区二区色综合朱莉 | 亚洲欧美一区二区三区极速播放 | 国产+成+人+亚洲欧洲自线| 欧美日韩精品欧美日韩精品一| 中文字幕av在线一区二区三区| 亚洲曰韩产成在线| 福利一区在线观看| 欧美高清视频不卡网| 日韩美女视频一区二区| 国产一区二区三区综合| 亚洲乱码中文字幕| 欧美一区二区性放荡片| 亚洲va天堂va国产va久| 国产电影精品久久禁18| 91精品久久久久久蜜臀| 一区二区在线观看不卡| 国产伦精一区二区三区| 欧美一区二区三区在线视频| 一区二区三区在线免费观看| 成人av免费在线| 日本一区二区电影| 久久国产夜色精品鲁鲁99| 91麻豆精品国产91久久久久久| 一区二区三区成人| 色哟哟一区二区在线观看 | 亚洲综合在线电影| av电影在线观看不卡| 亚洲国产精品精华液ab| 国产毛片精品视频| 久久久综合精品| 国产剧情一区二区| 精品99一区二区三区| 经典一区二区三区| 久久午夜电影网| 国产成人av一区二区三区在线 | 欧美视频在线播放| 中文字幕乱码亚洲精品一区| 国产福利电影一区二区三区| 精品粉嫩aⅴ一区二区三区四区| 奇米四色…亚洲| 日韩视频在线一区二区|