Szerkesztés

Megosztás a következőn keresztül:


SRB_OPEN_STREAM

The class driver sends this request to open a stream.

Return Value

The minidriver should set one of the following as the status in the SRB:

STATUS_SUCCESS
Indicates successful completion of the command.

STATUS_NOT_IMPLEMENTED
Indicates that the function is not supported by the minidriver.

STATUS_TOO_MANY_NODES
Indicates that there are not enough resources to open this stream.

STATUS_IO_DEVICE_ERROR
Indicates that a hardware failure occurred.

Comments

The class driver provides a HW_STREAM_OBJECT buffer in pSrb->StreamObject, with pSrb->StreamObject->StreamNumber set to the number of the stream to be opened. The pSrb pointer points to a HW_STREAM_REQUEST_BLOCK structure. StreamNumber corresponds to the offset of the stream within the HW_STREAM_DESCRIPTOR structure the minidriver provides in response to a SRB_GET_STREAM_INFO request. The class driver specifies the data format that the opened stream should provide in pSrb->CommandData->OpenFormat.

When the minidriver receives this request, it should determine if the specified stream can be opened at this time. The minidriver should also verify the KSDATAFORMAT format passed in. the SRB's OpenFormat field. If the stream can be opened, the minidriver updates the HW_STREAM_OBJECT structure, and returns STATUS_SUCCESS. If the maximum number of stream instances are already open, or the hardware resources necessary to open this stream are unavailable, the minidriver returns an appropriate error status.

When the SRB_OPEN_STREAM command is received by the minidriver, the minidriver should:

  1. Check that the maximum number of stream instances has not been exceeded and that the stream index value is valid.

  2. Check that the data format requested is valid for this stream.

  3. Set the format for the stream.

  4. Maintain an array of all the stream extension structures in the device extension so that IRPs can be canceled from any stream.

  5. Specify pointers, in the stream object, to the stream data handlers and control handlers.

  6. Set the DMA flag in the stream object if the device will perform DMA directly to the data buffer addresses passed into the ReceiveDataPacket routines. If the driver accesses data buffers passed in using logical addressing, also set the PIO flag in the stream object.

  7. If clock support is available on the stream, indicate this through the HwClockObject member in the stream object.