flexcop-usb.h 3.0 KB

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