Fix cross compilation (e.g. on Darwin). Following changes to make.tmpl,
[AROS.git] / arch / all-pc / boot / grub2-aros / include / grub / usbtrans.h
blobaef482cb9f322c5ea9988729b61dcbf80e413bd8
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2008 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_USBTRANS_H
20 #define GRUB_USBTRANS_H 1
22 #define MAX_USB_TRANSFER_LEN 0x0800
24 typedef enum
26 GRUB_USB_TRANSFER_TYPE_IN,
27 GRUB_USB_TRANSFER_TYPE_OUT,
28 GRUB_USB_TRANSFER_TYPE_SETUP
29 } grub_transfer_type_t;
31 typedef enum
33 GRUB_USB_TRANSACTION_TYPE_CONTROL,
34 GRUB_USB_TRANSACTION_TYPE_BULK
35 } grub_transaction_type_t;
37 struct grub_usb_transaction
39 int size;
40 int toggle;
41 grub_transfer_type_t pid;
42 grub_uint32_t data;
43 grub_size_t preceding;
45 typedef struct grub_usb_transaction *grub_usb_transaction_t;
47 struct grub_usb_transfer
49 int devaddr;
51 int endpoint;
53 int size;
55 int transcnt;
57 int max;
59 grub_transaction_type_t type;
61 grub_transfer_type_t dir;
63 struct grub_usb_device *dev;
65 struct grub_usb_transaction *transactions;
67 int last_trans;
68 /* Index of last processed transaction in OHCI/UHCI driver. */
70 void *controller_data;
72 /* Used when finishing transfer to copy data back. */
73 struct grub_pci_dma_chunk *data_chunk;
74 void *data;
76 typedef struct grub_usb_transfer *grub_usb_transfer_t;
80 enum
82 GRUB_USB_REQTYPE_TARGET_DEV = (0 << 0),
83 GRUB_USB_REQTYPE_TARGET_INTERF = (1 << 0),
84 GRUB_USB_REQTYPE_TARGET_ENDP = (2 << 0),
85 GRUB_USB_REQTYPE_TARGET_OTHER = (3 << 0),
86 GRUB_USB_REQTYPE_STANDARD = (0 << 5),
87 GRUB_USB_REQTYPE_CLASS = (1 << 5),
88 GRUB_USB_REQTYPE_VENDOR = (2 << 5),
89 GRUB_USB_REQTYPE_OUT = (0 << 7),
90 GRUB_USB_REQTYPE_IN = (1 << 7),
91 GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT = GRUB_USB_REQTYPE_TARGET_INTERF
92 | GRUB_USB_REQTYPE_CLASS | GRUB_USB_REQTYPE_OUT,
93 GRUB_USB_REQTYPE_VENDOR_OUT = GRUB_USB_REQTYPE_VENDOR | GRUB_USB_REQTYPE_OUT,
94 GRUB_USB_REQTYPE_CLASS_INTERFACE_IN = GRUB_USB_REQTYPE_TARGET_INTERF
95 | GRUB_USB_REQTYPE_CLASS | GRUB_USB_REQTYPE_IN,
96 GRUB_USB_REQTYPE_VENDOR_IN = GRUB_USB_REQTYPE_VENDOR | GRUB_USB_REQTYPE_IN
99 enum
101 GRUB_USB_REQ_GET_STATUS = 0x00,
102 GRUB_USB_REQ_CLEAR_FEATURE = 0x01,
103 GRUB_USB_REQ_SET_FEATURE = 0x03,
104 GRUB_USB_REQ_SET_ADDRESS = 0x05,
105 GRUB_USB_REQ_GET_DESCRIPTOR = 0x06,
106 GRUB_USB_REQ_SET_DESCRIPTOR = 0x07,
107 GRUB_USB_REQ_GET_CONFIGURATION = 0x08,
108 GRUB_USB_REQ_SET_CONFIGURATION = 0x09,
109 GRUB_USB_REQ_GET_INTERFACE = 0x0A,
110 GRUB_USB_REQ_SET_INTERFACE = 0x0B,
111 GRUB_USB_REQ_SYNC_FRAME = 0x0C
114 #define GRUB_USB_FEATURE_ENDP_HALT 0x00
115 #define GRUB_USB_FEATURE_DEV_REMOTE_WU 0x01
116 #define GRUB_USB_FEATURE_TEST_MODE 0x02
118 enum
120 GRUB_USB_HUB_FEATURE_PORT_RESET = 0x04,
121 GRUB_USB_HUB_FEATURE_PORT_POWER = 0x08,
122 GRUB_USB_HUB_FEATURE_C_PORT_CONNECTED = 0x10,
123 GRUB_USB_HUB_FEATURE_C_PORT_ENABLED = 0x11,
124 GRUB_USB_HUB_FEATURE_C_PORT_SUSPEND = 0x12,
125 GRUB_USB_HUB_FEATURE_C_PORT_OVERCURRENT = 0x13,
126 GRUB_USB_HUB_FEATURE_C_PORT_RESET = 0x14
129 enum
131 GRUB_USB_HUB_STATUS_PORT_CONNECTED = (1 << 0),
132 GRUB_USB_HUB_STATUS_PORT_ENABLED = (1 << 1),
133 GRUB_USB_HUB_STATUS_PORT_SUSPEND = (1 << 2),
134 GRUB_USB_HUB_STATUS_PORT_OVERCURRENT = (1 << 3),
135 GRUB_USB_HUB_STATUS_PORT_POWERED = (1 << 8),
136 GRUB_USB_HUB_STATUS_PORT_LOWSPEED = (1 << 9),
137 GRUB_USB_HUB_STATUS_PORT_HIGHSPEED = (1 << 10),
138 GRUB_USB_HUB_STATUS_C_PORT_CONNECTED = (1 << 16),
139 GRUB_USB_HUB_STATUS_C_PORT_ENABLED = (1 << 17),
140 GRUB_USB_HUB_STATUS_C_PORT_SUSPEND = (1 << 18),
141 GRUB_USB_HUB_STATUS_C_PORT_OVERCURRENT = (1 << 19),
142 GRUB_USB_HUB_STATUS_C_PORT_RESET = (1 << 20)
145 struct grub_usb_packet_setup
147 grub_uint8_t reqtype;
148 grub_uint8_t request;
149 grub_uint16_t value;
150 grub_uint16_t index;
151 grub_uint16_t length;
152 } GRUB_PACKED;
155 #endif /* GRUB_USBTRANS_H */