1 #ifndef _QUICK_CAM_DEVICE_H 2 #define _QUICK_CAM_DEVICE_H 3 4 #include "CamDevice.h" 5 6 #define STV_REG_COUNT 0x0c 7 // Control registers of the STV0600 ASIC 8 #define STV_I2C_WRITE 0x400 9 #define STV_I2C_WRITE1 0x400 10 #define STV_I2C_READ 0x1410 11 #define STV_ISO_ENABLE 0x1440 12 #define STV_SCAN_RATE 0x1443 13 #define STV_ISO_SIZE 0x15c1 14 #define STV_Y_CTRL 0x15c3 15 #define STV_X_CTRL 0x1680 16 #define STV_REG00 0x1500 17 #define STV_REG01 0x1501 18 #define STV_REG02 0x1502 19 #define STV_REG03 0x1503 20 #define STV_REG04 0x1504 21 #define STV_REG23 0x0423 22 23 24 // This class represents each webcam 25 class QuickCamDevice : public CamDevice 26 { 27 public: 28 QuickCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device); 29 ~QuickCamDevice(); 30 virtual bool SupportsBulk(); 31 virtual bool SupportsIsochronous(); 32 virtual status_t StartTransfer(); 33 virtual status_t StopTransfer(); 34 35 // generic register-like access 36 virtual ssize_t WriteReg(uint16 address, uint8 *data, size_t count=1); 37 virtual ssize_t ReadReg(uint16 address, uint8 *data, size_t count=1, bool cached=false); 38 39 // I2C-like access 40 virtual status_t GetStatusIIC(); 41 virtual status_t WaitReadyIIC(); 42 virtual ssize_t WriteIIC(uint8 address, uint8 *data, size_t count=1); 43 virtual ssize_t ReadIIC(uint8 address, uint8 *data); 44 virtual ssize_t ReadIIC8(uint8 address, uint8 *data); 45 virtual ssize_t ReadIIC16(uint8 address, uint16 *data); 46 virtual status_t SetIICBitsMode(size_t bits=8); 47 48 private: 49 virtual status_t SendCommand(uint8 dir, uint8 request, uint16 value, 50 uint16 index, uint16 length, void* data); 51 }; 52 53 // the addon itself, that instanciate 54 55 class QuickCamDeviceAddon : public CamDeviceAddon 56 { 57 public: 58 QuickCamDeviceAddon(WebCamMediaAddOn* webcam); 59 virtual ~QuickCamDeviceAddon(); 60 61 virtual const char *BrandName(); 62 virtual QuickCamDevice *Instantiate(CamRoster &roster, BUSBDevice *from); 63 64 }; 65 66 #endif /* _QUICK_CAM_CAM_DEVICE_H */ 67