Uwe Hermann | 06694a8 | 2010-09-23 18:16:46 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007 AMD |
| 5 | * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA |
| 19 | */ |
| 20 | |
Yinghai Lu | d57241f | 2007-02-28 11:17:02 +0000 | [diff] [blame] | 21 | #ifndef USB_CH9_H |
| 22 | #define USB_CH9_H |
| 23 | |
| 24 | #define USB_DIR_OUT 0 /* to device */ |
| 25 | #define USB_DIR_IN 0x80 /* to host */ |
| 26 | |
| 27 | /* |
| 28 | * USB types, the second of three bRequestType fields |
| 29 | */ |
| 30 | #define USB_TYPE_MASK (0x03 << 5) |
| 31 | #define USB_TYPE_STANDARD (0x00 << 5) |
| 32 | #define USB_TYPE_CLASS (0x01 << 5) |
| 33 | #define USB_TYPE_VENDOR (0x02 << 5) |
| 34 | #define USB_TYPE_RESERVED (0x03 << 5) |
| 35 | /* |
| 36 | * USB recipients, the third of three bRequestType fields |
| 37 | */ |
| 38 | #define USB_RECIP_MASK 0x1f |
| 39 | #define USB_RECIP_DEVICE 0x00 |
| 40 | #define USB_RECIP_INTERFACE 0x01 |
| 41 | #define USB_RECIP_ENDPOINT 0x02 |
| 42 | #define USB_RECIP_OTHER 0x03 |
| 43 | /* From Wireless USB 1.0 */ |
| 44 | #define USB_RECIP_PORT 0x04 |
| 45 | #define USB_RECIP_RPIPE 0x05 |
| 46 | |
| 47 | /* |
| 48 | * Standard requests, for the bRequest field of a SETUP packet. |
| 49 | * |
| 50 | * These are qualified by the bRequestType field, so that for example |
| 51 | * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved |
| 52 | * by a GET_STATUS request. |
| 53 | */ |
| 54 | #define USB_REQ_GET_STATUS 0x00 |
| 55 | #define USB_REQ_CLEAR_FEATURE 0x01 |
| 56 | #define USB_REQ_SET_FEATURE 0x03 |
| 57 | #define USB_REQ_SET_ADDRESS 0x05 |
| 58 | #define USB_REQ_GET_DESCRIPTOR 0x06 |
| 59 | #define USB_REQ_SET_DESCRIPTOR 0x07 |
| 60 | #define USB_REQ_GET_CONFIGURATION 0x08 |
| 61 | #define USB_REQ_SET_CONFIGURATION 0x09 |
| 62 | #define USB_REQ_GET_INTERFACE 0x0A |
| 63 | #define USB_REQ_SET_INTERFACE 0x0B |
| 64 | #define USB_REQ_SYNCH_FRAME 0x0C |
| 65 | |
| 66 | #define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ |
| 67 | #define USB_REQ_GET_ENCRYPTION 0x0E |
| 68 | #define USB_REQ_RPIPE_ABORT 0x0E |
| 69 | #define USB_REQ_SET_HANDSHAKE 0x0F |
| 70 | #define USB_REQ_RPIPE_RESET 0x0F |
| 71 | #define USB_REQ_GET_HANDSHAKE 0x10 |
| 72 | #define USB_REQ_SET_CONNECTION 0x11 |
| 73 | #define USB_REQ_SET_SECURITY_DATA 0x12 |
| 74 | #define USB_REQ_GET_SECURITY_DATA 0x13 |
| 75 | #define USB_REQ_SET_WUSB_DATA 0x14 |
| 76 | #define USB_REQ_LOOPBACK_DATA_WRITE 0x15 |
| 77 | #define USB_REQ_LOOPBACK_DATA_READ 0x16 |
| 78 | #define USB_REQ_SET_INTERFACE_DS 0x17 |
| 79 | |
| 80 | #define USB_DT_DEBUG 0x0a |
| 81 | |
| 82 | #define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */ |
| 83 | |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame^] | 84 | /* |
| 85 | * USB Packet IDs (PIDs) |
| 86 | */ |
| 87 | |
| 88 | /* token */ |
| 89 | #define USB_PID_OUT 0xe1 |
| 90 | #define USB_PID_IN 0x69 |
| 91 | #define USB_PID_SOF 0xa5 |
| 92 | #define USB_PID_SETUP 0x2d |
| 93 | /* handshake */ |
| 94 | #define USB_PID_ACK 0xd2 |
| 95 | #define USB_PID_NAK 0x5a |
| 96 | #define USB_PID_STALL 0x1e |
| 97 | #define USB_PID_NYET 0x96 |
| 98 | /* data */ |
| 99 | #define USB_PID_DATA0 0xc3 |
| 100 | #define USB_PID_DATA1 0x4b |
| 101 | #define USB_PID_DATA2 0x87 |
| 102 | #define USB_PID_MDATA 0x0f |
| 103 | /* Special */ |
| 104 | #define USB_PID_PREAMBLE 0x3c |
| 105 | #define USB_PID_ERR 0x3c |
| 106 | #define USB_PID_SPLIT 0x78 |
| 107 | #define USB_PID_PING 0xb4 |
| 108 | #define USB_PID_UNDEF_0 0xf0 |
| 109 | |
| 110 | #define USB_PID_DATA_TOGGLE 0x88 |
| 111 | |
Yinghai Lu | d57241f | 2007-02-28 11:17:02 +0000 | [diff] [blame] | 112 | struct usb_ctrlrequest { |
Stefan Reinauer | 5639448 | 2010-05-25 16:02:28 +0000 | [diff] [blame] | 113 | u8 bRequestType; |
| 114 | u8 bRequest; |
| 115 | u16 wValue; |
| 116 | u16 wIndex; |
| 117 | u16 wLength; |
Yinghai Lu | d57241f | 2007-02-28 11:17:02 +0000 | [diff] [blame] | 118 | } __attribute__ ((packed)); |
| 119 | |
| 120 | struct usb_debug_descriptor { |
Stefan Reinauer | 5639448 | 2010-05-25 16:02:28 +0000 | [diff] [blame] | 121 | u8 bLength; |
| 122 | u8 bDescriptorType; |
Yinghai Lu | d57241f | 2007-02-28 11:17:02 +0000 | [diff] [blame] | 123 | |
| 124 | /* bulk endpoints with 8 byte maxpacket */ |
Stefan Reinauer | 5639448 | 2010-05-25 16:02:28 +0000 | [diff] [blame] | 125 | u8 bDebugInEndpoint; |
| 126 | u8 bDebugOutEndpoint; |
Yinghai Lu | d57241f | 2007-02-28 11:17:02 +0000 | [diff] [blame] | 127 | }; |
| 128 | |
| 129 | #endif |