From: eagersh on
On Nov 13, 1:04 pm, Murugesan <Muruge...(a)discussions.microsoft.com>
wrote:
> Sorry Igor, my information might be unclear.I doesn't mean like that. We have
> a separate core which follows a vendor specific protocol. Some registers are
> there to control this core which is in a separate memory in the h/w & can be
> read/write only by using DMA.
> We have some registers mapped from PCI space separately which includes DMA
> ADDR registers, DMA Control registers. The registers to control the core are
> not mapped to PCI space, so slave access to these registers are not possible.
> Core regiser read/write can only done through DMA. Now my question is does
> framework supports to perform DMA for such
> small length?
>
> Murugesan
>

If your DMA registers are not mapped to PCI address space how could
initiate DMA transaction?
It is not matter if you have small or big buffer to transfer. Windows
framework only provides MDL or physical memory which you could use for
DMA transfer but initiate DMA transaction must be done by your driver.
You driver must prepare dma operation and starts it. You could look a
sample in WDK - PLX9x5x which shows how a driver does DMA operations.

Igor Sharovar
From: Murugesan on
OK. Actually I have two different sets of registers in my hw.
One set of registers are mapped to PCI space which includes DMA ADDR
registers, DMA control registers[these registers are used to initiate DMA
transaction.
Other set of registers are in hw buffer. This register space is completly
different and these are not mapped to PCI space. Read/Write to these
registers are done using DMA with the DMA control registers. These set of
registers are interface independent i.e they can be read/write using
PCI[dma]/SDIO. Read/Write to these second set of registers are only possible
via DMA[PCI] or CMD53[SDIO].
I hope this would explain my hw design.
I've already verified the WDK samples, based on that i've posted some
questions in my first post.
Coming back to original questions in my first post,

1. Can we perform DMA for 8 bytes using dmatransaction ?
YES.[From your previous answer]

2. What is wrong in the above mentioned sequence ?
I have provided a pseudo code in my first post. Please get back to my
first post.

3. Is it mandatory to call WdfDmaTransactionDmaCompleted in DPC handler ?
[ Right now, i've some problem with the interrupt, so only polling mode is
used)

4. I haven't initiated DMA on the context of a wdfrequest, so i can't use
WdfDmaTransactionInitializeUsingRequest(), will it be an issue ? [ This is
because all the sample drivers provided by microsoft has used
WdfDmaTransactionInitializeUsingRequest() and DMA has been initiated from
EvtIoQueue dispatched by any WdfRequest.


Murugesan


"eagersh" wrote:

> On Nov 13, 1:04 pm, Murugesan <Muruge...(a)discussions.microsoft.com>
> wrote:
> > Sorry Igor, my information might be unclear.I doesn't mean like that. We have
> > a separate core which follows a vendor specific protocol. Some registers are
> > there to control this core which is in a separate memory in the h/w & can be
> > read/write only by using DMA.
> > We have some registers mapped from PCI space separately which includes DMA
> > ADDR registers, DMA Control registers. The registers to control the core are
> > not mapped to PCI space, so slave access to these registers are not possible.
> > Core regiser read/write can only done through DMA. Now my question is does
> > framework supports to perform DMA for such
> > small length?
> >
> > Murugesan
> >
>
> If your DMA registers are not mapped to PCI address space how could
> initiate DMA transaction?
> It is not matter if you have small or big buffer to transfer. Windows
> framework only provides MDL or physical memory which you could use for
> DMA transfer but initiate DMA transaction must be done by your driver.
> You driver must prepare dma operation and starts it. You could look a
> sample in WDK - PLX9x5x which shows how a driver does DMA operations.
>
> Igor Sharovar
> .
>
From: eagersh on
On Nov 17, 11:10 pm, Murugesan <Muruge...(a)discussions.microsoft.com>
wrote:
> OK. Actually I have two different sets of registers in my hw.
> One set of registers are mapped to PCI space which includes DMA ADDR
> registers, DMA control registers[these registers are used to initiate DMA
> transaction.
> Other set of registers are in hw buffer. This register space is completly
> different and these are not mapped to PCI space. Read/Write to these
> registers are done using DMA with the DMA control registers. These set of
> registers are interface independent i.e they can be read/write using
> PCI[dma]/SDIO. Read/Write to these second set of registers are only possible
> via DMA[PCI] or CMD53[SDIO].
> I hope this would explain my hw design.
> I've already verified the WDK samples, based on that i've posted some
> questions in my first post.
> Coming back to original questions in my first post,
>
> 1. Can we perform DMA for 8 bytes using dmatransaction ?
>  YES.[From your previous answer]
There is only one limitation but it is not from Windows side. You
should check what kind of aliment of memory your hardware support.


> 2. What is wrong in the above mentioned sequence ?
>   I have provided a pseudo code in my first post. Please get back to my
> first post.
Is your ProgramDmaFunction called?
If it is, you should show this function too.
I have one comments. Usually if you allocate memory and MDL you need
to call MmBuildMdlForNonPagedPool. I don't know if this could be
related if you allocate a buffer by using MmAllocateContiguousMemory.
For 8 bytes buffer you don't need to use MmAllocateContiguousMemory
anyway.


> 3. Is it mandatory to call WdfDmaTransactionDmaCompleted in DPC handler ?
> [ Right now, i've some problem with the interrupt, so only polling mode is
> used)
No. This function is not linked to interrupt. It is only tells WDF
that DMA transaction is complete and ProgramDmaFunction should not be
called again.

> 4. I haven't initiated DMA on the context of a wdfrequest, so i can't use
> WdfDmaTransactionInitializeUsingRequest(), will it be an issue ? [ This is
> because all the sample drivers provided by microsoft has used
> WdfDmaTransactionInitializeUsingRequest() and DMA has been initiated from
> EvtIoQueue dispatched by any WdfRequest.
No, it should not be an issue.

Igor Sharovar
From: Abhishek R [MSFT] on
Some suggestions -
- Did you call MmProbeAndLockPages() or BuildMdlFromScatterGatherList() for
the memory you allocated? If you haven't built the PFN array for the MDL
then you won't be able to do DMA to it.
- Call WdfDmaTransactionDmaCompleted instead of
WdfDmaTransactionDmaCompletedFinal when terminating the transaction.
- Check the WDF log for errors (!wdflogdump debugger extension)
- Enable driver verifier and WDF verifier on your driver
- Try allocating non-cached memory to see if it makes a difference (
MmAllocateContiguousMemorySpecifyCache)
- Use h/w analyzers to see if dma transaction actually takes place

"Murugesan" <Murugesan(a)discussions.microsoft.com> wrote in message
news:37A20A0C-F067-4B9E-950F-C51A4234D301(a)microsoft.com...
> OK. Actually I have two different sets of registers in my hw.
> One set of registers are mapped to PCI space which includes DMA ADDR
> registers, DMA control registers[these registers are used to initiate DMA
> transaction.
> Other set of registers are in hw buffer. This register space is completly
> different and these are not mapped to PCI space. Read/Write to these
> registers are done using DMA with the DMA control registers. These set of
> registers are interface independent i.e they can be read/write using
> PCI[dma]/SDIO. Read/Write to these second set of registers are only
> possible
> via DMA[PCI] or CMD53[SDIO].
> I hope this would explain my hw design.
> I've already verified the WDK samples, based on that i've posted some
> questions in my first post.
> Coming back to original questions in my first post,
>
> 1. Can we perform DMA for 8 bytes using dmatransaction ?
> YES.[From your previous answer]
>
> 2. What is wrong in the above mentioned sequence ?
> I have provided a pseudo code in my first post. Please get back to my
> first post.
>
> 3. Is it mandatory to call WdfDmaTransactionDmaCompleted in DPC handler ?
> [ Right now, i've some problem with the interrupt, so only polling mode is
> used)
>
> 4. I haven't initiated DMA on the context of a wdfrequest, so i can't use
> WdfDmaTransactionInitializeUsingRequest(), will it be an issue ? [ This is
> because all the sample drivers provided by microsoft has used
> WdfDmaTransactionInitializeUsingRequest() and DMA has been initiated from
> EvtIoQueue dispatched by any WdfRequest.
>
>
> Murugesan
>
>
> "eagersh" wrote:
>
>> On Nov 13, 1:04 pm, Murugesan <Muruge...(a)discussions.microsoft.com>
>> wrote:
>> > Sorry Igor, my information might be unclear.I doesn't mean like that.
>> > We have
>> > a separate core which follows a vendor specific protocol. Some
>> > registers are
>> > there to control this core which is in a separate memory in the h/w &
>> > can be
>> > read/write only by using DMA.
>> > We have some registers mapped from PCI space separately which includes
>> > DMA
>> > ADDR registers, DMA Control registers. The registers to control the
>> > core are
>> > not mapped to PCI space, so slave access to these registers are not
>> > possible.
>> > Core regiser read/write can only done through DMA. Now my question is
>> > does
>> > framework supports to perform DMA for such
>> > small length?
>> >
>> > Murugesan
>> >
>>
>> If your DMA registers are not mapped to PCI address space how could
>> initiate DMA transaction?
>> It is not matter if you have small or big buffer to transfer. Windows
>> framework only provides MDL or physical memory which you could use for
>> DMA transfer but initiate DMA transaction must be done by your driver.
>> You driver must prepare dma operation and starts it. You could look a
>> sample in WDK - PLX9x5x which shows how a driver does DMA operations.
>>
>> Igor Sharovar
>> .
>>
From: Murugesan on
Guys, Thanks for your reply. I think the issue might be the memory to get
paged out. From Abishek & Igor's answers I could infer that I've missed to
lock the physical pages or to use MmBuildMdlForNonPagedPool. This might be
the reason for failure. I'll add corresponding functionalities.

Thanks,
Murugesan.S

"Abhishek R [MSFT]" wrote:

> Some suggestions -
> - Did you call MmProbeAndLockPages() or BuildMdlFromScatterGatherList() for
> the memory you allocated? If you haven't built the PFN array for the MDL
> then you won't be able to do DMA to it.
> - Call WdfDmaTransactionDmaCompleted instead of
> WdfDmaTransactionDmaCompletedFinal when terminating the transaction.
> - Check the WDF log for errors (!wdflogdump debugger extension)
> - Enable driver verifier and WDF verifier on your driver
> - Try allocating non-cached memory to see if it makes a difference (
> MmAllocateContiguousMemorySpecifyCache)
> - Use h/w analyzers to see if dma transaction actually takes place
>
> "Murugesan" <Murugesan(a)discussions.microsoft.com> wrote in message
> news:37A20A0C-F067-4B9E-950F-C51A4234D301(a)microsoft.com...
> > OK. Actually I have two different sets of registers in my hw.
> > One set of registers are mapped to PCI space which includes DMA ADDR
> > registers, DMA control registers[these registers are used to initiate DMA
> > transaction.
> > Other set of registers are in hw buffer. This register space is completly
> > different and these are not mapped to PCI space. Read/Write to these
> > registers are done using DMA with the DMA control registers. These set of
> > registers are interface independent i.e they can be read/write using
> > PCI[dma]/SDIO. Read/Write to these second set of registers are only
> > possible
> > via DMA[PCI] or CMD53[SDIO].
> > I hope this would explain my hw design.
> > I've already verified the WDK samples, based on that i've posted some
> > questions in my first post.
> > Coming back to original questions in my first post,
> >
> > 1. Can we perform DMA for 8 bytes using dmatransaction ?
> > YES.[From your previous answer]
> >
> > 2. What is wrong in the above mentioned sequence ?
> > I have provided a pseudo code in my first post. Please get back to my
> > first post.
> >
> > 3. Is it mandatory to call WdfDmaTransactionDmaCompleted in DPC handler ?
> > [ Right now, i've some problem with the interrupt, so only polling mode is
> > used)
> >
> > 4. I haven't initiated DMA on the context of a wdfrequest, so i can't use
> > WdfDmaTransactionInitializeUsingRequest(), will it be an issue ? [ This is
> > because all the sample drivers provided by microsoft has used
> > WdfDmaTransactionInitializeUsingRequest() and DMA has been initiated from
> > EvtIoQueue dispatched by any WdfRequest.
> >
> >
> > Murugesan
> >
> >
> > "eagersh" wrote:
> >
> >> On Nov 13, 1:04 pm, Murugesan <Muruge...(a)discussions.microsoft.com>
> >> wrote:
> >> > Sorry Igor, my information might be unclear.I doesn't mean like that.
> >> > We have
> >> > a separate core which follows a vendor specific protocol. Some
> >> > registers are
> >> > there to control this core which is in a separate memory in the h/w &
> >> > can be
> >> > read/write only by using DMA.
> >> > We have some registers mapped from PCI space separately which includes
> >> > DMA
> >> > ADDR registers, DMA Control registers. The registers to control the
> >> > core are
> >> > not mapped to PCI space, so slave access to these registers are not
> >> > possible.
> >> > Core regiser read/write can only done through DMA. Now my question is
> >> > does
> >> > framework supports to perform DMA for such
> >> > small length?
> >> >
> >> > Murugesan
> >> >
> >>
> >> If your DMA registers are not mapped to PCI address space how could
> >> initiate DMA transaction?
> >> It is not matter if you have small or big buffer to transfer. Windows
> >> framework only provides MDL or physical memory which you could use for
> >> DMA transfer but initiate DMA transaction must be done by your driver.
> >> You driver must prepare dma operation and starts it. You could look a
> >> sample in WDK - PLX9x5x which shows how a driver does DMA operations.
> >>
> >> Igor Sharovar
> >> .
> >>
> .
>