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

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

?? usb.c

?? KEIL驅動 各方面各 你的看法女士的煩惱 方看到你
?? C
?? 第 1 頁 / 共 5 頁
字號:
//*****************************************************************************
//
// usb.c - Driver for the USB Interface.
//
// Copyright (c) 2007-2008 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 microcontroller products.
// 
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  You may not combine
// this software with "viral" open-source software in order to form a larger
// program.  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 3223 of the Stellaris Peripheral Driver Library.
//
//*****************************************************************************

#include "../hw_types.h"
#include "../hw_memmap.h"
#include "../hw_ints.h"
#include "../hw_usb.h"
#include "debug.h"
#include "interrupt.h"
#include "usb.h"

//*****************************************************************************
//
// Amount to shift the RX interrupt sources by in the flags used in the
// interrupt calls.
//
//*****************************************************************************
#define USB_INT_RX_SHIFT        8

//*****************************************************************************
//
// Amount to shift the status interrupt sources by in the flags used in the
// interrupt calls.
//
//*****************************************************************************
#define USB_INT_STATUS_SHIFT    24

//*****************************************************************************
//
// Amount to shift the RX endpoint status sources by in the flags used in the
// calls.
//
//*****************************************************************************
#define USB_RX_EPSTATUS_SHIFT   16

//*****************************************************************************
//
// Converts from an endpoint specifier to the offset of the endpoint's
// control/status registers.
//
//*****************************************************************************
#define EP_OFFSET(Endpoint)     (Endpoint - 0x10)

//*****************************************************************************
//
//! \addtogroup usb_api
//! @{
//
//*****************************************************************************

//*****************************************************************************
//
// Sets one of the indexed registers.
//
// \param ulBase specifies the USB module base address.
// \param ulEndpoint is the endpoint index to target for this write.
// \param ulIndexedReg is the indexed register to write to.
// \param ucValue is the value to write to the register.
//
// This function is used to access the indexed registers for each endpoint.
// The only registers that are indexed are the FIFO configuration registers
// which are not used after configuration.
//
// \return None.
//
//*****************************************************************************
static void
USBIndexWrite(unsigned long ulBase, unsigned long ulEndpoint,
              unsigned long ulIndexedReg, unsigned long ulValue,
              unsigned long ulSize)
{
    unsigned long ulIndex;

    //
    // Check the arguments.
    //
    ASSERT(ulBase == USB0_BASE);
    ASSERT((ulEndpoint == 0) || (ulEndpoint == 1) || (ulEndpoint == 2) ||
           (ulEndpoint == 3));
    ASSERT((ulSize == 1) || (ulSize == 2));

    //
    // Save the old index in case it was in use.
    //
    ulIndex = HWREGB(ulBase + USB_O_EPIDX);

    //
    // Set the index.
    //
    HWREGB(ulBase + USB_O_EPIDX) = ulEndpoint;

    //
    // Determine the size of the register value.
    //
    if(ulSize == 1)
    {
        //
        // Set the value.
        //
        HWREGB(ulBase + ulIndexedReg) = ulValue;
    }
    else
    {
        //
        // Set the value.
        //
        HWREGH(ulBase + ulIndexedReg) = ulValue;
    }

    //
    // Restore the old index in case it was in use.
    //
    HWREGB(ulBase + USB_O_EPIDX) = ulIndex;
}

//*****************************************************************************
//
// Reads one of the indexed registers.
//
// \param ulBase specifies the USB module base address.
// \param ulEndpoint is the endpoint index to target for this write.
// \param ulIndexedReg is the indexed register to write to.
//
// This function is used interally to access the indexed registers for each
// endpoint.  The only registers that are indexed are the FIFO configuration
// registers which are not used after configuration.
//
// \return The value in the register requested.
//
//*****************************************************************************
static unsigned long
USBIndexRead(unsigned long ulBase, unsigned long ulEndpoint,
             unsigned long ulIndexedReg, unsigned long ulSize)
{
    unsigned char ulIndex;
    unsigned char ulValue;

    //
    // Check the arguments.
    //
    ASSERT(ulBase == USB0_BASE);
    ASSERT((ulEndpoint == 0) || (ulEndpoint == 1) || (ulEndpoint == 2) ||
           (ulEndpoint == 3));
    ASSERT((ulSize == 1) || (ulSize == 2));

    //
    // Save the old index in case it was in use.
    //
    ulIndex = HWREGB(ulBase + USB_O_EPIDX);

    //
    // Set the index.
    //
    HWREGB(ulBase + USB_O_EPIDX) = ulEndpoint;

    //
    // Determine the size of the register value.
    //
    if(ulSize == 1)
    {
        //
        // Get the value.
        //
        ulValue = HWREGB(ulBase + ulIndexedReg);
    }
    else
    {
        //
        // Get the value.
        //
        ulValue = HWREGH(ulBase + ulIndexedReg);
    }

    //
    // Restore the old index in case it was in use.
    //
    HWREGB(ulBase + USB_O_EPIDX) = ulIndex;

    //
    // Return the register's value.
    //
    return(ulValue);
}

//*****************************************************************************
//
//! Puts the USB bus in a suspended state.
//!
//! \param ulBase specifies the USB module base address.
//!
//! When used in host mode, this function will put the USB bus in the suspended
//! state.
//!
//! \note This function should only be called in host mode.
//!
//! \return None.
//
//*****************************************************************************
void
USBHostSuspend(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == USB0_BASE);

    //
    // Send the suspend signaling to the USB bus.
    //
    HWREGB(ulBase + USB_O_POWER) |= USB_POWER_SUSPEND;
}

//*****************************************************************************
//
//! Handles the USB bus reset condition.
//!
//! \param ulBase specifies the USB module base address.
//! \param bStart specifies whether to start or stop signaling reset on the USB
//! bus.
//!
//! When this function is called with the \e bStart parameter set to \b true,
//! this function will cause the start of a reset condition on the USB bus.
//! The caller should then delay at least 20ms before calling this function
//! again with the \e bStart parameter set to \b false.
//!
//! \note This function should only be called in host mode.
//!
//! \return None.
//
//*****************************************************************************
void
USBHostReset(unsigned long ulBase, tBoolean bStart)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == USB0_BASE);

    //
    // Send a reset signal to the bus.
    //
    if(bStart)
    {
        HWREGB(ulBase + USB_O_POWER) |= USB_POWER_RESET;
    }
    else
    {
        HWREGB(ulBase + USB_O_POWER) &= ~USB_POWER_RESET;
    }
}

//*****************************************************************************
//
//! Handles the USB bus resume condition.
//!
//! \param ulBase specifies the USB module base address.
//! \param bStart specifies if the USB controller is entering or leaving the
//! resume signaling state.
//!
//! When in device mode this function will bring the USB controller out of the
//! suspend state.  This call should first be made with the \e bStart parameter
//! set to \b true to start resume signaling.  The device application should
//! then delay at least 10ms but not more than 15ms before calling this
//! function with the \e bStart parameter set to \b false.
//!
//! When in host mode this function will signal devices to leave the suspend
//! state.  This call should first be made with the \e bStart parameter set to
//! \b true to start resume signaling.  The host application should then delay
//! at least 20ms before calling this function with the \e bStart parameter set
//! to \b false.  This will cause the controller to complete the resume
//! signaling on the USB bus.
//!
//! \return None.
//
//*****************************************************************************
void
USBHostResume(unsigned long ulBase, tBoolean bStart)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == USB0_BASE);

    //
    // Send a resume signal to the bus.
    //
    if(bStart)
    {
        HWREGB(ulBase + USB_O_POWER) |= USB_POWER_RESUME;
    }
    else
    {
        HWREGB(ulBase + USB_O_POWER) &= ~USB_POWER_RESUME;
    }
}

//*****************************************************************************
//
//! Returns the current speed of the USB device connected.
//!
//! \param ulBase specifies the USB module base address.
//!
//! This function will return the current speed of the USB bus.
//!
//! \note This function should only be called in host mode.
//!
//! \return Returns either \b USB_LOW_SPEED, \b USB_FULL_SPEED, or
//! \b USB_UNDEF_SPEED.
//
//*****************************************************************************
unsigned long
USBHostSpeedGet(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == USB0_BASE);

    //
    // If the Full Speed device bit is set, then this is a full speed device.
    //
    if(HWREGB(ulBase + USB_O_DEVCTL) & USB_DEVCTL_FSDEV)
    {
        return(USB_FULL_SPEED);
    }

    //
    // If the Low Speed device bit is set, then this is a low speed device.
    //
    if(HWREGB(ulBase + USB_O_DEVCTL) & USB_DEVCTL_LSDEV)
    {
        return(USB_LOW_SPEED);
    }

    //
    // The device speed is not known.
    //
    return(USB_UNDEF_SPEED);
}

//*****************************************************************************
//
//! Returns the status of the USB interrupts.
//!
//! \param ulBase specifies the USB module base address.
//!
//! This function will read the source of the interrupt for the USB controller.
//! There are three groups of interrupt sources, IN Endpoints, OUT Endpoints,
//! and general status changes.  This call will return the current status for
//! all of these interrupts.  The bit values returned should be compared
//! against the \b USB_HOST_IN, \b USB_HOST_OUT, \b USB_HOST_EP0,
//! \b USB_DEV_IN, \b USB_DEV_OUT, and \b USB_DEV_EP0 values.
//!
//! \note This call will clear the source of all of the general status
//! interrupts.
//!
//! \return Returns the status of the sources for the USB controller's
//! interrupt.
//
//*****************************************************************************
unsigned long
USBIntStatus(unsigned long ulBase)
{
    unsigned long ulStatus;

    //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久久性| 精品亚洲成a人在线观看 | 国产精品久久久久久一区二区三区 | 欧美日韩在线不卡| 亚洲高清免费视频| 欧美日韩成人在线一区| 热久久一区二区| 欧美成人aa大片| 福利一区二区在线| 亚洲日本va午夜在线影院| 91黄色免费版| 免费精品视频最新在线| 久久久精品免费观看| 国产aⅴ精品一区二区三区色成熟| 国产日韩视频一区二区三区| av日韩在线网站| 一区二区三区四区av| 777亚洲妇女| 国产精品一区二区男女羞羞无遮挡| 日韩欧美电影在线| 丁香六月综合激情| 一区二区三区四区国产精品| 91精品国产一区二区三区蜜臀| 久久精品国产久精国产爱| 国产日韩欧美一区二区三区乱码 | 国产亚洲欧美日韩在线一区| 99精品欧美一区二区三区小说| 怡红院av一区二区三区| 日韩欧美国产麻豆| 波多野结衣在线aⅴ中文字幕不卡| 一区二区三区欧美日| 欧美大片顶级少妇| 91浏览器在线视频| 激情文学综合网| 亚洲欧美日韩中文字幕一区二区三区| 欧美日韩一区小说| 成人美女在线观看| 日本欧美在线看| 综合激情成人伊人| 欧美变态tickle挠乳网站| 色婷婷久久久久swag精品 | 中文字幕第一页久久| 欧美做爰猛烈大尺度电影无法无天| 美女网站视频久久| 亚洲视频在线一区二区| 欧美草草影院在线视频| 在线观看国产91| 国产盗摄视频一区二区三区| 夜夜嗨av一区二区三区四季av| 国产视频一区在线播放| 51精品国自产在线| 色天天综合色天天久久| 国产麻豆精品95视频| 日本网站在线观看一区二区三区| 国产精品网曝门| 精品欧美乱码久久久久久1区2区 | 亚洲国产aⅴ成人精品无吗| 欧美国产乱子伦| 欧美电视剧免费全集观看| 欧美色图一区二区三区| 91麻豆免费看片| 国产精品538一区二区在线| 日本特黄久久久高潮| 亚洲成人www| 亚洲一二三级电影| 亚洲男人的天堂在线观看| 亚洲国产精品黑人久久久| 久久久国产精华| 欧美精品一区二区三区很污很色的 | 欧美午夜精品久久久久久孕妇| 丁香婷婷综合色啪| 国产suv精品一区二区883| 精品一区二区三区影院在线午夜| 性久久久久久久久久久久 | 午夜视频在线观看一区二区三区| 最新久久zyz资源站| 国产精品久久久一本精品| 国产三区在线成人av| 久久麻豆一区二区| 国产日韩精品一区二区三区| 久久夜色精品一区| 欧美精品一区二区三区在线| 久久综合成人精品亚洲另类欧美 | 欧美日韩精品一区二区天天拍小说| 96av麻豆蜜桃一区二区| 91麻豆蜜桃一区二区三区| 欧洲视频一区二区| 欧美日本一区二区三区四区| 欧美日韩国产中文| 欧美一区二区三区四区视频| 欧美一区二区三区啪啪| 欧美一级高清大全免费观看| 欧美一级午夜免费电影| 欧美成人vps| 国产精品午夜免费| 亚洲欧美成人一区二区三区| 亚洲乱码日产精品bd| 亚洲国产另类精品专区| 午夜久久久久久久久| 欧美aⅴ一区二区三区视频| 国模套图日韩精品一区二区 | 成人a级免费电影| 91在线精品一区二区三区| 欧美手机在线视频| 欧美va在线播放| 国产精品天天看| 亚洲综合丝袜美腿| 捆绑紧缚一区二区三区视频| 福利视频网站一区二区三区| 色妞www精品视频| 欧美一区二区三区视频在线| 久久久久一区二区三区四区| 中文字幕佐山爱一区二区免费| 亚洲综合激情小说| 久久国内精品自在自线400部| 国产盗摄一区二区| 欧美日韩精品一二三区| 欧美大片免费久久精品三p | 亚洲日本青草视频在线怡红院 | 国产精品网站在线观看| 亚洲国产成人av好男人在线观看| 日本一不卡视频| 99久久精品国产一区| 欧美一区二区精品在线| 国产精品人成在线观看免费| 亚洲国产精品久久人人爱蜜臀| 韩日欧美一区二区三区| 色噜噜狠狠成人网p站| 久久久久久久久久电影| 亚洲国产精品久久一线不卡| 国产sm精品调教视频网站| 4438x亚洲最大成人网| 中文字幕一区二区不卡| 久久狠狠亚洲综合| 欧美男人的天堂一二区| 国产精品成人一区二区艾草| 麻豆成人久久精品二区三区小说| 97精品国产97久久久久久久久久久久 | 亚洲一区二区在线播放相泽| 国产盗摄精品一区二区三区在线 | 老司机免费视频一区二区三区| 色综合中文字幕国产 | 精品1区2区在线观看| 视频一区视频二区中文字幕| 99久久免费国产| 久久久久88色偷偷免费| 午夜av电影一区| 一本色道久久综合亚洲精品按摩| 精品捆绑美女sm三区| 视频一区中文字幕国产| 欧美三级欧美一级| 亚洲欧美日韩国产成人精品影院| 国产乱国产乱300精品| 欧美肥妇毛茸茸| 一区二区三区四区视频精品免费| 国产精品一区久久久久| 日韩欧美色综合网站| 图片区小说区区亚洲影院| 91老师片黄在线观看| 国产精品美女久久久久aⅴ | 成人一级视频在线观看| 精品成人在线观看| 麻豆高清免费国产一区| 日韩一区二区在线看| 视频一区二区三区入口| 欧美日韩在线播| 日韩电影在线观看网站| 欧美色手机在线观看| 亚洲福利一区二区三区| 欧美视频中文一区二区三区在线观看| 亚洲人一二三区| 欧美综合欧美视频| 亚洲国产成人91porn| 欧美日韩久久久一区| 视频一区在线播放| 日韩欧美一级在线播放| 美女视频黄久久| 精品福利视频一区二区三区| 国产综合一区二区| 日本一区免费视频| eeuss鲁片一区二区三区在线看| 国产精品欧美久久久久无广告 | 盗摄精品av一区二区三区| 亚洲国产精品精华液ab| av中文字幕不卡| 亚洲免费观看高清完整版在线观看| 99这里只有久久精品视频| 亚洲男人的天堂网| 欧美二区三区的天堂| 蜜臀久久久99精品久久久久久| 日韩欧美电影一区| 顶级嫩模精品视频在线看| 一区二区三区日韩在线观看| 欧美日韩国产系列| 精品影视av免费| 国产精品美女www爽爽爽| 91黄色在线观看| 美女一区二区久久| 亚洲欧美综合色| 91麻豆精品国产91久久久久久|