dabusb.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #define _BULK_DATA_LEN 64
  2. typedef struct
  3. {
  4. unsigned char data[_BULK_DATA_LEN];
  5. unsigned int size;
  6. unsigned int pipe;
  7. }bulk_transfer_t,*pbulk_transfer_t;
  8. #define DABUSB_MINOR 240 /* some unassigned USB minor */
  9. #define DABUSB_VERSION 0x1000
  10. #define IOCTL_DAB_BULK _IOWR('d', 0x30, bulk_transfer_t)
  11. #define IOCTL_DAB_OVERRUNS _IOR('d', 0x15, int)
  12. #define IOCTL_DAB_VERSION _IOR('d', 0x3f, int)
  13. #ifdef __KERNEL__
  14. typedef enum { _stopped=0, _started } driver_state_t;
  15. typedef struct
  16. {
  17. struct semaphore mutex;
  18. struct usb_device *usbdev;
  19. wait_queue_head_t wait;
  20. wait_queue_head_t remove_ok;
  21. spinlock_t lock;
  22. atomic_t pending_io;
  23. driver_state_t state;
  24. int remove_pending;
  25. int got_mem;
  26. int total_buffer_size;
  27. unsigned int overruns;
  28. int readptr;
  29. int opened;
  30. int devnum;
  31. struct list_head free_buff_list;
  32. struct list_head rec_buff_list;
  33. } dabusb_t,*pdabusb_t;
  34. typedef struct
  35. {
  36. pdabusb_t s;
  37. struct urb *purb;
  38. struct list_head buff_list;
  39. } buff_t,*pbuff_t;
  40. typedef struct
  41. {
  42. wait_queue_head_t wait;
  43. } bulk_completion_context_t, *pbulk_completion_context_t;
  44. #define _DABUSB_IF 2
  45. #define _DABUSB_ISOPIPE 0x09
  46. #define _ISOPIPESIZE 16384
  47. #define _BULK_DATA_LEN 64
  48. // Vendor specific request code for Anchor Upload/Download
  49. // This one is implemented in the core
  50. #define ANCHOR_LOAD_INTERNAL 0xA0
  51. // EZ-USB Control and Status Register. Bit 0 controls 8051 reset
  52. #define CPUCS_REG 0x7F92
  53. #define _TOTAL_BUFFERS 384
  54. #define MAX_INTEL_HEX_RECORD_LENGTH 16
  55. #ifndef _BYTE_DEFINED
  56. #define _BYTE_DEFINED
  57. typedef unsigned char BYTE;
  58. #endif // !_BYTE_DEFINED
  59. #ifndef _WORD_DEFINED
  60. #define _WORD_DEFINED
  61. typedef unsigned short WORD;
  62. #endif // !_WORD_DEFINED
  63. typedef struct _INTEL_HEX_RECORD
  64. {
  65. BYTE Length;
  66. WORD Address;
  67. BYTE Type;
  68. BYTE Data[MAX_INTEL_HEX_RECORD_LENGTH];
  69. } INTEL_HEX_RECORD, *PINTEL_HEX_RECORD;
  70. #endif