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

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

?? usb.c

?? STM32+Grlib
?? C
?? 第 1 頁 / 共 5 頁
字號:
//*****************************************************************************
//
// usb.c - Driver for the USB Interface.
//
// Copyright (c) 2007-2010 Texas Instruments Incorporated.  All rights reserved.
// Software License Agreement
// 
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
// 
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// 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. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 5821 of the Stellaris Peripheral Driver Library.
//
//*****************************************************************************

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

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

//*****************************************************************************
//
// Amount to shift the RX interrupt sources by in the flags used in the
// interrupt calls.
//
//*****************************************************************************
#ifndef DEPRECATED
#define USB_INT_RX_SHIFT        8
#endif
#define USB_INTEP_RX_SHIFT      16

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

//*****************************************************************************
//
// 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)

//*****************************************************************************
//
// 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.
//!
//! \note WARNING: This API cannot be used on endpoint numbers greater than
//! endpoint 3 so USBIntStatusControl() or USBIntStatusEndpoint() should be
//! used instead.
//!
//! \return Returns the status of the sources for the USB controller's

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品麻豆99久久久久久| 欧美videofree性高清杂交| 欧美成人精品福利| 一区二区三区四区亚洲| 激情成人综合网| 91黄色免费版| 国产色产综合色产在线视频| 午夜不卡在线视频| gogo大胆日本视频一区| 日韩午夜在线影院| 亚洲电影在线播放| 91一区二区在线观看| 久久久久久久免费视频了| 天堂va蜜桃一区二区三区| 91免费看`日韩一区二区| 久久久www免费人成精品| 日韩黄色小视频| 色香蕉久久蜜桃| 国产精品美女一区二区三区| 美国十次了思思久久精品导航| 日韩精品一区二区三区在线| 综合色天天鬼久久鬼色| 国产丶欧美丶日本不卡视频| 91精品国产综合久久久蜜臀粉嫩| 在线观看欧美日本| 国产精品乱码一区二三区小蝌蚪| 中文字幕一区二区三区不卡 | 99久久99久久免费精品蜜臀| 91精品国产日韩91久久久久久| 欧美一级一区二区| 亚洲v日本v欧美v久久精品| 一本色道久久综合亚洲aⅴ蜜桃| 欧美亚州韩日在线看免费版国语版| 欧美丰满嫩嫩电影| 亚洲一区二区三区国产| av一二三不卡影片| 国产精品女人毛片| www.欧美精品一二区| 国产欧美视频在线观看| 国产福利不卡视频| 国产午夜亚洲精品理论片色戒 | 亚洲黄色小说网站| 91麻豆国产福利精品| 1024成人网色www| 91女神在线视频| 国产精品进线69影院| zzijzzij亚洲日本少妇熟睡| 日本一二三不卡| av在线综合网| 亚洲毛片av在线| 欧洲一区在线电影| 性做久久久久久| 91麻豆精品国产自产在线观看一区 | 91香蕉视频mp4| 亚洲精选一二三| 一本大道av伊人久久综合| 亚洲六月丁香色婷婷综合久久| 精品在线视频一区| 久久久亚洲欧洲日产国码αv| 亚洲国产成人高清精品| 欧美无砖专区一中文字| 日韩有码一区二区三区| 日韩色在线观看| 国产精品亚洲一区二区三区在线| 制服丝袜亚洲播放| 国模少妇一区二区三区| 国产精品丝袜一区| 91视频你懂的| 丝袜美腿亚洲综合| 精品国精品国产| 国产成人精品亚洲午夜麻豆| 国产精品久久久久久久久果冻传媒| 九九精品一区二区| 国产欧美日韩视频在线观看| 91在线码无精品| 日韩av电影天堂| 国产日韩欧美一区二区三区综合| 日本成人在线不卡视频| 久久婷婷一区二区三区| 99国产精品久久久久久久久久| 国产亚洲va综合人人澡精品| 不卡欧美aaaaa| 午夜伦欧美伦电影理论片| 亚洲精品在线网站| 91蝌蚪porny成人天涯| 日韩国产高清影视| 国产精品毛片久久久久久久| 色噜噜偷拍精品综合在线| 日韩和欧美一区二区| 中文字幕免费不卡| 欧美日韩高清一区二区不卡| 国内成人精品2018免费看| 亚洲欧美aⅴ...| 日韩欧美美女一区二区三区| 波多野结衣中文字幕一区| 五月天激情小说综合| 日本一区二区三区久久久久久久久不 | 亚洲男人电影天堂| 91精品国产高清一区二区三区蜜臀| 亚洲一区二区五区| 精品国产乱码久久| 91久久线看在观草草青青 | 日韩欧美在线网站| 99精品久久久久久| 精品综合免费视频观看| 亚洲国产精品久久人人爱 | 国产一区二区不卡在线| 亚洲色图欧美偷拍| 26uuu另类欧美| 欧美三级电影在线看| 狠狠狠色丁香婷婷综合激情 | 欧美一区二区三区在| 风间由美一区二区av101| 五月婷婷激情综合网| 国产精品传媒视频| 精品久久一区二区三区| 欧美色视频在线观看| 成人激情小说网站| 国产一区二区视频在线| 偷窥少妇高潮呻吟av久久免费| 678五月天丁香亚洲综合网| 成人h动漫精品| 国产精品自在在线| 蜜臀a∨国产成人精品| 亚洲一区二区三区四区五区黄 | 国产乱人伦偷精品视频免下载| 国产视频一区二区三区在线观看| 成人天堂资源www在线| 麻豆精品视频在线观看免费| 亚洲综合男人的天堂| 久久久久久日产精品| 日韩欧美一级精品久久| 欧美日精品一区视频| 91免费小视频| 波多野结衣中文字幕一区| 国产一区二区女| 美女视频第一区二区三区免费观看网站| 2014亚洲片线观看视频免费| 在线不卡a资源高清| 欧美综合一区二区三区| 97久久精品人人爽人人爽蜜臀| 亚洲成av人片一区二区三区| 国产精品白丝在线| 国产午夜精品久久久久久免费视 | 日韩成人免费电影| 亚洲成人综合视频| 亚洲尤物视频在线| 成人欧美一区二区三区| 国产精品色呦呦| 国产精品三级av在线播放| 久久精品人人做人人综合| 亚洲精品一区二区三区香蕉| 日韩一区二区在线观看视频| 337p亚洲精品色噜噜狠狠| 欧美日本精品一区二区三区| 精品视频一区二区不卡| 欧洲日韩一区二区三区| 欧美午夜理伦三级在线观看| 欧美性色黄大片| 欧美日本国产视频| 制服视频三区第一页精品| 欧美老肥妇做.爰bbww| 欧美日韩国产一级| 91精品国产手机| 日韩午夜电影在线观看| 日韩精品在线一区二区| 精品国产91乱码一区二区三区 | 日本高清免费不卡视频| 在线观看视频91| 91精品福利视频| 在线电影院国产精品| 欧美一级片免费看| 精品久久国产字幕高潮| 久久精品欧美一区二区三区麻豆| 91.麻豆视频| 精品人伦一区二区色婷婷| 久久先锋影音av鲁色资源| 中文无字幕一区二区三区| 欧美激情一区在线| 亚洲日本免费电影| 亚洲v日本v欧美v久久精品| 视频在线在亚洲| 激情丁香综合五月| 成人av资源下载| 欧洲色大大久久| 日韩精品在线看片z| 国产农村妇女毛片精品久久麻豆| 日韩欧美在线影院| 亚洲国产精品二十页| 一区二区三区欧美在线观看| 日欧美一区二区| 国产毛片一区二区| 色综合久久中文综合久久牛| 在线免费一区三区| 精品久久人人做人人爽| 一区在线观看视频| 日韩精品亚洲一区| 国产激情91久久精品导航| 欧美综合欧美视频| 亚洲精品一区二区精华|