⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbi2cinterface.h

📁 完整的基于Conxant平台的USB电视棒的WIN驱动程序。
💻 H
字号:
/*+++ *******************************************************************\ 
* 
*  Copyright and Disclaimer: 
*  
*     --------------------------------------------------------------- 
*     This software is provided "AS IS" without warranty of any kind, 
*     either expressed or implied, including but not limited to the 
*     implied warranties of noninfringement, merchantability and/or 
*     fitness for a particular purpose.
*     --------------------------------------------------------------- 
*   
*     Copyright (c) 2008 Conexant Systems, Inc. 
*     All rights reserved. 
*
\******************************************************************* ---*/ 
#ifndef _USB_I2C_INTERFACE_H_
#define _USB_I2C_INTERFACE_H_

extern "C" 
{
#include <wdm.h>
}

#include <windef.h>

#include "i2cIF.h"

class PolarisUsbInterface;
class CUsbInterface;
class Device;

class UsbI2cInterface : public I2cIF
{
public:
    UsbI2cInterface(PolarisUsbInterface* p_usb_firmware, CUsbInterface* p_usb, Device* p_device);

    // Increments the reference count for the calling interface on an 
    // object. QueryInferface calls addRef on the returned interface 
    // pointer on behalf of the caller.
    virtual INT       addRef();
    // Decrements the reference count for the calling interface 
    // on a object. If the reference count on the object falls 
    // to 0, the object is freed from memory.
    virtual INT       release();
    virtual NTSTATUS setCommandFormat(BOOLEAN first,BOOLEAN last);

    virtual BOOLEAN read( 
        BYTE   device_adr, 
        INT    size, 
        BYTE  *p_buf)
    {
        return TRUE;
    }

    virtual BOOLEAN write( 
        BYTE   device_adr, 
        INT    size, 
        BYTE  *p_buf)
    {
        return TRUE;
    }

    virtual BOOLEAN writeThenRead( 
        BYTE        device_adr, 
        INT         write_size, 
        const BYTE *p_write_buf,
        INT         read_size,
        BYTE       *p_read_buf)
    {
        return TRUE;
    }

    // the next 2 I2c interface added for Polaris
    // because Polaris only support single read & write
    virtual BOOLEAN read( 
        BYTE        device_adr, 
        INT         subaddr_size, 
        const BYTE  *p_subaddr_buf,
        INT         read_size,
        BYTE        *p_read_buf,
        BYTE        channel);

    virtual BOOLEAN write( 
        BYTE        device_adr, 
        INT         subaddr_size,
        const BYTE  *p_subaddr_buf,
        INT         write_size,
        BYTE        *p_write_buf,
        BYTE        channel);

    DWORD maxTransferSize();

    BOOL SelectAnalogMode();
    BOOL SelectDigitalMode();

    VOID lock();
    VOID unlock();

    BOOLEAN IsDigitalStreamRunning();
    BOOLEAN IsAnalogStreamRunning();

    BOOL getCurrentMode() {return _is_digital_mode;}

protected:

private:
    KMUTEX          _mutex;
    INT             _reference_count;

    CUsbInterface*  _p_usb;
    PolarisUsbInterface*    _p_usb_firmware;
    Device*         _p_device;
    BOOL            _is_digital_mode; // 0 - Analog Mode , 1 - Digital Mode

};

#endif //_USB_I2C_INTERFACE_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -