-
Notifications
You must be signed in to change notification settings - Fork 52
/
usbhw.h
57 lines (35 loc) · 1.03 KB
/
usbhw.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef _USBHW_H
#define _USBHW_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
#define EP0OUT (0x00)
#define EP0IN (0x80)
typedef void (*usb_callback_pointer)(void);
extern usb_callback_pointer EPcallbacks[30];
extern void EP0setup(void);
extern void EP0in(void);
extern void EP0out(void);
extern void USBEvent_busReset(void);
extern void USBEvent_connect(uint8_t connected);
extern void USBEvent_suspend(uint8_t suspended);
extern void USBEvent_Frame(void);
void usb_init(void);
void usb_task(void);
void usb_set_callback(uint8_t bEP, usb_callback_pointer callback);
void usb_realise_endpoint(uint8_t bEP, uint16_t packet_size);
int usb_can_write(uint8_t bEP);
int usb_write_packet(uint8_t bEP, void *data, int packetlen);
int usb_can_read(uint8_t bEP);
int usb_read_packet(uint8_t bEP, void *buffer, int buffersize);
void usb_connect(void);
void usb_disconnect(void);
void usb_ep_stall(uint8_t bEP);
void usb_ep_unstall(uint8_t bEP);
void usb_ep0_stall(void);
#ifdef __cplusplus
}
#endif
#endif /* _USBHW_H */