X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fmedia%2Fdvb%2Fdibusb%2Fdvb-dibusb.h;h=914a010a13b2d0a05f651fd291a1cb6b4a6ffcea;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=8a17fc0d6169135a2585b132cb845ec3a8f94392;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/drivers/media/dvb/dibusb/dvb-dibusb.h b/drivers/media/dvb/dibusb/dvb-dibusb.h index 8a17fc0d6..914a010a1 100644 --- a/drivers/media/dvb/dibusb/dvb-dibusb.h +++ b/drivers/media/dvb/dibusb/dvb-dibusb.h @@ -1,293 +1,165 @@ /* * dvb-dibusb.h * - * Copyright (C) 2004 Patrick Boettcher (patrick.boettcher@desy.de) + * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation, version 2. * - * for more information see dvb-dibusb.c . + * for more information see dvb-dibusb-core.c . */ - #ifndef __DVB_DIBUSB_H__ #define __DVB_DIBUSB_H__ +#include +#include +#include + +#include "dvb_frontend.h" +#include "dvb_demux.h" +#include "dvb_net.h" +#include "dmxdev.h" + #include "dib3000.h" +#include "mt352.h" + +/* debug */ +#ifdef CONFIG_DVB_DIBCOM_DEBUG +#define dprintk(level,args...) \ + do { if ((dvb_dibusb_debug & level)) { printk(args); } } while (0) + +#define debug_dump(b,l) {\ + int i; \ + for (i = 0; i < l; i++) deb_xfer("%02x ", b[i]); \ + deb_xfer("\n");\ +} + +#else +#define dprintk(args...) +#define debug_dump(b,l) +#endif + +extern int dvb_dibusb_debug; + +/* Version information */ +#define DRIVER_VERSION "0.3" +#define DRIVER_DESC "Driver for DiBcom based USB Budget DVB-T device" +#define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de" + +#define deb_info(args...) dprintk(0x01,args) +#define deb_xfer(args...) dprintk(0x02,args) +#define deb_alot(args...) dprintk(0x04,args) +#define deb_ts(args...) dprintk(0x08,args) +#define deb_err(args...) dprintk(0x10,args) +#define deb_rc(args...) dprintk(0x20,args) + +/* generic log methods - taken from usb.h */ +#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , __FILE__ , ## arg) +#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , __FILE__ , ## arg) +#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , __FILE__ , ## arg) + +struct dibusb_usb_controller { + const char *name; /* name of the usb controller */ + u16 cpu_cs_register; /* needs to be restarted, when the firmware has been downloaded. */ +}; typedef enum { DIBUSB1_1 = 0, - DIBUSB2_0, DIBUSB1_1_AN2235, -} dibusb_type; + DIBUSB2_0, + UMT2_0, +} dibusb_class_t; -static const char * dibusb_fw_filenames1_1[] = { - "dvb-dibusb-5.0.0.11.fw" -}; +typedef enum { + DIBUSB_TUNER_CABLE_THOMSON = 0, + DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5, + DIBUSB_TUNER_CABLE_LG_TDTP_E102P, + DIBUSB_TUNER_COFDM_PANASONIC_ENV77H11D5, +} dibusb_tuner_t; -static const char * dibusb_fw_filenames1_1_an2235[] = { - "dvb-dibusb-an2235-1.fw" -}; +typedef enum { + DIBUSB_DIB3000MB = 0, + DIBUSB_DIB3000MC, + DIBUSB_MT352, +} dibusb_demodulator_t; -static const char * dibusb_fw_filenames2_0[] = { - "dvb-dibusb-6.0.0.5.fw" -}; +typedef enum { + DIBUSB_RC_NO = 0, + DIBUSB_RC_NEC_PROTOCOL = 1, +} dibusb_remote_t; -struct dibusb_device_parameter { - dibusb_type type; - u8 demod_addr; - const char **fw_filenames; - const char *usb_controller; - u16 usb_cpu_csreg; - - int num_urbs; - int urb_buf_size; - int default_size; - int firmware_bug; - - int cmd_pipe; - int result_pipe; - int data_pipe; -}; +struct dibusb_tuner { + dibusb_tuner_t id; -static struct dibusb_device_parameter dibusb_dev_parm[3] = { - { .type = DIBUSB1_1, - .demod_addr = 0x10, - .fw_filenames = dibusb_fw_filenames1_1, - .usb_controller = "Cypress AN2135", - .usb_cpu_csreg = 0x7f92, - - .num_urbs = 3, - .urb_buf_size = 4096, - .default_size = 188*21, - .firmware_bug = 1, - - .cmd_pipe = 0x01, - .result_pipe = 0x81, - .data_pipe = 0x82, - }, - { .type = DIBUSB2_0, - .demod_addr = 0x18, - .fw_filenames = dibusb_fw_filenames2_0, - .usb_controller = "Cypress FX2", - .usb_cpu_csreg = 0xe600, - - .num_urbs = 3, - .urb_buf_size = 40960, - .default_size = 188*210, - .firmware_bug = 0, - - .cmd_pipe = 0x01, - .result_pipe = 0x81, - .data_pipe = 0x86, - }, - { .type = DIBUSB1_1_AN2235, - .demod_addr = 0x10, - .fw_filenames = dibusb_fw_filenames1_1_an2235, - .usb_controller = "Cypress CY7C64613 (AN2235)", - .usb_cpu_csreg = 0x7f92, - - .num_urbs = 3, - .urb_buf_size = 4096, - .default_size = 188*21, - .firmware_bug = 1, - - .cmd_pipe = 0x01, - .result_pipe = 0x81, - .data_pipe = 0x82, - } + u8 pll_addr; /* tuner i2c address */ }; +extern struct dibusb_tuner dibusb_tuner[]; -struct dibusb_device { - const char *name; - u16 cold_product_id; - u16 warm_product_id; - struct dibusb_device_parameter *parm; -}; +#define DIBUSB_POSSIBLE_I2C_ADDR_NUM 4 +struct dibusb_demod { + dibusb_demodulator_t id; -/* Vendor IDs */ -#define USB_VID_ANCHOR 0x0547 -#define USB_VID_AVERMEDIA 0x14aa -#define USB_VID_COMPRO 0x185b -#define USB_VID_COMPRO_UNK 0x145f -#define USB_VID_CYPRESS 0x04b4 -#define USB_VID_DIBCOM 0x10b8 -#define USB_VID_EMPIA 0xeb1a -#define USB_VID_GRANDTEC 0x5032 -#define USB_VID_HYPER_PALTEK 0x1025 -#define USB_VID_IMC_NETWORKS 0x13d3 -#define USB_VID_TWINHAN 0x1822 -#define USB_VID_ULTIMA_ELECTRONIC 0x05d8 - -/* Product IDs */ -#define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001 -#define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002 -#define USB_PID_COMPRO_DVBU2000_COLD 0xd000 -#define USB_PID_COMPRO_DVBU2000_WARM 0xd001 -#define USB_PID_COMPRO_DVBU2000_UNK_COLD 0x010c -#define USB_PID_COMPRO_DVBU2000_UNK_WARM 0x010d -#define USB_PID_DIBCOM_MOD3000_COLD 0x0bb8 -#define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9 -#define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6 -#define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 -#define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 -#define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 -#define USB_PID_KWORLD_VSTREAM_COLD 0x17de -#define USB_PID_KWORLD_VSTREAM_WARM 0x17df -#define USB_PID_TWINHAN_VP7041_COLD 0x3201 -#define USB_PID_TWINHAN_VP7041_WARM 0x3202 -#define USB_PID_ULTIMA_TVBOX_COLD 0x8105 -#define USB_PID_ULTIMA_TVBOX_WARM 0x8106 -#define USB_PID_ULTIMA_TVBOX_AN2235_COLD 0x8107 -#define USB_PID_ULTIMA_TVBOX_AN2235_WARM 0x8108 -#define USB_PID_ULTIMA_TVBOX_ANCHOR_COLD 0x2235 -#define USB_PID_ULTIMA_TVBOX_USB2_COLD 0x8109 -#define USB_PID_ULTIMA_TVBOX_USB2_FX_COLD 0x8613 -#define USB_PID_ULTIMA_TVBOX_USB2_FX_WARM 0x1002 -#define USB_PID_UNK_HYPER_PALTEK_COLD 0x005e -#define USB_PID_UNK_HYPER_PALTEK_WARM 0x005f -#define USB_PID_YAKUMO_DTT200U_COLD 0x0201 -#define USB_PID_YAKUMO_DTT200U_WARM 0x0301 - -#define DIBUSB_SUPPORTED_DEVICES 15 - -/* USB Driver stuff */ -static struct dibusb_device dibusb_devices[DIBUSB_SUPPORTED_DEVICES] = { - { .name = "TwinhanDTV USB1.1 / Magic Box / HAMA USB1.1 DVB-T device", - .cold_product_id = USB_PID_TWINHAN_VP7041_COLD, - .warm_product_id = USB_PID_TWINHAN_VP7041_WARM, - .parm = &dibusb_dev_parm[0], - }, - { .name = "KWorld V-Stream XPERT DTV - DVB-T USB1.1", - .cold_product_id = USB_PID_KWORLD_VSTREAM_COLD, - .warm_product_id = USB_PID_KWORLD_VSTREAM_WARM, - .parm = &dibusb_dev_parm[0], - }, - { .name = "Grandtec USB1.1 DVB-T/DiBcom USB1.1 DVB-T reference design (MOD3000)", - .cold_product_id = USB_PID_DIBCOM_MOD3000_COLD, - .warm_product_id = USB_PID_DIBCOM_MOD3000_WARM, - .parm = &dibusb_dev_parm[0], - }, - { .name = "Artec T1 USB1.1 TVBOX with AN2135", - .cold_product_id = USB_PID_ULTIMA_TVBOX_COLD, - .warm_product_id = USB_PID_ULTIMA_TVBOX_WARM, - .parm = &dibusb_dev_parm[0], - }, - { .name = "Artec T1 USB1.1 TVBOX with AN2235", - .cold_product_id = USB_PID_ULTIMA_TVBOX_AN2235_COLD, - .warm_product_id = USB_PID_ULTIMA_TVBOX_AN2235_WARM, - .parm = &dibusb_dev_parm[2], - }, - { .name = "Artec T1 USB1.1 TVBOX with AN2235 (misdesigned)", - .cold_product_id = USB_PID_ULTIMA_TVBOX_ANCHOR_COLD, - .warm_product_id = 0, /* undefined, this design becomes USB_PID_DIBCOM_MOD3000_WARM in warm state */ - .parm = &dibusb_dev_parm[2], - }, - { .name = "Artec T1 USB2.0 TVBOX (please report the warm ID)", - .cold_product_id = USB_PID_ULTIMA_TVBOX_USB2_COLD, - .warm_product_id = 0, /* don't know, it is most likely that the device will get another USB ID in warm state */ - .parm = &dibusb_dev_parm[1], - }, - { .name = "Artec T1 USB2.0 TVBOX with FX2 IDs (misdesigned, please report the warm ID)", - .cold_product_id = USB_PID_ULTIMA_TVBOX_USB2_FX_COLD, - .warm_product_id = USB_PID_ULTIMA_TVBOX_USB2_FX_WARM, /* undefined, it could be that the device will get another USB ID in warm state */ - .parm = &dibusb_dev_parm[1], - }, - { .name = "Compro Videomate DVB-U2000 - DVB-T USB1.1", - .cold_product_id = USB_PID_COMPRO_DVBU2000_COLD, - .warm_product_id = USB_PID_COMPRO_DVBU2000_WARM, - .parm = &dibusb_dev_parm[0], - }, - { .name = "Compro Videomate DVB-U2000 - DVB-T USB1.1 (really ?? please report the name!)", - .cold_product_id = USB_PID_COMPRO_DVBU2000_UNK_COLD, - .warm_product_id = USB_PID_COMPRO_DVBU2000_UNK_WARM, - .parm = &dibusb_dev_parm[0], - }, - { .name = "Unkown USB1.1 DVB-T device ???? please report the name to the author", - .cold_product_id = USB_PID_UNK_HYPER_PALTEK_COLD, - .warm_product_id = USB_PID_UNK_HYPER_PALTEK_WARM, - .parm = &dibusb_dev_parm[0], - }, - { .name = "DiBcom USB2.0 DVB-T reference design (MOD3000P)", - .cold_product_id = USB_PID_DIBCOM_MOD3001_COLD, - .warm_product_id = USB_PID_DIBCOM_MOD3001_WARM, - .parm = &dibusb_dev_parm[1], - }, - { .name = "Grandtec DVB-T USB1.1", - .cold_product_id = USB_PID_GRANDTEC_DVBT_USB_COLD, - .warm_product_id = USB_PID_GRANDTEC_DVBT_USB_WARM, - .parm = &dibusb_dev_parm[0], - }, - { .name = "Avermedia AverTV DVBT USB1.1", - .cold_product_id = USB_PID_AVERMEDIA_DVBT_USB_COLD, - .warm_product_id = USB_PID_AVERMEDIA_DVBT_USB_WARM, - .parm = &dibusb_dev_parm[0], - }, - { .name = "Yakumo DVB-T mobile USB2.0", - .cold_product_id = USB_PID_YAKUMO_DTT200U_COLD, - .warm_product_id = USB_PID_YAKUMO_DTT200U_WARM, - .parm = &dibusb_dev_parm[1], - } + int pid_filter_count; /* counter of the internal pid_filter */ + u8 i2c_addrs[DIBUSB_POSSIBLE_I2C_ADDR_NUM]; /* list of possible i2c addresses of the demod */ }; -/* USB Driver stuff */ -/* table of devices that work with this driver */ -static struct usb_device_id dibusb_table [] = { - { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_COLD)}, - { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_DVBT_USB_WARM)}, - { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_COLD) }, - { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_DVBU2000_WARM) }, - { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_COLD) }, - { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3000_WARM) }, - { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_COLD) }, - { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_MOD3001_WARM) }, - { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_COLD) }, - { USB_DEVICE(USB_VID_EMPIA, USB_PID_KWORLD_VSTREAM_WARM) }, - { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_COLD) }, - { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_GRANDTEC_DVBT_USB_WARM) }, - { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_COLD) }, - { USB_DEVICE(USB_VID_GRANDTEC, USB_PID_DIBCOM_MOD3000_WARM) }, - { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_COLD) }, - { USB_DEVICE(USB_VID_HYPER_PALTEK, USB_PID_UNK_HYPER_PALTEK_WARM) }, - { USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_COLD) }, - { USB_DEVICE(USB_VID_IMC_NETWORKS, USB_PID_TWINHAN_VP7041_WARM) }, - { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_COLD) }, - { USB_DEVICE(USB_VID_TWINHAN, USB_PID_TWINHAN_VP7041_WARM) }, - { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_COLD) }, - { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_WARM) }, - { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_COLD) }, - { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_AN2235_WARM) }, - { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_COLD) }, - { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_YAKUMO_DTT200U_WARM) }, - { USB_DEVICE(USB_PID_COMPRO_DVBU2000_UNK_COLD, USB_VID_COMPRO_UNK) }, - { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ULTIMA_TVBOX_USB2_COLD) }, +#define DIBUSB_MAX_TUNER_NUM 2 +struct dibusb_device_class { + dibusb_class_t id; -/* - * activate the following define when you have one of the devices and want to - * build it from build-2.6 in dvb-kernel - */ -// #define CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES -#ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES - { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) }, - { USB_DEVICE(USB_VID_CYPRESS, USB_PID_ULTIMA_TVBOX_USB2_FX_COLD) }, - { USB_DEVICE(USB_VID_ANCHOR, USB_PID_ULTIMA_TVBOX_USB2_FX_WARM) }, -#endif - { } /* Terminating entry */ + const struct dibusb_usb_controller *usb_ctrl; /* usb controller */ + const char *firmware; /* valid firmware filenames */ + + int pipe_cmd; /* command pipe (read/write) */ + int pipe_data; /* data pipe */ + + int urb_count; /* number of data URBs to be submitted */ + int urb_buffer_size; /* the size of the buffer for each URB */ + + dibusb_remote_t remote_type; /* does this device have a ir-receiver */ + + struct dibusb_demod *demod; /* which demodulator is mount */ + struct dibusb_tuner *tuner; /* which tuner can be found here */ }; -MODULE_DEVICE_TABLE (usb, dibusb_table); +#define DIBUSB_ID_MAX_NUM 15 +struct dibusb_usb_device { + const char *name; /* real name of the box */ + struct dibusb_device_class *dev_cl; /* which dibusb_device_class is this device part of */ -#define DIBUSB_I2C_TIMEOUT HZ*5 + struct usb_device_id *cold_ids[DIBUSB_ID_MAX_NUM]; /* list of USB ids when this device is at pre firmware state */ + struct usb_device_id *warm_ids[DIBUSB_ID_MAX_NUM]; /* list of USB ids when this device is at post firmware state */ +}; + +/* a PID for the pid_filter list, when in use */ +struct dibusb_pid +{ + int index; + u16 pid; + int active; +}; struct usb_dibusb { /* usb */ struct usb_device * udev; - struct dibusb_device * dibdev; + struct dibusb_usb_device * dibdev; + +#define DIBUSB_STATE_INIT 0x000 +#define DIBUSB_STATE_URB_LIST 0x001 +#define DIBUSB_STATE_URB_BUF 0x002 +#define DIBUSB_STATE_URB_SUBMIT 0x004 +#define DIBUSB_STATE_DVB 0x008 +#define DIBUSB_STATE_I2C 0x010 +#define DIBUSB_STATE_REMOTE 0x020 +#define DIBUSB_STATE_PIDLIST 0x040 + int init_state; int feedcount; - int pid_parse; - struct dib3000_xfer_ops xfer_ops; + struct dib_fe_xfer_ops xfer_ops; + + struct dibusb_tuner *tuner; struct urb **urb_list; u8 *buffer; @@ -295,49 +167,141 @@ struct usb_dibusb { /* I2C */ struct i2c_adapter i2c_adap; - struct i2c_client i2c_client; /* locking */ struct semaphore usb_sem; struct semaphore i2c_sem; + /* pid filtering */ + spinlock_t pid_list_lock; + struct dibusb_pid *pid_list; + /* dvb */ - int dvb_is_ready; struct dvb_adapter *adapter; struct dmxdev dmxdev; struct dvb_demux demux; struct dvb_net dvb_net; struct dvb_frontend* fe; + int (*fe_sleep) (struct dvb_frontend *); + int (*fe_init) (struct dvb_frontend *); + /* remote control */ struct input_dev rc_input_dev; struct work_struct rc_query_work; int rc_input_event; + + /* module parameters */ + int pid_parse; + int rc_query_interval; }; +/* commonly used functions in the separated files */ + +/* dvb-dibusb-firmware.c */ +int dibusb_loadfirmware(struct usb_device *udev, struct dibusb_usb_device *dibdev); + +/* dvb-dibusb-remote.c */ +int dibusb_remote_exit(struct usb_dibusb *dib); +int dibusb_remote_init(struct usb_dibusb *dib); + +/* dvb-dibusb-fe-i2c.c */ +int dibusb_i2c_msg(struct usb_dibusb *dib, u8 addr, + u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen); +int dibusb_fe_init(struct usb_dibusb* dib); +int dibusb_fe_exit(struct usb_dibusb *dib); +int dibusb_i2c_init(struct usb_dibusb *dib); +int dibusb_i2c_exit(struct usb_dibusb *dib); + +/* dvb-dibusb-dvb.c */ +void dibusb_urb_complete(struct urb *urb, struct pt_regs *ptregs); +int dibusb_dvb_init(struct usb_dibusb *dib); +int dibusb_dvb_exit(struct usb_dibusb *dib); -/* types of first byte of each buffer */ +/* dvb-dibusb-usb.c */ +int dibusb_readwrite_usb(struct usb_dibusb *dib, u8 *wbuf, u16 wlen, u8 *rbuf, + u16 rlen); + +int dibusb_hw_wakeup(struct dvb_frontend *); +int dibusb_hw_sleep(struct dvb_frontend *); +int dibusb_set_streaming_mode(struct usb_dibusb *,u8); +int dibusb_streaming(struct usb_dibusb *,int); + +int dibusb_urb_init(struct usb_dibusb *); +int dibusb_urb_exit(struct usb_dibusb *); + +/* dvb-dibusb-pid.c */ +int dibusb_pid_list_init(struct usb_dibusb *dib); +void dibusb_pid_list_exit(struct usb_dibusb *dib); +int dibusb_ctrl_pid(struct usb_dibusb *dib, struct dvb_demux_feed *dvbdmxfeed , int onoff); + +/* i2c and transfer stuff */ +#define DIBUSB_I2C_TIMEOUT HZ*5 + +/* + * protocol of all dibusb related devices + */ + +/* + * bulk msg to/from endpoint 0x01 + * + * general structure: + * request_byte parameter_bytes + */ #define DIBUSB_REQ_START_READ 0x00 #define DIBUSB_REQ_START_DEMOD 0x01 + +/* + * i2c read + * bulk write: 0x02 ((7bit i2c_addr << 1) & 0x01) register_bytes length_word + * bulk read: byte_buffer (length_word bytes) + */ #define DIBUSB_REQ_I2C_READ 0x02 + +/* + * i2c write + * bulk write: 0x03 (7bit i2c_addr << 1) register_bytes value_bytes + */ #define DIBUSB_REQ_I2C_WRITE 0x03 -/* prefix for reading the current RC key */ +/* + * polling the value of the remote control + * bulk write: 0x04 + * bulk read: byte_buffer (5 bytes) + * + * first byte of byte_buffer shows the status (0x00, 0x01, 0x02) + */ #define DIBUSB_REQ_POLL_REMOTE 0x04 #define DIBUSB_RC_NEC_EMPTY 0x00 #define DIBUSB_RC_NEC_KEY_PRESSED 0x01 #define DIBUSB_RC_NEC_KEY_REPEATED 0x02 -/* 0x05 0xXX */ +/* streaming mode: + * bulk write: 0x05 mode_byte + * + * mode_byte is mostly 0x00 + */ #define DIBUSB_REQ_SET_STREAMING_MODE 0x05 /* interrupt the internal read loop, when blocking */ #define DIBUSB_REQ_INTR_READ 0x06 -/* IO control - * 0x07 +/* io control + * 0x07 cmd_byte param_bytes + * + * param_bytes can be up to 32 bytes + * + * cmd_byte function parameter name + * 0x00 power mode + * 0x00 sleep + * 0x01 wakeup + * + * 0x01 enable streaming + * 0x02 disable streaming + * + * */ #define DIBUSB_REQ_SET_IOCTL 0x07 @@ -348,4 +312,8 @@ struct usb_dibusb { #define DIBUSB_IOCTL_POWER_SLEEP 0x00 #define DIBUSB_IOCTL_POWER_WAKEUP 0x01 +/* modify streaming of the FX2 */ +#define DIBUSB_IOCTL_CMD_ENABLE_STREAM 0x01 +#define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02 + #endif