[USB]
[reactos.git] / reactos / drivers / usb / usbehci / interfaces.h
1
2 #ifndef INTERFACES_HPP
3 #define INTERFACES_HPP
4
5 //---------------------------------------------------------------------------
6 //
7 // Object Hierachy
8 // --------------------------------------------------------------------
9 // | IRootHCDController |
10 // | IHCDController Intel USB Universal Host Controller - 3A37 |
11 // | IHCDController - Intel USB Universal HostController - 3A38 |
12 // | IHCDController - Intel USB Universal HostController - 3A38 |
13 // |------------------------------------------------------------------|
14 //
15 //
16 // IHCDController Intel USB Universal Host Controller - 3A37
17 // IHubController
18 // IUSBHardwareDevice
19 // IDMAMemoryManager
20 // IUSBQueue <- interacts with -> IUSBRequest
21 //
22 //
23 // Each IHCDController creates an IUSBHardwareDevice class upon initialization. The
24 // IUSBHardwardeDevice class is used to abstract usb controller specifics. The IHubController
25 // manages all attached devices and handles hub control ioctl requests.
26 //
27 // Each IUSBHardwareDevice has one IDMAMemoryManager and one IUSBQueue. The IDMAMemoryManager
28 // is used to handle dma memory allocations. The IUSBQueue manages requests which are send to the
29 // usb hardware. See IUSBRequest class for details.
30 //
31
32
33 //=========================================================================================
34 //
35 // class IRootHCDController
36 //
37 // Description: This class serves as the root host controller. The host controller mantains
38 // a list of registered controllers and provides support functions for the host controllers
39
40 struct IHCDController;
41
42 DECLARE_INTERFACE_(IRootHCDController, IUnknown)
43 {
44 DEFINE_ABSTRACT_UNKNOWN()
45
46 //-----------------------------------------------------------------------------------------
47 //
48 // Initialize
49 //
50 // Description: This function initializes the root host controller. It allocates the resources
51 // required to manage the registered controllers
52
53 virtual NTSTATUS Initialize() = 0;
54
55 //-----------------------------------------------------------------------------------------
56 //
57 // RegisterHCD
58 //
59 // Description: this function registers a host controller with the root host controller
60
61 virtual NTSTATUS RegisterHCD(struct IHCDController * Controller) = 0;
62
63 //-----------------------------------------------------------------------------------------
64 //
65 // UnregisterHCD
66 //
67 // Description: this function unregistes a host controller
68
69 virtual NTSTATUS UnregisterHCD(struct IHCDController * Controller) = 0;
70
71 //-----------------------------------------------------------------------------------------
72 //
73 // GetControllerCount
74 //
75 // Description: returns the number of host controllers registered
76
77 virtual ULONG GetControllerCount() = 0;
78
79 };
80
81 typedef IRootHCDController *PROOTHDCCONTROLLER;
82
83 //=========================================================================================
84 //
85 // class IHCDController
86 //
87 // Description: This class is used to manage a single USB host controller
88 //
89
90 DECLARE_INTERFACE_(IHCDController, IUnknown)
91 {
92 DEFINE_ABSTRACT_UNKNOWN()
93
94 //-----------------------------------------------------------------------------------------
95 //
96 // Initialize
97 //
98 // Description: This function initializes the IHCDController implementation.
99 // It creates an IUSBHardwareDevice object and initializes it. It also registeres itself with
100 // the IRootHCDController
101 //
102 virtual NTSTATUS Initialize(IN PROOTHDCCONTROLLER RootHCDController,
103 IN PDRIVER_OBJECT DriverObject,
104 IN PDEVICE_OBJECT PhysicalDeviceObject) = 0;
105
106 };
107
108 typedef IHCDController *PHCDCONTROLLER;
109
110
111 //=========================================================================================
112 //
113 // class IUSBHardwareDevice
114 //
115 // Description: This class provides access to the usb hardware controller
116 //
117
118 struct IDMAMemoryManager;
119 struct IUSBQueue;
120
121 DECLARE_INTERFACE_(IUSBHardwareDevice, IUnknown)
122 {
123 DEFINE_ABSTRACT_UNKNOWN()
124
125 //-----------------------------------------------------------------------------------------
126 //
127 // Initialize
128 //
129 // Description: Initializes the usb device controller
130
131 virtual NTSTATUS Initialize(PDRIVER_OBJECT DriverObject,
132 PDEVICE_OBJECT FunctionalDeviceObject,
133 PDEVICE_OBJECT PhysicalDeviceObject,
134 PDEVICE_OBJECT LowerDeviceObject) = 0;
135
136 //-----------------------------------------------------------------------------------------
137 //
138 // PnpStart
139 //
140 // Description: handles pnp start request from device. It registeres the interrupt,
141 // sets up the ports and prepares the device. It then starts the controller
142
143 virtual NTSTATUS PnpStart(PCM_RESOURCE_LIST RawResources,
144 PCM_RESOURCE_LIST TranslatedResources) = 0;
145
146 //-----------------------------------------------------------------------------------------
147 //
148 // PnpStop
149 //
150 // Description: handles pnp stop request from device. It unregisteres the interrupt, releases ports and dma object.
151
152 virtual NTSTATUS PnpStop(void) = 0;
153
154 //-----------------------------------------------------------------------------------------
155 //
156 // GetDeviceDetails
157 //
158 // Description: returns the device details such as vendor id, device id, number of ports and speed
159
160 virtual NTSTATUS GetDeviceDetails(OUT OPTIONAL PUSHORT VendorId,
161 OUT OPTIONAL PUSHORT DeviceId,
162 OUT OPTIONAL PULONG NumberOfPorts,
163 OUT OPTIONAL PULONG Speed) = 0;
164
165 //-----------------------------------------------------------------------------------------
166 //
167 // GetUSBQueue
168 //
169 // Description: returns interface to internal IUSBQueue
170 // Interface is reference counted, you need to call release method when you are done with it
171 // Do not call Initialize on IUSBQueue, the object is already initialized
172
173 virtual NTSTATUS GetUSBQueue(OUT struct IUSBQueue **OutUsbQueue) = 0;
174
175 //-----------------------------------------------------------------------------------------
176 //
177 // GetDMA
178 //
179 // Description: returns the DMA object which can be used to allocate memory from the common buffer
180
181 virtual NTSTATUS GetDMA(OUT struct IDMAMemoryManager **OutDMAMemoryManager) = 0;
182
183
184 //-----------------------------------------------------------------------------------------
185 //
186 // ResetController()
187 //
188 // Description: this function resets the controller
189 // Returns STATUS_SUCCESS when the controller was successfully reset
190
191 virtual NTSTATUS ResetController() = 0;
192
193 //-----------------------------------------------------------------------------------------
194 //
195 // StartController
196 //
197 // Description: this functions starts controller allowing interrupts for device connects/removal, and execution of
198 // Periodic and Asynchronous Schedules.
199 //
200
201 virtual NTSTATUS StartController() = 0;
202
203 //-----------------------------------------------------------------------------------------
204 //
205 // StopController
206 //
207 // Description: this functions stops controller disabling interrupts for device connects/removal, and execution of
208 // Periodic and Asynchronous Schedules.
209 //
210
211 virtual NTSTATUS StopController() = 0;
212
213 //-----------------------------------------------------------------------------------------
214 //
215 // ResetPort
216 //
217 // Description: this functions resets the port on the controller
218 //
219
220 virtual NTSTATUS ResetPort(ULONG PortNumber) = 0;
221
222 //-----------------------------------------------------------------------------------------
223 //
224 // GetPortStatus
225 //
226 // Description: this functions return status and change state of port
227 //
228 virtual NTSTATUS GetPortStatus(ULONG PortId, OUT USHORT *PortStatus, OUT USHORT *PortChange) = 0;
229
230 //-----------------------------------------------------------------------------------------
231 //
232 // ClearPortStatus
233 //
234 // Description: Clears Status of Port, for example Connection, Enable and Reset
235 //
236 virtual NTSTATUS ClearPortStatus(ULONG PortId, ULONG Status) = 0;
237
238 //-----------------------------------------------------------------------------------------
239 //
240 // SetPortFeature
241 //
242 // Description: this functions Sets Feature on Port, for example Enable, Power and Reset
243 //
244 virtual NTSTATUS SetPortFeature(ULONG PortId, ULONG Feature) = 0;
245
246 //-----------------------------------------------------------------------------------------
247 //
248 // SetAsyncListRegister
249 //
250 // Description: this functions sets the register to a address that is the physical address of a QueueHead.
251 // This is the location at which the controller will start executing the Asynchronous Schedule.
252 //
253 // FIXME: This is only available for USB 2.0
254 virtual VOID SetAsyncListRegister(ULONG PhysicalAddress) = 0;
255
256 //-----------------------------------------------------------------------------------------
257 //
258 // SetPeriodicListRegister
259 //
260 // Description: this functions sets the register to a address that is the physical address of a ???.
261 // This is the location at which the controller will start executing the Periodic Schedule.
262 //
263 virtual VOID SetPeriodicListRegister(ULONG PhysicalAddress) = 0;
264
265 //-----------------------------------------------------------------------------------------
266 //
267 // GetAsyncListRegister
268 //
269 // Description: Returns the memory address used in the Asynchronous Register
270 //
271 virtual struct _QUEUE_HEAD * GetAsyncListQueueHead() = 0;
272
273 //-----------------------------------------------------------------------------------------
274 //
275 // GetPeriodicListRegister
276 //
277 // Description: Returns the the memory address used in the Periodic Register
278 //
279 virtual ULONG GetPeriodicListRegister() = 0;
280
281 //-----------------------------------------------------------------------------------------
282 //
283 // SetStatusChangeEndpointCallBack
284 //
285 // Description: Used to callback to the hub controller when SCE detected
286 //
287 virtual VOID SetStatusChangeEndpointCallBack(PVOID CallBack,PVOID Context) = 0;
288
289 //-----------------------------------------------------------------------------------------
290 //
291 // AcquireDeviceLock
292 //
293 // Description: acquires the device lock
294
295 virtual KIRQL AcquireDeviceLock(void) = 0;
296
297 //-----------------------------------------------------------------------------------------
298 //
299 // ReleaseLock
300 //
301 // Description: releases the device lock
302
303 virtual void ReleaseDeviceLock(KIRQL OldLevel) = 0;
304
305 // set command
306 virtual void SetCommandRegister(struct _EHCI_USBCMD_CONTENT *UsbCmd) = 0;
307
308 // get command
309 virtual void GetCommandRegister(struct _EHCI_USBCMD_CONTENT *UsbCmd) = 0;
310
311
312
313 };
314
315 typedef IUSBHardwareDevice *PUSBHARDWAREDEVICE;
316
317
318 //=========================================================================================
319 //
320 // class IDMAMemoryManager
321 //
322 // Description: This class provides access to the dma buffer. It provides methods to
323 // allocate and free from the dma buffer
324 //
325
326 DECLARE_INTERFACE_(IDMAMemoryManager, IUnknown)
327 {
328 DEFINE_ABSTRACT_UNKNOWN()
329
330 //-----------------------------------------------------------------------------------------
331 //
332 // Initialize
333 //
334 // Description: initializes the memory manager
335
336 virtual NTSTATUS Initialize(IN PUSBHARDWAREDEVICE Device,
337 IN PKSPIN_LOCK Lock,
338 IN ULONG DmaBufferSize,
339 IN PVOID VirtualBase,
340 IN PHYSICAL_ADDRESS PhysicalAddress,
341 IN ULONG DefaultBlockSize) = 0;
342
343 //-----------------------------------------------------------------------------------------
344 //
345 // Allocate
346 //
347 // Description: allocates block of memory from allocator
348
349 virtual NTSTATUS Allocate(IN ULONG Size,
350 OUT PVOID *OutVirtualBase,
351 OUT PPHYSICAL_ADDRESS OutPhysicalAddress) = 0;
352
353
354 //-----------------------------------------------------------------------------------------
355 //
356 // Free
357 //
358 // Description: releases memory block
359
360 virtual NTSTATUS Release(IN PVOID VirtualBase,
361 IN ULONG Size) = 0;
362
363 };
364
365 typedef IDMAMemoryManager *PDMAMEMORYMANAGER;
366
367
368 //=========================================================================================
369 //
370 // class IUSBRequest
371 //
372 // Description: This class is used to issue request to usb controller. The class is
373 // initialized using InitializeXXX methods. You also need to call SetEndpoint to define the endpoint
374 // In addition you can call SetCompletionDetails if you need to wait for the end of
375 // the request or want to complete an irp. You call AddUSBRequest to add the request to the queue.
376 // Once the request is completed the CompletionCallback is invoked. The CompletionCallback
377 // will take care of any completion details which have been set. If the request is cancelled, the
378 // CancelCallback routine is invoked.
379 //
380
381 struct _QUEUE_HEAD;
382 struct _USB_ENDPOINT;
383
384 DECLARE_INTERFACE_(IUSBRequest, IUnknown)
385 {
386 DEFINE_ABSTRACT_UNKNOWN()
387
388 //-----------------------------------------------------------------------------------------
389 //
390 // InitializeWithSetupPacket
391 //
392 // Description: initializes the request packet with an setup packet
393 // If there is a TransferBuffer, the TransferBufferLength contains the length of the buffer
394
395
396 virtual NTSTATUS InitializeWithSetupPacket(IN PDMAMEMORYMANAGER DmaManager,
397 IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket,
398 IN UCHAR DeviceAddress,
399 IN OPTIONAL struct _USB_ENDPOINT *EndpointDescriptor,
400 IN OUT ULONG TransferBufferLength,
401 IN OUT PMDL TransferBuffer) = 0;
402
403 //-----------------------------------------------------------------------------------------
404 //
405 // InitializeWithIrp
406 //
407 // Description: initializes the request with an IRP
408 // The irp contains an URB block which contains all necessary information
409
410 virtual NTSTATUS InitializeWithIrp(IN PDMAMEMORYMANAGER DmaManager,
411 IN OUT PIRP Irp) = 0;
412
413 //-----------------------------------------------------------------------------------------
414 //
415 // CompletionCallback
416 //
417 // Description: called when request has been completed. It is called when
418 // IUSBQueue completes a queue head
419
420 virtual VOID CompletionCallback(IN NTSTATUS NtStatusCode,
421 IN ULONG UrbStatusCode,
422 IN struct _QUEUE_HEAD *QueueHead) = 0;
423
424 //-----------------------------------------------------------------------------------------
425 //
426 // CancelCallback
427 //
428 // Description: called when the queue head is cancelled
429
430 virtual VOID CancelCallback(IN NTSTATUS NtStatusCode,
431 IN struct _QUEUE_HEAD *QueueHead) = 0;
432
433 //-----------------------------------------------------------------------------------------
434 //
435 // GetQueueHead
436 //
437 // Description: returns an initialized queue head which contains all transfer descriptors
438
439 virtual NTSTATUS GetQueueHead(struct _QUEUE_HEAD ** OutHead) = 0;
440
441 //-----------------------------------------------------------------------------------------
442 //
443 // IsRequestComplete
444 //
445 // Description: returns true when the request has been completed
446 // Should be called after the CompletionCallback has been invoked
447 // This function is called by IUSBQueue after queue head has been completed
448 // If the function returns true, IUSBQueue will then call ShouldReleaseRequestAfterCompletion
449 // If that function returns also true, it calls Release() to delete the IUSBRequest
450
451 virtual BOOLEAN IsRequestComplete() = 0;
452
453 //-----------------------------------------------------------------------------------------
454 //
455 // GetTransferType
456 //
457 // Description: returns the type of the request: control, bulk, iso, interrupt
458
459 virtual ULONG GetTransferType() = 0;
460
461 //-----------------------------------------------------------------------------------------
462 //
463 // GetResultStatus
464 //
465 // Description: returns the status code of the result
466 // Note: this function will block the caller untill the request has been completed
467
468 virtual VOID GetResultStatus(OUT OPTIONAL NTSTATUS * NtStatusCode,
469 OUT OPTIONAL PULONG UrbStatusCode) = 0;
470
471 //-----------------------------------------------------------------------------------------
472 //
473 // IsRequestInitialized
474 //
475 // Description: returns true when the request has been successfully initialized using InitializeXXX methods
476
477 virtual BOOLEAN IsRequestInitialized() = 0;
478
479 //-----------------------------------------------------------------------------------------
480 //
481 // ShouldReleaseRequestAfterCompletion
482 //
483 // Description: this function gets called when the request returns
484 // IUSBQueue will then call Release() on the object to release all associated memory
485 // This function will typically return true when the request has been initialized with an irp
486 // If the request was initialized with an setup packet, it will return false
487
488 virtual BOOLEAN ShouldReleaseRequestAfterCompletion() = 0;
489
490 //----------------------------------------------------------------------------------------
491 //
492 // FreeQueueHead
493 //
494 // Description: frees the queue head with the associated transfer descriptors
495
496 virtual VOID FreeQueueHead(struct _QUEUE_HEAD * QueueHead) = 0;
497
498 //---------------------------------------------------------------------------------------
499 //
500 // GetTransferBuffer
501 //
502 // Description: this function returns the transfer buffer mdl and length
503 // Used by IUSBQueue for mapping buffer contents with DMA
504
505 virtual VOID GetTransferBuffer(OUT PMDL * OutMDL,
506 OUT PULONG TransferLength) = 0;
507
508 //--------------------------------------------------------------------------------------
509 //
510 // IsQueueHeadComplete
511 //
512 // Description: returns true when the queue head which was passed as a parameter has been completed
513
514 virtual BOOLEAN IsQueueHeadComplete(struct _QUEUE_HEAD * QueueHead) = 0;
515 };
516
517
518 typedef IUSBRequest *PUSBREQUEST;
519
520 //=========================================================================================
521 //
522 // class IUSBQueue
523 //
524 // Description: This class manages pending requests
525 //
526
527 DECLARE_INTERFACE_(IUSBQueue, IUnknown)
528 {
529 DEFINE_ABSTRACT_UNKNOWN()
530
531 //-----------------------------------------------------------------------------------------
532 //
533 // Initialize
534 //
535 // Description: initializes the object
536
537 virtual NTSTATUS Initialize(IN PUSBHARDWAREDEVICE Hardware,
538 IN PDMA_ADAPTER AdapterObject,
539 IN PDMAMEMORYMANAGER MemManager,
540 IN OPTIONAL PKSPIN_LOCK Lock) = 0;
541
542 //-----------------------------------------------------------------------------------------
543 //
544 // GetPendingRequestCount
545 //
546 // Description: returns the number of pending requests true from IsRequestComplete
547
548 virtual ULONG GetPendingRequestCount() = 0;
549
550 //-----------------------------------------------------------------------------------------
551 //
552 // AddUSBRequest
553 //
554 // Description: adds an usb request to the queue.
555 // Returns status success when successful
556
557 virtual NTSTATUS AddUSBRequest(IUSBRequest * Request) = 0;
558 virtual NTSTATUS AddUSBRequest(PURB Urb) = 0;
559 //-----------------------------------------------------------------------------------------
560 //
561 // CancelRequests()
562 //
563 // Description: cancels all requests
564
565 virtual NTSTATUS CancelRequests() = 0;
566
567 //-----------------------------------------------------------------------------------------
568 //
569 // CreateUSBRequest
570 //
571 // Description: creates an usb request
572
573 virtual NTSTATUS CreateUSBRequest(IUSBRequest **OutRequest) = 0;
574
575 //--------------------------------------------------------------------------------------
576 //
577 // InterruptCallback
578 //
579 // Description: callback when the periodic / asynchronous queue has been completed / queue head been completed
580
581 virtual VOID InterruptCallback(IN NTSTATUS Status, OUT PULONG ShouldRingDoorBell) = 0;
582
583 //--------------------------------------------------------------------------------------
584 //
585 // CompleteAsyncRequests
586 //
587 // Description: once a request has been completed it is moved to pending queue. Since a queue head should only be freed
588 // after a door bell ring, this needs some synchronization.
589 // This function gets called by IUSBHardware after it the Interrupt on Async Advance bit has been set
590
591 virtual VOID CompleteAsyncRequests() = 0;
592
593 //-----------------------------------------------------------------------------------------
594 //
595 // AbortDevicePipe
596 //
597 // Description: aborts all pending requsts of an device
598
599 virtual NTSTATUS AbortDevicePipe(UCHAR DeviceAddress, IN PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor) = 0;
600
601 };
602
603 typedef IUSBQueue *PUSBQUEUE;
604
605 //=========================================================================================
606 //
607 // class IHubController
608 //
609 // Description: This class implements a hub controller
610 //
611
612 DECLARE_INTERFACE_(IHubController, IUnknown)
613 {
614 DEFINE_ABSTRACT_UNKNOWN()
615
616 //----------------------------------------------------------------------------------------
617 //
618 // Initialize
619 //
620 // Description: Initializes the hub controller
621
622 virtual NTSTATUS Initialize(IN PDRIVER_OBJECT DriverObject,
623 IN PHCDCONTROLLER Controller,
624 IN PUSBHARDWAREDEVICE Device,
625 IN BOOLEAN IsRootHubDevice,
626 IN ULONG DeviceAddress) = 0;
627
628 //----------------------------------------------------------------------------------------
629 //
630 // GetHubControllerDeviceObject
631 //
632 // Description: Returns the hub controller device object
633
634 virtual NTSTATUS GetHubControllerDeviceObject(PDEVICE_OBJECT * HubDeviceObject) = 0;
635
636 //----------------------------------------------------------------------------------------
637 //
638 // GetHubControllerSymbolicLink
639 //
640 // Description: Returns the symbolic link of the root hub
641
642 virtual NTSTATUS GetHubControllerSymbolicLink(ULONG BufferLength, PVOID Buffer, PULONG RequiredLength) = 0;
643
644
645 };
646
647 typedef IHubController *PHUBCONTROLLER;
648
649 //=========================================================================================
650 //
651 // class IDispatchIrp
652 //
653 // Description: This class is used to handle irp dispatch requests
654 //
655
656 DECLARE_INTERFACE_(IDispatchIrp, IUnknown)
657 {
658 DEFINE_ABSTRACT_UNKNOWN()
659
660 //-----------------------------------------------------------------------------------------
661 //
662 // HandlePnp
663 //
664 // Description: This function handles all pnp requests
665
666 virtual NTSTATUS HandlePnp(IN PDEVICE_OBJECT DeviceObject,
667 IN OUT PIRP Irp) = 0;
668
669 //-----------------------------------------------------------------------------------------
670 //
671 // HandlePower
672 //
673 // Description: This function handles all power pnp requests
674 //
675 virtual NTSTATUS HandlePower(IN PDEVICE_OBJECT DeviceObject,
676 IN OUT PIRP Irp) = 0;
677
678 //-----------------------------------------------------------------------------------------
679 //
680 // HandleDeviceControl
681 //
682 // Description: handles device io control requests
683
684 virtual NTSTATUS HandleDeviceControl(IN PDEVICE_OBJECT DeviceObject,
685 IN OUT PIRP Irp) = 0;
686 };
687
688 typedef IDispatchIrp *PDISPATCHIRP;
689
690 //=========================================================================================
691 //
692 // class IUSBDevice
693 //
694 // Description: This class is used to abstract details of a usb device
695 //
696
697 DECLARE_INTERFACE_(IUSBDevice, IUnknown)
698 {
699 DEFINE_ABSTRACT_UNKNOWN()
700
701 //----------------------------------------------------------------------------------------
702 //
703 // Initialize
704 //
705 // Description: Initializes the usb device
706
707 virtual NTSTATUS Initialize(IN PHUBCONTROLLER HubController,
708 IN PUSBHARDWAREDEVICE Device,
709 IN PVOID Parent,
710 IN ULONG Port,
711 IN ULONG PortStatus) = 0;
712
713 //-----------------------------------------------------------------------------------------
714 //
715 // IsHub
716 //
717 // Description: returns true when device is a hub
718
719 virtual BOOLEAN IsHub() = 0;
720
721 //-----------------------------------------------------------------------------------------
722 //
723 // GetParent
724 //
725 // Description: gets the parent device of the this device
726
727 virtual NTSTATUS GetParent(PVOID * Parent) = 0;
728
729 //-----------------------------------------------------------------------------------------
730 //
731 // GetDeviceAddress
732 //
733 // Description: gets the device address of the this device
734
735 virtual UCHAR GetDeviceAddress() = 0;
736
737
738 //-----------------------------------------------------------------------------------------
739 //
740 // GetPort
741 //
742 // Description: gets the port to which this device is connected
743
744 virtual ULONG GetPort() = 0;
745
746 //-----------------------------------------------------------------------------------------
747 //
748 // GetSpeed
749 //
750 // Description: gets the speed of the device
751
752 virtual USB_DEVICE_SPEED GetSpeed() = 0;
753
754 //-----------------------------------------------------------------------------------------
755 //
756 // GetType
757 //
758 // Description: gets the type of the device, either 1.1 or 2.0 device
759
760 virtual USB_DEVICE_TYPE GetType() = 0;
761
762 //-----------------------------------------------------------------------------------------
763 //
764 // GetState
765 //
766 // Description: gets the device state
767
768 virtual ULONG GetState() = 0;
769
770 //-----------------------------------------------------------------------------------------
771 //
772 // SetDeviceHandleData
773 //
774 // Description: sets device handle data
775
776 virtual void SetDeviceHandleData(PVOID Data) = 0;
777
778 //-----------------------------------------------------------------------------------------
779 //
780 // SetDeviceAddress
781 //
782 // Description: sets device handle data
783
784 virtual NTSTATUS SetDeviceAddress(UCHAR DeviceAddress) = 0;
785
786 //-----------------------------------------------------------------------------------------
787 //
788 // GetDeviceDescriptor
789 //
790 // Description: sets device handle data
791
792 virtual void GetDeviceDescriptor(PUSB_DEVICE_DESCRIPTOR DeviceDescriptor) = 0;
793
794 //-----------------------------------------------------------------------------------------
795 //
796 // GetConfigurationValue
797 //
798 // Description: gets current selected configuration index
799
800 virtual UCHAR GetConfigurationValue() = 0;
801
802 //-----------------------------------------------------------------------------------------
803 //
804 // SubmitIrp
805 //
806 // Description: submits an irp containing an urb
807
808 virtual NTSTATUS SubmitIrp(PIRP Irp) = 0;
809
810 //-----------------------------------------------------------------------------------------
811 //
812 // GetConfigurationDescriptors
813 //
814 // Description: returns one or more configuration descriptors
815
816 virtual VOID GetConfigurationDescriptors(IN PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptorBuffer,
817 IN ULONG BufferLength,
818 OUT PULONG OutBufferLength) = 0;
819
820 //-----------------------------------------------------------------------------------------
821 //
822 // Description: returns length of configuration descriptors
823 //
824 virtual ULONG GetConfigurationDescriptorsLength() = 0;
825
826 //-----------------------------------------------------------------------------------------
827 //
828 // SubmitSetupPacket
829 //
830 // Description: submits an setup packet. The usb device will then create an usb request from it and submit it to the queue
831
832 virtual NTSTATUS SubmitSetupPacket(IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket,
833 IN OUT ULONG BufferLength,
834 OUT PVOID Buffer) = 0;
835
836 //-----------------------------------------------------------------------------------------
837 //
838 // SelectConfiguration
839 //
840 // Description: selects a configuration
841
842 virtual NTSTATUS SelectConfiguration(IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
843 IN PUSBD_INTERFACE_INFORMATION Interface,
844 OUT USBD_CONFIGURATION_HANDLE *ConfigurationHandle) = 0;
845
846 //-----------------------------------------------------------------------------------------
847 //
848 // SelectConfiguration
849 //
850 // Description: selects a interface of an configuration
851
852 virtual NTSTATUS SelectInterface(IN USBD_CONFIGURATION_HANDLE ConfigurationHandle,
853 IN OUT PUSBD_INTERFACE_INFORMATION Interface) = 0;
854
855 //-----------------------------------------------------------------------------------------
856 //
857 // AbortPipe
858 //
859 // Description: aborts all pending requsts
860
861 virtual NTSTATUS AbortPipe(IN PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor) = 0;
862
863 };
864
865 typedef IUSBDevice *PUSBDEVICE;
866
867 #endif