Development of EDMA driver based on am335x

Source: Internet
Author: User
0 Introduction

EDMA is the TI custom enhanced DMA data transfer mode, which, after a simple understanding, essentially designs a very efficient mode for merging multiple DMA transmissions. 1 Introduction to the Protocol

A simple introduction to the protocol can refer to http://blog.chinaunix.net/uid-28818752-id-3749701.html and http://blog.chinaunix.net/uid-24567872-id-3161827.html.

The API provided by the Linux kernel can refer to http://blog.chinaunix.net/uid-28818752-id-3750016.html.

Simple use of EDMA as a DMA drive project, you can refer to http://www.cnblogs.com/imapla/p/4122609.html.

Hopefully, the full use of the EDMA driver will require some preparation, such as what compiler options the kernel provides, and refer to the Http://processors.wiki.ti.com/index.php/AM335x_EDMA_Driver ' S_ Guide. According to this link, you can find the official referral code is am335x PSP Package contents in the edma-test.c, but unfortunately not found for the time being.

2 project development process record 2.1 environment Introduction

Hardware is based on am335x chip Beaglebone-black platform, software is the linux-3.8.13 kernel. 2.2 Records 2.2.1 Driver Description:

AM335X uses the EDMA controller, not DMA, the basic principle and DMA to grasp the source, purpose, length can be, but the transmission of the mode of diversification, and theoretically will be more efficient.

The default configuration file should be configured with CONFIG_EDMA, as shown in the following figure.


Main reference driver File description

ARCH/ARM/COMMON/EDMA.CEDMA Controller provides the main interface implementation file;

DRIVER/DMA/EDMA.C a reference drive daemon using the EDMA API;

Driver/dma/virt-dma.c

The connection thought of the three is somewhat similar to the relation of Dev-platform-bus bus;

Note that in fact EDMA.C and VIRT-DMA.C temporarily did not find any use, but when I tried to remove from the compilation options, the entire system could not start, guessing "TI EDMA Support" Not only does it make it possible to compile virt-dma.c and edma.c files, it should also involve a lot of other content. In addition, the system boot, found that the default load DRIVER/DMA/EDMA.C driver, has its printing information (by selecting "DMA Engine verbose debugging" and reduce the print threshold can be observed).

Procedural Framework

First, the driver load will immediately apply for a 4MB consecutive address space of the physical address, the reason for the application is that each DMA transmission using the address is the physical address, the general description of the scenario may be " The application needs to use DMA to copy the XXXX byte contents of the XXXX address to my buffer, so that the XXX address is the physical address, but the buffer is the virtual address used in the application space. Since most applications may be malloc, the physical space is discontinuous (so even using the API to turn virtual addresses into physical addresses is meaningless, discontinuous). So the driver uses a 4MB size buffer as a transit space (the reason the driver does this because the application is not able to get 4MB continuous physical address space), first use DMA transfer to the buffer, and then after the transfer is completed, The user program reads the operation function to copy it to the discontinuous virtual address space specified by the application layer. This copy operation is relatively fast (has been validated), guessing just modifies the virtual address to the physical address mapping relationship, is not a true meaning of the copy. In addition, because the kernel does not change the basis, can only apply to the maximum space of 4MB, so the amount of data required for DMA transfer is less than 4MB, if the demand is greater than 4MB, you need to establish a policy in the driver to complete.

Second, the interfaces provided to the user include, by IOCTL, setting the source physical address, length, starting the DMA transfer, turning off the DMA transfer (releasing the resource), and reading (copying the data to the application space). In addition IOCTL use of the command word is not standard, before the test 0x0000002 has been reported bad addreess error, the test is that the number can not use IOCTL cmd.

       Finally, the application-tier program initiates the transfer by invoking the IOCTL settings parameter, and then calls read to copy the data. At the same time, the correctness of DMA transmission data is validated by Mmap. It should be noted that, according to the data manual, the am335x address map is known to map the 0X8000_0000~0XBFFF_FFFF, and the control of memory nodes in the Beaglebone-black device tree file is 8000_0000~9000_ 0000, so the physical address of the removal if the use of SDRAM then the range should be 8000_0000~9000_0000.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.