30 typedef unsigned int (*USBDataCallback) (
void *,
unsigned int );
40 USBDataCallback handler;
44 #define USB_EP_size_to_gc(x) ((x <= 8 )?USB_EP_BUFSIZE_8_gc:\ 45 (x <= 16 )?USB_EP_BUFSIZE_16_gc:\ 46 (x <= 32 )?USB_EP_BUFSIZE_32_gc:\ 47 (x <= 64 )?USB_EP_BUFSIZE_64_gc:\ 48 (x <= 128 )?USB_EP_BUFSIZE_128_gc:\ 49 (x <= 256 )?USB_EP_BUFSIZE_256_gc:\ 50 (x <= 512 )?USB_EP_BUFSIZE_512_gc:\ 51 USB_EP_BUFSIZE_1023_gc) 53 #define USB_EP_IN 0x80 59 #define USB_EP_PP 0x40 76 #define EP_DEF(NAME, EPNO, TYPE, PACKET_SIZE,HANDLER) \ 77 extern unsigned char NAME##_buf[((EPNO)&USB_EP_PP)?PACKET_SIZE*2:PACKET_SIZE ]; \ 78 extern EP_data NAME##_data; \ 79 unsigned char NAME##_buf[((EPNO)&USB_EP_PP)?PACKET_SIZE*2:PACKET_SIZE ]; \ 80 EP_data NAME##_data = { \ 89 #define EP_DEF_init(NAME) ep_def_init(&(NAME##_data)) 90 #define EP_DEF_init_buffer(NAME) ep_def_init_buffer(&(NAME##_data)) 91 #define EP_DEF_in(NAME) ep_def_in(&(NAME##_data)) 92 #define EP_DEF_out(NAME) ep_def_out(&(NAME##_data)) 94 #define EP_NOTE_IDLE 0 95 #define EP_NOTE_SET_DCD 1 96 #define EP_NOTE_CLR_DCD 2 97 #define EP_NOTE_SEND 0x80 99 extern uint8_t ep0_buf_in[USB_DEF_EP0_SIZE];
100 extern uint8_t ep0_buf_out[USB_DEF_EP0_SIZE];
101 extern USB_EP_pair_t endpoints[USB_DEF_EP_MAX];
106 void ep_def_init_buffer (
EP_data *p );
107 void ep_def_init (
EP_data *p );
109 void ep_def_out (
EP_data *p );
Bibliothek zur USB-Kommunikation von Jürgen W.