flexcop-usb.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #ifndef __FLEXCOP_USB_H_INCLUDED__
  2. #define __FLEXCOP_USB_H_INCLUDED__
  3. #include <linux/usb.h>
  4. /* transfer parameters */
  5. #define B2C2_USB_FRAMES_PER_ISO 4
  6. #define B2C2_USB_NUM_ISO_URB 4
  7. #define B2C2_USB_CTRL_PIPE_IN usb_rcvctrlpipe(fc_usb->udev,0)
  8. #define B2C2_USB_CTRL_PIPE_OUT usb_sndctrlpipe(fc_usb->udev,0)
  9. #define B2C2_USB_DATA_PIPE usb_rcvisocpipe(fc_usb->udev,0x81)
  10. struct flexcop_usb {
  11. struct usb_device *udev;
  12. struct usb_interface *uintf;
  13. u8 *iso_buffer;
  14. int buffer_size;
  15. dma_addr_t dma_addr;
  16. struct urb *iso_urb[B2C2_USB_NUM_ISO_URB];
  17. struct flexcop_device *fc_dev;
  18. u8 tmp_buffer[1023+190];
  19. int tmp_buffer_length;
  20. };
  21. #if 0
  22. /* request types TODO What is its use?*/
  23. typedef enum {
  24. /* something is wrong with this part
  25. RTYPE_READ_DW = (1 << 6),
  26. RTYPE_WRITE_DW_1 = (3 << 6),
  27. RTYPE_READ_V8_MEMORY = (6 << 6),
  28. RTYPE_WRITE_V8_MEMORY = (7 << 6),
  29. RTYPE_WRITE_V8_FLASH = (8 << 6),
  30. RTYPE_GENERIC = (9 << 6),
  31. */
  32. } flexcop_usb_request_type_t;
  33. #endif
  34. /* request */
  35. typedef enum {
  36. B2C2_USB_WRITE_V8_MEM = 0x04,
  37. B2C2_USB_READ_V8_MEM = 0x05,
  38. B2C2_USB_READ_REG = 0x08,
  39. B2C2_USB_WRITE_REG = 0x0A,
  40. /* B2C2_USB_WRITEREGLO = 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. /*
  59. * function definition for UTILITY request 0x12
  60. * DKT 020304 - new utility function
  61. */
  62. typedef 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. #define B2C2_WAIT_FOR_OPERATION_RW 1*HZ /* 1 s */
  83. #define B2C2_WAIT_FOR_OPERATION_RDW 3*HZ /* 3 s */
  84. #define B2C2_WAIT_FOR_OPERATION_WDW 1*HZ /* 1 s */
  85. #define B2C2_WAIT_FOR_OPERATION_V8READ 3*HZ /* 3 s */
  86. #define B2C2_WAIT_FOR_OPERATION_V8WRITE 3*HZ /* 3 s */
  87. #define B2C2_WAIT_FOR_OPERATION_V8FLASH 3*HZ /* 3 s */
  88. typedef enum {
  89. V8_MEMORY_PAGE_DVB_CI = 0x20,
  90. V8_MEMORY_PAGE_DVB_DS = 0x40,
  91. V8_MEMORY_PAGE_MULTI2 = 0x60,
  92. V8_MEMORY_PAGE_FLASH = 0x80
  93. } flexcop_usb_mem_page_t;
  94. #define V8_MEMORY_EXTENDED (1 << 15)
  95. #define USB_MEM_READ_MAX 32
  96. #define USB_MEM_WRITE_MAX 1
  97. #define USB_FLASH_MAX 8
  98. #define V8_MEMORY_PAGE_SIZE 0x8000 // 32K
  99. #define V8_MEMORY_PAGE_MASK 0x7FFF
  100. #endif