How to map device addresses into user space

Alfred Perlstein bright at mu.org
Fri Jan 4 03:18:36 UTC 2013


On 1/3/13 7:00 PM, Dr. Rolf Jansen wrote:
> Am 03.01.2013 um 17:17 schrieb Mehmet Erol Sanliturk:
>
>> On Thu, Jan 3, 2013 at 8:45 AM, Dr. Rolf Jansen <rj at cyclaero.com> wrote:
>>
>>> ...
>>>
>>> I need to map the Base Address Registers into user space memory, in order to pass the BAR's to the National Instruments Drivers Development Kit (NI-DDK). The DDK is a complex set of C++ classes running in user space, that read/write directly from/into the BAR's.
>>>
>>> The FreeBSD bus_space_* functions are useless in this respect, because the DDK isn't designed that way, I need the BAR addresses mapped into user space.
>>>
>>> ...
>> There is the following book:
>>
>> FreeBSD Device Drivers
>>
>> Product Details
>>
>>      Paperback: 352 pages
>>      Publisher: No Starch Press; Original edition (May 7, 2012)
>>      Language: English
>>      ISBN-10: 1593272049
>>      ISBN-13: 978-1593272043
>
> Mehmet,
>
> Many thanks for your response.
>
> I know this book. It suggests accessing the PCI registers using Newbus (Chapter 7). Newbus hides away direct reading/writing to the BAR's, and therefore, Newbus is useless in the given respect.
>
> Again, I need the exact PCI Base Address Registers directly mapped into user space, so that I can do in my user space measurement controller something like the following:
>
>    user_space_BAR[0 + funcOffset] &= 0x03;

Can't you mmap /dev/mem?

Sorry for being naive, I have not done this before.

-Alfred



More information about the freebsd-drivers mailing list