watiss
watiss

Reputation: 111

C application for parallel communication with direct memory access

I'm having a problem with a parallel connection I've got to establish using DMA (Direct Acces Memory).

I've got to write some characters to a parallel port with a given address, through a C application. I know that for a PIO access, there are the _inp/_outp functions, but I don't know how to manage a direct memory access parallel communication.

Does anyone know how I should do or has any good links (I couldn't find any even after long research on the Web

Upvotes: 0

Views: 190

Answers (1)

Mats Petersson
Mats Petersson

Reputation: 129504

This is not something that can be answered generically.

DMA access is determined by either a DMA controller (in OLD PC's), or using "bus mastering" (PCI onwards). Either of these solutions requires access to the relevant hardware manuals for the device that you are working with (and the DMA controller, if applicable).

In general, the principle works as this:

  1. Reserve a piece of memory (DMA buffer) for the device to store data in.
  2. Configure the device to store the data in said region (remember that in nearly all cases, DMA happens on physical addresses, as opposed to the virtual addresses that Windows or Linux uses).
  3. When the device has stored the requested data, an interrupt is fired, the software responsible for the device takes the interrupt and signals some higher level software that the data is ready, and (perhaps) reprograms the device to start storing data again (either after copying the DMA buffer to someplace else, or assigning a new DMA buffer).

Upvotes: 2

Related Questions