I’m writing a driver to work with a PC104 data-aq board but I’m experiencing a “lack of experience” in DMA programming, so, I need some help.
First, my system consists in a SBC (Single-Board computer - Versalogic Bobcat R4) using the ELanSC520 Microcontroller, and a Data Acquisition Board VCM-DAS-2 (Versalogic).
According to the hardware documentation for both boards:
1 - SBC - Bobcat
1.1 - SBC only the DMA channel 5 and 6
1.2 - the DMA registrers address are the same as the 82357 (Intel x86)
2 - VCM-DAS-2
2.1 - the board is capable to use the DMA channel 5 (jumpered)
2.2 - (… interrupt request is sent to CPU when the DMA controller (at cpu) indicates a TC (Terminal Count)
I want to program the Dataaq board to populate a DMA area with the conversion data for later processing.
My problem is, It’s my first DMA program and I can’t look at the data generated.
What I’m doing now :
1 - Program the data-aq board for Periodic Trigger (using a 8254 clock) and populate the DMA area.
2 - Program the DMA controller using the channel 5 (16 bits transfer)
3 - InterruptWait (the data-aq board IRQ number)
4 - Show the data.
1 - create a continuos memory region (using mmap) (void *DMABuffer_VIR)
2 - offset to the real physical address (mem_offset) (void *DMABuffer_PHYS)
2.1 - memset to clear the area.
3 - write the address to the dma controller (page and addr registers)
3.1 - question. I have to send the Phys address, right?
4 - enable the DMA controller
5 - Program the data-aq board and trigger the first conversion.
6 - Interrupt wait (TC Count for the DMA Controller)
7 - inspect data generated
7.1 - Another question, I have to look for the data in the DMABuffer_VIR, right?
I’m programming the DemandMode, AddressIncrement, AutoInit and WriteCycle in the DMA controller.
I started the program, after a few seconds (depending on the bufsize and trigger time), an interrupt is generated and I look into the buffer but I get only zeros (0 - memset during the memory allocation).
I assume that I’m doing some stupid thing with the memory allocation.
So, I would appreciate some guidance…