PCI DMA memory-to-memory transfer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
 
I want to do memory-to-memory data transfer using dma controller 8237.
 
I configured channel 0 as read and channel 1 as write one. After that i wrote data pattern at address "phys". Using dma, i am transferring data from address "phys" to "tphys". I used get_dma_residue() to know the status. It is always 5 only. Pls help me to resolve this issue.
 

/*** DMA Mode Register ***/
#define DMA_PCI_NRZ_READ 0x88
#define DMA_PCI_NRZ_WRITE 0x85
#define MEM_TO_MEM_ENABLE 0x01
#define DREQ_CH_ONE   0x04
#define DREQ_CH_TWO   0x05
#define CHANNEL_ZERO        0x00
#define CHANNEL_ONE         0x01
#define SET_CH1_MASK  0x04
#define SET_CH2_MASK  0x05
 
flags = claim_dma_lock();
/** Clear the status bits ***/
get = dma_inb(DMA1_STAT_REG);
printk("status bits %d\n", get);
/** Disable DMA while configuring **/
disable_dma(card->writechannel);
set_dma_mode(card->writechannel, DMA_PCI_NRZ_WRITE);
clear_dma_ff(card->writechannel);
printk("tphys %ld\n", tphys);
set_dma_addr(card->writechannel, tphys); //card->chandma + 210);
set_dma_count(card->writechannel, 5);
/*** Configure the DMA channel 0 as read channel **/
disable_dma(card->readchannel);
set_dma_mode(card->readchannel, DMA_PCI_NRZ_READ);
clear_dma_ff(card->readchannel);
printk("phys %ld\n", phys);
set_dma_addr(card->readchannel, phys); //card->chandma);
set_dma_count(card->readchannel, 5);
/**** Configure DMA command register for mem-to-mem transfer **/
data = "">
printk("value of cmd reg, b %d\n", data);
data = "" | MEM_TO_MEM_ENABLE;
printk("value of data cmd %d\n", data);
outb(data, DMA1_CMD_REG);
data = "">
printk("value of cmd reg, a %d\n", data);
data = "">
printk("REQ reg,b %d\n", data);
outb(0x04, DMA1_REQ_REG);
outb(0x05, DMA1_REQ_REG);
data = "">
printk("REQ reg,a %d\n", data);
/** Enable DMA operation ***/
enable_dma(card->writechannel);
enable_dma(card->readchannel);
/*** Release the lock **/
release_dma_lock(flags);
 
Thanks & Regards,
Munees.


Brings words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux