04-22-2008 11:13 AM
05-07-2008 11:13 AM - edited 05-07-2008 11:15 AM
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 operation
1: DMA Channel 0 will be assigned for this operation
2: DMA Channel 1 will be assigned for this operation
3: DMA Channel 4 will be assigned for this operation
4: DMA Channel 2 will be assigned for this operation
5: DMA Channel 5 will be assigned for this operation
8: 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:
This should hopefully be enough to guide you in the right direction. I do not anticipate having time to create a full example of this for a while, but you can always request one here with a product suggestion.
05-13-2008 08:13 AM