Root/
Source at commit 1146 created 12 years 11 months ago. By azimutz, Sync with trunk (r1145). Add nVidia dev id's, 0DF4 for "GeForce GT 450M" (issue 99) and 1251 for "GeForce GTX 560M" (thanks to oSxFr33k for testing). | |
---|---|
1 | /*␊ |
2 | ␉File:␉␉IOBluetoothHCIRequest.h␊ |
3 | ␉Contains:␉Bluetooth Host Controller request object.␊ |
4 | ␉Copyright:␉(c) 2001-2008 by Apple, all rights reserved.␊ |
5 | */␊ |
6 | ␊ |
7 | #pragma once␊ |
8 | ␊ |
9 | #import <IOKit/IOService.h>␊ |
10 | #import <IOKit/system.h>␊ |
11 | ␊ |
12 | #import <IOKit/bluetooth/Bluetooth.h>␊ |
13 | ␊ |
14 | ␊ |
15 | class IOCommandGate;␊ |
16 | class IOTimerEventSource;␊ |
17 | class IOBluetoothHCIController;␊ |
18 | ␊ |
19 | // Forward declaration to avoid the need to include IOBluetoothHCIUserLibShared.h␊ |
20 | typedef struct␉BluetoothHCINotificationMessage;␊ |
21 | ␊ |
22 | //===========================================================================================================================␊ |
23 | // enums, macros, etc.␊ |
24 | //===========================================================================================================================␊ |
25 | ␊ |
26 | enum␊ |
27 | {␊ |
28 | ␉kMaxHCIBufferLength␉= 512␊ |
29 | };␊ |
30 | ␊ |
31 | typedef UInt8␉BluetoothHCIRequestState;␊ |
32 | enum BluetoothHCIRequestStates␊ |
33 | {␊ |
34 | ␉kHCIRequestStateIdle␉␉= 0,␉␉// Doing nothing - neither waiting nor busy. usually waiting for deletion.␊ |
35 | ␉kHCIRequestStateWaiting␉␉= 1,␉␉// On the wait queue - request has not been processed in any way.␊ |
36 | ␉kHCIRequestStateBusy␉␉= 2,␉␉// On the busy queue - request is sent and is currently processing␊ |
37 | };␊ |
38 | ␊ |
39 | ␊ |
40 | //===========================================================================================================================␊ |
41 | // IOBluetoothHCIRequest␊ |
42 | //===========================================================================================================================␊ |
43 | ␊ |
44 | class IOBluetoothHCIRequest : public OSObject␊ |
45 | {␊ |
46 | OSDeclareDefaultStructors( IOBluetoothHCIRequest )␊ |
47 | ␊ |
48 | ␉UInt8␉␉␉␉␉␉␉␉mPrivateResultsBuffer[kMaxHCIBufferLength*4];␉// Just in case they didn't give a results ptr.␊ |
49 | ␉IOByteCount␉␉␉␉␉␉␉mPrivateResultsSize;␉␉␉␉␉␉␉// Result size.␊ |
50 | ␉BluetoothHCITransportID␉␉␉␉mTransportID;␉␉␉␉␉␉␉␉␉// Transport ID to use for this request.␊ |
51 | ␉UInt8␉␉␉␉␉␉␉␉mState;␉␉␉␉␉␉␉␉␉␉␉// Busy, waiting, idle.␊ |
52 | ␉bool␉␉␉␉␉␉␉␉mAsyncNotify;␊ |
53 | ␉task_t␉␉␉␉␉␉␉␉mOwningTaskID;␊ |
54 | ␉BluetoothHCIRequestCallbackInfo␉␉mCallbackInfo;␉␉␉␉␉␉␉␉␉// When this request is complete, call this.␊ |
55 | ␉BluetoothHCICommandOpCode␉␉␉mOpCode;␊ |
56 | BluetoothDeviceAddress␉␉␉␉mDeviceAddress;␊ |
57 | BluetoothConnectionHandle␉␉␉mConnectionHandle;␊ |
58 | ␉BluetoothHCINotificationMessage *␉mNotificationMessage;␊ |
59 | ␉IOByteCount␉␉␉␉␉␉␉mNotificationMessageSize;␊ |
60 | ␉␉␊ |
61 | ␉␊ |
62 | public:␊ |
63 | ␊ |
64 | ␉IOBluetoothHCIRequest *␉␉␉␉mNextBusy;␉␉␉␉␉␉␉␉␉// Points to next request element on busy queue.␊ |
65 | ␉IOBluetoothHCIRequest *␉␉␉␉mNextWait;␉␉␉␉␉␉␉␉␉// Points to next request element on wait queue.␊ |
66 | ␉IOBluetoothHCIRequest *␉␉␉␉mNextAllocated;␉␉␉␉␉␉␉␉// Points to next allocated request element.␊ |
67 | ␉IOBluetoothHCIRequest *␉␉␉␉mPreviousAllocated;␉␉␉␉␉␉␉// Points to next allocated request element.␊ |
68 | ␉BluetoothHCIRequestID␉␉␉␉mID;␉␉␉␉␉␉␉␉␉␉// For internal identification.␊ |
69 | ␉UInt8␉␉␉␉␉␉␉␉mCommandBuffer[kMaxHCIBufferLength];␉␉// Built-up HCI Command to send to the transport.␊ |
70 | ␉IOByteCount␉␉␉␉␉␉␉mCommandBufferSize;␉␉␉␉␉␉␉// Size of command buffer.␊ |
71 | ␉␊ |
72 | ␉UInt8 *␉␉␉␉␉␉␉␉mResultsPtr;␉␉␉␉␉␉␉␉// Result ptr, provided by object creator.␊ |
73 | ␉IOByteCount␉␉␉␉␉␉␉mResultsSize;␉␉␉␉␉␉␉␉// Result size.␊ |
74 | ␉␊ |
75 | ␉IOCommandGate *␉␉␉␉␉␉mCommandGate;␊ |
76 | IOTimerEventSource *␉␉␉␉mTimer;␉␊ |
77 | ␉IOBluetoothHCIController *␉␉␉mHCIController;␊ |
78 | IOReturn␉␉␉␉␉␉␉mStatus;␉␉␉␉␉␉␉␉␉// Success/failure code of request.␊ |
79 | ␉UInt32␉␉␉␉␉␉␉␉mTimeout;␉␉␉␉␉␉␉␉␉// Timeout for request to complete, in milliseconds.␊ |
80 | ␉UInt32␉␉␉␉␉␉␉␉mControlFlags;␊ |
81 | ␉int␉␉␉␉␉␉␉␉␉mPID;␉␉␉␉␉␉␉␉␉␉// Creating Task␊ |
82 | ␉bool␉␉␉␉␉␉␉␉mHCIRequestDeleteWasCalled;␉␉␉␉␉// Fixed rdar://problem/7044168␊ |
83 | ␉␊ |
84 | ␉␊ |
85 | public:␊ |
86 | ␊ |
87 | ␉bool␉␉␉␉␉␉␉init( IOCommandGate *commandGate, IOBluetoothHCIController *hciController );␊ |
88 | ␉void␉␉␉␉␉␉␉free();␊ |
89 | ␉␊ |
90 | ␉static IOBluetoothHCIRequest *␉Create( IOCommandGate *commandGate, IOBluetoothHCIController *hciController, bool async = TRUE, UInt32 timeout = 5, UInt32 controlFlags = 0 );␊ |
91 | ␉static IOReturn␉␉␉␉␉Dispose( IOBluetoothHCIRequest * inObject );␊ |
92 | ␊ |
93 | ␉␊ |
94 | ␉// Called when a request is started on a transport, and completed.␊ |
95 | ␉␊ |
96 | ␉IOReturn␉␉␉␉␉Start();␊ |
97 | ␉void␉␉␉␉␉␉Complete();␊ |
98 | ␊ |
99 | ␉// Accessors for object members.␊ |
100 | ␊ |
101 | ␉void␉␉␉␉␉␉SetState( BluetoothHCIRequestState inState );␊ |
102 | ␉BluetoothHCIRequestState␉GetState() { return( mState ); }␊ |
103 | ␊ |
104 | ␉void␉␉␉␉␉␉SetHCIStatus( BluetoothHCIStatus inStatus ) { mStatus = inStatus; }␊ |
105 | ␉BluetoothHCIStatus␉␉␉GetHCIStatus() { return( mStatus ); }␊ |
106 | ␊ |
107 | ␉void␉␉␉␉␉␉SetID( BluetoothHCIRequestID inID ) { mID = inID; }␊ |
108 | ␉BluetoothHCIRequestID␉␉GetID() { return( mID ); }␊ |
109 | ␊ |
110 | ␉void␉␉␉␉␉␉␉␉SetCallbackInfo( BluetoothHCIRequestCallbackInfo * inInfo );␊ |
111 | ␉BluetoothHCIRequestCallbackInfo *␉GetCallbackInfo() { return( &mCallbackInfo ); }␊ |
112 | ␉␊ |
113 | ␉void␉␉␉␉␉␉SetOwningTaskID( task_t inTaskID ) { mOwningTaskID = inTaskID; }␊ |
114 | ␉task_t␉␉␉␉␉␉GetOwningTaskID() { return( mOwningTaskID ); }␊ |
115 | ␉␊ |
116 | ␉void *␉␉␉␉␉␉GetCommandBuffer();␊ |
117 | ␉␊ |
118 | ␉BluetoothHCICommandOpCode␉GetCommandOpCode();␊ |
119 | ␉void␉␉␉␉␉␉SetCommandOpCode( BluetoothHCICommandOpCode inOpCode ) { mOpCode = inOpCode; }␊ |
120 | ␊ |
121 | BluetoothDeviceAddress *␉GetDeviceAddress() { return &mDeviceAddress; }␊ |
122 | void␉␉␉␉␉␉SetDeviceAddress( const BluetoothDeviceAddress *inDeviceAddress ) { if ( inDeviceAddress != NULL ) memcpy( &mDeviceAddress, inDeviceAddress, sizeof( BluetoothDeviceAddress ) ); }␊ |
123 | void␉␉␉␉␉␉ClearDeviceAddress() { bzero( &mDeviceAddress, sizeof( BluetoothDeviceAddress ) ); }␊ |
124 | Boolean␉␉␉␉␉␉CompareDeviceAddress( const BluetoothDeviceAddress *inDeviceAddress );␊ |
125 | ␊ |
126 | BluetoothConnectionHandle␉GetConnectionHandle() { return mConnectionHandle; }␊ |
127 | void␉␉␉␉␉␉SetConnectionHandle( BluetoothConnectionHandle inConnectionHandle ) { mConnectionHandle = inConnectionHandle; }␊ |
128 | void␉␉␉␉␉␉ClearConnectionHandle() { mConnectionHandle = kBluetoothConnectionHandleNone; }␊ |
129 | ␉␊ |
130 | ␉void␉␉␉␉␉␉SetTimeout( UInt32 inTimeout ) { mTimeout = inTimeout; }␉// in milliseconds␊ |
131 | ␉UInt32␉␉␉␉␉␉GetTimeout() { return( mTimeout ); }␊ |
132 | ␊ |
133 | ␉void␉␉␉␉␉␉StartTimer();␊ |
134 | ␉␊ |
135 | static void ␉␉␉␉timerFired( OSObject *owner, IOTimerEventSource *sender );␊ |
136 | void␉␉␉␉␉␉handleTimeout();␊ |
137 | ␉␊ |
138 | ␉void␉␉␉␉␉␉CopyDataIntoResultsPtr( UInt8 * inDataPtr, IOByteCount inSize );␊ |
139 | ␉void␉␉␉␉␉␉SetParamPtrAndSize( UInt8 paramNumber, UInt8 * inParamPtr, IOByteCount inSize );␊ |
140 | ␉␊ |
141 | ␉void␉␉␉␉␉␉SetResultsBufferPtrAndSize( UInt8 * resultsBuffer, IOByteCount inSize );␊ |
142 | ␉void␉␉␉␉␉␉SetResultsDataSize( IOByteCount inCount );␊ |
143 | ␉UInt8 *␉␉␉␉␉␉GetResultsBuffer();␊ |
144 | ␉IOByteCount␉␉␉␉␉GetResultsBufferSize();␊ |
145 | ␉␊ |
146 | ␉mach_vm_address_t␉␉␉GetNotificationRefCon() { return( mCallbackInfo.asyncIDRefCon ); }␊ |
147 | ␉␊ |
148 | ␉void␉␉␉␉␉␉SetDoAsyncNotify( bool inAsyncNotify ) { mAsyncNotify = inAsyncNotify; }␊ |
149 | ␉Boolean␉␉␉␉␉␉IsSynchronous() { return !mAsyncNotify; }␊ |
150 | ␉␊ |
151 | ␉void␉␉␉␉␉␉SetControlFlags( UInt32 controlFlags ) { mControlFlags = controlFlags; }␊ |
152 | ␉UInt32␉␉␉␉␉␉GetControlFlags() { return mControlFlags; }␊ |
153 | ␉␊ |
154 | ␉const char *␉␉␉␉RequestDescription();␊ |
155 | };␊ |
156 |