简体   繁体   English

Linux dma设备驱动程序dma_request_channel失败

[英]Linux dma device driver dma_request_channel fails

I'm trying to write a platform driver that interfaces with the DMA on an embedded system. 我正在尝试编写一个与嵌入式系统上的DMA接口的平台驱动程序。 We are using the Zedboard and Xilinx's AXI DMA IP. 我们正在使用Zedboard和Xilinx的AXI DMA IP。 However, I believe our errors are related to the Linux kernel. 但是,我相信我们的错误与Linux内核有关。

To get a tx/rx channel for the DMA, linux provides the dma_request_channel function. 为了获得DMA的tx/rx通道,Linux提供了dma_request_channel函数。 This function uses a filter and a filter parameter that needs to match the DMA. 此函数使用需要与DMA匹配的过滤器和过滤器参数。 This function gets a list of all the DMA's available in the system and uses the filter to match it to the one we want. 此函数获取系统中所有可用DMA的列表,并使用过滤器将其与所需的匹配。 However, it would seem that this is not able to get all the available DMA's but only one. 但是,这似乎无法获得所有可用的DMA,而只能获得一个。 ARM cores come with their own PL330 hard IP DMA . ARM内核带有自己的PL330硬IP DMA That is the only one it sees. 那是它看到的唯一一个。

The kernel code is oh so convoluted to understand that I am stuck in the list header file here 内核代码太难理解了,以至于我被卡在列表头文件中

Could someone explain what LIST_HEAD_INIT does? 有人可以解释LIST_HEAD_INIT做什么吗? What C syntax is that? 那是什么C语法?

Do I need to to something do have the hardware peripheral become visible to the OS? 我是否需要使硬件外围设备对操作系统可见? I thought the device tree takes care of that and we have included it in the device tree. 我以为设备树可以解决这个问题,我们已经将其包含在设备树中。 We can also get the base address of this by using the get_platform_resources API. 我们还可以通过使用get_platform_resources API获取其基址。

Could someone explain what LIST_HEAD_INIT does? What C syntax is that?

LIST_HEAD_INIT is a macro which initializes the members of struct list_head in LIST_HEAD macro. LIST_HEAD_INIT是一个宏,用于初始化LIST_HEAD宏中struct list_head的成员。

#define LIST_HEAD_INIT(name) { &(name), &(name) }

#define LIST_HEAD(name) \
          struct list_head name = LIST_HEAD_INIT(name) 

//Taken from scripts/kconfig/list.h    
struct list_head {
          struct list_head *next, *prev;
  };

Here both prev and next is initialized with same member. 在这里,prev和next都使用相同的成员初始化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM