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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? pio.c

?? filesystem 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);
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品在线观| 国产成人免费视频| 欧美日韩国产小视频| 亚洲午夜av在线| 欧美片网站yy| 麻豆成人av在线| 久久久久国产精品麻豆| 国产91精品久久久久久久网曝门| 国产午夜精品福利| 99久久99精品久久久久久| 亚洲精品免费在线播放| 欧美日韩高清一区二区| 久久精品理论片| 亚洲国产高清在线| 91蝌蚪porny| 婷婷开心激情综合| 日韩一区二区三区视频| 国产成人av自拍| 一区二区激情小说| 日韩女优av电影| 成人一区二区三区在线观看| 亚洲精品久久7777| 欧美成人伊人久久综合网| 成人高清伦理免费影院在线观看| 一区二区三区四区精品在线视频| 日韩一级二级三级| 国产iv一区二区三区| 亚洲不卡av一区二区三区| 26uuu精品一区二区 | 亚洲影视在线观看| 欧美电视剧免费全集观看| 白白色亚洲国产精品| 丝袜国产日韩另类美女| 中文成人综合网| 777久久久精品| www.日韩av| 日韩电影一区二区三区四区| 国产精品美女久久久久aⅴ| 欧美久久久久久久久久| 国产大陆精品国产| 日韩精品一二区| 国产精品初高中害羞小美女文| 欧美日韩国产电影| 91在线看国产| 国产精品综合一区二区三区| 五月激情综合网| 亚洲区小说区图片区qvod| 久久亚洲影视婷婷| 91精品国产色综合久久久蜜香臀| av中文字幕一区| 国精产品一区一区三区mba视频 | 久久精品国产一区二区| 亚洲精品久久嫩草网站秘色| 国产三级一区二区三区| 欧美理论在线播放| 91麻豆免费看片| 成人在线视频一区二区| 麻豆一区二区在线| 舔着乳尖日韩一区| 一区二区三区加勒比av| 中文字幕在线一区免费| 久久亚洲一级片| 精品欧美黑人一区二区三区| 制服丝袜av成人在线看| 欧洲国产伦久久久久久久| fc2成人免费人成在线观看播放| 国产毛片精品视频| 色狠狠一区二区三区香蕉| 国产一区亚洲一区| 精品一区二区免费| 六月丁香婷婷色狠狠久久| 三级不卡在线观看| 婷婷六月综合网| 日本一区中文字幕 | 午夜精品一区二区三区免费视频 | 亚洲一区国产视频| 亚洲精品午夜久久久| 亚洲欧美激情插| 一区二区三区视频在线观看 | 一区二区三区产品免费精品久久75| 中文无字幕一区二区三区| 国产清纯白嫩初高生在线观看91 | 蜜臀91精品一区二区三区| 日本一区中文字幕| 麻豆精品视频在线观看| 蜜桃精品在线观看| 激情综合网激情| 国产精品小仙女| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 97国产精品videossex| 99热在这里有精品免费| gogo大胆日本视频一区| 91福利国产精品| 91麻豆精品久久久久蜜臀| 欧美老肥妇做.爰bbww| 欧美一区二区三区日韩视频| 日韩一级二级三级| 国产日韩av一区| 亚洲男人天堂一区| 成人黄色777网| 91福利国产精品| 日韩一级欧美一级| 国产亚洲综合性久久久影院| 国产精品久久毛片av大全日韩| 亚洲日本va午夜在线影院| 亚洲成人自拍一区| 国产最新精品精品你懂的| 成人国产精品免费网站| 91国偷自产一区二区开放时间| 欧美高清www午色夜在线视频| 久久亚洲精品小早川怜子| 国产精品色哟哟网站| 亚洲一区二区三区四区在线免费观看| 日本少妇一区二区| 高清日韩电视剧大全免费| 欧美体内she精高潮| 欧美刺激脚交jootjob| 国产精品成人免费精品自在线观看| 亚洲成人777| 国产91精品免费| 欧美美女激情18p| 国产精品视频一二三区| 亚洲国产综合色| 国产精品自在欧美一区| 欧美日韩的一区二区| 久久久久久一级片| 性做久久久久久免费观看| 国产精品自在在线| 欧美精品高清视频| 亚洲欧美色图小说| 激情伊人五月天久久综合| 在线观看亚洲一区| 国产亚洲人成网站| 日韩精品电影在线观看| 精品国内二区三区| 亚洲国产精品久久久久婷婷884 | 日韩电影在线一区| 91亚洲精品久久久蜜桃网站| 精品日韩99亚洲| 亚洲一二三级电影| 99视频精品在线| 国产亚洲欧美在线| 久久超碰97人人做人人爱| 欧美性高清videossexo| 国产精品美女久久福利网站| 激情国产一区二区| 欧美日本一区二区| 一区二区三区中文在线| 99视频精品在线| 中文字幕免费不卡| 国产一区在线视频| 日韩一区二区在线观看视频| 午夜视黄欧洲亚洲| 91在线精品一区二区三区| 亚洲国产精品99久久久久久久久| 久久99日本精品| 日韩精品一区二区三区四区| 日韩av不卡在线观看| 欧美亚洲高清一区二区三区不卡| 国产精品国产三级国产aⅴ中文| 国产精品综合二区| 久久久久久免费毛片精品| 精品一区二区三区不卡| 777xxx欧美| 免费观看久久久4p| 日韩午夜在线播放| 免费在线成人网| 欧美一级日韩不卡播放免费| 日韩黄色小视频| 91麻豆精品国产91久久久久| 视频在线观看91| 欧美一区二区三区性视频| 免费视频最近日韩| 精品国产91九色蝌蚪| 国产综合色视频| 中文字幕av一区 二区| 国产99久久久久久免费看农村| 国产午夜精品一区二区三区嫩草| 国产aⅴ精品一区二区三区色成熟| 久久伊人中文字幕| 国产激情视频一区二区三区欧美| 久久久蜜臀国产一区二区| 国产精品一二三区在线| 中文字幕av不卡| 在线观看一区二区精品视频| 午夜精品久久久久久久99樱桃 | 日韩一区二区不卡| 国产乱人伦偷精品视频免下载 | 天天色综合成人网| 日韩欧美亚洲国产精品字幕久久久| 久久av老司机精品网站导航| 国产午夜亚洲精品羞羞网站| gogogo免费视频观看亚洲一| 亚洲国产综合人成综合网站| 欧美成人vr18sexvr| 国产99精品视频| 亚洲电影在线播放| 日韩精品一区二区三区在线观看| 国产成人av一区二区三区在线观看| 国产精品日产欧美久久久久|