1/* 2 * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III 3 * flexcop-usb.h - header file for the USB part 4 * see flexcop.c for copyright information 5 */ 6#ifndef __FLEXCOP_USB_H_INCLUDED__ 7#define __FLEXCOP_USB_H_INCLUDED__ 8 9#include <linux/usb.h> 10 11/* transfer parameters */ 12#define B2C2_USB_FRAMES_PER_ISO 4 13#define B2C2_USB_NUM_ISO_URB 4 14 15#define B2C2_USB_CTRL_PIPE_IN usb_rcvctrlpipe(fc_usb->udev, 0) 16#define B2C2_USB_CTRL_PIPE_OUT usb_sndctrlpipe(fc_usb->udev, 0) 17#define B2C2_USB_DATA_PIPE usb_rcvisocpipe(fc_usb->udev, 0x81) 18 19struct flexcop_usb { 20 struct usb_device *udev; 21 struct usb_interface *uintf; 22 23 u8 *iso_buffer; 24 int buffer_size; 25 dma_addr_t dma_addr; 26 27 struct urb *iso_urb[B2C2_USB_NUM_ISO_URB]; 28 struct flexcop_device *fc_dev; 29 30 u8 tmp_buffer[1023+190]; 31 int tmp_buffer_length; 32}; 33 34 35/* request */ 36typedef enum { 37 B2C2_USB_WRITE_V8_MEM = 0x04, 38 B2C2_USB_READ_V8_MEM = 0x05, 39 B2C2_USB_READ_REG = 0x08, 40 B2C2_USB_WRITE_REG = 0x0A, 41 B2C2_USB_WRITEREGHI = 0x0B, 42 B2C2_USB_FLASH_BLOCK = 0x10, 43 B2C2_USB_I2C_REQUEST = 0x11, 44 B2C2_USB_UTILITY = 0x12, 45} flexcop_usb_request_t; 46 47/* function definition for I2C_REQUEST */ 48typedef enum { 49 USB_FUNC_I2C_WRITE = 0x01, 50 USB_FUNC_I2C_MULTIWRITE = 0x02, 51 USB_FUNC_I2C_READ = 0x03, 52 USB_FUNC_I2C_REPEATWRITE = 0x04, 53 USB_FUNC_GET_DESCRIPTOR = 0x05, 54 USB_FUNC_I2C_REPEATREAD = 0x06, 55 /* DKT 020208 - add this to support special case of DiSEqC */ 56 USB_FUNC_I2C_CHECKWRITE = 0x07, 57 USB_FUNC_I2C_CHECKRESULT = 0x08, 58} flexcop_usb_i2c_function_t; 59 60/* function definition for UTILITY request 0x12 61 * DKT 020304 - new utility function */ 62typedef enum { 63 UTILITY_SET_FILTER = 0x01, 64 UTILITY_DATA_ENABLE = 0x02, 65 UTILITY_FLEX_MULTIWRITE = 0x03, 66 UTILITY_SET_BUFFER_SIZE = 0x04, 67 UTILITY_FLEX_OPERATOR = 0x05, 68 UTILITY_FLEX_RESET300_START = 0x06, 69 UTILITY_FLEX_RESET300_STOP = 0x07, 70 UTILITY_FLEX_RESET300 = 0x08, 71 UTILITY_SET_ISO_SIZE = 0x09, 72 UTILITY_DATA_RESET = 0x0A, 73 UTILITY_GET_DATA_STATUS = 0x10, 74 UTILITY_GET_V8_REG = 0x11, 75 /* DKT 020326 - add function for v1.14 */ 76 UTILITY_SRAM_WRITE = 0x12, 77 UTILITY_SRAM_READ = 0x13, 78 UTILITY_SRAM_TESTFILL = 0x14, 79 UTILITY_SRAM_TESTSET = 0x15, 80 UTILITY_SRAM_TESTVERIFY = 0x16, 81} flexcop_usb_utility_function_t; 82 83#define B2C2_WAIT_FOR_OPERATION_RW (1*HZ) 84#define B2C2_WAIT_FOR_OPERATION_RDW (3*HZ) 85#define B2C2_WAIT_FOR_OPERATION_WDW (1*HZ) 86 87#define B2C2_WAIT_FOR_OPERATION_V8READ (3*HZ) 88#define B2C2_WAIT_FOR_OPERATION_V8WRITE (3*HZ) 89#define B2C2_WAIT_FOR_OPERATION_V8FLASH (3*HZ) 90 91typedef enum { 92 V8_MEMORY_PAGE_DVB_CI = 0x20, 93 V8_MEMORY_PAGE_DVB_DS = 0x40, 94 V8_MEMORY_PAGE_MULTI2 = 0x60, 95 V8_MEMORY_PAGE_FLASH = 0x80 96} flexcop_usb_mem_page_t; 97 98#define V8_MEMORY_EXTENDED (1 << 15) 99#define USB_MEM_READ_MAX 32 100#define USB_MEM_WRITE_MAX 1 101#define USB_FLASH_MAX 8 102#define V8_MEMORY_PAGE_SIZE 0x8000 /* 32K */ 103#define V8_MEMORY_PAGE_MASK 0x7FFF 104 105#endif 106