Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/i386/include/IOKit/bluetooth/IOBluetoothHCIController.h

1/*
2File:IOBluetoothHCIController.h
3Contains:Bluetooth Host Controller base class.
4Copyright:(c) 2001-2008 by Apple, all rights reserved.
5*/
6
7
8#pragma once
9
10//====================================================================================================
11// Imports
12//====================================================================================================
13
14#import <IOKit/IOService.h>
15#import <IOKit/system.h>
16#import <IOKit/system.h>
17#import <kern/thread_call.h>
18
19#import </usr/include/AvailabilityMacros.h>
20
21#include <IOKit/pwr_mgt/RootDomain.h>
22
23#import <IOKit/bluetooth/Bluetooth.h>
24
25#import <IOKit/bluetooth/IOBluetoothTypes.h>
26#import <IOKit/bluetooth/IOBluetoothInternal.h>
27
28//====================================================================================================
29// Forward declarations
30//====================================================================================================
31
32class OSSet;
33class IOWorkLoop;
34class IOCommandGate;
35class IOWorkQueue;
36class IOBluetoothDevice;
37class IOBluetoothHCIRequest;
38class IOBluetoothHCIController;
39class IOBluetoothACLMemoryDescriptor;
40class IOTimerEventSource;
41class IOBluetoothInactivityTimerEventSource;
42class IOBluetoothHCIPacketLogUserClient;
43
44//====================================================================================================
45// defines, typdefs, etc.
46//====================================================================================================
47
48#define kNoReturnParamNULL
49
50typedefuint16_tDevicePublishNotificationStateType;
51enum DevicePublishNotificationStateTypes
52{
53kHasNotRegisteredForDevicePublishNotification= 0x0001,
54kHasRegisteredForDevicePublishNotification= 0x0002,
55kDevicePublishNotificationCalled= 0x0004,
56kDevicePublishNotificationProcessed= 0x0008
57};
58
59typedef UInt32 HCIDataHandlerType;
60enum HCIDataHandlerTypes
61{
62kTransportDataTypeHCIEvents,
63kTransportDataTypeACL,
64kTransportDataTypeSCO
65};
66
67typedef IOReturn (*IOBluetoothIncomingDataAction) ( IOBluetoothHCIController *hciController, UInt8 *inDataPtr, UInt32 inDataSize, UInt32 inSequenceNumber );
68typedef IOReturn (*IOBluetoothHCIControllerDataHandler) ( void * contextPtr, const UInt8 * data, UInt32 dataSize );
69
70typedef struct HCIDataHandlerHCIDataHandler;
71struct HCIDataHandler
72{
73IOBluetoothHCIControllerDataHandlerprocPtr;
74void * contextPtr;
75};
76
77typedef struct HCIEventNotificationListenerHCIEventNotificationListener;
78struct HCIEventNotificationListener
79{
80task_towningTask;// Used to ID these things when adding/removing them from our listener pool.
81mach_port_tport;// Mach port to send out the notificaton.
82void * refCon;// RefCon for the port's use.
83};
84
85#define POWER_STATE_CHANGE_IN_PROGRESS()( mCurrentInternalPowerState != mPendingInternalPowerState )
86#defineIS_POWERING_DOWN()( POWER_STATE_CHANGE_IN_PROGRESS() && ( mPendingInternalPowerState == kIOBluetoothHCIControllerInternalPowerStateOff ) )
87
88//====================================================================================================
89// Callback structure for data:
90//====================================================================================================
91
92typedef struct SendDataContext
93{
94// Data sent:
95IOMemoryDescriptor *memoryDescriptorPointer;
96
97// Referece to the device that sent the data:
98IOBluetoothDevice *devicePointer;
99void *devicePointerContextInfo0;
100void *devicePointerContextInfo1;
101
102// And the controller that received it:
103IOBluetoothHCIController *hciController;
104void *controllerPointerContextInfo0;
105void *controllerPointerContextInfo1;
106
107// ReturnValue:
108IOReturn sendingWasSuccessful;
109} SendDataContext;
110
111
112//====================================================================================================
113// Keep track of hearing devices
114//====================================================================================================
115typedef struct HearingDeviceListType
116{
117BluetoothDeviceAddressmDeviceAddress;
118boolmRemoveDeviceCalled;
119DevicePublishNotificationStateTypemDevicePublishNotificationState;
120HearingDeviceListType *mNextDevice;
121HearingDeviceListType *mPreviousDevice;
122} HearingDeviceListType;
123
124//====================================================================================================
125// IOBluetoothHCIController
126//====================================================================================================
127
128class IOBluetoothHCIController : public IOService
129{
130// We don't make many friends, but at least we have a few...
131
132 friend class IOBluetoothHCIPacketLogUserClient;
133 friend class IOBluetoothSerialManager;
134 friend class IOBluetoothHCIUserClient;
135 friend class IOBluetoothDevice;
136friend class IOBluetoothHCIRequest;
137
138// IOKit stuff.
139
140 OSDeclareDefaultStructors( IOBluetoothHCIController )
141
142protected:
143
144IOWorkLoop *mWorkLoop;
145IOCommandGate *mCommandGate;
146IOWorkQueue *mWorkQueue;
147IOTimerEventSource *mTimerEventSource;
148BooleanmShouldRunInactivityTimer;
149
150// Data and request queue stuff.
151
152HCIEventNotificationListener*mHCIEventListenersList;
153size_tmHCIEventListenersListSize;
154 HCIDataHandler*mHCIEventDataHandlerList;
155size_tmHCIEventDataHandlerListSize;
156HCIDataHandler*mACLDataHandlerList;
157size_tmACLDataHandlerListSize;
158HCIDataHandler*mSCODataHandlerList;
159size_tmSCODataHandlerListSize;
160
161IOBluetoothHCIRequest * mBusyQueueHead;
162IOBluetoothHCIRequest * mWaitQueueHead;
163IOBluetoothHCIRequest **mHCIRequestList;
164
165 IOBluetoothDevice *mDeviceListHead;
166
167OSSet *mPacketLogClients;
168UInt8 *mPacketLogBuffer;
169UInt32mPacketLogBufferSize;
170
171uint8_t *mEventDataBuffer;// Events without matching requests will use this.
172size_tmEventDataBufferSize;
173
174 // This keeps track of the ACL packets we actually sent:
175 BluetoothHCIBufferSizemHCIBufferSize;
176 UInt16mNumOutstandingACLPackets;
177
178 OSArray *mAllowedIncomingL2CAPChannels;
179
180 UInt32mNextAvailableSequenceNumber;
181 UInt32mCurrentlyExecutingSequenceNumber;
182 UInt16mActiveConnections;
183
184// Packet Queue description:
185typedef struct QueuePacketHolder {
186IOMemoryDescriptor*memDescriptor;// The data we need to send
187SendDataContext *contextPtr;// Context pointer for the sent data.
188IOBluetoothDevice *inTargetDevice;// The device that enqueued the data.
189struct QueuePacketHolder*next;// The next block in the queue.
190} QueuePacketHolder;
191 QueuePacketHolder *mACLQueueHead, *mACLQueueTail;
192
193// Counters to limit the number of packets in the queue (we do not want to go out of memory)
194UInt32 mNumberOfPacketsInQueue;
195
196// The allowed RFCOMM channels
197 OSArray *mAllowedIncomingRFCOMMChannels;
198
199IOBluetoothHCIControllerInternalPowerStatemCurrentInternalPowerState;
200IOBluetoothHCIControllerInternalPowerStatemPendingInternalPowerState;
201BooleanmAsyncPowerStateChangeInProgress;
202UInt32mPendingPowerStateChangeOptions;
203IOBluetoothHCIControllerPowerOptionsmControllerPowerOptions;
204BooleanmPowerStateChangeIsUserEnforced;
205
206BooleanmHardwareSetupComplete;
207
208IOBluetoothHCIControllerConfigStatemControllerConfigState;
209IOBluetoothHCIControllerConfigStatemPreviousControllerConfigState;
210
211IOBluetoothHCIControllerFeatureFlagsmControllerFeatureFlags;
212
213// Overrides.
214
215bool start( IOService * provider );
216
217bool init( OSDictionary* dictionary );
218
219 virtual voidfree();
220
221#if defined( MAC_OS_X_VERSION_10_5 )
222 virtual voidsystemWillShutdown( IOOptionBits specifier );
223#endif
224
225 static IOReturninitHardwareAction(OSObject*owner,
226 void*arg1,
227 void*arg2,
228 void*arg3,
229 void*arg4 );
230
231 virtual boolinitHardware( IOService * provider );
232
233 static IOReturnsetupHardwareAction(OSObject*owner,
234void*arg1,
235void*arg2,
236void*arg3,
237void*arg4 );
238
239virtual IOReturnsetupHardware( IOService* provider );
240
241 virtual voidhardwareSetupComplete( IOReturn status );
242
243virtualvoidsetConfigState( IOBluetoothHCIControllerConfigState configState );
244virtualboolterminate( IOOptionBits options = 0 );
245virtual boolwillTerminate( IOService * provider, IOOptionBits options );
246virtual booldidTerminate( IOService * provider, IOOptionBits options, bool * defer );
247
248void stop( IOService * provider );
249
250IOReturnnewUserClient(task_t owningTask,
251void *securityID,
252UInt32 type,
253IOUserClient **handler );
254
255uint32_tCountExistingHCIControllers();
256
257virtual IOReturnpowerStateWillChangeTo(IOPMPowerFlagspowerFlags,
258unsigned longpowerState,
259IOService *from );
260
261virtualunsigned longmaxCapabilityForDomainState( IOPMPowerFlags domainState );
262
263virtual unsigned longinitialPowerStateForDomainState ( IOPMPowerFlags powerFlags );
264
265// Our protected custom stuff.
266
267 static IOReturnDetachUserClientsAction(OSObject *owner,
268 void *arg1,
269 void *arg2,
270 void *arg3,
271 void *arg4 );
272
273 virtual voidDetachUserClients();
274
275 static IOReturnsetPropertiesAction( OSObject*owner,
276 void*arg1,
277 void*arg2,
278 void*arg3,
279 void*arg4 );
280
281 virtual IOReturnsetPropertiesWL( OSObject * properties );
282
283 static IOReturnAddPacketLogUserClientAction(OSObject *owner,
284 void *arg1,
285 void *arg2,
286 void *arg3,
287 void *arg4 );
288
289 virtual IOReturnAddPacketLogUserClient( IOBluetoothHCIPacketLogUserClient *newPacketLogUserClient );
290
291virtual boolPacketLogFillBufferedData();
292
293 virtual voidPacketLogClientClosed( IOBluetoothHCIPacketLogUserClient *packetLogClient );
294
295 virtual voidLogPacket( UInt8 packetType, void *packetData, size_t packetSize );
296
297static IOReturnLogPacketAction( OSObject *owner, void *arg1, void *arg2, void *arg3, void *arg4 );
298
299virtualvoidDesyncIncomingData( IOBluetoothIncomingDataAction action, UInt8 *inDataPtr, UInt32 inDataSize );
300
301staticvoidDesyncIncomingDataAction( IOBluetoothHCIController *hciController, IOBluetoothIncomingDataAction action, void *inDataPtr, UInt32 inDataSize, UInt32 sequenceNumber );
302
303 virtual voidSynchronizePacketSequence( UInt32 sequenceNumber );
304
305 virtual IOReturnAddDevice( IOBluetoothDevice *inDevice );
306
307 virtual IOReturnRemoveDevice( IOBluetoothDevice *inDevice );
308
309 virtual IOReturnCreateDeviceFromConnectionResults( BluetoothHCIEventConnectionCompleteResults *connectionResults );
310
311 virtual IOReturnDestroyDeviceWithDisconnectionResults( BluetoothHCIEventDisconnectionCompleteResults *disconnectionResults );
312
313 virtual IOReturnDestroyDevice( IOBluetoothDevice *inDevice );
314
315 virtual IOReturnDestroyAllDevices();
316
317 virtual voidFlushDeviceACLPackets( IOBluetoothDevice *inDevice );
318
319 virtual voidDecrementOutstandingACLPackets( UInt16 delta );
320
321 virtual voidProcessFlushOccurredEvent( BluetoothHCIEventFlushOccurredResults *inFlushResults );
322
323 virtual voidProcessNumCompletedPacketsEvent( UInt8 *inDataPtr );
324
325 virtual voidProcessHCIControllerResetEvent();
326
327 virtual IOReturnDispatchIncomingACLData( UInt8 *inDataPtr, UInt32 inDataSize );
328
329// Common methods for L2CAP and RFCOMM channel managment:
330virtual voidMergeChannelDescription(OSDictionary *destination , OSDictionary *source);
331virtual voidRemoveChannelRestrictions(OSDictionary *toChange , OSDictionary *removeRule, const char *key);
332virtual BooleanIsAllowedDevice(OSDictionary *description , IOBluetoothDevice *device);
333virtual voidRemoveAllRules();
334
335// L2CAP channel managment methods:
336 virtual voidRemoveAllowedIncomingL2CAPChannel( OSObject *channelID );
337virtual IOReturn AddAllowedIncomingL2CAPChannel( OSDictionary *channelDescription );
338virtual OSDictionary *GetIncomingL2CAPChannelDescription( OSNumber *psmNumber );
339
340// L2CAP channel accessory methods:
341 virtual voidAddAllowedIncomingL2CAPChannel( BluetoothL2CAPPSM incomingPSM );
342 virtual voidAddAllowedIncomingL2CAPChannel( OSNumber *psmNumber );
343 virtual void RemoveAllowedIncomingL2CAPChannel( BluetoothL2CAPPSM incomingPSM );
344
345// RFCOMM channel managment methods:
346virtual OSDictionary *GetIncomingRFCOMMChannelDescription( OSNumber *channelIDNumber );
347virtual IOReturn AddAllowedIncomingRFCOMMChannel( OSDictionary *channelDescription );
348 virtual voidRemoveAllowedIncomingRFCOMMChannel( OSObject *channelID );
349
350// RFCOMM channel accessory methods:
351 virtual voidAddAllowedIncomingRFCOMMChannel( BluetoothRFCOMMChannelID incomingChannelID );
352 virtual voidAddAllowedIncomingRFCOMMChannel( OSNumber *channelIDNumber );
353 virtual voidAddSecureIncomingRFCOMMChannel( BluetoothRFCOMMChannelID incomingChannelID );
354 virtual voidAddSecureIncomingRFCOMMChannel( OSNumber *channelIDNumber );
355 virtual void RemoveAllowedIncomingRFCOMMChannel( BluetoothRFCOMMChannelID incomingChannelID );
356
357virtual IOReturnTransferACLPacketToHW(IOMemoryDescriptor *memDescriptor,
358SendDataContext *contextPtr);
359
360// ACL Packet queue:
361virtual IOReturnEnqueuePacket(IOMemoryDescriptor*memDescriptor,
362SendDataContext*contextPtr,
363IOBluetoothDevice*inTargetDevice);
364
365virtual IOReturnDequeuePacket();
366
367virtual IOReturnRemoveAllPacketsBelongingTo(IOBluetoothDevice*inTargetDevice);
368
369public:
370
371 // IOWorkLoop and IOCommandGate accessors
372
373 virtual IOWorkLoop *getWorkLoop() const;
374
375 virtual IOCommandGate *getCommandGate() const;
376
377 virtual IOReturn setProperties( OSObject * properties );
378
379// Subclasses must implement these for it to be a working transport
380// in the Bluetooth Family world.
381
382virtualIOReturnSendHCIRequest(UInt8 * buffer,
383IOByteCountbufferSize );
384
385staticIOReturnSendACLCompletedAction ( OSObject *owner, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5, void *arg6 );
386
387virtualvoidSendACLCompleted(SendDataContext*contextPtr);
388
389virtualIOReturnSendACLData(IOMemoryDescriptor*memDescriptor,
390SendDataContext *contextPtr );
391
392virtualIOReturnGetTransportInfo( BluetoothTransportInfo *infoStruct );
393
394staticIOReturnSendSCOCompletedAction ( OSObject *owner, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5, void *arg6 );
395
396// Override to do something custom with the data. Otherwise, the registered data handler
397// will get a peek at it.
398
399 // The ProcessXXXData() functions are safe to be called from anywhere.
400 // They call ProcessXXXDataWL() on the workloop using ProcessXXXDataAction()
401
402virtualvoid ProcessEventData( UInt8 * inDataPtr, UInt32 inDataSize );
403
404virtualvoid ProcessACLData( UInt8 * data, UInt32 dataSize );
405
406virtualvoid ProcessSCOData( UInt8 * data, UInt32 dataSize, UInt32 inMissingData, AbsoluteTime inTimestamp, Boolean copyData );
407
408virtualvoid ProcessEventDataWL( UInt8 * inDataPtr, UInt32 inDataSize, UInt32 sequenceNumber );
409
410virtualvoid ProcessACLDataWL( UInt8 * data, UInt32 dataSize, UInt32 sequenceNumber );
411
412virtualvoid ProcessSCODataWL( UInt8 * data, UInt32 dataSize, UInt32 inMissingData, AbsoluteTime inTimestamp, Boolean copyData );
413
414staticIOReturnProcessEventDataAction( IOBluetoothHCIController *hciController,
415UInt8 *incomingDataPtr,
416UInt32inDataSize,
417UInt32inSequenceNumber );
418
419staticIOReturnProcessACLDataAction(IOBluetoothHCIController *hciController,
420UInt8 *incomingDataPtr,
421UInt32inDataSize,
422UInt32inSequenceNumber );
423
424// The following is only a "ghost" call and exists only to make the compiler happy, its implementation
425// does not do anything.
426staticIOReturnProcessSCODataAction( IOBluetoothHCIController *hciController,
427UInt8 *incomingDataPtr,
428UInt32inDataSize,
429UInt32inMissingData,
430UInt32inTimestampHi,
431UInt32inTimestampLo,
432BooleaninCopyData );
433
434staticIOReturnProcessSCODataActionAT( IOBluetoothHCIController *hciController,
435UInt8 *incomingDataPtr,
436UInt32inDataSize,
437UInt32inMissingData,
438AbsoluteTime*inTimestamp,
439BooleaninCopyData );
440
441// Data processing helpers.
442
443 virtual boolGetCompleteCodeForCommand(BluetoothHCICommandOpCodeinOpCode,
444 BluetoothHCIEventCode*outEventCode );
445
446virtualboolGetOpCodeAndEventCode(UInt8 * inDataPtr,
447BluetoothHCICommandOpCode * outOpCode,
448BluetoothHCIEventCode * eventCode,
449 BluetoothHCIEventStatus *outStatus,
450 BluetoothDeviceAddress *outDeviceAddress,
451 BluetoothConnectionHandle *outConnectionHandle );
452
453virtualIOReturnFindConnectionCompleteType( BluetoothHCICommandOpCode *outOpCode );
454
455virtualIOReturnHandleSpecialOpcodes( BluetoothHCICommandOpCode opCode );
456
457// This is a hook for other interested parties to get HCI event notifications. When a user client is created,
458// that mach_port_t will be passed on to us via these calls so that their port will get HCI events that aren't
459// specifically tied to a requst object, but occur due to requests they make.
460
461virtualIOReturnAddHCIEventNotification( task_t inOwningTask, mach_port_t inPort, void * refCon );
462
463virtualvoidBroadcastEventNotification(BluetoothHCIRequestIDinID,
464BluetoothHCIEventCodeinEventCode,
465IOReturneventStatus,
466UInt8 *inDataToSendPtr,
467IOByteCount inDataSize,
468 BluetoothHCICommandOpCodeinOpCode );
469
470virtual voidBroadcastConfigStateChangeNotification(IOBluetoothHCIControllerConfigState oldState,
471IOBluetoothHCIControllerConfigState newState );
472
473virtual IOReturnRemoveHCIEventNotification( task_t inOwningTask );
474
475// This is a hook for other interested parties to get data from transports. They will register itself
476// with these to receive the raw data from the transport, bypassing HCI code.
477
478virtualIOReturnAddDataClient(HCIDataHandlerType inType,
479IOBluetoothHCIControllerDataHandler inProcPtr,
480void * inContextPtr );
481
482virtual IOReturnNotifyDataClients( HCIDataHandlerType inType, UInt8 * inDataPtr, UInt32 inDataSize );
483
484virtual IOReturnRemoveDataClient( HCIDataHandlerType inType, IOBluetoothHCIControllerDataHandler inProcPtr );
485
486// Request creation, deletion and other data processing stuff.
487
488virtualIOReturn HCIRequestCreate(BluetoothHCIRequestID * outRequestID,
489bool inDoAsyncNotify = TRUE,
490UInt32 inTimeout = 5,
491BluetoothHCIRequestCallbackInfo * inCallbackInfo = NULL,
492task_tinTaskID= 0,
493UInt32inControlFlags= 0 );
494
495virtualIOReturnHCIRequestDelete( task_t inTask, BluetoothHCIRequestID inID );
496
497virtualIOReturn LookupRequest( BluetoothHCIRequestID inID, IOBluetoothHCIRequest ** outRequestPtr );
498
499 virtual IOReturnPrepareRequestForNewCommand(BluetoothHCIRequestIDinID,
500 const BluetoothDeviceAddress *inDeviceAddress,
501 BluetoothConnectionHandleinConnectionHandle );
502
503virtualIOReturnEnqueueRequest( IOBluetoothHCIRequest * inRequestPtr );
504
505virtualIOReturnFindQueuedRequest(BluetoothHCICommandOpCodeopCode,
506 BluetoothDeviceAddress *inDeviceAddress,
507 BluetoothConnectionHandleinConnectionHandle,
508 BooleaninUseAttributes,
509 IOBluetoothHCIRequest **outRequestPtr );
510
511virtualIOReturnDequeueRequest( IOBluetoothHCIRequest * inRequestPtr );
512
513virtualIOReturn EnqueueWaitRequest( IOBluetoothHCIRequest * inRequestPtr );
514
515virtualIOReturnFindQueuedWaitRequest( BluetoothHCICommandOpCode opCode, IOBluetoothHCIRequest ** outRequestPtr );
516
517virtual IOReturnDequeueWaitRequest( IOBluetoothHCIRequest * inRequestPtr );
518
519virtualIOReturnAbortRequest( IOBluetoothHCIRequest * inRequestPtr );
520
521virtualIOReturnFindNextExpiringRequest( BluetoothHCICommandOpCode opCode, IOBluetoothHCIRequest ** outRequestPtr );
522
523virtualIOReturnProcessWaitingRequests();
524
525inlineIOBluetoothHCIRequest*GetNextWaitRequest() { return( mWaitQueueHead ); }
526
527inlineIOBluetoothHCIRequest*GetNextBusyRequest() { return( mBusyQueueHead ); }
528
529virtualvoidTakeAHexDump( const void *inData, UInt32 inDataSize );
530
531virtualIOReturnDumpStats();
532
533virtual IOBluetoothHCIControllerPowerOptionsGetControllerPowerOptions();
534virtual IOBluetoothHCIControllerInternalPowerStateGetControllerPowerState();
535virtual IOReturnWaitForControllerPowerState( IOBluetoothHCIControllerInternalPowerState powerState );
536
537virtual IOReturnRequestPowerStateChange( IOBluetoothHCIControllerInternalPowerState newPowerState );
538
539virtual IOReturnSendHCIRequestFormatted( BluetoothHCIRequestIDinID,
540 BluetoothHCICommandOpCode inOpCode,
541 IOByteCountoutResultsSize,
542 void *outResultsPtr,
543 const char *inFormat,
544 ... );
545
546staticvoidRequestExpired( OSObject *owner, IOTimerEventSource *sender );
547
548// Misc stuff.
549
550IOReturnDisposeRequestsForTaskID( task_t inTaskID );
551
552IOReturnKillAllPendingRequests( Boolean destroy, Boolean includeIdleRequests );
553 voidSendingRequest( IOBluetoothHCIRequest *requestPtr );
554 voidDecrementActiveConnections( );
555
556virtualvoidActiveConnectionsInProgress( );
557virtualvoidAllConnectionsGone( );
558
559virtual IOReturnSendRawHCICommand(BluetoothHCIRequestIDinID,
560char * buffer,
561UInt32bufferSize );
562
563// Vendor Specific stuff.
564
565virtualIOReturnVendorCommand(BluetoothHCIRequestID inID,
566BluetoothHCIVendorCommandSelectorinSelector,
567UInt8 *inCommandData,
568IOByteCountinCommandDataSize,
569IOByteCount outBufferSize,
570UInt8 * outBuffer );
571
572// IOBluetoothDevice object management
573
574 virtual IOBluetoothDevice *FindDeviceWithHandle( BluetoothConnectionHandle inConnectionHandle );
575
576 virtual IOBluetoothDevice * FindDeviceWithAddress( const BluetoothDeviceAddress *inDeviceAddress );
577
578 virtual IOReturnSendACLPacket(IOBluetoothACLMemoryDescriptor*memDescriptor,
579 SendDataContext *contextPtr,
580 IOBluetoothDevice *inTargetDevice = NULL );
581
582
583 // API for the serial manager to open a new connection
584
585 virtual IOBluetoothDevice *OpenDeviceConnection( const BluetoothDeviceAddress *inDeviceAddress );
586
587 static IOReturn OpenDeviceConnectionAction(OSObject*owner,
588 void *arg1,
589 void*arg2,
590 void*arg3,
591 void*arg4 );
592
593 virtual IOBluetoothDevice *OpenDeviceConnectionWL( const BluetoothDeviceAddress *inDeviceAddress );
594
595 // API to track the secure state of RFCOMM channels
596 virtual Boolean IsSecureIncomingRFCOMMChannel( BluetoothRFCOMMChannelID incomingChannelID );
597 virtual Boolean IsSecureIncomingRFCOMMChannel( OSNumber *channelIDNumber );
598
599// API to track allowed incoming L2CAP and RFCOMM channels given a device:
600virtual Boolean IsAllowedIncomingL2CAPChannelForDevice( BluetoothL2CAPPSM incomingPSM, IOBluetoothDevice *device );
601virtual Boolean IsAllowedIncomingRFCOMMChannelForDevice( BluetoothRFCOMMChannelID incomingChannelID, IOBluetoothDevice *device );
602
603// Enabled state for RFCOMM channels:
604virtual void SetEnabledIncomingRFCOMMChannel( OSNumber *channelIDNumber, bool ShouldBeEnabled);
605virtual void SetEnabledIncomingRFCOMMChannel( BluetoothRFCOMMChannelID incomingChannelID, bool ShouldBeEnabled);
606
607 virtual Boolean ShouldRunInactivityTimer(); // NOT USED: See StartIdleTimer
608 virtual voidSetRunInactivityTimer( Boolean shouldRun ); // NOT USED: See StopIdleTimer
609
610//============================
611
612// From here on out, we implement each of the commands in the HCI spec. You can work around
613// hardware bugs by overriding any of these functions if necessary.
614
615
616// Link Control Commands.
617
618virtual IOReturnBluetoothHCIInquiry(BluetoothHCIRequestID inID,
619BluetoothLAPinLAP,
620BluetoothHCIInquiryLengthinInquiryLength,
621BluetoothHCIResponseCountinMaxResponseCount,
622BluetoothHCIInquiryResults *outResults );
623
624virtual IOReturnBluetoothHCIInquiryCancel( BluetoothHCIRequestID inID );
625
626virtual IOReturnBluetoothHCIPeriodicInquiryMode(BluetoothHCIRequestID inID,
627BluetoothHCIInquiryLengthinMaxPeriodLength,
628BluetoothHCIInquiryLengthinMinPeriodLength,
629BluetoothLAPinLAP,
630BluetoothHCIInquiryLengthinInquiryLength,
631BluetoothHCIResponseCountinMaxResponses,
632 BluetoothHCIInquiryResults *outResults );
633
634virtual IOReturnBluetoothHCIExitPeriodicInquiryMode( BluetoothHCIRequestIDinID );
635
636virtual IOReturnBluetoothHCICreateConnection(BluetoothHCIRequestIDinID,
637const BluetoothDeviceAddress *inAddressPtr,
638BluetoothPacketTypeinPacketType,
639BluetoothPageScanRepetitionModeinPageScanRepetitionMode,
640BluetoothPageScanModeinPageScanMode,
641BluetoothClockOffsetinClockOffset,
642BluetoothAllowRoleSwitchinAllowRoleSwitch,
643BluetoothHCIEventConnectionCompleteResults *outConnectionHandle );
644
645virtual IOReturnBluetoothHCIDisconnect( BluetoothHCIRequestIDinID,
646BluetoothConnectionHandle inConnectionHandle,
647BluetoothReasonCodeinReason,
648 BluetoothHCIEventDisconnectionCompleteResults *outResults );
649
650virtual IOReturnBluetoothHCIAddSCOConnection(BluetoothHCIRequestIDinID,
651BluetoothConnectionHandleinACLConnectionHandle,
652BluetoothPacketType inPacketType );
653
654virtual IOReturnBluetoothHCIAcceptConnectionRequest(BluetoothHCIRequestIDinID,
655const BluetoothDeviceAddress *inAddressPtr,
656BluetoothRoleinRole );
657
658virtual IOReturnBluetoothHCIRejectConnectionRequest(BluetoothHCIRequestIDinID,
659const BluetoothDeviceAddress *inAddressPtr,
660BluetoothReasonCodeinReason );
661
662virtual IOReturnBluetoothHCILinkKeyRequestReply(BluetoothHCIRequestIDinID,
663const BluetoothDeviceAddress *inAddressPtr,
664const BluetoothKey *inKeyPtr,
665BluetoothDeviceAddress *outAddress );
666
667virtual IOReturnBluetoothHCILinkKeyRequestNegativeReply( BluetoothHCIRequestIDinID,
668const BluetoothDeviceAddress *inAddressPtr,
669BluetoothDeviceAddress *outAddress );
670
671virtual IOReturnBluetoothHCIPINCodeRequestReply(BluetoothHCIRequestIDinID,
672const BluetoothDeviceAddress *inAddressPtr,
673IOByteCountinPINCodeSize,
674const BluetoothPINCode *inPINCode,
675BluetoothDeviceAddress *outAddress );
676
677virtual IOReturnBluetoothHCIPINCodeRequestNegativeReply(BluetoothHCIRequestIDinID,
678const BluetoothDeviceAddress *inAddressPtr,
679BluetoothDeviceAddress *outAddress );
680
681virtual IOReturnBluetoothHCIChangeConnectionPacketType( BluetoothHCIRequestIDinID,
682BluetoothConnectionHandleinConnectionHandle,
683BluetoothPacketTypeinPacketType );
684
685virtual IOReturnBluetoothHCIAuthenticationRequested(BluetoothHCIRequestIDinID,
686BluetoothConnectionHandleinConnectionHandle );
687
688virtual IOReturnBluetoothHCISetEncryptionEnable(BluetoothHCIRequestIDinID,
689BluetoothConnectionHandleinConnectionHandle,
690BluetoothEncryptionEnableinEncryptionEnable );
691
692virtual IOReturnBluetoothHCIChangeConnectionLinkKey(BluetoothHCIRequestIDinID,
693BluetoothConnectionHandleinConnectionHandle );
694
695virtual IOReturnBluetoothHCIMasterLinkKey(BluetoothHCIRequestIDinID,
696BluetoothKeyFlaginKeyFlag );
697
698virtual IOReturnBluetoothHCIRemoteNameRequest(BluetoothHCIRequestIDinID,
699const BluetoothDeviceAddress *inAddressPtr,
700BluetoothPageScanRepetitionMode inPageScanRepetitionMode,
701BluetoothPageScanModeinPageScanMode,
702BluetoothClockOffsetinClockOffset,
703BluetoothHCIEventRemoteNameRequestResults *outName );
704
705virtual IOReturnBluetoothHCIReadRemoteSupportedFeatures(BluetoothHCIRequestIDinID,
706BluetoothConnectionHandleinConnectionHandle,
707BluetoothHCIEventReadRemoteSupportedFeaturesResults *outFeatures );
708
709virtual IOReturnBluetoothHCIReadRemoteVersionInformation(BluetoothHCIRequestIDinID,
710BluetoothConnectionHandleinConnectionHandle,
711BluetoothHCIEventReadRemoteVersionInfoResults *outVersionInfo );
712
713virtual IOReturnBluetoothHCIReadClockOffset(BluetoothHCIRequestIDinID,
714BluetoothConnectionHandleinConnectionHandle,
715BluetoothClockOffset *outClockOffset );
716
717// Link Policy commands.
718
719virtualIOReturnBluetoothHCIHoldMode(BluetoothHCIRequestID inID,
720BluetoothConnectionHandleinConnectionHandle,
721BluetoothHCIModeIntervalinHoldModeMaxInterval,
722BluetoothHCIModeIntervalinHoldModeMinInterval );
723
724virtualIOReturnBluetoothHCISniffMode(BluetoothHCIRequestID inID,
725BluetoothConnectionHandleinConnectionHandle,
726BluetoothHCIModeIntervalinSniffModeMaxInterval,
727BluetoothHCIModeIntervalinSniffModeMinInterval,
728BluetoothHCISniffAttemptCountinSniffAttemptCount,
729BluetoothHCISniffTimeoutinSniffModeTimeout );
730
731virtualIOReturnBluetoothHCIExitSniffMode(BluetoothHCIRequestID inID,
732BluetoothConnectionHandleinConnectionHandle );
733
734virtualIOReturnBluetoothHCIParkMode(BluetoothHCIRequestID inID,
735BluetoothConnectionHandleinConnectionHandle,
736BluetoothHCIParkModeBeaconIntervalinMaxInterval,
737BluetoothHCIParkModeBeaconIntervalinMinInterval );
738
739virtualIOReturnBluetoothHCIExitParkMode(BluetoothHCIRequestID inID,
740BluetoothConnectionHandleinConnectionHandle );
741
742virtualIOReturnBluetoothHCIQualityOfServiceSetup(BluetoothHCIRequestID inID,
743BluetoothConnectionHandleinConnectionHandle,
744BluetoothHCIQualityOfServiceSetupParams * inSetupPtr );
745
746virtualIOReturnBluetoothHCIRoleDiscovery(BluetoothHCIRequestIDinID,
747BluetoothConnectionHandleinConnectionHandle,
748BluetoothHCIRoleInfo *outRoleInfo );
749
750virtualIOReturnBluetoothHCISwitchRole(BluetoothHCIRequestIDinID,
751BluetoothDeviceAddress * inAddressPtr,
752BluetoothHCIRoleinNewRole );
753
754virtualIOReturnBluetoothHCIReadLinkPolicySettings(BluetoothHCIRequestIDinID,
755BluetoothConnectionHandleinConnectionHandle,
756BluetoothHCILinkPolicySettingsInfo *outSettingsInfo );
757
758virtualIOReturnBluetoothHCIWriteLinkPolicySettings(BluetoothHCIRequestIDinID,
759BluetoothConnectionHandleinConnectionHandle,
760BluetoothHCILinkPolicySettingsinSettings,
761BluetoothConnectionHandle *outConnectionHandle );
762
763// Host controller and baseband commands.
764
765virtualIOReturnBluetoothHCISetEventMask(BluetoothHCIRequestIDinID,
766BluetoothSetEventMask *inMask );
767
768virtualIOReturnBluetoothHCIReset( BluetoothHCIRequestIDinID );
769
770virtualIOReturnBluetoothHCISetEventFilter( BluetoothHCIRequestIDinID );
771
772virtualIOReturnBluetoothHCIFlush(BluetoothHCIRequestID inID,
773BluetoothConnectionHandleinHandle );
774
775virtualIOReturnBluetoothHCIReadPINType(BluetoothHCIRequestIDinID,
776BluetoothPINType *outType );
777
778virtualIOReturnBluetoothHCIWritePINType(BluetoothHCIRequestIDinID,
779BluetoothPINTypeinType );
780
781virtualIOReturnBluetoothHCICreateNewUnitKey( BluetoothHCIRequestIDinID );
782
783virtualIOReturnBluetoothHCIReadStoredLinkKey(BluetoothHCIRequestIDinID,
784BluetoothDeviceAddress *targetDevice,
785BluetoothHCIReadStoredLinkKeysFlag * inFlags,
786BluetoothHCIStoredLinkKeysInfo *outKeysInfo );
787
788virtualIOReturnBluetoothHCIWriteStoredLinkKey( BluetoothHCIRequestIDinID,
789IOItemCount inNumKeysToWrite,
790BluetoothDeviceAddressinDeviceAddresses[],
791BluetoothKeyinLinkKeys[],
792BluetoothHCINumLinkKeysToWrite * outNumKeysWritten );
793
794virtualIOReturnBluetoothHCIDeleteStoredLinkKey(BluetoothHCIRequestIDinID,
795BluetoothDeviceAddress*targetDevice,
796BluetoothHCIDeleteStoredLinkKeyFlag *inFlag,
797BluetoothHCINumLinkKeysDeleted *outNumDeleted );
798
799virtualIOReturnBluetoothHCIReadLocalName(BluetoothHCIRequestIDinID,
800BluetoothDeviceNamename );
801
802virtualIOReturnBluetoothHCIChangeLocalName( BluetoothHCIRequestIDinID,
803 BluetoothDeviceNamenewName );
804
805virtualIOReturnBluetoothHCIReadConnectionAcceptTimeout( BluetoothHCIRequestIDinID,
806BluetoothHCIConnectionAcceptTimeout *outTimeout );
807
808virtualIOReturnBluetoothHCIWriteConnectionAcceptTimeout(BluetoothHCIRequestIDinID,
809BluetoothHCIConnectionAcceptTimeoutinTimeout );
810
811virtualIOReturnBluetoothHCIReadPageTimeout(BluetoothHCIRequestID inID,
812BluetoothHCIPageTimeout * outDataPtr );
813
814virtualIOReturnBluetoothHCIWritePageTimeout(BluetoothHCIRequestID inID,
815BluetoothHCIPageTimeout inTimeout );
816
817virtualIOReturnBluetoothHCIReadScanEnable( BluetoothHCIRequestID inID,
818BluetoothHCIPageScanEnableState *outState );
819
820virtualIOReturnBluetoothHCIWriteScanEnable( BluetoothHCIRequestIDinID,
821BluetoothHCIPageScanEnableStateinState );
822
823virtualIOReturnBluetoothHCIReadPageScanActivity(BluetoothHCIRequestID inID,
824BluetoothHCIScanActivity *outActivityInfo );
825
826virtualIOReturnBluetoothHCIWritePageScanActivity(BluetoothHCIRequestID inID,
827BluetoothHCIScanActivity *inActivityInfo );
828
829virtualIOReturnBluetoothHCIReadInquiryScanActivity(BluetoothHCIRequestID inID,
830BluetoothHCIScanActivity *outActivityInfo );
831
832virtualIOReturnBluetoothHCIWriteInquiryScanActivity(BluetoothHCIRequestID inID,
833BluetoothHCIScanActivity *inActivityInfo );
834
835virtualIOReturnBluetoothHCIReadAuthenticationEnable(BluetoothHCIRequestID inID,
836BluetoothHCIAuthenticationEnable *outAuthenticationState );
837
838virtualIOReturnBluetoothHCIWriteAuthenticationEnable(BluetoothHCIRequestID inID,
839BluetoothHCIAuthenticationEnableinAuthenticationState );
840
841virtualIOReturnBluetoothHCIReadEncryptionMode(BluetoothHCIRequestID inID,
842BluetoothHCIEncryptionMode *outEncryptionState );
843
844virtualIOReturnBluetoothHCIWriteEncryptionMode(BluetoothHCIRequestID inID,
845BluetoothHCIEncryptionModeinEncryptionMode );
846
847virtualIOReturnBluetoothHCIReadClassOfDevice(BluetoothHCIRequestIDinID,
848BluetoothClassOfDevice *outClassOfDevice );
849
850virtualIOReturnBluetoothHCIWriteClassOfDevice(BluetoothHCIRequestIDinID,
851BluetoothClassOfDeviceinClassOfDevice );
852
853virtualIOReturnBluetoothHCIReadVoiceSetting(BluetoothHCIRequestID inID,
854BluetoothHCIVoiceSetting *outVoiceSetting );
855
856virtualIOReturnBluetoothHCIWriteVoiceSetting(BluetoothHCIRequestIDinID,
857BluetoothHCIVoiceSettinginVoiceSetting );
858
859virtualIOReturnBluetoothHCIReadAutomaticFlushTimeout(BluetoothHCIRequestID inID,
860BluetoothConnectionHandleinConnectionHandle,
861BluetoothHCIAutomaticFlushTimeoutInfo *outAutomaticFlushTimeoutInfo );
862
863
864virtualIOReturnBluetoothHCIWriteAutomaticFlushTimeout(BluetoothHCIRequestIDinID,
865BluetoothHCIAutomaticFlushTimeoutInfo *inAutomaticFlushTimeoutInfo,
866BluetoothConnectionHandle *outConnectionHandle );
867
868virtualIOReturnBluetoothHCIReadNumBroadcastRetransmissions(BluetoothHCIRequestID inID,
869BluetoothHCINumBroadcastRetransmissions *outNumRetrans );
870
871virtualIOReturnBluetoothHCIWriteNumBroadcastRetransmissions(BluetoothHCIRequestIDinID,
872BluetoothHCINumBroadcastRetransmissionsinNumRetrans );
873
874virtualIOReturnBluetoothHCIReadHoldModeActivity(BluetoothHCIRequestID inID,
875BluetoothHCIHoldModeActivity *outState );
876
877virtualIOReturnBluetoothHCIWriteHoldModeActivity(BluetoothHCIRequestIDinID,
878BluetoothHCIHoldModeActivityinState );
879
880virtualIOReturnBluetoothHCIReadTransmitPowerLevel(BluetoothHCIRequestID inID,
881BluetoothConnectionHandleinHandle,
882BluetoothHCITransmitPowerLevelTypeinType,
883BluetoothHCITransmitPowerLevelInfo *outLevelInfo );
884
885virtualIOReturnBluetoothHCIReadSCOFlowControlEnable(BluetoothHCIRequestID inID,
886BluetoothHCIFlowControlState *outState );
887
888virtualIOReturnBluetoothHCIWriteSCOFlowControlEnable(BluetoothHCIRequestIDinID,
889BluetoothHCIFlowControlStateinState );
890
891virtualIOReturnBluetoothHCISetHostControllerToHostFlowControl(BluetoothHCIRequestIDinID,
892BluetoothHCIFlowControlStateinState );
893
894virtualIOReturnBluetoothHCIHostBufferSize(BluetoothHCIRequestID inID,
895BluetoothHCIBufferSize * inSize );
896
897virtualIOReturnBluetoothHCIHostNumberOfCompletePackets( BluetoothHCIRequestID inID );
898
899virtualIOReturnBluetoothHCIReadLinkSupervisionTimeout(BluetoothHCIRequestID inID,
900BluetoothConnectionHandleinHandle,
901BluetoothHCILinkSupervisionTimeout *outInfo );
902
903virtualIOReturnBluetoothHCIWriteLinkSupervisionTimeout(BluetoothHCIRequestID inID,
904BluetoothHCILinkSupervisionTimeout *inInfo,
905BluetoothConnectionHandle *outHandle );
906
907virtualIOReturnBluetoothHCIReadNumberOfSupportedIAC(BluetoothHCIRequestID inID,
908BluetoothHCISupportedIAC *outNumSupported );
909
910virtualIOReturnBluetoothHCIReadCurrentIACLAP(BluetoothHCIRequestID inID );
911
912virtualIOReturnBluetoothHCIWriteCurrentIACLAP(BluetoothHCIRequestID inID );
913
914virtualIOReturnBluetoothHCIReadPageScanPeriodMode(BluetoothHCIRequestID inID,
915BluetoothHCIPageScanPeriodMode *outMode );
916
917virtualIOReturnBluetoothHCIWritePageScanPeriodMode(BluetoothHCIRequestID inID,
918BluetoothHCIPageScanPeriodModeinMode );
919
920virtualIOReturnBluetoothHCIReadPageScanMode(BluetoothHCIRequestID inID,
921BluetoothHCIPageScanMode *outMode );
922
923virtualIOReturnBluetoothHCIWritePageScanMode(BluetoothHCIRequestID inID,
924BluetoothHCIPageScanModeinMode );
925
926// Informational commands.
927
928virtualIOReturnBluetoothHCIReadLocalVersionInformation( BluetoothHCIRequestIDinID,
929 BluetoothHCIVersionInfo *outVersionInfo );
930
931virtualIOReturnBluetoothHCIReadLocalSupportedFeatures( BluetoothHCIRequestIDinID,
932BluetoothHCISupportedFeatures *outFeatures );
933
934virtualIOReturnBluetoothHCIReadBufferSize( BluetoothHCIRequestID inID,
935BluetoothHCIBufferSize * outSize );
936
937virtualIOReturnBluetoothHCIReadCountryCode(BluetoothHCIRequestID inID,
938BluetoothHCICountryCode * outCountryCode );
939
940virtualIOReturnBluetoothHCIReadDeviceAddress(BluetoothHCIRequestID inID,
941BluetoothDeviceAddress *outAddress );
942
943// Status commands.
944
945virtualIOReturnBluetoothHCIReadFailedContactCounter(BluetoothHCIRequestID inID,
946BluetoothConnectionHandleinConnectionHandle,
947BluetoothHCIFailedContactInfo *outFailedContactCount );
948
949virtualIOReturnBluetoothHCIResetFailedContactCounter(BluetoothHCIRequestID inID,
950BluetoothConnectionHandleinConnectionHandle );
951
952virtualIOReturnBluetoothHCIGetLinkQuality(BluetoothHCIRequestID inID,
953BluetoothConnectionHandleinConnectionHandle,
954BluetoothHCILinkQualityInfo *outLinkQualityInfo );
955
956virtualIOReturnBluetoothHCIReadRSSI(BluetoothHCIRequestID inID,
957BluetoothConnectionHandleinConnectionHandle,
958BluetoothHCIRSSIInfo *outRSSIInfo );
959
960// Testing Commands.
961
962virtualIOReturnBluetoothHCIReadLoopbackMode(BluetoothHCIRequestID inID,
963BluetoothHCILoopbackMode *inLoopbackMode );
964
965virtualIOReturnBluetoothHCIWriteLoopbackMode(BluetoothHCIRequestIDinID,
966BluetoothHCILoopbackModeinLoopbackMode );
967
968virtualIOReturnBluetoothHCIEnableDeviceUnderTestMode( BluetoothHCIRequestIDinID );
969
970virtual IOBluetoothHCIControllerFeatureFlagsGetControllerFeatureFlags();
971
972protected:
973
974// Power managment functions:
975
976virtual boolconfigurePM(IOService *provider);
977
978virtualIOReturnsetPowerState( unsigned long powerStateOrdinal, IOService* whatDevice );
979staticIOReturnsetPowerStateAction( OSObject *owner, void *arg1, void *arg2, void *arg3, void *arg4 );
980virtualIOReturnsetPowerStateWL( unsigned long powerStateOrdinal, IOService* whatDevice );
981
982virtual voidUpdatePowerStateProperty( IOBluetoothHCIControllerInternalPowerState powerState );
983
984virtual voidSetControllerPowerOptions( IOBluetoothHCIControllerPowerOptions controllerPowerOptions );
985virtual IOReturnPerformPowerStateChange(IOBluetoothHCIControllerInternalPowerState oldPowerState,
986IOBluetoothHCIControllerInternalPowerState newPowerState,
987UInt32 powerStateOptions,
988UInt32 *microsecondsUntilComplete );
989virtual voidCompletePowerStateChange();
990
991virtual voidSetControllerFeatureFlags( IOBluetoothHCIControllerFeatureFlags featureFlags );
992
993virtual IOReturnsetAggressiveness( unsigned long type, unsigned long newLevel );
994
995// Enablers for future Changes.
996
997 typedef struct ExpansionData
998{
999void*mUnsedPointer1, *mUnsedPointer2;
1000
1001// Max number of HCI command allowed;
1002UInt8mNumberOfCommandsAllowedByHardware;
1003UInt8mNumConfiguredHIDDevices;
1004UInt8mControllerSleepFlags;
1005
1006// This pointer is depreacted and free for future uses.
1007void*mUnusedPointer;
1008
1009// AFH support:
1010// the mask for the channels to use:
1011UInt8mMaskByte[10];
1012
1013// AirPort changes notifications:
1014IONotifier *windowServerNotifier;
1015IONotifier *mAirPortPCI;
1016BooleanmProcessingConnectionRequest;
1017BooleanmWaitingForCompletedACLPacketsToSleep;
1018
1019 // SCO Support
1020UInt8mNumSCOConnections;
1021UInt8*mSCOPacketBuffer;
1022UInt16mNumBufferedSCOBytes;
1023AbsoluteTimemBufferedSCOPacketTimestamp;
1024
1025// Repository for the packets when logging at boot
1026OSArray*mRepositoryForBoot;
1027UInt16mMaxNumberOfBootPackets;
1028
1029IOService*mOverriddenControllerProvider;
1030
1031size_tmHCIRequestListSize;
1032uint32_tmNewRequestIndex;
1033
1034IOBluetoothInactivityTimerEventSource*mIdleTimer;
1035BooleanmSystemOnTheWayToSleep;
1036
1037// New Airport notifications:
1038IONotifier *mIO80211Interface;
1039
1040UInt32mNextAvailableSCOSequenceNumber;
1041UInt32mCurrentlyExecutingSCOSequenceNumber;
1042
1043BooleanmNeedToCleanUpWaitForAckQueue;
1044BooleanmResettingDevice;
1045
1046HearingDeviceListType *mConnectedHearingDeviceListHead;
1047HearingDeviceListType *mConnectedHearingDeviceListTail;
1048
1049} ExpansionData;
1050
1051ExpansionData*mExpansionData;
1052
1053#definemConnectedHearingDeviceListTailIOBluetoothHCIController::mExpansionData->mConnectedHearingDeviceListTail
1054#definemConnectedHearingDeviceListHeadIOBluetoothHCIController::mExpansionData->mConnectedHearingDeviceListHead
1055#definemResettingDeviceIOBluetoothHCIController::mExpansionData->mResettingDevice
1056#definemNeedToCleanUpWaitForAckQueueIOBluetoothHCIController::mExpansionData->mNeedToCleanUpWaitForAckQueue
1057#define mNextAvailableSCOSequenceNumberIOBluetoothHCIController::mExpansionData->mNextAvailableSCOSequenceNumber
1058#define mCurrentlyExecutingSCOSequenceNumberIOBluetoothHCIController::mExpansionData->mCurrentlyExecutingSCOSequenceNumber
1059
1060#define mNumberOfCommandsAllowedByHardwareIOBluetoothHCIController::mExpansionData->mNumberOfCommandsAllowedByHardware
1061#definemNumConfiguredHIDDevicesIOBluetoothHCIController::mExpansionData->mNumConfiguredHIDDevices
1062#define mControllerSleepFlagsIOBluetoothHCIController::mExpansionData->mControllerSleepFlags
1063#define mSleepWakeNotifierIOBluetoothHCIController::mExpansionData->mSleepWakeNotifier
1064
1065#define mMaskByteIOBluetoothHCIController::mExpansionData->mMaskByte
1066#define windowServerNotifierIOBluetoothHCIController::mExpansionData->windowServerNotifier
1067#define mAirPortPCIIOBluetoothHCIController::mExpansionData->mAirPortPCI
1068#define mProcessingConnectionRequestIOBluetoothHCIController::mExpansionData->mProcessingConnectionRequest
1069#define mWaitingForCompletedACLPacketsToSleep IOBluetoothHCIController::mExpansionData->mWaitingForCompletedACLPacketsToSleep
1070
1071#definemNumSCOConnectionsIOBluetoothHCIController::mExpansionData->mNumSCOConnections
1072#define mSCOPacketBufferIOBluetoothHCIController::mExpansionData->mSCOPacketBuffer
1073#define mNumBufferedSCOBytesIOBluetoothHCIController::mExpansionData->mNumBufferedSCOBytes
1074#define mBufferedSCOPacketTimestampIOBluetoothHCIController::mExpansionData->mBufferedSCOPacketTimestamp
1075#define mRepositoryForBootIOBluetoothHCIController::mExpansionData->mRepositoryForBoot
1076#define mMaxNumberOfBootPacketsIOBluetoothHCIController::mExpansionData->mMaxNumberOfBootPackets
1077#define mOverriddenControllerProviderIOBluetoothHCIController::mExpansionData->mOverriddenControllerProvider
1078#define mHCIRequestListSizeIOBluetoothHCIController::mExpansionData->mHCIRequestListSize
1079#define mNewRequestIndexIOBluetoothHCIController::mExpansionData->mNewRequestIndex
1080#define mIdleTimerIOBluetoothHCIController::mExpansionData->mIdleTimer
1081#define mSystemOnTheWayToSleepIOBluetoothHCIController::mExpansionData->mSystemOnTheWayToSleep
1082#define mIO80211InterfaceIOBluetoothHCIController::mExpansionData->mIO80211Interface
1083
1084enum {
1085kIOBluetoothHCIControllerSleepFlagInquiryScanWasEnabled= 0x01
1086};
1087
1088
1089private:
1090
1091// Command Packet Queue:
1092virtual IOReturnEnqueueRequestForController( IOBluetoothHCIRequest *requestPtr );// Was OSMetaClassDeclareReservedUnused(IOBluetoothHCIController, 0 )
1093virtual IOReturnDequeueAndSendRequests();// Was OSMetaClassDeclareReservedUnused(IOBluetoothHCIController, 1 )
1094virtual IOReturnRemoveAllRequestsFromQueue();// Was OSMetaClassDeclareReservedUnused(IOBluetoothHCIController, 2 )
1095
1096// New Device creation upon connection:
1097IOReturn CreateDeviceFromConnectionResults( BluetoothHCIEventConnectionCompleteResults *connectionResults, bool isInitiator);
1098
1099// Expanded version of OpenDeviceConnection MUST BE CALLED IN THE WORKLOOP
1100 virtual IOBluetoothDevice *OpenDeviceConnection( const BluetoothDeviceAddress *inDeviceAddress, BluetoothHCIPageTimeout pageTimeoutValue, bool authenticationRequired);
1101
1102// sleepWakeHandler DEPRECATED METHOD RETURNS kIOReturnUnsupported ALL THE TIME!
1103staticIOReturn sleepWakeHandler( void *target, void *refCon, UInt32 messageType, IOService *service, void *messageArgument, vm_size_t argSize );
1104
1105staticIOReturnrestartShutdownAction( OSObject *owner, void *arg1, void *arg2, void *arg3, void *arg4 );
1106staticIOReturnsystemSleepWakeAction( OSObject *owner, void *arg1, void *arg2, void *arg3, void *arg4 );
1107
1108public:
1109virtualIOReturn restartShutdownWL( UInt32 messageType, void *reserved);
1110
1111// AFH support:
1112virtualUInt8 *rangeForChannel(UInt16 channel);
1113virtual IOReturn handleAirPortChangesChannelWL(IOService *serviceForAirport);
1114
1115// Version of stop in the workloop
1116virtual void stopWL( IOService * provider );
1117
1118private:
1119static bool staticAirPortDriverNotification(void *us, void *unused, IOService * yourDevice);
1120static IOReturn handleAirPortChangesChannelAction( OSObject *owner, void *castMeToServiceForAirport, void *arg2, void *arg3, void *arg4, void *arg5, void *arg6 );
1121
1122static bool windowServerDidAppear( void * target, void * refCon, IOService * newService, IONotifier * notifier );
1123static IOReturn windowServerDidAppearAction( OSObject *owner, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5, void *arg6 );
1124
1125// Expansion slots:
1126OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 0 );
1127OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 1 );
1128OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 2 );
1129OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 3 );
1130OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 4 );
1131OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 5 );
1132
1133OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 6 );
1134OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 7 );
1135OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 8 );
1136
1137OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 9 );
1138virtual void SetNumSCOConnections( UInt8 numSCOConnections );
1139
1140OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 10 );
1141virtual void UpdateSCOConnections( UInt8 numSCOConnections );
1142
1143OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 11 );
1144virtual IOBluetoothDevice *FindDeviceWithSCOHandle( BluetoothConnectionHandle inConnectionHandle );
1145
1146OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 12 );
1147virtual IOReturn SendSCOData(IOMemoryDescriptor*scoDataDescriptor,
1148SendDataContext*scoDataContext );
1149
1150protected:
1151OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 13 );
1152virtualvoidSendSCOCompleted( SendDataContext *contextPtr, AbsoluteTime timestamp );
1153
1154OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 14 );
1155virtual IOReturn DispatchIncomingSCOData( UInt8 *inDataPtr, UInt32 inDataSize, UInt32 inMissingData, AbsoluteTime inTimestamp );
1156
1157 OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 15 );
1158 virtual bool willTerminateWL( IOService * provider, IOOptionBits options );
1159
1160OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 16 );
1161virtual bool shouldOverrideExistingController( IOBluetoothHCIController *controller );
1162
1163static void idleTimerFired( OSObject *owner, IOTimerEventSource *timerEventSource );
1164
1165OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 17 );
1166virtual void handleIdleTimeout();
1167
1168static IOReturn terminateAction(OSObject*owner,
1169void*arg1,
1170void*arg2,
1171void*arg3,
1172void*arg4 );
1173
1174OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 18 );
1175virtual IOReturn terminateWL( IOOptionBits options );
1176
1177// Support for dynamic channel width
1178OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 19 );
1179virtualUInt8 *rangeForChannel(UInt16 channel, SInt16 width);
1180
1181public:
1182
1183// v1.2 + v2.1 commands
1184
1185OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 20 );
1186virtualIOReturnBluetoothHCIReadExtendedInquiryResponse(BluetoothHCIRequestIDinID,
1187BluetoothHCIReadExtendedInquiryResponseResults *outData );
1188
1189
1190OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 21 );
1191virtualIOReturnBluetoothHCIWriteExtendedInquiryResponse(BluetoothHCIRequestIDinID,
1192BluetoothHCIFECRequiredinFECRequired,
1193BluetoothHCIExtendedInquiryResponse *inData );
1194
1195OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 22 );
1196virtualIOReturnBluetoothHCIReadInquiryMode(BluetoothHCIRequestIDinID,
1197BluetoothHCIInquiryMode*outMode );
1198
1199
1200OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 23 );
1201virtualIOReturnBluetoothHCIWriteInquiryMode(BluetoothHCIRequestIDinID,
1202BluetoothHCIInquiryModeinMode );
1203
1204OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 24 );
1205virtualIOReturnBluetoothHCIReadSimplePairingMode(BluetoothHCIRequestIDinID,
1206BluetoothHCISimplePairingMode*outMode );
1207
1208
1209OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 25 );
1210virtualIOReturnBluetoothHCIWriteSimplePairingMode(BluetoothHCIRequestIDinID,
1211BluetoothHCISimplePairingModeinMode );
1212
1213OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 26 );
1214virtual IOReturnBluetoothHCIIOCapabilityRequestReply(BluetoothHCIRequestIDinID,
1215const BluetoothDeviceAddress *inAddress,
1216BluetoothIOCapabilityinIOCapability,
1217BluetoothOOBDataPresenceinOOBDataPresence,
1218BluetoothAuthenticationRequirementsinAuthenticationRequirements );
1219
1220OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 27 );
1221virtualIOReturnBluetoothHCIReadLocalOOBData(BluetoothHCIRequestIDinID,
1222BluetoothHCIReadLocalOOBDataResults *outData);
1223
1224OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 28 );
1225virtualIOReturnBluetoothHCIReadInquiryResponseTransmitPower(BluetoothHCIRequestIDinID,
1226BluetoothHCITransmitPowerLevel *outData);
1227
1228OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 29 );
1229virtualIOReturnBluetoothHCIWriteInquiryResponseTransmitPower(BluetoothHCIRequestIDinID,
1230BluetoothHCITransmitPowerLevelinData );
1231
1232OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 30 );
1233virtualIOReturnBluetoothHCIUserConfirmationRequestReply(BluetoothHCIRequestIDinID,
1234const BluetoothDeviceAddress *inAddress );
1235
1236OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 31 );
1237virtualIOReturnBluetoothHCIUserConfirmationRequestNegativeReply(BluetoothHCIRequestIDinID,
1238const BluetoothDeviceAddress *inAddress );
1239
1240OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 32 );
1241virtualIOReturnBluetoothHCIUserPasskeyRequestReply(BluetoothHCIRequestIDinID,
1242const BluetoothDeviceAddress *inAddress,
1243BluetoothPasskeyinPasskey);
1244
1245OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 33 );
1246virtualIOReturnBluetoothHCIUserPasskeyRequestNegativeReply(BluetoothHCIRequestIDinID,
1247const BluetoothDeviceAddress *inAddress );
1248
1249OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 34 );
1250virtualIOReturnBluetoothHCIRemoteOOBDataRequestReply(BluetoothHCIRequestIDinID,
1251const BluetoothDeviceAddress *inAddress,
1252BluetoothHCISimplePairingOOBData *hash,
1253BluetoothHCISimplePairingOOBData *randomizer );
1254
1255OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 35 );
1256virtualIOReturnBluetoothHCIRemoteOOBDataRequestNegativeReply(BluetoothHCIRequestIDinID,
1257const BluetoothDeviceAddress *inAddress );
1258
1259OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 36 );
1260virtualIOReturnBluetoothHCIWriteSimplePairingDebugMode(BluetoothHCIRequestIDinID,
1261BluetoothSimplePairingDebugModeinData);
1262
1263OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 37 );
1264virtualIOReturnBluetoothHCISendKeypressNotification(BluetoothHCIRequestIDinID,
1265const BluetoothDeviceAddress *inAddress,
1266BluetoothKeypressNotificationTypeinData);
1267
1268protected:
1269OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 38 );
1270virtualIOReturnsystemSleepWakeWL( UInt32 messageType, void *reserved);
1271
1272public:
1273OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 39 );
1274virtualIOReturnBluetoothHCIReadLocalExtendedFeatures(BluetoothHCIRequestIDinID,
1275 BluetoothHCIPageNumberinPageNumber,
1276 BluetoothHCIExtendedFeaturesInfo *outFeatures );
1277
1278OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 40 );
1279virtual IOReturnBluetoothHCIReadRemoteExtendedFeatures(BluetoothHCIRequestIDinID,
1280BluetoothConnectionHandleinConnectionHandle,
1281BluetoothHCIPageNumberinPageNumber,
1282BluetoothHCIEventReadRemoteExtendedFeaturesResults *outFeatures );
1283
1284OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 41 );
1285virtualIOReturnBluetoothHCIReadAFHChannelAssessmentMode(BluetoothHCIRequestIDinID,
1286BluetoothHCIAFHChannelAssessmentMode *outData );
1287
1288OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 42 );
1289virtual IOReturnBluetoothHCIWriteAFHChannelAssessmentMode(BluetoothHCIRequestIDinID,
1290BluetoothHCIAFHChannelAssessmentModeinData );
1291
1292OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 43 );
1293virtual IOReturnBluetoothHCISetAFHHostChannelClassification(BluetoothHCIRequestIDinID,
1294uint8_t *inDataPtr,
1295uint8_tinDataLength );
1296
1297private:
1298OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 44 );
1299virtual IOReturnBluetoothHCIReadAFHChannelMap(BluetoothHCIRequestID inID,
1300BluetoothConnectionHandleinConnectionHandle,
1301BluetoothAFHResults *outData );
1302
1303OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 45 );
1304 virtual voidSynchronizeSCOPacketSequence( UInt32 sequenceNumber );
1305
1306OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 46 );
1307virtual IOReturnBluetoothHCICreateConnectionCancel(BluetoothHCIRequestIDinID,
1308const BluetoothDeviceAddress *inAddressPtr,
1309BluetoothDeviceAddress *outAddress );
1310
1311OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 47 );
1312 virtual IOReturnBluetoothHCIRemoteNameRequestCancel(BluetoothHCIRequestIDinID,
1313const BluetoothDeviceAddress *inAddressPtr,
1314BluetoothDeviceAddress *outAddress );
1315
1316OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 48 );
1317voidStartIdleTimer( uint32_t milliseconds );
1318
1319OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 49 );
1320voidStopIdleTimer();
1321
1322public:
1323OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 50 );
1324virtualIOReturnsetUnackQueueCompletionCalled(void * memoryDescriptor);
1325
1326protected:
1327OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 51 );
1328virtual IOReturnRemovePacket(IOMemoryDescriptor*memDescriptor);
1329
1330public:
1331OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 52 );
1332IOReturn exitHIDSniff(bool exitSniff);
1333
1334public:
1335OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 53 );
1336virtual IOReturnWaitForControllerPowerStateWithTimeout( IOBluetoothHCIControllerInternalPowerStatepowerState,
1337 UInt32waitTimeInMicroSecond);
1338public:
1339OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 54 );
1340voidSetHCIDriverExistsVariableTo( bool isLoaded );
1341
1342public:
1343OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 55 );
1344virtualIOReturnToggleLMPLogging( );
1345
1346public:
1347OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 56 );
1348virtualHearingDeviceListType * FindHearingDeviceWithAddress( const BluetoothDeviceAddress *inDeviceAddress );
1349
1350public:
1351OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 57 );
1352virtualIOReturnAddHearingDevice( IOBluetoothDevice *inDevice );
1353
1354public:
1355OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 58 );
1356virtualIOReturnRemoveHearingDevice( IOBluetoothDevice *inDevice, bool all );
1357
1358public:
1359OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 59 );
1360virtualIOReturnSetDevicePublishNotificationState( const BluetoothDeviceAddress *inDeviceAddress, DevicePublishNotificationStateType state );
1361
1362public:
1363OSMetaClassDeclareReservedUsed(IOBluetoothHCIController, 60 );
1364virtualDevicePublishNotificationStateType *GetDevicePublishNotificationState( const BluetoothDeviceAddress *inDeviceAddress );
1365
1366private:
1367OSMetaClassDeclareReservedUnused(IOBluetoothHCIController, 61 );
1368OSMetaClassDeclareReservedUnused(IOBluetoothHCIController, 62 );
1369OSMetaClassDeclareReservedUnused(IOBluetoothHCIController, 63 );
1370};
1371

Archive Download this file

Revision: 2225