Hi all,

In my pc camera driver, there must be a SRB_READ_DATA command function, such
as "VideoReadData" named, to receive images captured from digital camera into
SRB data buffer. This will make a pc camera preview function on PC. At
VideoReadData function, I use the ExInterlockedInsertTailList API function to
queue each incoming SRB. But I find that it must be after calling
StreamClassStreamNotification, a new SRB is still passed into VideoReadData
function. This will make SRB queue nonsense because there is only one SRB in
the queue at a time. Is there any method or setting to queue more incoming
SRBs at a time?

Sample code as followings,

typedef struct {
LIST_ENTRY ListEntry;
PHW_STREAM_REQUEST_BLOCK pSrb;
ULONGLONG FrameNumber;
} *P_SRB_EXTENSION;

typedef struct {
LIST_ENTRY PendingIoList;
KSPIN_LOCK PendingIoListSpin;
LIST_ENTRY CompletedReadSrbList;
KSPIN_LOCK DispatchSpinLock;
}*P_DEVICE_EXTENSION;

int VideoReadData(PHW_STREAM_REQUEST_BLOCK pSrb)
{
P_DEVICE_EXTENSION pDevExt = (PS_PA_DEVICE_EXTENSION)
pSrb->HwDeviceExtension;

P_SRB_EXTENSION pSrbEx = (PS_PA_SRB_EXTENSION)pSrb->SRBExtension;

ExInterlockedInsertTailList( &(pDevExt->PendingIoList),
&(pSrbEx->ListEntry),
&pDevExt->PendingIoListSpin);
{
//actions to fill in SRB data buffer
...
...
...
}
StreamNotification(pSrb,StreamRequestComplete);
return 0;
}





Regards, Allen

Re: relation of SRBs and StreamClassStreamNotification function by Maxim

Maxim
Fri Mar 18 07:21:27 CST 2005

I think that the pattern of SRB flow to your driver is chosen by upper
level components - KS and DirectShow. So, you must support the most generic
case, even if in the reality it is (usually) a degenerate case of single SRB.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com

"Allen" <Allen@discussions.microsoft.com> wrote in message
news:85F8F0BA-10B9-473C-9DC0-ADD134976404@microsoft.com...
> Hi all,
>
> In my pc camera driver, there must be a SRB_READ_DATA command function, such
> as "VideoReadData" named, to receive images captured from digital camera into
> SRB data buffer. This will make a pc camera preview function on PC. At
> VideoReadData function, I use the ExInterlockedInsertTailList API function to
> queue each incoming SRB. But I find that it must be after calling
> StreamClassStreamNotification, a new SRB is still passed into VideoReadData
> function. This will make SRB queue nonsense because there is only one SRB in
> the queue at a time. Is there any method or setting to queue more incoming
> SRBs at a time?
>
> Sample code as followings,
>
> typedef struct {
> LIST_ENTRY ListEntry;
> PHW_STREAM_REQUEST_BLOCK pSrb;
> ULONGLONG FrameNumber;
> } *P_SRB_EXTENSION;
>
> typedef struct {
> LIST_ENTRY PendingIoList;
> KSPIN_LOCK PendingIoListSpin;
> LIST_ENTRY CompletedReadSrbList;
> KSPIN_LOCK DispatchSpinLock;
> }*P_DEVICE_EXTENSION;
>
> int VideoReadData(PHW_STREAM_REQUEST_BLOCK pSrb)
> {
> P_DEVICE_EXTENSION pDevExt = (PS_PA_DEVICE_EXTENSION)
> pSrb->HwDeviceExtension;
>
> P_SRB_EXTENSION pSrbEx = (PS_PA_SRB_EXTENSION)pSrb->SRBExtension;
>
> ExInterlockedInsertTailList( &(pDevExt->PendingIoList),
> &(pSrbEx->ListEntry),
> &pDevExt->PendingIoListSpin);
> {
> //actions to fill in SRB data buffer
> ...
> ...
> ...
> }
> StreamNotification(pSrb,StreamRequestComplete);
> return 0;
> }
>
>
>
>
>
> Regards, Allen