Chameleon

Chameleon Svn Source Tree

Root/branches/rewrite/i386/include/IOKit/bluetooth/IOBluetoothHCIRequest.h

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/*
2File:IOBluetoothHCIRequest.h
3Contains:Bluetooth Host Controller request object.
4Copyright:(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
15class IOCommandGate;
16class IOTimerEventSource;
17class IOBluetoothHCIController;
18
19// Forward declaration to avoid the need to include IOBluetoothHCIUserLibShared.h
20typedef structBluetoothHCINotificationMessage;
21
22//===========================================================================================================================
23// enums, macros, etc.
24//===========================================================================================================================
25
26enum
27{
28kMaxHCIBufferLength= 512
29};
30
31typedef UInt8BluetoothHCIRequestState;
32enum BluetoothHCIRequestStates
33{
34kHCIRequestStateIdle= 0,// Doing nothing - neither waiting nor busy. usually waiting for deletion.
35kHCIRequestStateWaiting= 1,// On the wait queue - request has not been processed in any way.
36kHCIRequestStateBusy= 2,// On the busy queue - request is sent and is currently processing
37};
38
39
40//===========================================================================================================================
41// IOBluetoothHCIRequest
42//===========================================================================================================================
43
44class IOBluetoothHCIRequest : public OSObject
45{
46 OSDeclareDefaultStructors( IOBluetoothHCIRequest )
47
48UInt8mPrivateResultsBuffer[kMaxHCIBufferLength*4];// Just in case they didn't give a results ptr.
49IOByteCountmPrivateResultsSize;// Result size.
50BluetoothHCITransportIDmTransportID;// Transport ID to use for this request.
51UInt8mState;// Busy, waiting, idle.
52boolmAsyncNotify;
53task_tmOwningTaskID;
54BluetoothHCIRequestCallbackInfomCallbackInfo;// When this request is complete, call this.
55BluetoothHCICommandOpCodemOpCode;
56 BluetoothDeviceAddressmDeviceAddress;
57 BluetoothConnectionHandlemConnectionHandle;
58BluetoothHCINotificationMessage *mNotificationMessage;
59IOByteCountmNotificationMessageSize;
60
61
62public:
63
64IOBluetoothHCIRequest *mNextBusy;// Points to next request element on busy queue.
65IOBluetoothHCIRequest *mNextWait;// Points to next request element on wait queue.
66IOBluetoothHCIRequest *mNextAllocated;// Points to next allocated request element.
67IOBluetoothHCIRequest *mPreviousAllocated;// Points to next allocated request element.
68BluetoothHCIRequestIDmID;// For internal identification.
69UInt8mCommandBuffer[kMaxHCIBufferLength];// Built-up HCI Command to send to the transport.
70IOByteCountmCommandBufferSize;// Size of command buffer.
71
72UInt8 *mResultsPtr;// Result ptr, provided by object creator.
73IOByteCountmResultsSize;// Result size.
74
75IOCommandGate *mCommandGate;
76 IOTimerEventSource *mTimer;
77IOBluetoothHCIController *mHCIController;
78 IOReturnmStatus;// Success/failure code of request.
79UInt32mTimeout;// Timeout for request to complete, in milliseconds.
80UInt32mControlFlags;
81intmPID;// Creating Task
82boolmHCIRequestDeleteWasCalled;// Fixed rdar://problem/7044168
83
84
85public:
86
87boolinit( IOCommandGate *commandGate, IOBluetoothHCIController *hciController );
88voidfree();
89
90static IOBluetoothHCIRequest *Create( IOCommandGate *commandGate, IOBluetoothHCIController *hciController, bool async = TRUE, UInt32 timeout = 5, UInt32 controlFlags = 0 );
91static IOReturnDispose( IOBluetoothHCIRequest * inObject );
92
93
94// Called when a request is started on a transport, and completed.
95
96IOReturnStart();
97voidComplete();
98
99// Accessors for object members.
100
101voidSetState( BluetoothHCIRequestState inState );
102BluetoothHCIRequestStateGetState() { return( mState ); }
103
104voidSetHCIStatus( BluetoothHCIStatus inStatus ) { mStatus = inStatus; }
105BluetoothHCIStatusGetHCIStatus() { return( mStatus ); }
106
107voidSetID( BluetoothHCIRequestID inID ) { mID = inID; }
108BluetoothHCIRequestIDGetID() { return( mID ); }
109
110voidSetCallbackInfo( BluetoothHCIRequestCallbackInfo * inInfo );
111BluetoothHCIRequestCallbackInfo *GetCallbackInfo() { return( &mCallbackInfo ); }
112
113voidSetOwningTaskID( task_t inTaskID ) { mOwningTaskID = inTaskID; }
114task_tGetOwningTaskID() { return( mOwningTaskID ); }
115
116void *GetCommandBuffer();
117
118BluetoothHCICommandOpCodeGetCommandOpCode();
119voidSetCommandOpCode( BluetoothHCICommandOpCode inOpCode ) { mOpCode = inOpCode; }
120
121 BluetoothDeviceAddress *GetDeviceAddress() { return &mDeviceAddress; }
122 voidSetDeviceAddress( const BluetoothDeviceAddress *inDeviceAddress ) { if ( inDeviceAddress != NULL ) memcpy( &mDeviceAddress, inDeviceAddress, sizeof( BluetoothDeviceAddress ) ); }
123 voidClearDeviceAddress() { bzero( &mDeviceAddress, sizeof( BluetoothDeviceAddress ) ); }
124 BooleanCompareDeviceAddress( const BluetoothDeviceAddress *inDeviceAddress );
125
126 BluetoothConnectionHandleGetConnectionHandle() { return mConnectionHandle; }
127 voidSetConnectionHandle( BluetoothConnectionHandle inConnectionHandle ) { mConnectionHandle = inConnectionHandle; }
128 voidClearConnectionHandle() { mConnectionHandle = kBluetoothConnectionHandleNone; }
129
130voidSetTimeout( UInt32 inTimeout ) { mTimeout = inTimeout; }// in milliseconds
131UInt32GetTimeout() { return( mTimeout ); }
132
133voidStartTimer();
134
135 static void timerFired( OSObject *owner, IOTimerEventSource *sender );
136 voidhandleTimeout();
137
138voidCopyDataIntoResultsPtr( UInt8 * inDataPtr, IOByteCount inSize );
139voidSetParamPtrAndSize( UInt8 paramNumber, UInt8 * inParamPtr, IOByteCount inSize );
140
141voidSetResultsBufferPtrAndSize( UInt8 * resultsBuffer, IOByteCount inSize );
142voidSetResultsDataSize( IOByteCount inCount );
143UInt8 *GetResultsBuffer();
144IOByteCountGetResultsBufferSize();
145
146mach_vm_address_tGetNotificationRefCon() { return( mCallbackInfo.asyncIDRefCon ); }
147
148voidSetDoAsyncNotify( bool inAsyncNotify ) { mAsyncNotify = inAsyncNotify; }
149BooleanIsSynchronous() { return !mAsyncNotify; }
150
151voidSetControlFlags( UInt32 controlFlags ) { mControlFlags = controlFlags; }
152UInt32GetControlFlags() { return mControlFlags; }
153
154const char *RequestDescription();
155};
156

Archive Download this file

Revision: 1146