[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [rtl] Re: your mail
Hi Tomek,
mmap and other posix file functions are supported in rtl_posixio.o,
so mmap is available for RT-threads. mmap on /dev/mem does
ioremap internally. This is more of a proof of concept
right now, but it does work. See examples/mmap.
Michael.
Tomasz Motylewski (motyl@stan.chemie.unibas.ch) wrote:
> On Fri, 21 Apr 2000, Zhixu Liu wrote:
>
> > I have a question about the share memory use mmap. (in rtlinux-2.2)
> > I use the example in mmap, but what i want to know is is there is a
>
> mmap is for user space. Use ioremap in the kernel.
>
> > limit of the size of share memory, for when i try to map a region
> > about 1000 int, in the kernel module the computer always dead.
> >
> > Following is the program i use.
> >
> > ===================================
> > #include <rtl.h>
> > #include <unistd.h>
> > #include <fcntl.h>
> > #include <sys/mman.h>
>
> Did you compile it with -D__KERNEL__ etc. ? You should not include things
> like unistd.h or fcntl.h or sys/mman.h in kernel space. They are unusable
> there anyway.
>
> > int fd = open("/dev/mem", O_RDWR);
> I do not think it is supported in the kernel.
>
> > start = (int *)mmap(0,length*sizeof(int),PROT_READ|PROT_WRITE,
> > MAP_SHARED,fd,BASE_ADDRESS);
>
> Just use ioremap instead.
>
> --
> Tomek
- References:
- No Subject
- From: Zhixu Liu <liuzx@bessun.ihep.ac.cn>
- Re: your mail
- From: Tomasz Motylewski <motyl@stan.chemie.unibas.ch>