Answer the question
In order to leave comments, you need to log in
How to add data to DMA and transfer it?
I need to send data from one device to another using Uart. In order to track whether data has been sent, I want to use DMA. Explain how to allocate memory in DMA to send data over it and check that they are sent.
P.S. I need an example code, because my own does not work
Answer the question
In order to leave comments, you need to log in
DMA (Direct Memory Access) - data transfer by a third-party controller with direct memory access. For example, on the PCI bus you have an ATA controller that received data from the hard drive and put it into RAM on its own. And the CPU at the same time periodically checks the completion of the transfer (usually in the hardware register of the controller itself).
To use DMA when transmitting over UART, you need a hardware UART controller with DMA support (I have not seen such for x86 PC). Suppose you have found such a controller. The controller works with physical memory, and the software on the x86 PC works with virtual memory, so you will need to write your own kernel driver, which:
1) will have access to the controller's UART hardware registers (to set physical memory regions and check status flags)
2) will be able to allocate ranges of physical memory and expose them to the controller
3) interact with the system via IOCTL in order to transfer the read data to the final software
The implementation is highly dependent on your device and the UART controller itself. You need to look at the documentation and write a driver according to it. You didn't even specify whether you are doing this on a PC or on some WiFi router.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question