summaryrefslogtreecommitdiff
path: root/Core/EM/AMIDebugRx/binaries/LIBS/UsbCableSelect.c
blob: d67bec594a1d88362cf321ea8c32487be92997c3 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
//*****************************************************************//
//*****************************************************************//
//*****************************************************************//
//**                                                             **//
//**         (C)Copyright 2009, American Megatrends, Inc.        **//
//**                                                             **//
//**                     All Rights Reserved.                    **//
//**                                                             **//
//**   5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093  **//
//**                                                             **//
//**                     Phone (770)-246-8600                    **//
//**                                                             **//
//*****************************************************************//
//*****************************************************************//
//*****************************************************************//
// $Header: /Alaska/BIN/Modules/AMIDebugRx/binaries/LIBS/UsbCableSelect.c 3     9/29/11 3:21p Madhans $
//
// $Revision: 3 $
//
// $Date: 9/29/11 3:21p $
//*****************************************************************
//*****************************************************************
//
// Revision History
// ----------------
// $Log: /Alaska/BIN/Modules/AMIDebugRx/binaries/LIBS/UsbCableSelect.c $
// 
// 3     9/29/11 3:21p Madhans
// File revision # 2 Comments corrected.
// 
// 2     7/17/09 7:15p Madhans
// DebugRx 1.30.0022
// 
// 2     7/13/09 2:43p Sudhirv
// Updated with Coding Standards
// 
// 1     7/07/09 4:46p Sudhirv
// Restructure Binaries Created
// 
// 1     5/01/09 7:48p Madhans
// AMIDebug Rx Module. Intial Checkin.
// 
// 1     4/29/09 7:51a Sudhirv
// AMI Debug Rx module created
// 
// 8     3/27/09 8:24a Sudhirv
// Updated Coding Standards.
// 
// 7     8/29/07 12:45p Madhans
// Common code for 4.x and 3.x
// 
// 6     6/13/07 3:16p Madhans
// Copyright Year updated.
// 
// 5     1/22/07 11:36a Madhans
// Modification made for Binary Release 1.04.0003.
// 
// 3     1/05/07 1:05p Ashrafj
// Latest version 1.04.0001 Beta
// Known issues from previous 1.04.000 Beta release has been fixed.
// 
// 2     9/21/06 6:40p Ashrafj
// Remove the specific changes made previously to support for the USB File transfer
// Cable, which was provided by means of SDL token support
// and instead provided the USB Device Request command interface to the
// DbgrUsbCableSelectLib, so any new cables support can be added through
// this library.
// 
// 1     9/13/06 6:54p Ashrafj
// New Usb Cable support (Multi-LinQ Usb 2.0 cable) added. The usage of
// this cable is based on new SDL token named USE_ALI_5632_CTRL_USB2_CABLE is
// added, along with new library named DbgrUsbCableSelectLib. This library
// is common for both PEI and DXE Transport modules to select between 2
// USB cables.
//
//*****************************************************************

//<AMI_FHDR_START>
//--------------------------------------------------------------------
//
// Name:	UsbCableSelect.c
//
// Description:	DbgrUsbCableSelectLib library source file.
//				
//--------------------------------------------------------------------
//<AMI_FHDR_END>

//--------------------------------------------------------------------
#include <Efi.h>
#ifdef ALASKA_SUPPORT
#include "token.h"
#else
#include "tokens.h"
#endif
//--------------------------------------------------------------------
//
// The following functions are from the USB Transport module, to INIT USB
// Cable Device.
//
EFI_STATUS	InitUsb2DebugCableDevice();
EFI_STATUS	SetFeature(UINT16 FeatureSelector);
EFI_STATUS	SetAddress(UINT8 Addr);
EFI_STATUS	SetConfiguration(UINT16 ConfigValue);
void		UpdateBulkTransferEndpoints(UINT8	InEndpoint, UINT8	OutEndpoint);
//--------------------------------------------------------------------

//<AMI_PHDR_START>
//--------------------------------------------------------------------
// Procedure:	Init_ALi5632Ctrl_Usb2Cable
//
// Description:	Sets ALi 5632 Controller USB Cable device address
//				and issues configuration commands.
//				This is left as an example for porting engineer.
//
// Input:		UINT8	Addr
//
// Output:		EFI_STATUS
//
//--------------------------------------------------------------------
//<AMI_PHDR_END>

#if	USE_ALI_5632_CTRL_USB2_CABLE

EFI_STATUS	Init_ALi5632Ctrl_Usb2Cable(UINT8	Addr)
{
	EFI_STATUS	Status = EFI_NOT_FOUND;
	Status = SetAddress(Addr);
	if(Status == EFI_SUCCESS){

		Status = SetConfiguration(1);

		//update the globals for bulk transfer endpoints
		UpdateBulkTransferEndpoints(1,2);
	}
	
	return Status;
}

#endif

//<AMI_PHDR_START>
//--------------------------------------------------------------------
// Procedure:	InitUsbCableDevice()
//
// Description:	To select between Usb 2.0 Debug Cable device or any
//				other OEM specific USB 2.0 USB cable like ALi 5632 Usb2.0 Cable.
//
// Input:		None
//
// Output:		EFI_STATUS
//
//--------------------------------------------------------------------
//<AMI_PHDR_END>

EFI_STATUS InitUsbCableDevice()
{
#if	USE_ALI_5632_CTRL_USB2_CABLE
	//
	//This is just left as an example to porting Engineer
	//
	return Init_ALi5632Ctrl_Usb2Cable(MULTI_LINQ_USB2_DEVICE_ADDRESS);
#else
	return InitUsb2DebugCableDevice();
#endif
}
//*****************************************************************//
//*****************************************************************//
//*****************************************************************//
//**                                                             **//
//**         (C)Copyright 2009, American Megatrends, Inc.        **//
//**                                                             **//
//**                     All Rights Reserved.                    **//
//**                                                             **//
//**   5555 Oakbrook Pkwy, Building 200,Norcross, Georgia 30093  **//
//**                                                             **//
//**                     Phone (770)-246-8600                    **//
//**                                                             **//
//*****************************************************************//
//*****************************************************************//
//*****************************************************************//