-
Notifications
You must be signed in to change notification settings - Fork 2
/
USBhandler.h
68 lines (52 loc) · 1.45 KB
/
USBhandler.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
58
59
60
61
62
63
64
65
66
67
68
#ifndef __USB_HANDLER_H__
#define __USB_HANDLER_H__
#include <stdint.h>
#include "include/ch5xx.h"
#include "include/ch5xx_usb.h"
#include "USBconstant.h"
extern __xdata __at(EP0_ADDR)
uint8_t Ep0Buffer[];
extern __xdata __at(EP1_ADDR)
uint8_t Ep1Buffer[];
extern __xdata __at(EP2_ADDR)
uint8_t Ep2Buffer[];
extern __xdata uint16_t SetupLen;
extern __xdata uint8_t SetupReq, UsbConfig;
extern const __code uint8_t *pDescr;
#define UsbSetupBuf ((PUSB_SETUP_REQ)Ep0Buffer)
#define DEFAULT_ENDP0_SIZE_ 64
// Out
#define EP0_OUT_Callback USB_EP0_OUT
#define EP1_OUT_Callback USB_EP1_OUT
#define EP2_OUT_Callback USB_EP2_OUT
#define EP3_OUT_Callback NOP_Process
#define EP4_OUT_Callback NOP_Process
// SOF
#define EP0_SOF_Callback NOP_Process
#define EP1_SOF_Callback NOP_Process
#define EP2_SOF_Callback NOP_Process
#define EP3_SOF_Callback NOP_Process
#define EP4_SOF_Callback NOP_Process
// IN
#define EP0_IN_Callback USB_EP0_IN
#define EP1_IN_Callback USB_EP1_IN
#define EP2_IN_Callback USB_EP2_IN
#define EP3_IN_Callback NOP_Process
#define EP4_IN_Callback NOP_Process
// SETUP
#define EP0_SETUP_Callback USB_EP0_SETUP
#define EP1_SETUP_Callback NOP_Process
#define EP2_SETUP_Callback NOP_Process
#define EP3_SETUP_Callback NOP_Process
#define EP4_SETUP_Callback NOP_Process
#ifdef __cplusplus
extern "C" {
#endif
void USBInterrupt(void);
void USBDeviceCfg();
void USBDeviceIntCfg();
void USBDeviceEndPointCfg();
#ifdef __cplusplus
} // extern "C"
#endif
#endif