That was it! Thanks so much!
I added '| O_SYNC' to the open call, and the crash went away.
I uncommented out the remaining code (that actually toggled the DIO
pins) and now things are working perfectly.
Thanks again!
jw
--- In wrote:
>
> I use 'O_RDWR | O_SYNC' in the open statement
> e.g. int fd = open( "/dev/mem", O_RDWR | O_SYNC) ;
>
> Also try taking out the call to mlockall.. perhaps you have not
properly
> set up the required memory before the call.
>
>
> wrote on 04/11/2007 09:37:28 AM:
>
> > Hi all,
> >
> > I am trying to use the RTAI extensions to control some DIO pins in a
> > hard real time process. I am new to RTAI and running into a problem
> > making this work
> >
> > I have built and installed the RTAI extensions and run the latency
> > test from the test suite and get what appear to be reasonable results.
> >
> > I am now trying to morph the latency test program into one that also
> > toggles a DIO bit twice a second with as low a max latency as
possible.
> >
> > I have updated the latency program to run at the desired interval, but
> > when I try to do the mmap to get access to the DIO pins, the system
> > crashes. I do this prior to making the mlockall call:
> >
> >
> > // get access to DIO pins
> > int fd = open("/dev/mem", O_RDWR);
> > unsigned char *start;
> > start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd,
> > 0x80840000);
> >
> > <rt mailbox and task init calls>
> >
> > // lock all memory
> > mlockall(MCL_CURRENT | MCL_FUTURE);
> >
> >
> > Adding the above mmap call triggers the system crash. Removing it
> > (and all subsequent references) allows the program to run on the
> > desired schedule.
> >
> > Any idea that am I doing wrong?
> >
> > I need to figure out how to get more diagnostic info out before the
> > crash, but thought I would ask in case the problem was obvious to
> someone.
> >
> >
> > Regards,
> >
> > jw
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
>
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|