Skip to content

august95/dma-memory-allocator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

dmamem is a linux driver for allocating dma memory in a no-map region, and getting a virtual pointer to that memory from userspace.

The driver has a char device which is accessible through /dev/dmamem after the driver has been probed. The compatibility string is "dmamem". Use mmap after the device has been opened to get the virutal pointer.

  1. add to defconfig:
CONFIG_DMAMEM_DRIVER=y
  1. add drivers/dmamem/Kconfig file:
config DMAMEM_DRIVER
tristate "DMAMEM Reserved Memory Driver"
depends on OF
help
  Say Y to enable the DMAMEM reserved memory driver.
  1. Source file in drivers/Kconfig:
source "drivers/dmamem/Kconfig"
  1. add file to drivers/Makefile:
obj-$(CONFIG_DMAMEM_DRIVER) += dmamem/

Device-tree changes:

reserved-memory {
  #address-cells = < 0x0 >;
  #size-cells = < 0x0 >;
  ranges = <>;

  bank0@0 {
  no-map;
  compatible = "shared-dma-pool";
  phandle = < 0x1 >;
  reg = < 0x80000000 0x20000000 >;
};

};
reserved-driver@0 {
  compatible = "dmamem";
  memory-region = < 0x1>;
};

open char device in /dev/dmamem, mmap has been overloaded

if audoprobing is not desired with compatibility string, bind the driver manually: echo dmamem > /sys/bus/platform/devices/0.dmamem/driver_override echo 0.dmamem > /sys/bus/platform/drivers/dmamem/bind *This is just and example, inspect /sys/ on the specific platform

About

linux driver for allocating dma memory in a no-map region

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages