usbdesc.h 2.96 KB
Newer Older
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
/*
 *  GRUB  --  GRand Unified Bootloader
 *  Copyright (C) 2008  Free Software Foundation, Inc.
 *
 *  GRUB is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  GRUB is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef	GRUB_USBDESC_H
#define	GRUB_USBDESC_H	1

#include <grub/types.h>
#include <grub/symbol.h>

typedef enum {
  GRUB_USB_DESCRIPTOR_DEVICE = 1,
  GRUB_USB_DESCRIPTOR_CONFIG,
  GRUB_USB_DESCRIPTOR_STRING,
  GRUB_USB_DESCRIPTOR_INTERFACE,
  GRUB_USB_DESCRIPTOR_ENDPOINT,
31
  GRUB_USB_DESCRIPTOR_DEBUG = 10,
32 33 34
  GRUB_USB_DESCRIPTOR_HUB = 0x29
} grub_usb_descriptor_t;

35 36 37 38
struct grub_usb_desc
{
  grub_uint8_t length;
  grub_uint8_t type;
39
} GRUB_PACKED;
40

41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
struct grub_usb_desc_device
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint16_t usbrel;
  grub_uint8_t class;
  grub_uint8_t subclass;
  grub_uint8_t protocol;
  grub_uint8_t maxsize0;
  grub_uint16_t vendorid;
  grub_uint16_t prodid;
  grub_uint16_t devrel;
  grub_uint8_t strvendor;
  grub_uint8_t strprod;
  grub_uint8_t strserial;
56
  grub_uint8_t configcnt;
57
} GRUB_PACKED;
58 59 60 61 62 63 64 65 66 67 68

struct grub_usb_desc_config
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint16_t totallen;
  grub_uint8_t numif;
  grub_uint8_t config;
  grub_uint8_t strconfig;
  grub_uint8_t attrib;
  grub_uint8_t maxpower;
69
} GRUB_PACKED;
70 71

#if 0
72
struct grub_usb_desc_if_association
73 74 75 76 77 78 79 80 81
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint8_t firstif;
  grub_uint8_t ifcnt;
  grub_uint8_t class;
  grub_uint8_t subclass;
  grub_uint8_t protocol;
  grub_uint8_t function;
82
} GRUB_PACKED;
83 84 85 86 87 88 89 90 91 92 93 94 95
#endif

struct grub_usb_desc_if
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint8_t ifnum;
  grub_uint8_t altsetting;
  grub_uint8_t endpointcnt;
  grub_uint8_t class;
  grub_uint8_t subclass;
  grub_uint8_t protocol;
  grub_uint8_t strif;
96
} GRUB_PACKED;
97 98 99 100 101 102 103 104 105

struct grub_usb_desc_endp
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint8_t endp_addr;
  grub_uint8_t attrib;
  grub_uint16_t maxpacket;
  grub_uint8_t interval;
106
} GRUB_PACKED;
107 108 109 110 111 112

struct grub_usb_desc_str
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint16_t str[0];
113
} GRUB_PACKED;
114

115 116 117 118 119 120
struct grub_usb_desc_debug
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint8_t in_endp;
  grub_uint8_t out_endp;
121
} GRUB_PACKED;
122

123 124 125 126 127 128 129 130 131
struct grub_usb_usb_hubdesc
{
  grub_uint8_t length;
  grub_uint8_t type;
  grub_uint8_t portcnt;
  grub_uint16_t characteristics;
  grub_uint8_t pwdgood;
  grub_uint8_t current;
  /* Removable and power control bits follow.  */
132
} GRUB_PACKED;
133 134

#endif /* GRUB_USBDESC_H */