The IServiceGroup interface encapsulates a group of objects that all require notification of the same service request. When the service-group object receives notification of the request, it forwards the notification to each of the objects in the group. The IServiceGroup interface is implemented by the PortCls system driver and exposed to miniport drivers. A miniport driver creates an IServiceGroup object by calling PcNewServiceGroup. IServiceGroup inherits from the IServiceSink interface.
Service-group objects exposing an IServiceGroup interface are typically used to demultiplex requests for interrupt service, although the functionality of a service group is general enough to make it potentially useful for other purposes as well. The miniport driver's ISR (interrupt-service routine) calls a notification method in the lower-edge interface of the port driver; the notification method takes a pointer to the service group as a call parameter. During this call, the port driver calls RequestService (see IServiceSink::RequestService) on the service group and queues a DPC (deferred procedure call). When the DPC executes, it forwards the service request to all member objects in the service group.
The miniport-driver code typically does not need to call any IServiceGroup interface methods. Instead, the port driver calls these methods to add its own IServiceSink objects to the service groups that it obtains from the miniport driver. Miniport drivers create service-group objects as required and associate those service groups with objects that will require service. For example, a WaveCyclic miniport driver associates a stream object with the service group that it specifies as an output parameter to the IMiniportWaveCyclic::NewStream method.
In the context of WaveCyclic miniport drivers, associating all streams with one service group causes the port driver to service all streams based on a single notification. Associating each stream with its own service group allows the interrupt-service routine to select the stream that will be serviced by the port driver during the execution of the DPC.
A miniport driver's ISR calls one of the following port methods to notify a service group of a service request:
A miniport driver outputs a reference to its service group when the port driver calls one of the following initialization methods:
The port driver adds its own IServiceSink object to the service group that it obtains from the Init call. When the miniport driver's ISR later calls Notify to send notification to that service group, the service group queues a DPC that forwards notification to the port driver's IServiceSink object, which in turn forwards notification to the miniport driver by calling one of the following service methods:
IMiniportDMus::Service (not used)
A miniport driver also outputs a reference to its service group when the port driver calls one of the following stream-creation methods:
IMiniportWaveCyclic::NewStream
As discussed above, the miniport driver has the option of creating a different service group for each stream or sharing a single service group across all streams.
In the case of a WavePci port driver, the port object adds its own IServiceSink object to the service group that it obtains from the IMiniportWavePci::NewStream call. When the miniport driver's ISR later calls Notify to send notification to that service group, the service group queues a DPC that forwards the notification to the port driver's IServiceSink object, which in turn does the following:
In addition to the methods that IServiceGroup inherits from the IServiceSink interface, IServiceGroup supports the following methods:
IServiceGroup::CancelDelayedService