1/*
2 * Copyright (c) 2009 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24     File:       DeviceControlPriv.i.c
25
26     Contains:   xxx put contents here xxx
27
28     Version:    xxx put version here xxx
29
30     DRI:        xxx put dri here xxx
31
32     Copyright:  � 1999-2001 by Apple Computer, Inc., all rights reserved.
33
34     Warning:    *** APPLE INTERNAL USE ONLY ***
35                 This file contains unreleased SPI's
36
37     BuildInfo:  Built by:            wgulland
38                 On:                  Tue Mar 12 16:49:05 2002
39                 With Interfacer:     3.0d35   (Mac OS X for PowerPC)
40                 From:                DeviceControlPriv.i
41                     Revision:        3
42                     Dated:           6/15/99
43                     Last change by:  KW
44                     Last comment:    fix screwup
45
46     Bugs:       Report bugs to Radar component "System Interfaces", "Latest"
47                 List the version information (from above) in the Problem Description.
48
49*/
50
51#include <CoreServices/CoreServices.h>
52//#include <CarbonCore/MixedMode.h>
53//#include <CarbonCore/Components.h>
54#include <DeviceControlPriv.h>
55#if MP_SUPPORT
56	#include "MPMixedModeSupport.h"
57#endif
58
59#define TOOLBOX_TRAPADDRESS(trapNum) (*(((UniversalProcPtr*)(((trapNum & 0x03FF) << 2) + 0xE00))))
60#define OS_TRAPADDRESS(trapNum)      (*(((UniversalProcPtr*)(((trapNum & 0x00FF) << 2) + 0x400))))
61
62#ifndef TRAPGLUE_NO_COMPONENT_CALL
63DEFINE_API( ComponentResult ) DeviceControlEnableAVCTransactions(ComponentInstance instance)
64{
65	#if PRAGMA_STRUCT_ALIGN
66	  #pragma options align=mac68k
67	#elif PRAGMA_STRUCT_PACKPUSH
68	  #pragma pack(push, 2)
69	#elif PRAGMA_STRUCT_PACK
70	  #pragma pack(2)
71	#endif
72	struct DeviceControlEnableAVCTransactionsGluePB {
73		unsigned char                  componentFlags;
74		unsigned char                  componentParamSize;
75		short                          componentWhat;
76		ComponentInstance              instance;
77	};
78	#if PRAGMA_STRUCT_ALIGN
79	  #pragma options align=reset
80	#elif PRAGMA_STRUCT_PACKPUSH
81	  #pragma pack(pop)
82	#elif PRAGMA_STRUCT_PACK
83	  #pragma pack()
84	#endif
85
86	#if OLD_COMPONENT_GLUE
87	struct DeviceControlEnableAVCTransactionsGluePB myDeviceControlEnableAVCTransactionsGluePB = {
88		0,
89		0,
90		256
91	};
92
93	#else
94	struct DeviceControlEnableAVCTransactionsGluePB myDeviceControlEnableAVCTransactionsGluePB;
95	*((unsigned long*)&myDeviceControlEnableAVCTransactionsGluePB) = 0x00000100;
96
97	myDeviceControlEnableAVCTransactionsGluePB.componentFlags = 0;
98	myDeviceControlEnableAVCTransactionsGluePB.componentParamSize = 0;
99	myDeviceControlEnableAVCTransactionsGluePB.componentWhat = 256;
100
101	#endif
102
103	myDeviceControlEnableAVCTransactionsGluePB.instance = instance;
104
105	#if TARGET_API_MAC_OS8
106		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myDeviceControlEnableAVCTransactionsGluePB);
107	#else
108		return (ComponentResult)CallComponentDispatch( (ComponentParameters*)&myDeviceControlEnableAVCTransactionsGluePB );
109	#endif
110}
111#endif
112
113
114#ifndef TRAPGLUE_NO_COMPONENT_CALL
115DEFINE_API( ComponentResult ) DeviceControlDisableAVCTransactions(ComponentInstance instance)
116{
117	#if PRAGMA_STRUCT_ALIGN
118	  #pragma options align=mac68k
119	#elif PRAGMA_STRUCT_PACKPUSH
120	  #pragma pack(push, 2)
121	#elif PRAGMA_STRUCT_PACK
122	  #pragma pack(2)
123	#endif
124	struct DeviceControlDisableAVCTransactionsGluePB {
125		unsigned char                  componentFlags;
126		unsigned char                  componentParamSize;
127		short                          componentWhat;
128		ComponentInstance              instance;
129	};
130	#if PRAGMA_STRUCT_ALIGN
131	  #pragma options align=reset
132	#elif PRAGMA_STRUCT_PACKPUSH
133	  #pragma pack(pop)
134	#elif PRAGMA_STRUCT_PACK
135	  #pragma pack()
136	#endif
137
138	#if OLD_COMPONENT_GLUE
139	struct DeviceControlDisableAVCTransactionsGluePB myDeviceControlDisableAVCTransactionsGluePB = {
140		0,
141		0,
142		257
143	};
144
145	#else
146	struct DeviceControlDisableAVCTransactionsGluePB myDeviceControlDisableAVCTransactionsGluePB;
147//	*((unsigned long*)&myDeviceControlDisableAVCTransactionsGluePB) = 0x00000101;
148
149	myDeviceControlDisableAVCTransactionsGluePB.componentFlags = 0;
150	myDeviceControlDisableAVCTransactionsGluePB.componentParamSize = 0;
151	myDeviceControlDisableAVCTransactionsGluePB.componentWhat = 257;
152
153	#endif
154
155	myDeviceControlDisableAVCTransactionsGluePB.instance = instance;
156
157	#if TARGET_API_MAC_OS8
158		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myDeviceControlDisableAVCTransactionsGluePB);
159	#else
160		return (ComponentResult)CallComponentDispatch( (ComponentParameters*)&myDeviceControlDisableAVCTransactionsGluePB );
161	#endif
162}
163#endif
164
165
166#ifndef TRAPGLUE_NO_COMPONENT_CALL
167DEFINE_API( ComponentResult ) DeviceControlSetDeviceConnectionID(ComponentInstance instance, DeviceConnectionID connectionID)
168{
169	#if PRAGMA_STRUCT_ALIGN
170	  #pragma options align=mac68k
171	#elif PRAGMA_STRUCT_PACKPUSH
172	  #pragma pack(push, 2)
173	#elif PRAGMA_STRUCT_PACK
174	  #pragma pack(2)
175	#endif
176	struct DeviceControlSetDeviceConnectionIDGluePB {
177		unsigned char                  componentFlags;
178		unsigned char                  componentParamSize;
179		short                          componentWhat;
180		DeviceConnectionID             connectionID;
181		ComponentInstance              instance;
182	};
183	#if PRAGMA_STRUCT_ALIGN
184	  #pragma options align=reset
185	#elif PRAGMA_STRUCT_PACKPUSH
186	  #pragma pack(pop)
187	#elif PRAGMA_STRUCT_PACK
188	  #pragma pack()
189	#endif
190
191	#if OLD_COMPONENT_GLUE
192	struct DeviceControlSetDeviceConnectionIDGluePB myDeviceControlSetDeviceConnectionIDGluePB = {
193		0,
194		4,
195		258
196	};
197
198	#else
199	struct DeviceControlSetDeviceConnectionIDGluePB myDeviceControlSetDeviceConnectionIDGluePB;
200//	*((unsigned long*)&myDeviceControlSetDeviceConnectionIDGluePB) = 0x00040102;
201
202	myDeviceControlSetDeviceConnectionIDGluePB.componentFlags = 0;
203	myDeviceControlSetDeviceConnectionIDGluePB.componentParamSize = 4;
204	myDeviceControlSetDeviceConnectionIDGluePB.componentWhat = 258;
205
206	#endif
207
208	myDeviceControlSetDeviceConnectionIDGluePB.connectionID = connectionID;
209	myDeviceControlSetDeviceConnectionIDGluePB.instance = instance;
210
211	#if TARGET_API_MAC_OS8
212		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myDeviceControlSetDeviceConnectionIDGluePB);
213	#else
214		return (ComponentResult)CallComponentDispatch( (ComponentParameters*)&myDeviceControlSetDeviceConnectionIDGluePB );
215	#endif
216}
217#endif
218
219
220#ifndef TRAPGLUE_NO_COMPONENT_CALL
221DEFINE_API( ComponentResult ) DeviceControlGetDeviceConnectionID(ComponentInstance instance, DeviceConnectionID* connectionID)
222{
223	#if PRAGMA_STRUCT_ALIGN
224	  #pragma options align=mac68k
225	#elif PRAGMA_STRUCT_PACKPUSH
226	  #pragma pack(push, 2)
227	#elif PRAGMA_STRUCT_PACK
228	  #pragma pack(2)
229	#endif
230	struct DeviceControlGetDeviceConnectionIDGluePB {
231		unsigned char                  componentFlags;
232		unsigned char                  componentParamSize;
233		short                          componentWhat;
234		DeviceConnectionID*            connectionID;
235		ComponentInstance              instance;
236	};
237	#if PRAGMA_STRUCT_ALIGN
238	  #pragma options align=reset
239	#elif PRAGMA_STRUCT_PACKPUSH
240	  #pragma pack(pop)
241	#elif PRAGMA_STRUCT_PACK
242	  #pragma pack()
243	#endif
244
245	#if OLD_COMPONENT_GLUE
246	struct DeviceControlGetDeviceConnectionIDGluePB myDeviceControlGetDeviceConnectionIDGluePB = {
247		0,
248		4,
249		259
250	};
251
252	#else
253	struct DeviceControlGetDeviceConnectionIDGluePB myDeviceControlGetDeviceConnectionIDGluePB;
254//	*((unsigned long*)&myDeviceControlGetDeviceConnectionIDGluePB) = 0x00040103;
255
256	myDeviceControlGetDeviceConnectionIDGluePB.componentFlags = 0;
257	myDeviceControlGetDeviceConnectionIDGluePB.componentParamSize = 4;
258	myDeviceControlGetDeviceConnectionIDGluePB.componentWhat = 259;
259
260	#endif
261
262	myDeviceControlGetDeviceConnectionIDGluePB.connectionID = connectionID;
263	myDeviceControlGetDeviceConnectionIDGluePB.instance = instance;
264
265	#if TARGET_API_MAC_OS8
266		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myDeviceControlGetDeviceConnectionIDGluePB);
267	#else
268		return (ComponentResult)CallComponentDispatch( (ComponentParameters*)&myDeviceControlGetDeviceConnectionIDGluePB );
269	#endif
270}
271#endif
272
273
274