1 #ifndef __USB_API_H__SYN81IFYBN__
2 #define __USB_API_H__SYN81IFYBN__
6 typedef struct _USBBuffer USBBuffer;
18 #define USB_BUFFER_SUBMITTED 0x01
22 #define USB_BUFFER_SHORT_END 0x02
25 #define USB_BUFFER_PACKET_END 0x04
28 #define USB_BUFFER_NOTIFY 0x08
31 #define USB_BUFFER_IN 0x40
36 #define USB_BUFFER_SETUP 0x20
40 #define USB_BUFFER_HALT 0x100
45 #define USB_BUFFER_SHORT_PACKET 0x10
48 #define USB_BUFFER_FAILED 0x80
51 #define USB_BUFFER_ARCH_FLAG_1 0x1000
52 #define USB_BUFFER_ARCH_FLAG_2 0x2000
53 #define USB_BUFFER_ARCH_FLAG_3 0x4000
54 #define USB_BUFFER_ARCH_FLAG_4 0x8000
61 struct USBRequestHandler
64 uint8_t request_type_mask;
68 unsigned int (*handler_func)();
72 struct USBRequestHandlerHook
74 struct USBRequestHandlerHook *
next;
75 const struct USBRequestHandler *
const handler;
79 usb_register_request_handler(
struct USBRequestHandlerHook *hook);
82 usb_prepend_request_handler(
struct USBRequestHandlerHook *hook);
85 usb_setup_bulk_endpoint(uint8_t addr);
87 usb_setup_interrupt_endpoint(uint8_t addr);
92 usb_submit_recv_buffer(uint8_t ep_addr, USBBuffer *buffer);
99 usb_submit_xmit_buffer(uint8_t ep_addr, USBBuffer *buffer);
103 usb_send_pending(uint8_t ep_addr);
108 usb_discard_all_buffers(uint8_t ep_addr);
111 usb_disable_endpoint(uint8_t addr);
120 usb_set_ep_event_process(uint8_t addr,
struct process *p);
124 usb_set_global_event_process(
struct process *p);
127 #define USB_EVENT_CONFIG 0x01
128 #define USB_EVENT_SUSPEND 0x02
129 #define USB_EVENT_RESUME 0x04
130 #define USB_EVENT_RESET 0x08
135 usb_get_global_events(
void);
138 #define USB_EP_EVENT_NOTIFICATION 0x01
140 usb_get_ep_events(uint8_t addr);
143 usb_get_current_configuration(
void);