Bus Mastering over PCI under RedHat7.1
Hi ,
I am a new member to this mailing list. I am currently in 8th semester of B.E. Computer Science. Currently I am doing my project on High Speed Data Acquisition on cPCI under RTLinux.
I am new to device driver concept and also to the PCI bus mastering concept. Actually I have to do DMA (bus mastering ) over PCI bus. But I got stuck here. I am having RedHat7.1 installed on my computer and there is a network card on PCI slot. I want to transfer some amount of data from the other computer through hyperterminal to the memory buffer on my computer through DMA .But I am not able to get this done.
The steps that I did are like this....
1). Identified the device on PCI bus by using "pci_find_device()" function.
2). Then I checked whether the device supports the DMA operation or not. It gives me the positive result i.e. it supports it.
3). Then I made the device bus master using "pci_set_master()".
4). Then I allocated a DMA buffer using "kmalloc" with flag GFP_DMA flag of 1KB.
5). Then I did streaming mapping of the buffer using "pci_map_single()" function which gave me the bus address.
6).Then I unmapped the buffer after some time.... and tried to access the buffer, but it gave me some core dump and automatically restarted the computer..
Here I have not installed any irq. I am just sending a string to the memory and I want that to be produced on the other machine on network.
I read some material on DMA over PCI. There also I am confused that during DMA how to specify both the source address and destination address. As I think is that if we want to transfer the data from memory to i/o then we need to specify only source address(memory address) and it takes the destination address(i/o address) by itself or vice - versa.
Also one thing more is that some tutorials talk abt. a step as "Do DMA operation". What doed it mean? Whether we have to do it by some functions like "memcpy_toio" etc. or device itself does this for me.
Please help me regarding this.
Thanks in advance
Ashutosh Sharma
|