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