It already works!. Change the address to 0x12000000 (as sugested me)
my error was that I was using in the code "char *argv[]" (arguments
from command line) and when I ran the program dind't pass any
argument (ej ./myprogram 12 ) so, the bug was reported!
Thanks for the help!
rgo
--- In "islandwind" <> wrote:
>
> --- In Rodrigo Gómez <smrodin@> wrote:
> >
> > I chage the line:
> > control = (char *)mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd,
> > 0x12000000);
> > and even send the error data (segmentation fault).
> >
> > Any other sugestion?
> >
> > rgo
> > --- In "Yan Seiner" <yan@> wrote:
> > >
> > > --- In Rodrigo Gómez <smrodin@> wrote:
> > > >
> > > > Hello everybody
> > > >
> > > > Have some of you accessed at DIOs 16 and 17 in the 7400?
> > > >
> > > > I tried to acces to memory map, but the program returned
> "segmentation
> > > > fault"
> > > > I just tried the address in the manual:
> > > > "0x1200_0001: GPIO direction/data for DIO_16 to DIO_19
> > > > bit 3:0 - data register
> > > > bit 7:4 - data direction register ('1' means 'output')"
> > > >
> > > > My code is:
> > > > #include <sys/mman.h>
> > > > #include <sys/types.h>
> > > > #include <sys/stat.h>
> > > > #include <fcntl.h>
> > > > #include <unistd.h>
> > > >
> > > > int main(int argc, char *argv[])
> > > > {
> > > > int fd = open("/dev/mem", O_RDWR|O_SYNC);
> > > > int ledPrender;
> > > > unsigned char *control;
> > > > control = (char *)mmap(0, 4096, PROT_READ|PROT_WRITE,
> MAP_SHARED, fd,
> > > > 0x12000001);
> > >
> > > This doesn't look page aligned... 0x12000000 maybe?
> > >
> > > > control[0] = 0xF0;
> > > > control[0] = 1;
> > > > }
> > > > I'm runnig with root permisions over debian running in a USB
memory
> > > > Any help would be great!
> > > > Thanks
> > > > rgo
> > > >
> > >
> >
> Did you check if DIO16 and DIO17 are being used in somewhere else ?
> For example default console I/O ? (since they are usart2 receive and
> transmit ports)
>
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/
|