9 #define USB_URBSIZE(data_size, iso_count) \
10 (data_size + sizeof(struct usb_urb) + iso_count * \
11 sizeof(struct usb_iso_packet_desc))
13 #define USB_PREPARE_URB(urb, data_size, iso_count) \
16 urb->iso_data.iso_desc = data_size;\
17 urb->urb_size = data_size+sizeof(struct usb_urb)+iso_count * \
18 sizeof(struct usb_iso_packet_desc); \
25 void (*urb_completion
)(struct usb_urb
*urb
);
26 void (*connect_device
)(unsigned dev_id
, unsigned int interfaces
);
27 void (*disconnect_device
)(unsigned dev_id
);
30 struct usb_device_id
{
40 u8_t bInterfaceSubClass
;
41 u8_t bInterfaceProtocol
;
44 struct usb_iso_packet_desc
{
46 unsigned int length
; /* expected length */
47 unsigned int actual_length
;
51 /** isochronous transfer */
52 #define USB_TRANSFER_ISO 0
53 /** interrupt transfer */
54 #define USB_TRANSFER_INT 1
55 /** control transfer */
56 #define USB_TRANSFER_CTL 2
58 #define USB_TRANSFER_BLK 3
63 #define USB_INVALID_URB_ID 0
69 /** ID identifying the device on HCD side */
81 unsigned long transfer_flags
;
84 /* housekeeping information needed by usb library */
89 size_t iso_desc_offset
;
90 int number_of_packets
;
94 /* data allways starts here */
98 struct usb_ctrlrequest
{
104 } __attribute__ ((packed
));
107 static void dump_urb(struct usb_urb
*urb
) {
108 printf("================\n");
109 printf("DUMP: urb (0x%p)\n", urb
);
110 printf("================\n");
111 printf("= dev_id: %d\n", urb
->dev_id
);
112 printf("= type: %d\n", urb
->type
);
113 printf("= endpoint: %d\n", urb
->endpoint
);
114 printf("= direction: %d\n", urb
->direction
);
115 printf("= status: %d\n", urb
->status
);
116 printf("= error_count: %d\n", urb
->error_count
);
117 printf("= size: %d\n", urb
->size
);
118 printf("= actual_length: %d\n", urb
->actual_length
);
119 printf("= interval %d\n", urb
->interval
);
120 printf("= transfer_flags %x\n", urb
->transfer_flags
);
121 printf("= urb_id = %d\n", urb
->urb_id
);
122 printf("= urb_size = 0x%x\n", urb
->urb_size
);
123 printf("= setup_packet: \n");
124 printf("= bRequestType: 0x%x \n",
125 ((struct usb_ctrlrequest
*)urb
->setup_packet
)->bRequestType
);
126 printf("= bRequest 0x%x \n",
127 ((struct usb_ctrlrequest
*)urb
->setup_packet
)->bRequest
);
128 printf("= wValue: 0x%x \n",
129 ((struct usb_ctrlrequest
*)urb
->setup_packet
)->wValue
);
130 printf("= wIndex: 0x%x \n",
131 ((struct usb_ctrlrequest
*)urb
->setup_packet
)->wIndex
);
132 printf("= wLength: 0x%x \n",
133 ((struct usb_ctrlrequest
*)urb
->setup_packet
)->wLength
);
134 printf("===============\n");
141 int usb_send_urb(struct usb_urb
* urb
);
143 /** Cancels an URB */
144 int usb_cancle_urb(struct usb_urb
* urb
);
146 /** Gets the USB device ID of an USB device **/
147 int usb_get_device_id(int dev_id
, struct usb_device_id
*usb_device_id
);
149 /* this initializes a session with the HCD */
150 int usb_init(char *name
);
152 /** This functions handles a message from the HCD */
153 int usb_handle_msg(struct usb_driver
*ubd
, message
*msg
);
155 #endif /* _MINIX_USB_H */