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

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

?? usb.c

?? STM32+Grlib
?? C
?? 第 1 頁 / 共 5 頁
字號:
//! This function will cause the soft connect feature of the USB controller to
//! be enabled.  Call USBDisconnect() to remove the USB device from the bus.
//!
//! \note This function should only be called in device mode.
//!
//! \return None.
//
//*****************************************************************************
void
USBDevConnect(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == USB0_BASE);

    //
    // Enable connection to the USB bus.
    //
    HWREGB(ulBase + USB_O_POWER) |= USB_POWER_SOFTCONN;
}

//*****************************************************************************
//
//! Removes the USB controller from the bus in device mode.
//!
//! \param ulBase specifies the USB module base address.
//!
//! This function will cause the soft connect feature of the USB controller to
//! remove the device from the USB bus.  A call to USBDevConnect() is needed to
//! reconnect to the bus.
//!
//! \note This function should only be called in device mode.
//!
//! \return None.
//
//*****************************************************************************
void
USBDevDisconnect(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == USB0_BASE);

    //
    // Disable connection to the USB bus.
    //
    HWREGB(ulBase + USB_O_POWER) &= (~USB_POWER_SOFTCONN);
}

//*****************************************************************************
//
//! Sets the address in device mode.
//!
//! \param ulBase specifies the USB module base address.
//! \param ulAddress is the address to use for a device.
//!
//! This function will set the device address on the USB bus.  This address was
//! likely received via a SET ADDRESS command from the host controller.
//!
//! \note This function should only be called in device mode.
//!
//! \return None.
//
//*****************************************************************************
void
USBDevAddrSet(unsigned long ulBase, unsigned long ulAddress)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == USB0_BASE);

    //
    // Set the function address in the correct location.
    //
    HWREGB(ulBase + USB_O_FADDR) = (unsigned char)ulAddress;
}

//*****************************************************************************
//
//! Returns the current device address in device mode.
//!
//! \param ulBase specifies the USB module base address.
//!
//! This function will return the current device address.  This address was set
//! by a call to USBDevAddrSet().
//!
//! \note This function should only be called in device mode.
//!
//! \return The current device address.
//
//*****************************************************************************
unsigned long
USBDevAddrGet(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBase == USB0_BASE);

    //
    // Return the function address.
    //
    return(HWREGB(ulBase + USB_O_FADDR));
}

//*****************************************************************************
//
//! Sets the base configuration for a host endpoint.
//!
//! \param ulBase specifies the USB module base address.
//! \param ulEndpoint is the endpoint to access.
//! \param ulMaxPayload is the maximum payload for this endpoint.
//! \param ulNAKPollInterval is the either the NAK timeout limit or the polling
//! interval depending on the type of endpoint.
//! \param ulTargetEndpoint is the endpoint that the host endpoint is
//! targeting.
//! \param ulFlags are used to configure other endpoint settings.
//!
//! This function will set the basic configuration for the transmit or receive
//! portion of an endpoint in host mode.  The \e ulFlags parameter determines
//! some of the configuration while the other parameters provide the rest.  The
//! \e ulFlags parameter determines whether this is an IN endpoint
//! (USB_EP_HOST_IN or USB_EP_DEV_IN) or an OUT endpoint (USB_EP_HOST_OUT or
//! USB_EP_DEV_OUT), whether this is a Full speed endpoint (USB_EP_SPEED_FULL)
//! or a Low speed endpoint (USB_EP_SPEED_LOW).
//!
//! The \b USB_EP_MODE_ flags control the type of the endpoint.
//! - \b USB_EP_MODE_CTRL is a control endpoint.
//! - \b USB_EP_MODE_ISOC is an isochronous endpoint.
//! - \b USB_EP_MODE_BULK is a bulk endpoint.
//! - \b USB_EP_MODE_INT is an interrupt endpoint.
//!
//! The \e ulNAKPollInterval parameter has different meanings based on the
//! \b USB_EP_MODE value and whether or not this call is being made for
//! endpoint zero or another endpoint.  For endpoint zero or any Bulk
//! endpoints, this value always indicates the number of frames to allow a
//! device to NAK before considering it a timeout.  If this endpoint is an
//! isochronous or interrupt endpoint, this value is the polling interval for
//! this endpoint.
//!
//! For interrupt endpoints the polling interval is simply the number of
//! frames between polling an interrupt endpoint.  For isochronous endpoints
//! this value represents a polling interval of 2 ^ (\e ulNAKPollInterval - 1)
//! frames.  When used as a NAK timeout, the \e ulNAKPollInterval value
//! specifies 2 ^ (\e ulNAKPollInterval - 1) frames before issuing a time out.
//! There are two special time out values that can be specified when setting
//! the \e ulNAKPollInterval value.  The first is \b MAX_NAK_LIMIT which is the
//! maximum value that can be passed in this variable.  The other is
//! \b DISABLE_NAK_LIMIT which indicates that there should be no limit on the
//! number of NAKs.
//!
//! The \b USB_EP_DMA_MODE_ flags enables the type of DMA used to access the
//! endpoint's data FIFOs.  The choice of the DMA mode depends on how the DMA
//! controller is configured and how it is being used.  See the ``Using USB
//! with the uDMA Controller'' section for more information on DMA
//! configuration.
//!
//! When configuring the OUT portion of an endpoint, the \b USB_EP_AUTO_SET bit
//! is specified to cause the transmission of data on the USB bus to start
//! as soon as the number of bytes specified by \e ulMaxPayload have been
//! written into the OUT FIFO for this endpoint.
//!
//! When configuring the IN portion of an endpoint, the \b USB_EP_AUTO_REQUEST
//! bit can be specified to trigger the request for more data once the FIFO has
//! been drained enough to fit \e ulMaxPayload bytes.  The \b USB_EP_AUTO_CLEAR
//! bit can be used to clear the data packet ready flag automatically once the
//! data has been read from the FIFO.  If this is not used, this flag must be
//! manually cleared via a call to USBDevEndpointStatusClear() or
//! USBHostEndpointStatusClear().
//!
//! \note This function should only be called in host mode.
//!
//! \return None.
//
//*****************************************************************************
void
USBHostEndpointConfig(unsigned long ulBase, unsigned long ulEndpoint,
                      unsigned long ulMaxPayload,
                      unsigned long ulNAKPollInterval,
                      unsigned long ulTargetEndpoint, unsigned long ulFlags)
{
    unsigned long ulRegister;

    //
    // Check the arguments.
    //
    ASSERT(ulBase == USB0_BASE);
    ASSERT((ulEndpoint == USB_EP_0) || (ulEndpoint == USB_EP_1) ||
           (ulEndpoint == USB_EP_2) || (ulEndpoint == USB_EP_3) ||
           (ulEndpoint == USB_EP_4) || (ulEndpoint == USB_EP_5) ||
           (ulEndpoint == USB_EP_6) || (ulEndpoint == USB_EP_7) ||
           (ulEndpoint == USB_EP_8) || (ulEndpoint == USB_EP_9) ||
           (ulEndpoint == USB_EP_10) || (ulEndpoint == USB_EP_11) ||
           (ulEndpoint == USB_EP_12) || (ulEndpoint == USB_EP_13) ||
           (ulEndpoint == USB_EP_14) || (ulEndpoint == USB_EP_15));
    ASSERT(ulNAKPollInterval <= MAX_NAK_LIMIT);

    //
    // Endpoint zero is configured differently than the other endpoints, so see
    // if this is endpoint zero.
    //
    if(ulEndpoint == USB_EP_0)
    {
        //
        // Set the NAK timeout.
        //
        HWREGB(ulBase + USB_O_NAKLMT) = ulNAKPollInterval;

        //
        // Set the transfer type information.
        //
        HWREGB(ulBase + EP_OFFSET(ulEndpoint) + USB_O_TYPE0) =
            ((ulFlags & USB_EP_SPEED_FULL) ? USB_TYPE0_SPEED_FULL :
             USB_TYPE0_SPEED_LOW);
    }
    else
    {
        //
        // Start with the target endpoint.
        //
        ulRegister = ulTargetEndpoint;

        //
        // Set the speed for the device using this endpoint.
        //
        if(ulFlags & USB_EP_SPEED_FULL)
        {
            ulRegister |= USB_TXTYPE1_SPEED_FULL;
        }
        else
        {
            ulRegister |= USB_TXTYPE1_SPEED_LOW;
        }

        //
        // Set the protocol for the device using this endpoint.
        //
        switch(ulFlags & USB_EP_MODE_MASK)
        {
            //
            // The bulk protocol is being used.
            //
            case USB_EP_MODE_BULK:
            {
                ulRegister |= USB_TXTYPE1_PROTO_BULK;
                break;
            }

            //
            // The isochronous protocol is being used.
            //
            case USB_EP_MODE_ISOC:
            {
                ulRegister |= USB_TXTYPE1_PROTO_ISOC;
                break;
            }

            //
            // The interrupt protocol is being used.
            //
            case USB_EP_MODE_INT:
            {
                ulRegister |= USB_TXTYPE1_PROTO_INT;
                break;
            }

            //
            // The control protocol is being used.
            //
            case USB_EP_MODE_CTRL:
            {
                ulRegister |= USB_TXTYPE1_PROTO_CTRL;
                break;
            }
        }

        //
        // See if the transmit or receive endpoint is being configured.
        //
        if(ulFlags & USB_EP_HOST_OUT)
        {
            //
            // Set the transfer type information.
            //
            HWREGB(ulBase + EP_OFFSET(ulEndpoint) + USB_O_TXTYPE1) =
                ulRegister;

            //
            // Set the NAK timeout or polling interval.
            //
            HWREGB(ulBase + EP_OFFSET(ulEndpoint) + USB_O_TXINTERVAL1) =
                ulNAKPollInterval;

            //
            // Set the Maximum Payload per transaction.
            //
            HWREGB(ulBase + EP_OFFSET(ulEndpoint) + USB_O_TXMAXP1) =
                ulMaxPayload;

            //
            // Set the transmit control value to zero.
            //
            ulRegister = 0;

            //
            // Allow auto setting of TxPktRdy when max packet size has been
            // loaded into the FIFO.
            //
            if(ulFlags & USB_EP_AUTO_SET)
            {
                ulRegister |= USB_TXCSRH1_AUTOSET;
            }

            //
            // Configure the DMA Mode.
            //
            if(ulFlags & USB_EP_DMA_MODE_1)
            {
                ulRegister |= USB_TXCSRH1_DMAEN | USB_TXCSRH1_DMAMOD;
            }
            else if(ulFlags & USB_EP_DMA_MODE_0)
            {
                ulRegister |= USB_TXCSRH1_DMAEN;
            }

            //
            // Write out the transmit control value.
            //
            HWREGB(ulBase + EP_OFFSET(ulEndpoint) + USB_O_TXCSRH1) =
                (unsigned char)ulRegister;
        }
        else
        {
            //
            // Set the transfer type information.
            //
            HWREGB(ulBase + EP_OFFSET(ulEndpoint) + USB_O_RXTYPE1) =
                ulRegister;

            //
            // Set the NAK timeout or polling interval.
            //
            HWREGB(ulBase + EP_OFFSET(ulEndpoint) + USB_O_RXINTERVAL1) =
                ulNAKPollInterval;

            //
            // Set the receive control value to zero.
            //
            ulRegister = 0;

            //
            // Allow auto clearing of RxPktRdy when packet of size max packet
            // has been unloaded from the FIFO.
            //
            if(ulFlags & USB_EP_AUTO_CLEAR)
            {
                ulRegister |= USB_RXCSRH1_AUTOCL;
            }

            //
            // Configure the DMA Mode.
            //
            if(ulFlags & USB_EP_DMA_MODE_1)
            {
                ulRegister |= USB_RXCSRH1_DMAEN | USB_RXCSRH1_DMAMOD;
            }
            else if(ulFlags & USB_EP_DMA_MODE_0)
            {
                ulRegister |= USB_RXCSRH1_DMAEN;
            }

            //
            // Write out the receive control value.
            //
            HWREGB(ulBase + EP_OFFSET(ulEndpoint) + USB_O_RXCSRH1) =
                (unsigned char)ulRegister;
        }
    }
}

//*****************************************************************************
//
//! Sets the configuration for an endpoint.
//!
//! \param ulBase specifies the USB module base address.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91官网在线免费观看| 中文字幕一区二区三区不卡 | 国产精品 欧美精品| 日本三级韩国三级欧美三级| 午夜伊人狠狠久久| 天使萌一区二区三区免费观看| 亚洲国产视频一区二区| 五月婷婷欧美视频| 青青国产91久久久久久| 免费国产亚洲视频| 黄一区二区三区| 国产精品综合av一区二区国产馆| 国产一区二区免费看| 国产精品亚洲视频| 99国产精品一区| 在线亚洲精品福利网址导航| 欧美日韩一区二区三区在线| 欧美精品一级二级| 欧美成人午夜电影| 国产区在线观看成人精品| 亚洲欧洲一区二区在线播放| 亚洲黄色免费网站| 日本亚洲电影天堂| 国产一区二区三区四区五区入口| 成人一道本在线| 欧美在线视频日韩| 日韩网站在线看片你懂的| 久久久久久久精| 亚洲欧美日韩精品久久久久| 偷拍一区二区三区| 久久激情综合网| jlzzjlzz亚洲女人18| 欧美性videosxxxxx| 欧美成人性战久久| 中文字幕在线观看一区| 五月激情综合婷婷| 国产一区欧美一区| 99riav久久精品riav| 欧美私人免费视频| 久久久久久久久久电影| 一区二区在线观看不卡| 极品少妇xxxx精品少妇| 成人app软件下载大全免费| 欧美日本一道本| 久久九九影视网| 亚洲成在线观看| 国产91露脸合集magnet | 精品国产电影一区二区| 国产精品天干天干在观线 | 91福利精品视频| 欧美电影免费提供在线观看| 国产精品福利av| 久久99深爱久久99精品| 色婷婷综合在线| 欧美精品一区二区三区四区| 亚洲综合一区二区三区| 国产东北露脸精品视频| 欧美色视频在线| 中文字幕va一区二区三区| 天天综合色天天综合色h| www.日韩精品| 久久久综合激的五月天| 午夜亚洲福利老司机| a在线欧美一区| 久久青草国产手机看片福利盒子| 夜色激情一区二区| 成人高清免费观看| 精品欧美一区二区在线观看| 一区二区三区欧美日韩| 国产成人av电影在线观看| 欧美一区二区三区四区久久 | 粉嫩久久99精品久久久久久夜| 欧美日韩国产经典色站一区二区三区| 26uuu精品一区二区| 亚洲成人7777| 92精品国产成人观看免费| 欧美亚洲高清一区二区三区不卡| 亚洲精品中文字幕在线观看| 一本到不卡精品视频在线观看 | 中文字幕精品综合| 美国三级日本三级久久99| 在线亚洲人成电影网站色www| 国产精品久久三| 国产精选一区二区三区| 精品国产在天天线2019| 日韩一区精品字幕| 欧美系列日韩一区| 亚洲欧美电影院| 99久久99久久综合| 国产免费成人在线视频| 精品一区二区免费| 日韩欧美国产电影| 免费成人在线影院| 欧美一级夜夜爽| 日精品一区二区| 欧美肥妇毛茸茸| 日韩一区精品字幕| 欧美一区二区三区色| 午夜精品久久久久久久久久| 欧美亚洲综合色| 亚洲一区二区五区| 欧美男女性生活在线直播观看| 亚洲国产日韩av| 欧美电影一区二区| 日韩国产高清影视| 日韩免费成人网| 国产真实乱偷精品视频免| 欧美精品一区二| 国产麻豆成人传媒免费观看| 国产欧美视频一区二区三区| 成人av免费在线播放| 中文字幕在线不卡| 日本精品一区二区三区高清| 一区二区三区蜜桃| 51精品视频一区二区三区| 青青草精品视频| 久久综合久久鬼色中文字| 国产精品1024久久| 亚洲人成亚洲人成在线观看图片| 91香蕉视频黄| 亚洲电影在线免费观看| 日韩欧美视频一区| 丁香啪啪综合成人亚洲小说 | 中文字幕一区二区三区色视频| 99re这里只有精品6| 亚洲在线观看免费| 欧美一区二区国产| 国产老肥熟一区二区三区| 国产精品久久精品日日| 在线看国产一区二区| 日产国产高清一区二区三区| 精品国偷自产国产一区| 成人不卡免费av| 亚洲不卡av一区二区三区| 日韩精品一区二区三区在线| 成人黄色av电影| 午夜视频在线观看一区| 久久久久国产精品厨房| 色综合一个色综合亚洲| 日本伊人精品一区二区三区观看方式| 久久蜜桃av一区二区天堂| 成人成人成人在线视频| 午夜成人免费视频| 欧美国产一区二区| 欧美久久久一区| 成人一区二区视频| 天堂蜜桃91精品| 国产精品久久久久久久蜜臀| 制服丝袜av成人在线看| 成人黄色在线看| 蜜乳av一区二区| 亚洲欧洲日韩av| 欧美一级片免费看| 91网上在线视频| 久久不见久久见免费视频1 | 99在线精品一区二区三区| 天堂蜜桃一区二区三区| 国产精品美女久久久久久久久久久| 欧美亚洲国产一区二区三区| 国产成人精品免费视频网站| 亚洲国产另类精品专区| 国产精品日韩精品欧美在线| 欧美日韩国产综合一区二区| 成人禁用看黄a在线| 麻豆久久久久久| 亚洲狠狠丁香婷婷综合久久久| 久久久www成人免费毛片麻豆| 欧美怡红院视频| 成人一区在线看| 久久电影网电视剧免费观看| 亚洲资源在线观看| 国产精品乱码一区二三区小蝌蚪| 91精品免费在线| 欧美曰成人黄网| 成人动漫视频在线| 国产一区二区在线免费观看| 午夜电影久久久| 亚洲激情图片一区| 国产精品美女久久久久久2018| 精品欧美一区二区在线观看| 欧美日韩成人一区二区| 91麻豆swag| 成人高清视频在线| 国产一区二区精品久久| 免费观看30秒视频久久| 婷婷激情综合网| 亚洲自拍偷拍综合| 亚洲女与黑人做爰| 国产精品成人一区二区三区夜夜夜| 精品福利一区二区三区| 欧美一级欧美三级| 这里只有精品免费| 欧美日韩三级一区二区| 91黄色在线观看| 91麻豆123| 日本乱人伦一区| 一本高清dvd不卡在线观看| 91视频在线看| 97精品久久久久中文字幕| 91在线观看高清|