2 * URB formatting related definitions
8 #include <ddekit/usb.h>
9 #include <ddekit/semaphore.h>
11 /* Possible values for attach_urb_data's buf_type */
12 /* Both may be used for single URB */
13 #define URB_BUF_TYPE_DATA 0 /* attached buffer is data buffer */
14 #define URB_BUF_TYPE_SETUP 1 /* attached buffer is setup structure */
16 /* Possible values for blocking_urb_submit's check_len */
17 /* Use URB_SUBMIT_CHECK_LEN when actual data buffer length returned
18 * by HCD must match expected length, supplied in attach_urb_data */
19 #define URB_SUBMIT_CHECK_LEN 0 /* return error on length mismatch */
20 #define URB_SUBMIT_ALLOW_MISMATCH 1 /* ignore length check */
22 /* Endpoint configuration related */
23 #define URB_INVALID_EP (-1) /* default for unset endpoint */
25 /*---------------------------*
27 *---------------------------*/
28 /* URB's endpoint configuration */
29 typedef struct urb_ep_config
{
31 ddekit_int32_t ep_num
;
32 ddekit_int32_t direction
;
34 ddekit_int32_t max_packet_size
;
35 ddekit_int32_t interval
;
39 /*---------------------------*
40 * declared functions *
41 *---------------------------*/
42 void init_urb(struct ddekit_usb_urb
*, struct ddekit_usb_dev
*,
44 void attach_urb_data(struct ddekit_usb_urb
*, int, void *, ddekit_uint32_t
);
45 int blocking_urb_submit(struct ddekit_usb_urb
*, ddekit_sem_t
*, int);
47 #endif /* !_URB_HELPER_H_ */