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

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

?? cudalpipe.cpp

?? reference about wireless design which is helpful to everyone
?? CPP
字號:
#include <Cudal.h>
#include "UsbIoPipe.h"




/** \brief	Protected constructor (to prevent user instantiation)
 *
 * The constructor initializes the CudalPipe object by storing parameters passed from 
 * \ref CudalDongle::CreatePipe(). The pipe is then reset.
 *
 * \note The constructor should only be called by \ref CudalDongle::CreatePipe().
 *
 * \param[in]		*pUsbIoPipe
 *      The USBIO pipe object created by \ref CudalDongle::CreatePipe()
 * \param[in]		endpointIndex
 *      The same value that was passed to \ref CudalDongle::CreatePipe()
 * \param[in]		directionIsIn
 *      The same value that was passed to \ref CudalDongle::CreatePipe()
 */
CudalPipe::CudalPipe(CUsbIoPipe *pUsbIoPipe, BYTE endpointIndex, BOOL directionIsIn) {
    
    // Store the parameters
    m_pUsbIoPipe = pUsbIoPipe;
    m_endpointIndex = endpointIndex;
    m_directionIsIn = directionIsIn; 
    
	// Reset the pipe
	m_pUsbIoPipe->ResetPipe();

} // CudalPipe




/** \brief  Destroys the pipe object
 */
CudalPipe::~CudalPipe() {
    m_pUsbIoPipe->AbortPipe();
    m_pUsbIoPipe->ResetPipe();
    m_pUsbIoPipe->Unbind();
    delete m_pUsbIoPipe;
} // ~CudalPipe




/** \brief	Submits a read request on the pipe, and waits for it to complete
 *
 * To achieve high data rates, the size of each transfer should be maximized (up to 4 kB).
 * If the operation fails, the pipe is automatically reset. Note that data may be lost upon a timeout!
 *
 * \param[out]      *pData
 *      Pointer to a caller-provided buffer that receives the data
 * \param[in,out]   *pLength
 *      Pointer to a caller-provided varible that initially specifies the size of the data buffer 
 *      (1-4096). If the function returns \c USBIO_ERR_SUCCESS, it indicates the number of valid bytes in 
 *      the data buffer.
 * \param[in]       timeout
 *      Specifies a timeout interval, in milliseconds. The default value is 5 seconds. The value
 *      \c INFINITE makes the interval never elapse. In that case the \ref AbortAll() function
 *      must be run from another thread to cancel the read request.
 *
 * \return
 *		A \ref USBIOERR code (see "usbio_i.h" for more details). If the operation succeeds that would be 
 *      \c USBIO_ERR_SUCCESS = 0. If the specified timeout interval is reached, \c USBIO_ERR_TIMEOUT
 *      is returned.
 * 
 * \sa WriteSync(), CudalPipe::AbortAll
 */
USBIOERR CudalPipe::ReadSync(void *pData, DWORD *pLength, DWORD timeout) {
    if (m_directionIsIn) {
        USBIOERR result = m_pUsbIoPipe->ReadSync(pData, *pLength, timeout);
        if (result != USBIO_ERR_SUCCESS) {
            m_pUsbIoPipe->ResetPipe();
        }
        return result;
    } else {
        return USBIO_ERR_INVALID_INBUFFER;
    }
} // ReadSync




/** \brief	Submits a write request on the pipe, and waits for it to complete
 *
 * To achieve high data rates, the size of each transfer should be maximized (up to 4 kB).
 * If the operation fails, the pipe is automatically reset.
 * 
 * \param[out]      *pData
 *      Pointer to the buffer containing the data to be written
 * \param[in,out]   *pLength
 *      Pointer to a caller-provided varible that initially specifies the number of bytes to be 
 *      transferred (1-4096). If the function returns \c USBIO_ERR_SUCCESS, it indicates the number of
 *      bytes actually transferred.
 * \param[in]       timeout
 *      Specifies a timeout interval, in milliseconds. The default value is 5 seconds. The value
 *      \c INFINITE makes the interval never elapse. In that case the \ref AbortAll() function
 *      must be run from another thread to cancel the write request.
 *
 * \return
 *		A \ref USBIOERR code (see "usbio_i.h" for more details). If the operation succeeds that would be 
 *      \c USBIO_ERR_SUCCESS = 0. If the specified timeout interval is reached, \c USBIO_ERR_TIMEOUT
 *      is returned.
 * 
 * \sa CudalPipe::ReadSync, CudalPipe::AbortAll
 */
USBIOERR CudalPipe::WriteSync(void *pData, DWORD *pLength, DWORD timeout) {
    if (!m_directionIsIn) {
        USBIOERR result = m_pUsbIoPipe->WriteSync(pData, *pLength, timeout);
        if (result != USBIO_ERR_SUCCESS) {
            m_pUsbIoPipe->ResetPipe();
        }
        return result;
    } else {
        return USBIO_ERR_INVALID_OUTBUFFER;
    }
} // WriteSync




/** \brief Submits a read request on the pipe, and returns immediately
 *
 * To achieve high data rates, the size of each transfer should be maximized (up to 4 kB).
 *
 * \param[in]       *pInfo
 *      Pointer to a caller-provided \ref CudalAsyncInfo object that contains information about the 
 *      asynchronous transfer. Note that each transfer must have it's own \ref CudalAsyncInfo object.
 * \param[out]      *pData
 *      Pointer to a caller-provided buffer that receives the data
 * \param[in]       maxLength
 *      The maximum number of bytes to be read (1-4096).
 *
 * \return
 *		\c TRUE if the operation succeeds, otherwise FALSE
 *
 * \sa CudalPipe::WaitAsync, CudalPipe::WaitAsyncTermination, CudalPipe::AbortAll
 */
// Submits a read request on the pipe, and returns immediately
BOOL CudalPipe::ReadAsync(CudalAsyncInfo *pInfo, void *pData, DWORD maxLength) {
    
    // Sanity checks
    if (maxLength > 4096) return NULL;

    // Initialize the transfer structure
    pInfo->m_pUsbIoBuf->NumberOfBytesToTransfer = maxLength;
    pInfo->m_length = maxLength;
    pInfo->m_pData = pData;

    // Submit the read request
    return m_pUsbIoPipe->Read(pInfo->m_pUsbIoBuf);

} // ReadAsync




/** \brief Submits a write request on the pipe, and returns immediately
 *
 * To achieve high data rates, the size of each transfer should be maximized (up to 4 kB).
 *
 * \param[in]       *pInfo
 *      Pointer to a caller-provided \ref CudalAsyncInfo object that contains information about the 
 *      asynchronous transfer. Note that each transfer must have it's own \ref CudalAsyncInfo object.
 * \param[out]      *pData
 *      Pointer to the first byte to be written. The data is copied into the \ref CudalAsyncInfo
 *      structure, so \c *pData can be deleted or modified after this function returns.
 * \param[in]       length
 *      The number of bytes to be written (1-4096)
 *
 * \return
 *		\c TRUE if the operation succeeds, otherwise FALSE
 *
 * \sa CudalPipe::WaitAsync, CudalPipe::WaitAsyncTermination, CudalPipe::AbortAll
 */
BOOL CudalPipe::WriteAsync(CudalAsyncInfo *pInfo, void *pData, DWORD length) {
    
    // Sanity checks
    if (length > 4096) return NULL;

    // Initialize the info
    pInfo->m_length = length;
    pInfo->m_pData = NULL;
    pInfo->m_pUsbIoBuf->NumberOfBytesToTransfer = length;
    memcpy(pInfo->m_pUsbIoBuf->Buffer(), pData, length);

    // Submit the read request
    return m_pUsbIoPipe->Write(pInfo->m_pUsbIoBuf);

} // WriteAsync




/** \brief Waits for an asynchronous read/write operation to complete
 *
 * This function should be called to check whether or not an asynchronous read/write request has 
 * finished. If it has not, the function simply returns \c USBIO_ERR_TIMEOUT, and the request remains
 * active. To terminate read/write requests, the application must call \ref AbortAll(), followed by a
 * call to \ref WaitAsyncTermination() for each pending request.
 *
 * \param[in]       *pInfo
 *      Pointer to a caller-provided \ref CudalAsyncInfo object that contains information about the 
 *      asynchronous transfer
 * \param[out]      *pActualLength
 *      Pointer to a variable that receives the number of bytes actually transferred, provided that the
 *      return value is \c USBIO_ERR_SUCCESS.
 * \param[in]       timeout
 *      Specifies a timeout interval, in milliseconds. The default value is 5 seconds. The value
 *      \c INFINITE makes the interval never elapse.
 *
 * \return
 *		A \ref USBIOERR code (see "usbio_i.h" for more details). If the operation succeeds that would be 
 *      \c USBIO_ERR_SUCCESS = 0. For a timeout it is \c USBIO_ERR_TIMEOUT.
 * 
 * \sa CudalPipe::ReadAsync, CudalPipe::WriteAsync, CudalPipe::WaitAsyncTermination, CudalPipe::AbortAll
 */
USBIOERR CudalPipe::WaitAsync(CudalAsyncInfo *pInfo, DWORD *pActualLength, DWORD timeout) {
    
    // Wait for the transfer to complete
    USBIOERR result = m_pUsbIoPipe->WaitForCompletion(pInfo->m_pUsbIoBuf, timeout);

    // Examine the result
    switch (result) {

    // Success -> Delete the buffers and return the actual length
    case USBIO_ERR_SUCCESS:
        if (pActualLength) *pActualLength = pInfo->m_pUsbIoBuf->BytesTransferred;
        if (pInfo->m_pData) {
            memcpy(pInfo->m_pData, pInfo->m_pUsbIoBuf->Buffer(), pInfo->m_pUsbIoBuf->BytesTransferred);
        }
        break;

	// Timeout -> Nothing happens...
	case USBIO_ERR_TIMEOUT:
		break;

	// If the operation fails, the pipe is reset
    default:
		m_pUsbIoPipe->ResetPipe();
        if (pActualLength) *pActualLength = 0;
        break;
    }
    return result;

} // WaitAsync




/** \brief	Aborts all transfers on the pipe
 *
 * Aborted transfer functions will return \c USBIO_ERR_CANCELED.
 *
 * \return
 *		A \ref USBIOERR code (see "usbio_i.h" for more details). If the operation succeeds that would be 
 *      \c USBIO_ERR_SUCCESS = 0.
 * 
 * \sa CudalPipe::ReadSync, CudalPipe::WriteSync, CudalPipe::WaitAsync, CudalPipe::WaitAsyncTermination
 */
USBIOERR CudalPipe::AbortAll() {
    return m_pUsbIoPipe->AbortPipe();
} // Abort




/** \brief	Initialize the USBIO buffer and blanks all other information
 *
 * The USBIO buffer size is always set to 4096 bytes, which the maximum number for CUDAL transfers
 */
CudalAsyncInfo::CudalAsyncInfo() {
    m_pUsbIoBuf = new CUsbIoBuf(4096);
    m_pData = NULL;
    m_length = 0;
} // CudalAsyncInfo




/** \brief	Destroys the USBIO buffer and blanks all other information
 *
 * Note that a transfer must have been properly terminated before destroying the CudalAsyncInfo object!
 */
CudalAsyncInfo::~CudalAsyncInfo() {
    delete m_pUsbIoBuf;
} // ~CudalAsyncInfo

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一本色道久久综合亚洲91| 欧美精品一卡二卡| 蜜桃精品在线观看| 国产精品视频观看| 欧美一卡二卡三卡| 色综合久久久久综合体桃花网| 另类小说一区二区三区| 亚洲永久精品国产| 亚洲国产岛国毛片在线| 欧美一级国产精品| 色婷婷国产精品久久包臀| 国产成人av电影在线观看| 欧美aaa在线| 亚洲成av人片www| 亚洲免费观看高清完整版在线观看熊 | 亚洲第一综合色| 国产精品久久久久久久久图文区| 精品国产一区二区国模嫣然| 91精品一区二区三区久久久久久| 日本高清不卡aⅴ免费网站| 成人免费av在线| 国产98色在线|日韩| 激情五月激情综合网| 欧美96一区二区免费视频| 亚洲成人免费在线| 亚洲国产美女搞黄色| 亚洲乱码国产乱码精品精98午夜 | 欧美日韩三级在线| 色呦呦一区二区三区| www.日韩在线| 97精品电影院| 91色乱码一区二区三区| 99亚偷拍自图区亚洲| 成人免费高清视频在线观看| 丰满少妇久久久久久久| 国产成人免费av在线| 国产成人精品午夜视频免费| 国产精品中文字幕日韩精品| 国内精品不卡在线| 国产乱一区二区| 国产乱理伦片在线观看夜一区| 国产一区在线精品| 国产福利电影一区二区三区| 国产成人啪免费观看软件| 国产91丝袜在线观看| 国产不卡在线视频| 91免费小视频| 欧美三级日韩在线| 日韩欧美精品三级| 国产亚洲欧美日韩在线一区| 国产欧美日韩在线观看| 国产精品美女久久久久久2018 | 久久99精品一区二区三区三区| 久久精品国产999大香线蕉| 久久精品国产澳门| 处破女av一区二区| 欧美午夜免费电影| 91麻豆精品国产91久久久资源速度| 日韩午夜三级在线| 国产日产欧美精品一区二区三区| 国产精品不卡在线| 亚洲一区二区视频| 免费精品视频在线| 国产不卡免费视频| 在线中文字幕一区| 日韩精品中文字幕在线不卡尤物| 久久久99免费| 亚洲精品高清在线| 美国一区二区三区在线播放| 国产69精品久久久久毛片| 日本高清免费不卡视频| 日韩一区二区三区视频在线观看| 国产亚洲精品资源在线26u| 亚洲精品欧美激情| 老司机精品视频线观看86| 国产suv精品一区二区三区| 欧美主播一区二区三区| 久久婷婷国产综合精品青草| 亚洲人精品午夜| 狠狠网亚洲精品| 在线日韩国产精品| 欧美精品一区二区在线播放| 亚洲欧美日韩综合aⅴ视频| 久久国产三级精品| 91视视频在线直接观看在线看网页在线看| 777色狠狠一区二区三区| 亚洲国产岛国毛片在线| 日韩中文字幕91| 99久久精品免费看| 久久日韩粉嫩一区二区三区| 亚洲一区电影777| 国产成人免费9x9x人网站视频| 欧美精品日韩精品| 最新成人av在线| 麻豆91精品视频| 在线观看一区不卡| 亚洲国产成人在线| 久久国产综合精品| 欧美精品在线视频| 亚洲女与黑人做爰| 国产成人综合精品三级| 91精品国产一区二区三区| 亚洲欧美另类图片小说| 国产黄人亚洲片| 日韩午夜激情视频| 性久久久久久久久| 一本久久精品一区二区| 日本一区二区三区电影| 精彩视频一区二区| 欧美一区二区精美| 亚洲线精品一区二区三区| a在线欧美一区| 国产日韩在线不卡| 国产一区二区日韩精品| 91精品麻豆日日躁夜夜躁| 亚洲综合色视频| 91同城在线观看| 中文字幕亚洲成人| 国产91高潮流白浆在线麻豆| 精品成人一区二区三区| 日本亚洲视频在线| 555www色欧美视频| 婷婷六月综合亚洲| 欧美日韩电影在线| 亚洲国产精品久久人人爱蜜臀| 一本一道综合狠狠老| 亚洲欧洲制服丝袜| 色综合久久中文综合久久牛| 亚洲精选视频免费看| 99久久精品国产导航| 亚洲人123区| 色婷婷精品久久二区二区蜜臀av | 亚洲美女区一区| 99这里都是精品| 亚洲特黄一级片| 一本色道**综合亚洲精品蜜桃冫 | 亚洲一区二区三区国产| 色婷婷综合视频在线观看| 国产精品美日韩| 一本久久a久久免费精品不卡| 一区二区三区精品视频| 欧美日韩一二三| 日韩va亚洲va欧美va久久| 日韩午夜在线影院| 国产精品一二三区| 国产精品久线在线观看| 色婷婷久久久久swag精品 | 成人久久视频在线观看| 国产精品二三区| 欧美色图12p| 美女视频一区在线观看| 久久九九国产精品| 不卡的av电影| 亚洲一区在线免费观看| 日韩女优制服丝袜电影| 懂色av一区二区三区蜜臀| 亚洲欧洲精品天堂一级| 欧美曰成人黄网| 免费日韩伦理电影| 国产精品美女视频| 欧美少妇bbb| 国产在线精品不卡| 国产精品久久久久久亚洲伦 | 欧美一区二区三区啪啪| 国产自产v一区二区三区c| 国产精品卡一卡二卡三| 欧美日韩免费电影| 激情文学综合插| 亚洲黄色录像片| 日韩欧美自拍偷拍| 成人高清伦理免费影院在线观看| 亚洲自拍偷拍欧美| 久久综合久久综合久久| 91亚洲精华国产精华精华液| 视频一区视频二区在线观看| 国产网站一区二区| 欧美日韩国产片| 丁香婷婷综合激情五月色| 亚洲综合激情另类小说区| 久久毛片高清国产| 欧美日韩高清一区二区| 成人免费视频免费观看| 青青草国产精品亚洲专区无| 亚洲欧洲在线观看av| 日韩欧美一级二级| 色哟哟一区二区在线观看| 激情丁香综合五月| 亚洲午夜久久久| 亚洲国产精品ⅴa在线观看| 日韩三级免费观看| 日本高清免费不卡视频| 国产精品一区二区三区四区| 性久久久久久久| 亚洲精品视频自拍| 国产亚洲欧美在线| 日韩精品专区在线影院重磅| 欧美吞精做爰啪啪高潮| 成人激情av网| 国产精品自拍网站| 蜜臀av一区二区在线观看 |