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:       DeviceControl.i.c
25
26     Contains:   Component API for doing AVC transactions.
27
28     Version:    xxx put version here xxx
29
30     DRI:        Jed (George) Wilson
31
32     Copyright:  � 1999-2001 by Apple Computer, Inc., all rights reserved.
33
34     Warning:    *** APPLE INTERNAL USE ONLY ***
35                 This file may contain unreleased API's
36
37     BuildInfo:  Built by:            wgulland
38                 On:                  Tue Mar 12 16:49:01 2002
39                 With Interfacer:     3.0d35   (Mac OS X for PowerPC)
40                 From:                DeviceControl.i
41                     Revision:        3
42                     Dated:           6/16/99
43                     Last change by:  GDW
44                     Last comment:    Changed AVC struct name to DVC for people that include
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 <DVComponentGlue/DeviceControl.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 ) DeviceControlDoAVCTransaction(ComponentInstance instance, DVCTransactionParams* params)
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 DeviceControlDoAVCTransactionGluePB {
73		unsigned char                  componentFlags;
74		unsigned char                  componentParamSize;
75		short                          componentWhat;
76		DVCTransactionParams*          params;
77		ComponentInstance              instance;
78	};
79	#if PRAGMA_STRUCT_ALIGN
80	  #pragma options align=reset
81	#elif PRAGMA_STRUCT_PACKPUSH
82	  #pragma pack(pop)
83	#elif PRAGMA_STRUCT_PACK
84	  #pragma pack()
85	#endif
86
87	#if OLD_COMPONENT_GLUE
88	struct DeviceControlDoAVCTransactionGluePB myDeviceControlDoAVCTransactionGluePB = {
89		0,
90		4,
91		1
92	};
93
94	#else
95	struct DeviceControlDoAVCTransactionGluePB myDeviceControlDoAVCTransactionGluePB;
96	//*((unsigned long*)&myDeviceControlDoAVCTransactionGluePB) = 0x00040001;
97
98	myDeviceControlDoAVCTransactionGluePB.componentFlags = 0;
99	myDeviceControlDoAVCTransactionGluePB.componentParamSize = 4;
100	myDeviceControlDoAVCTransactionGluePB.componentWhat = 1;
101
102	#endif
103
104	myDeviceControlDoAVCTransactionGluePB.params = params;
105	myDeviceControlDoAVCTransactionGluePB.instance = instance;
106
107	#if TARGET_API_MAC_OS8
108		return (ComponentResult)CallUniversalProc(CallComponentUPP, 0x000000F0, &myDeviceControlDoAVCTransactionGluePB);
109	#else
110		return (ComponentResult)CallComponentDispatch( (ComponentParameters*)&myDeviceControlDoAVCTransactionGluePB );
111	#endif
112}
113#endif
114
115
116