亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
91在线视频18| 波多野结衣视频一区| 久久精品999| 亚洲一二三区在线观看| 免费高清在线一区| 欧美一卡在线观看| 麻豆精品新av中文字幕| 亚洲精品一区二区三区在线观看| 麻豆精品一区二区综合av| 欧美大胆一级视频| 狠狠色狠狠色综合| 国产精品久久久久一区| www.亚洲免费av| 一级日本不卡的影视| 欧美精品精品一区| 美女网站在线免费欧美精品| 精品欧美黑人一区二区三区| 丁香婷婷综合激情五月色| 中文成人综合网| 91成人在线精品| 免费成人在线网站| 国产精品免费视频观看| 在线看一区二区| 日本成人超碰在线观看| 国产婷婷精品av在线| 色妹子一区二区| 日韩精品一区第一页| 欧美岛国在线观看| 成人一区二区三区在线观看| 亚洲女同女同女同女同女同69| 欧美专区日韩专区| 极品少妇一区二区| 亚洲视频免费看| 欧美大片日本大片免费观看| 国产91高潮流白浆在线麻豆| 欧美一级高清片| 欧美一级一区二区| 国产麻豆精品theporn| 亚洲美女少妇撒尿| 日韩视频一区二区三区| 欧美人与禽zozo性伦| 精品一区二区三区久久| 综合久久国产九一剧情麻豆| 欧美一级二级三级乱码| 成人高清视频免费观看| 青青草国产成人av片免费| 国产精品久久久99| 日韩欧美成人午夜| 色偷偷一区二区三区| 国产伦精品一区二区三区在线观看 | 91精品国产一区二区人妖| 国产成人久久精品77777最新版本| 亚洲国产精品嫩草影院| 久久午夜色播影院免费高清| 欧美性猛交xxxx黑人交| 成人av电影免费在线播放| 青青草国产精品97视觉盛宴| 亚洲免费大片在线观看| 久久精品网站免费观看| 91精品国产综合久久精品图片| 99精品视频免费在线观看| 国内久久精品视频| 免费在线一区观看| 国产一区二区美女| 亚洲乱码国产乱码精品精的特点 | 欧美电影免费观看高清完整版在 | 成人午夜激情片| 久久国产精品无码网站| 亚洲一卡二卡三卡四卡无卡久久 | 成人免费一区二区三区在线观看| 日韩精品一区二区三区中文精品| 欧美日韩免费不卡视频一区二区三区| av在线免费不卡| 成人午夜免费视频| 国产电影精品久久禁18| 国产麻豆欧美日韩一区| 韩国精品久久久| 国内精品伊人久久久久av影院| 久久精品国产**网站演员| 日韩福利电影在线观看| 日韩av网站免费在线| 日本在线不卡一区| 日本视频一区二区三区| 美女脱光内衣内裤视频久久网站| 日韩av电影天堂| 久久国产尿小便嘘嘘| 激情深爱一区二区| 国产在线播放一区三区四| 国产主播一区二区三区| 国产成人夜色高潮福利影视| 丁香亚洲综合激情啪啪综合| 成人高清免费在线播放| 91美女片黄在线观看| 欧美色图免费看| 日韩一级片在线观看| 久久综合网色—综合色88| 国产三级久久久| 中文字幕一区二区三区在线观看| 亚洲男同性视频| 香蕉久久一区二区不卡无毒影院 | 免费观看30秒视频久久| 国内精品伊人久久久久影院对白| 国产精品66部| 色综合天天综合| 欧美裸体一区二区三区| 欧美xxxxxxxx| 国产精品麻豆一区二区| 亚洲一区二区三区四区中文字幕| 亚洲第一电影网| 精品一区二区三区免费| 成人午夜碰碰视频| 欧美视频在线不卡| 久久久精品国产99久久精品芒果| 亚洲欧美综合另类在线卡通| 亚洲18影院在线观看| 精品影院一区二区久久久| 成人小视频免费在线观看| 在线观看av一区| 欧美精品一区二区三区在线播放| 国产精品灌醉下药二区| 日韩精品福利网| 成人免费视频一区| 91麻豆精品国产91久久久久久久久 | 国产成人免费在线观看不卡| 色婷婷av一区二区三区软件| 欧美mv日韩mv| 亚洲一区二区在线免费看| 国产高清精品网站| 在线不卡一区二区| 国产精品理论在线观看| 裸体一区二区三区| 色香蕉成人二区免费| 国产日韩一级二级三级| 天堂va蜜桃一区二区三区| 成人午夜电影久久影院| 欧美一级精品在线| 亚洲欧美激情在线| 国产精品18久久久久久久网站| 欧美色综合网站| 中文成人综合网| 久久国产精品无码网站| 欧美日韩国产一级| 亚洲欧美偷拍卡通变态| 国产综合成人久久大片91| 51精品视频一区二区三区| 日韩伦理免费电影| 国产精品 欧美精品| 欧美一区二区三区性视频| 亚洲理论在线观看| 成人激情小说乱人伦| 亚洲精品一区二区三区四区高清| 日韩电影免费在线看| 欧美综合一区二区三区| 亚洲精品中文在线影院| 成人免费视频一区| 国产欧美一区二区精品久导航 | 色香蕉成人二区免费| 中文字幕一区二区日韩精品绯色| 狠狠色综合日日| 日韩欧美一二三| 秋霞国产午夜精品免费视频| 欧美日韩久久一区| 亚洲国产中文字幕| 欧美日韩国产精选| 亚洲一区二区黄色| 欧美亚洲精品一区| 亚洲一区在线观看免费 | 国产精品99久| 久久你懂得1024| 国产精品亚洲第一区在线暖暖韩国| 欧美一级久久久久久久大片| 日韩av中文字幕一区二区| 欧美日韩国产天堂| 日本视频在线一区| 欧美大片顶级少妇| 精品在线免费视频| 国产日韩av一区| 国产99精品视频| 国产精品成人一区二区三区夜夜夜| 国产91精品在线观看| 国产精品久久福利| 在线精品视频免费观看| 亚洲国产欧美在线| 欧美肥胖老妇做爰| 九色|91porny| 久久日一线二线三线suv| 国产激情一区二区三区四区| 欧美国产精品专区| 99国产精品国产精品久久| 亚洲伊人伊色伊影伊综合网| 91精品在线麻豆| 激情综合色综合久久| 亚洲国产精品精华液2区45| 91色在线porny| 肉肉av福利一精品导航| 精品粉嫩超白一线天av| 91亚洲精品乱码久久久久久蜜桃 | 亚洲精品视频自拍| 4hu四虎永久在线影院成人| 国产在线视频一区二区三区|