0001
0002
0003
0004
0005
0006
0007 #ifndef __FLEXCOP_USB_H_INCLUDED__
0008 #define __FLEXCOP_USB_H_INCLUDED__
0009
0010 #include <linux/usb.h>
0011
0012
0013 #define B2C2_USB_FRAMES_PER_ISO 4
0014 #define B2C2_USB_NUM_ISO_URB 4
0015
0016 #define B2C2_USB_CTRL_PIPE_IN usb_rcvctrlpipe(fc_usb->udev, 0)
0017 #define B2C2_USB_CTRL_PIPE_OUT usb_sndctrlpipe(fc_usb->udev, 0)
0018 #define B2C2_USB_DATA_PIPE usb_rcvisocpipe(fc_usb->udev, 1)
0019
0020 struct flexcop_usb {
0021 struct usb_device *udev;
0022 struct usb_interface *uintf;
0023
0024 u8 *iso_buffer;
0025 int buffer_size;
0026 dma_addr_t dma_addr;
0027
0028 struct urb *iso_urb[B2C2_USB_NUM_ISO_URB];
0029 struct flexcop_device *fc_dev;
0030
0031 u8 tmp_buffer[1023+190];
0032 int tmp_buffer_length;
0033
0034
0035 u8 data[80];
0036 struct mutex data_mutex;
0037 };
0038
0039 #if 0
0040
0041 typedef enum {
0042
0043 } flexcop_usb_request_type_t;
0044 #endif
0045
0046
0047 typedef enum {
0048 B2C2_USB_WRITE_V8_MEM = 0x04,
0049 B2C2_USB_READ_V8_MEM = 0x05,
0050 B2C2_USB_READ_REG = 0x08,
0051 B2C2_USB_WRITE_REG = 0x0A,
0052 B2C2_USB_WRITEREGHI = 0x0B,
0053 B2C2_USB_FLASH_BLOCK = 0x10,
0054 B2C2_USB_I2C_REQUEST = 0x11,
0055 B2C2_USB_UTILITY = 0x12,
0056 } flexcop_usb_request_t;
0057
0058
0059 typedef enum {
0060 USB_FUNC_I2C_WRITE = 0x01,
0061 USB_FUNC_I2C_MULTIWRITE = 0x02,
0062 USB_FUNC_I2C_READ = 0x03,
0063 USB_FUNC_I2C_REPEATWRITE = 0x04,
0064 USB_FUNC_GET_DESCRIPTOR = 0x05,
0065 USB_FUNC_I2C_REPEATREAD = 0x06,
0066
0067 USB_FUNC_I2C_CHECKWRITE = 0x07,
0068 USB_FUNC_I2C_CHECKRESULT = 0x08,
0069 } flexcop_usb_i2c_function_t;
0070
0071
0072
0073 typedef enum {
0074 UTILITY_SET_FILTER = 0x01,
0075 UTILITY_DATA_ENABLE = 0x02,
0076 UTILITY_FLEX_MULTIWRITE = 0x03,
0077 UTILITY_SET_BUFFER_SIZE = 0x04,
0078 UTILITY_FLEX_OPERATOR = 0x05,
0079 UTILITY_FLEX_RESET300_START = 0x06,
0080 UTILITY_FLEX_RESET300_STOP = 0x07,
0081 UTILITY_FLEX_RESET300 = 0x08,
0082 UTILITY_SET_ISO_SIZE = 0x09,
0083 UTILITY_DATA_RESET = 0x0A,
0084 UTILITY_GET_DATA_STATUS = 0x10,
0085 UTILITY_GET_V8_REG = 0x11,
0086
0087 UTILITY_SRAM_WRITE = 0x12,
0088 UTILITY_SRAM_READ = 0x13,
0089 UTILITY_SRAM_TESTFILL = 0x14,
0090 UTILITY_SRAM_TESTSET = 0x15,
0091 UTILITY_SRAM_TESTVERIFY = 0x16,
0092 } flexcop_usb_utility_function_t;
0093
0094 #define B2C2_WAIT_FOR_OPERATION_RW 1000
0095 #define B2C2_WAIT_FOR_OPERATION_RDW 3000
0096 #define B2C2_WAIT_FOR_OPERATION_WDW 1000
0097
0098 #define B2C2_WAIT_FOR_OPERATION_V8READ 3000
0099 #define B2C2_WAIT_FOR_OPERATION_V8WRITE 3000
0100 #define B2C2_WAIT_FOR_OPERATION_V8FLASH 3000
0101
0102 typedef enum {
0103 V8_MEMORY_PAGE_DVB_CI = 0x20,
0104 V8_MEMORY_PAGE_DVB_DS = 0x40,
0105 V8_MEMORY_PAGE_MULTI2 = 0x60,
0106 V8_MEMORY_PAGE_FLASH = 0x80
0107 } flexcop_usb_mem_page_t;
0108
0109 #define V8_MEMORY_EXTENDED (1 << 15)
0110 #define USB_MEM_READ_MAX 32
0111 #define USB_MEM_WRITE_MAX 1
0112 #define USB_FLASH_MAX 8
0113 #define V8_MEMORY_PAGE_SIZE 0x8000
0114 #define V8_MEMORY_PAGE_MASK 0x7FFF
0115
0116 #endif