[comp.sys.mips] Use of mmap

ajc@bbn.com (Anthony J. Courtemanche) (11/23/89)

I'm (still) working on a device driver for an M2000 running release
4.20 of RISC/os.  I've been told that I can use mmap() to map kernel
resources into a user process address space.  I want to do this for
a device driver that has set aside some kernel memory for a device to
DMA into; I want user processes to be able to see this memory.

mmap() seems like what I want, but I do not know what to pass
as the file descriptor argument that is associated with the kernel
memory that I want to map into the user's address space.  If anyone
knows how to make a "file descriptor associated with a memory device"
(words taken from the mmap() man page), please let me know.  I've also
been told that a good example is in the file mem.c, but I do not have
a source liscence and mem.c was not included on my system (I just got
mem.o in the device driver area).

Thanks for any help you can give.


--Anthony Courtemanche
  ajc@bbn.com

rogerk@mips.COM (Roger B.A. Klorese) (11/28/89)

In article <48700@bbn.COM> ajc@bbn.com (Anthony J. Courtemanche) writes:
>mmap() seems like what I want, but I do not know what to pass
>as the file descriptor argument that is associated with the kernel
>memory that I want to map into the user's address space.  If anyone
>knows how to make a "file descriptor associated with a memory device"
>(words taken from the mmap() man page), please let me know.

It's the fd on which the user has opened /dev/your-device.
-- 
ROGER B.A. KLORESE      MIPS Computer Systems, Inc.      phone: +1 408 720-2939
928 E. Arques Ave.  Sunnyvale, CA  94086                        rogerk@mips.COM
{ames,decwrl,pyramid}!mips!rogerk
"I want to live where it's always Saturday."  -- Guadalcanal Diary