Discussion:
How to use DMA with CDO DIO (PCIe6251m)
(too old to reply)
imer
2008-04-22 16:40:10 UTC
Permalink
Hi --

I'm working on a driver for M-Series devices (PCIe6251m). I generate
digital waveforms on the Port 0 DIO lines using FIFO to store the
digital samples.
Because M Series devices have a DMA controller dedicated to moving data
from the system memory to the DO waveform generation FIFO, my next work
is to implement this.
Does anyone have a few lines of sample code that would nudge me in the
right direction? (programmation of CDIO_DMA_Select_Register).

thanks!
Tom W [DE]
2008-05-07 16:40:16 UTC
Permalink
Hi imer-
I don't have time to create an example now, but I can give you some tips that might help you get started.
First, the values for CDIO_DMA_Select:
Bits 7..4 are CDO_DMA_Select.  Bits 3..0 are CDI_DMA_Select.  Possible values for both values are as follow (other values are undefined):
0: No DMA Channel will be assigned for this operation1: DMA Channel 0 will be assigned for this operation2: DMA Channel 1 will be assigned for this operation3: DMA Channel 4 will be assigned for this operation4: DMA Channel 2 will be assigned for this operation5: DMA Channel 5 will be assigned for this operation8: DMA Channel 3 will be assigned for this operation
In addition, you will need to program the DMA controller on the board using the method shown in the "generic dma library" that's available with the MHDDK downloads.  The method to access functions in that library is shown in several of the AI examples from the M Series MHDDK.  Check out aiex3.cpp, for example. 
This line (  mite->setAddressOffset(0x500);  ) sets the address offset for the DMA controller to use.  There are DMA controllers available at 0x500, 0x600, etc for the 6 DMA controllers on the board.  DMA controllers 0-3 can only be used with DMA request lines 0-3 and DMA controllers 4-5 can only be used with DMA request lines 4-5.  So, you'll want to choose the DMA channel for CDO_DMA_Select and a DMA controller that can be used together.
Then you only need to program the DMA request line with a call to tDMAChannel::config (  shown in aiex3.cpp as dma->config()  ).  If you choose to use DMA channels 4-5, you should be aware that there is a bug in the DMA library in tDMAChannel.cpp in this call (  _miteChannel->DeviceConfig.setReqSource ( 4 + _drq );  ).  It is correct for DMA channels 0-3, but for DMA channels 4-5 it should be (  _miteChannel->DeviceConfig.setReqSource ( _drq );  ).  In other words, the mapping for the DMA request source line and the value to write to DeviceConfig.setReqSource is:

- DRQ0 4

- DRQ1 5

- DRQ2 6

- DRQ3 7

- DRQ4 4

- DRQ5 5

This should hopefully be enough to guide you in the right direction.&nbsp; I do not anticipate having time to create a full example of this for a while, but you can always request one <a href="http://digital.ni.com/public.nsf/allkb/EDA7C01C684ACB6286256FF0000238D5?OpenDocument" target="_blank">here</a> with a product suggestion. Message Edited by Tom W [DE] on 05-07-2008 11:15 AM
imer
2008-05-13 13:40:07 UTC
Permalink
Hi Tom-


The informations are okay. DMA controller dedicated to moving data from the system memory to the CDO waveform generation is working fine now.

Thanks very much for the help

Imer.

Loading...