Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00019 #ifndef USB_H__
00020 #define USB_H__
00021
00022 #include "usb_desc_bootloader.h"
00023
00024 #define USB_EP0_HSNAK() do {ep0cs = 0x02; } while(0)
00025 #define USB_EP0_STALL() do {ep0cs = 0x11; } while(0) // Set both DSTALL and STALL when we want to stall a request during a SETUP transaction
00026
00027 #define INT_SUDAV 0x00
00028 #define INT_SOF 0x04
00029 #define INT_SUTOK 0x08
00030 #define INT_SUSPEND 0x0C
00031 #define INT_USBRESET 0x10
00032 #define INT_EP0IN 0x18
00033 #define INT_EP0OUT 0x1C
00034 #define INT_EP1IN 0x20
00035 #define INT_EP1OUT 0x24
00036
00037 #define USB_BM_STATE_CONFIGURED 0x01
00038 #define USB_BM_STATE_ALLOW_REMOTE_WAKEUP 0x02
00039
00045 typedef enum
00046 {
00047 ATTACHED,
00048 POWERED,
00049 DEFAULT,
00050 ADDRESSED,
00051 CONFIGURED,
00052 SUSPENDED
00053 } usb_state_t;
00054
00055 void usb_init(void);
00056 void usb_irq(void);
00057
00058 #endif // USB_H__