summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/cbi.h
blob: d312176cacca60fb5cac6bb6d1806fdb0fd6e4b0 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*++

Copyright (c) 2006, Intel Corporation                                                         
All rights reserved. This program and the accompanying materials                          
are licensed and made available under the terms and conditions of the BSD License         
which accompanies this distribution.  The full text of the license may be found at        
http://opensource.org/licenses/bsd-license.php                                            
                                                                                          
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

Module Name:

    cbi.h

Abstract:

    USB CBI transportation protocol definitions.
--*/

#ifndef _CBI_H
#define _CBI_H


#include <IndustryStandard/Usb.h>

#define bit(a)                  (1 << (a))

#define MASS_STORAGE_CLASS      0x08
#define CBI0_INTERFACE_PROTOCOL 0x00
#define CBI1_INTERFACE_PROTOCOL 0x01

//
// in millisecond unit
//
#define STALL_1_SECOND          1000  

#pragma pack(1)
//
// Data block definition for transportation through interrupt endpoint
//
typedef struct {
  UINT8 bType;
  UINT8 bValue;
} INTERRUPT_DATA_BLOCK;

#pragma pack()

#define USB_CBI_DEVICE_SIGNATURE  EFI_SIGNATURE_32 ('u', 'c', 'b', 'i')

//
// Device structure for CBI, interrupt endpoint may be not used in
// CBI1 Protocol
//
typedef struct {
  UINT32                        Signature;
  EFI_DEVICE_PATH_PROTOCOL      *DevicePath;
  EFI_USB_ATAPI_PROTOCOL        UsbAtapiProtocol;
  EFI_USB_IO_PROTOCOL           *UsbIo;
  EFI_USB_INTERFACE_DESCRIPTOR  InterfaceDescriptor;
  EFI_USB_ENDPOINT_DESCRIPTOR   BulkInEndpointDescriptor;
  EFI_USB_ENDPOINT_DESCRIPTOR   BulkOutEndpointDescriptor;
  EFI_USB_ENDPOINT_DESCRIPTOR   InterruptEndpointDescriptor;
  EFI_UNICODE_STRING_TABLE      *ControllerNameTable;
} USB_CBI_DEVICE;

#define USB_CBI_DEVICE_FROM_THIS(a) \
    CR(a, USB_CBI_DEVICE, UsbAtapiProtocol, USB_CBI_DEVICE_SIGNATURE)

extern EFI_COMPONENT_NAME_PROTOCOL  gUsbCbi0ComponentName;
extern EFI_DRIVER_BINDING_PROTOCOL  gUsbCbi0DriverBinding;

//
// EFI Component Name Functions
//
EFI_STATUS
EFIAPI
UsbCbi0ComponentNameGetDriverName (
  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
  IN  CHAR8                        *Language,
  OUT CHAR16                       **DriverName
  );

EFI_STATUS
EFIAPI
UsbCbi0ComponentNameGetControllerName (
  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
  IN  EFI_HANDLE                                      ControllerHandle,
  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
  IN  CHAR8                                           *Language,
  OUT CHAR16                                          **ControllerName
  );

#endif