Data Transfer Mechanisms
➢ In computer-based data acquisition applications,
data incoming or outgoing through computer I/O
devices must often be managed at high speeds
or in large quantities. The three primary data
transfer mechanisms:
➢ Polling
➢ Interrupts ( Programmed I/O)
➢ DMA
DMA Transfer
DMA Controller
The PC motherboard has a DMA controller on the South Bridge that can
master
the I/O bus and initiate DMA to or from a peripheral.
This is usually the case for legacy ISA cards.
Can be viewed in /proc/dma on Linux machines
On Galileo
DMA Implementations
➢ Native DMA
➢ ISA Bus-master DMA
➢ PCI Bus-master DMA
Native DMA
The only pieces of legacy hardware that use
ISA DMA and are still fairly common are Super
I/O devices on motherboards that often
integrate a built-in floppy disk controller, an
IrDA infrared controller when FIR (fast infrared)
mode is selected, and a IEEE 1284 parallel port
controller when ECP mode is selected.
Native DMA
ISA Bus-master DMA
● lshw command on terminal
PCI Bus-master DMA
PCI Bus-master DMA
PCI IDE Bus-mastering
● The PCI bus also allows you to set up
compatible IDE/ATA hard disk drives to be bus
masters. Under the correct conditions this can
increase performance over the use of PIO
modes, which are the default way that IDE/ATA
hard disks transfer data to and from the system.
When PCI bus mastering is used, IDE/ATA
devices use DMA modes to transfer data
instead of PIO.
PCI IDE Bus-mastering
PCI IDE Bus-mastering
● hdparm -i /dev/sda
●
Bitbake menuconfig
DMA Controller in Galileo
Quark SoC Block Diagram
Channels Present
ls -l /sys/class/dma
Used and Unused Channels
Inserting our module
dmesg
Execution of a DMA-operation (single block transfer)
1)The CPU prepares the DMA-operation by the construction
of a descriptor , containing all necessary information for the
DMAC to independently perform the DMA-operation (off-
load engine for data transfer).
2)It initializes the operation by writing a command to a
register in the DMAC (2a) or to a special assigned memory
area (command area), where the DMAC can poll for the
command and/or the descriptor (2b).
3)Then the DMAC addresses the device data register
4) and reads the data into a temporary data register .
5)In another bus transfer cycle, it addresses the memory
block and
6) writes the data from the temporary data register to the
memory block .
dmesg after rmmod
Contd.
Issues faced on Ubuntu
Code Flow
External links and References
➢ LDD 3- DMA
➢ Essential Linux Device Drivers
➢ https://en.wikipedia.org/wiki/Direct_memory_access
➢ http://www.pcguide.com/ref/mbsys/buses/types/pciID
➢ http://www.pcguide.com/ref/hdd/if/ide/confControllers
➢ http://www.tweak3d.net/articles/howbusmaster/3.sht
● Intel Quark SoC Datasheet
External links and References
● Intel ICH7 Datasheet
● Intel ICH5 Datasheet
● http://stackoverflow.com/questions/28868932/using
● National Instruments Application Note 011-DMA
Fundamentals on Various PC Platforms
● http://zeus.nyf.hu/~bajalinov/OS/07/dma.pdf
Thanks

Direct Memory Access (DMA)-Working and Implementation

  • 1.
    Data Transfer Mechanisms ➢In computer-based data acquisition applications, data incoming or outgoing through computer I/O devices must often be managed at high speeds or in large quantities. The three primary data transfer mechanisms: ➢ Polling ➢ Interrupts ( Programmed I/O) ➢ DMA
  • 2.
  • 3.
    DMA Controller The PCmotherboard has a DMA controller on the South Bridge that can master the I/O bus and initiate DMA to or from a peripheral. This is usually the case for legacy ISA cards. Can be viewed in /proc/dma on Linux machines
  • 4.
  • 5.
    DMA Implementations ➢ NativeDMA ➢ ISA Bus-master DMA ➢ PCI Bus-master DMA
  • 6.
    Native DMA The onlypieces of legacy hardware that use ISA DMA and are still fairly common are Super I/O devices on motherboards that often integrate a built-in floppy disk controller, an IrDA infrared controller when FIR (fast infrared) mode is selected, and a IEEE 1284 parallel port controller when ECP mode is selected.
  • 7.
  • 8.
    ISA Bus-master DMA ●lshw command on terminal
  • 9.
  • 10.
  • 11.
    PCI IDE Bus-mastering ●The PCI bus also allows you to set up compatible IDE/ATA hard disk drives to be bus masters. Under the correct conditions this can increase performance over the use of PIO modes, which are the default way that IDE/ATA hard disks transfer data to and from the system. When PCI bus mastering is used, IDE/ATA devices use DMA modes to transfer data instead of PIO.
  • 12.
  • 13.
    PCI IDE Bus-mastering ●hdparm -i /dev/sda ●
  • 14.
  • 17.
  • 18.
  • 19.
    Channels Present ls -l/sys/class/dma
  • 20.
  • 21.
  • 22.
  • 23.
    Execution of aDMA-operation (single block transfer) 1)The CPU prepares the DMA-operation by the construction of a descriptor , containing all necessary information for the DMAC to independently perform the DMA-operation (off- load engine for data transfer). 2)It initializes the operation by writing a command to a register in the DMAC (2a) or to a special assigned memory area (command area), where the DMAC can poll for the command and/or the descriptor (2b). 3)Then the DMAC addresses the device data register 4) and reads the data into a temporary data register . 5)In another bus transfer cycle, it addresses the memory block and 6) writes the data from the temporary data register to the memory block .
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
    External links andReferences ➢ LDD 3- DMA ➢ Essential Linux Device Drivers ➢ https://en.wikipedia.org/wiki/Direct_memory_access ➢ http://www.pcguide.com/ref/mbsys/buses/types/pciID ➢ http://www.pcguide.com/ref/hdd/if/ide/confControllers ➢ http://www.tweak3d.net/articles/howbusmaster/3.sht ● Intel Quark SoC Datasheet
  • 31.
    External links andReferences ● Intel ICH7 Datasheet ● Intel ICH5 Datasheet ● http://stackoverflow.com/questions/28868932/using ● National Instruments Application Note 011-DMA Fundamentals on Various PC Platforms ● http://zeus.nyf.hu/~bajalinov/OS/07/dma.pdf
  • 32.