flexcop-usb.h 3.1 KB

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