How to write a driver for ARM platform

Matthias Lange matthias.lange at kernkonzept.com
Wed May 20 08:14:58 CEST 2015


Hi,

On 05/19/2015 09:00 PM, qxjsjjjz wrote:
> Hi,
> 
> I have designed a device in FPGA. This device has only one register
> and this register is mapped to physical address 0x41200000. I can
> operate this address in kernel level. And now I want to write a driver
> to operate this device. Because the driver runs at application level
> and I can just operate virtual address. I want to know how to map
> this physical address 0x41200000 to driver virtual address so I can
> operate this device in the application driver. Thanks a lot.

You have to take the following steps.

1. Add a new hardware device to your device tree and add a Mmio resource
to it.
2. Create a vbus for your user level driver and assign the hardware
device to it.
3. In your user level driver, query the vbus for devices and their
associated resources using the vbus API.
4. Map the Mmio resource from your hardware device into the address
space of your user level driver.

Now you can access the registers a the mapped (=virtual) address.

Best,
Matthias.


-- 
Matthias Lange, matthias.lange at kernkonzept.com, +49 - 351 - 41 88 86 14

Kernkonzept GmbH.  Sitz: Dresden.  Amtsgericht Dresden, HRB 31129.
Geschäftsführer: Dr.-Ing. Michael Hohmuth




More information about the l4-hackers mailing list