linux驱动之DMA驱动

DMA驱动允许外设直接与系统内存交互,减少CPU参与数据传输,从而提高系统效率。在并发场景下,CPU可以在DMA传输期间执行其他任务,显著提升系统吞吐率。通过对比实验如./dma_test nodma 100与./dma_test dma 100,可以观察到DMA带来的性能差异。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

DMA是一种无需CPU的参加就可以让外设与系统内存之间进行双向数据传输的硬件机制。它可以使系统CPU从实际的I/O数据传输过程中摆脱出来,大大提高系统的吞吐率,并且在传输期间,CPU还可以并发执行其他任务。

#include<linux/module.h>
#include<linux/kernel.h>
#include<linux/fs.h>
#include<linux/init.h>
#include<linux/delay.h>
#include<linux/irq.h>
#include<asm/uaccess.h>
#include<asm/irq.h>
#include<asm/io.h>
#include<linux/cdev.h>
#include<linux/device.h>
#include<linux/dma-mapping.h>
static int major = 0;
#define MEM_CPY_NO_DMA 0
#define MEM_CPY_DMA 1
#define BUF_SIZE (512*1024)
static char *src;
static u32 src_phys;
static char *dst;
static u32 dst_phys;
static struct class *cls;
#define DMA0_BASE_ADDR 0x4B000000
#define DMA0_BASE_ADDR 0x4B000000
#define DMA0_BASE_ADDR 0x4B000000
#define DMA0_BASE_ADDR 0x4B000000

struct ex4412_dma_regs{
    unsigned long disrc;
    unsigned long disrcc;
    unsigned long didst;
    unsigned long didstc;
    
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值