diff options
| author | tmk <nobody@nowhere> | 2011-02-09 00:03:58 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2011-02-22 03:08:59 +0900 |
| commit | acc974c64b1e17e6807133fdc50de5bb34aedda5 (patch) | |
| tree | 7af7511a56d680a4d93b535c52891a8ffc15dd04 /usb.h | |
| parent | 5552b5afeaa9ce7432f9ded3586984253f292d80 (diff) | |
| download | qmk_firmware-acc974c64b1e17e6807133fdc50de5bb34aedda5.tar.gz qmk_firmware-acc974c64b1e17e6807133fdc50de5bb34aedda5.zip | |
added protocol stack: pjrc, vusb
Diffstat (limited to 'usb.h')
| -rw-r--r-- | usb.h | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/usb.h b/usb.h deleted file mode 100644 index 85e0e33df..000000000 --- a/usb.h +++ /dev/null | |||
| @@ -1,98 +0,0 @@ | |||
| 1 | #ifndef USB_H | ||
| 2 | #define USB_H 1 | ||
| 3 | |||
| 4 | #include <stdint.h> | ||
| 5 | #include <stdbool.h> | ||
| 6 | #include <avr/io.h> | ||
| 7 | |||
| 8 | |||
| 9 | extern bool remote_wakeup; | ||
| 10 | extern bool suspend; | ||
| 11 | |||
| 12 | void usb_init(void); // initialize everything | ||
| 13 | uint8_t usb_configured(void); // is the USB port configured | ||
| 14 | void usb_remote_wakeup(void); | ||
| 15 | |||
| 16 | |||
| 17 | |||
| 18 | |||
| 19 | #define EP_TYPE_CONTROL 0x00 | ||
| 20 | #define EP_TYPE_BULK_IN 0x81 | ||
| 21 | #define EP_TYPE_BULK_OUT 0x80 | ||
| 22 | #define EP_TYPE_INTERRUPT_IN 0xC1 | ||
| 23 | #define EP_TYPE_INTERRUPT_OUT 0xC0 | ||
| 24 | #define EP_TYPE_ISOCHRONOUS_IN 0x41 | ||
| 25 | #define EP_TYPE_ISOCHRONOUS_OUT 0x40 | ||
| 26 | |||
| 27 | #define EP_SINGLE_BUFFER 0x02 | ||
| 28 | #define EP_DOUBLE_BUFFER 0x06 | ||
| 29 | |||
| 30 | #define EP_SIZE(s) ((s) == 64 ? 0x30 : \ | ||
| 31 | ((s) == 32 ? 0x20 : \ | ||
| 32 | ((s) == 16 ? 0x10 : \ | ||
| 33 | 0x00))) | ||
| 34 | |||
| 35 | #define MAX_ENDPOINT 4 | ||
| 36 | |||
| 37 | #define LSB(n) (n & 255) | ||
| 38 | #define MSB(n) ((n >> 8) & 255) | ||
| 39 | |||
| 40 | #if defined(__AVR_AT90USB162__) | ||
| 41 | #define HW_CONFIG() | ||
| 42 | #define PLL_CONFIG() (PLLCSR = ((1<<PLLE)|(1<<PLLP0))) | ||
| 43 | #define USB_CONFIG() (USBCON = (1<<USBE)) | ||
| 44 | #define USB_FREEZE() (USBCON = ((1<<USBE)|(1<<FRZCLK))) | ||
| 45 | #elif defined(__AVR_ATmega32U4__) | ||
| 46 | #define HW_CONFIG() (UHWCON = 0x01) | ||
| 47 | #define PLL_CONFIG() (PLLCSR = 0x12) | ||
| 48 | #define USB_CONFIG() (USBCON = ((1<<USBE)|(1<<OTGPADE))) | ||
| 49 | #define USB_FREEZE() (USBCON = ((1<<USBE)|(1<<FRZCLK))) | ||
| 50 | #elif defined(__AVR_AT90USB646__) | ||
| 51 | #define HW_CONFIG() (UHWCON = 0x81) | ||
| 52 | #define PLL_CONFIG() (PLLCSR = 0x1A) | ||
| 53 | #define USB_CONFIG() (USBCON = ((1<<USBE)|(1<<OTGPADE))) | ||
| 54 | #define USB_FREEZE() (USBCON = ((1<<USBE)|(1<<FRZCLK))) | ||
| 55 | #elif defined(__AVR_AT90USB1286__) | ||
| 56 | #define HW_CONFIG() (UHWCON = 0x81) | ||
| 57 | #define PLL_CONFIG() (PLLCSR = 0x16) | ||
| 58 | #define USB_CONFIG() (USBCON = ((1<<USBE)|(1<<OTGPADE))) | ||
| 59 | #define USB_FREEZE() (USBCON = ((1<<USBE)|(1<<FRZCLK))) | ||
| 60 | #endif | ||
| 61 | |||
| 62 | // standard control endpoint request types | ||
| 63 | #define GET_STATUS 0 | ||
| 64 | #define CLEAR_FEATURE 1 | ||
| 65 | #define SET_FEATURE 3 | ||
| 66 | #define SET_ADDRESS 5 | ||
| 67 | #define GET_DESCRIPTOR 6 | ||
| 68 | #define GET_CONFIGURATION 8 | ||
| 69 | #define SET_CONFIGURATION 9 | ||
| 70 | #define GET_INTERFACE 10 | ||
| 71 | #define SET_INTERFACE 11 | ||
| 72 | // HID (human interface device) | ||
| 73 | #define HID_GET_REPORT 1 | ||
| 74 | #define HID_GET_IDLE 2 | ||
| 75 | #define HID_GET_PROTOCOL 3 | ||
| 76 | #define HID_SET_REPORT 9 | ||
| 77 | #define HID_SET_IDLE 10 | ||
| 78 | #define HID_SET_PROTOCOL 11 | ||
| 79 | #define HID_REPORT_INPUT 1 | ||
| 80 | #define HID_REPORT_OUTPUT 2 | ||
| 81 | #define HID_REPORT_FEATURE 3 | ||
| 82 | // CDC (communication class device) | ||
| 83 | #define CDC_SET_LINE_CODING 0x20 | ||
| 84 | #define CDC_GET_LINE_CODING 0x21 | ||
| 85 | #define CDC_SET_CONTROL_LINE_STATE 0x22 | ||
| 86 | // HID feature selectors | ||
| 87 | #define DEVICE_REMOTE_WAKEUP 1 | ||
| 88 | #define ENDPOINT_HALT 0 | ||
| 89 | #define TEST_MODE 2 | ||
| 90 | |||
| 91 | // LEDS | ||
| 92 | #define USB_LED_NUM_LOCK 0 | ||
| 93 | #define USB_LED_CAPS_LOCK 1 | ||
| 94 | #define USB_LED_SCROLL_LOCK 2 | ||
| 95 | #define USB_LED_COMPOSE 3 | ||
| 96 | #define USB_LED_KANA 4 | ||
| 97 | |||
| 98 | #endif | ||
