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

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

?? pio.c

?? Dataflash example for ARM9 using KEIL.
?? 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一区二区三区免费野_久草精品视频
欧美美女黄视频| 成人免费三级在线| 久久亚洲精精品中文字幕早川悠里| 一区二区三区四区蜜桃| 欧美少妇xxx| 香蕉成人伊视频在线观看| 欧美高清视频在线高清观看mv色露露十八 | 在线视频欧美精品| 丝袜美腿亚洲色图| 欧美精品一区男女天堂| 久久丁香综合五月国产三级网站| www国产亚洲精品久久麻豆| 国产一区二区三区高清播放| 国产日韩精品一区二区浪潮av| 成人精品一区二区三区四区 | www.视频一区| 亚洲福利国产精品| 精品久久久久久最新网址| 国产91在线观看| 亚洲欧美一区二区三区国产精品| 欧美日韩精品一区二区三区蜜桃 | 日韩欧美亚洲国产精品字幕久久久| 蜜臀91精品一区二区三区| 91精品国产高清一区二区三区蜜臀| 国产最新精品免费| 中文字幕一区免费在线观看| 精品视频一区二区不卡| 午夜久久久影院| 精品国产91久久久久久久妲己 | 亚洲欧洲av色图| 日韩一区二区影院| 99久久久国产精品免费蜜臀| 日本成人在线网站| 麻豆一区二区在线| 婷婷亚洲久悠悠色悠在线播放| 一区二区三区 在线观看视频| 中文字幕高清不卡| 亚洲欧洲av在线| 亚洲人成精品久久久久| 亚洲最大成人综合| 午夜国产精品影院在线观看| 蜜臀久久99精品久久久画质超高清 | 奇米888四色在线精品| 免费观看久久久4p| 精品亚洲成a人在线观看| 国产精品乡下勾搭老头1| 成人av在线资源| 99在线热播精品免费| 成人爽a毛片一区二区免费| 国产精品一二三四| av一区二区三区在线| 日本道免费精品一区二区三区| 欧美日韩精品一区二区天天拍小说| 欧美一卡二卡三卡| 精品久久一二三区| 日本一区二区高清| 亚洲精品国产高清久久伦理二区| 国产精品久久久99| 亚洲天堂福利av| 首页国产欧美日韩丝袜| 国产一区二区在线观看免费| 97久久超碰国产精品| 欧美色综合天天久久综合精品| 精品日韩av一区二区| 欧美激情一区在线观看| 一区二区三区在线观看视频 | 麻豆精品视频在线| 成人av网站在线| 在线看国产日韩| 久久综合久久综合久久综合| 亚洲精品在线观看网站| 国产精品视频在线看| 天天av天天翘天天综合网| 精品中文字幕一区二区| 国产乱对白刺激视频不卡| 日本乱人伦一区| 精品久久久久香蕉网| 亚洲精品视频在线| 蜜臀av一级做a爰片久久| 一本一道久久a久久精品| 日韩精品一区二区三区老鸭窝| 亚洲人精品午夜| 精品午夜久久福利影院| 91国偷自产一区二区三区观看| 欧美日韩精品免费观看视频| 欧美丰满嫩嫩电影| 26uuu久久天堂性欧美| 一区二区三区四区精品在线视频 | 欧美怡红院视频| 欧美激情一区二区三区| 日韩精品福利网| 韩日av一区二区| 777奇米成人网| 亚洲三级在线免费观看| 国产一区二区主播在线| 538在线一区二区精品国产| 日韩欧美一区在线| 1区2区3区欧美| 国产精品一二一区| 欧美成人高清电影在线| 午夜成人在线视频| 91精品1区2区| 国产精品家庭影院| 国产成人精品免费看| 日韩欧美一区二区久久婷婷| 中文字幕亚洲精品在线观看| 蜜桃视频在线一区| 色94色欧美sute亚洲线路一久| 国产精品天天看| 国产一区二区三区四区五区入口 | 国产日韩高清在线| 国产剧情在线观看一区二区| 日韩一区二区视频| 蜜臀av一级做a爰片久久| 色综合久久天天| 中文字幕第一区综合| 老鸭窝一区二区久久精品| 91精选在线观看| 日韩福利视频网| 欧美日韩黄色影视| 午夜免费久久看| 欧美精品丝袜中出| 午夜影院在线观看欧美| 欧美精三区欧美精三区| 一区二区欧美国产| 成人av在线网站| 亚洲精选视频免费看| 色狠狠桃花综合| 国产精品乱码一区二区三区软件| 久久精品国产99久久6| 色噜噜偷拍精品综合在线| 国产精品狼人久久影院观看方式| 成人听书哪个软件好| 亚洲精品一区二区三区影院 | 91在线免费视频观看| 国产日韩欧美不卡| 国产黄人亚洲片| 中文字幕一区二区三区av| 国产精品影视在线| 亚洲国产精品激情在线观看| 成人国产免费视频| 亚洲日本欧美天堂| 欧美日韩亚洲综合| 久久99精品久久久久久国产越南| 亚洲精品一区二区三区精华液| 国产一区二区三区四| 国产精品区一区二区三区| 欧美手机在线视频| 国产一区视频在线看| 亚洲靠逼com| 欧美mv和日韩mv国产网站| 99精品国产一区二区三区不卡| 日韩精品1区2区3区| 日本一区二区在线不卡| 欧美日韩免费在线视频| 国产成人av电影| 婷婷综合五月天| 国产精品高潮呻吟| 日韩精品一区二区三区视频在线观看| 波多野结衣一区二区三区| 美女视频网站久久| 一区二区三区在线视频播放| 午夜视频一区二区三区| 欧美亚洲综合久久| 国产成人激情av| 亚洲精品视频在线| 国产欧美视频一区二区| 88在线观看91蜜桃国自产| 91麻豆国产自产在线观看| 另类小说视频一区二区| 亚洲精品国产一区二区精华液| 久久蜜桃av一区精品变态类天堂 | 欧美午夜理伦三级在线观看| 国产精品18久久久久久久久久久久| 亚洲电影在线免费观看| 国产精品色一区二区三区| 日韩欧美在线不卡| 欧美日韩高清不卡| 91热门视频在线观看| 国产乱码精品一品二品| 美女网站色91| 婷婷中文字幕一区三区| 一区二区三区不卡视频在线观看| 国产视频一区不卡| 精品成人一区二区| 日韩一区二区中文字幕| 欧美日韩精品二区第二页| 色妞www精品视频| 成人ar影院免费观看视频| 国产精一区二区三区| 久久99精品国产麻豆不卡| 三级在线观看一区二区| 亚洲电影欧美电影有声小说| 亚洲美女视频在线| 中文字幕中文字幕在线一区| 久久综合五月天婷婷伊人| 精品日韩成人av| 精品美女一区二区| 日韩精品一区二| 亚洲精品一区二区三区精华液|