ts-7000
[Top] [All Lists]

[ts-7000] Re: relays control

To:
Subject: [ts-7000] Re: relays control
From: "naturalwatt" <>
Date: Thu, 15 Oct 2009 16:51:38 -0000
You should test that both the open() and mmap() calls return sensible values, 
not -1 for error.

You can check with dmesg to see where it is crashing.

--- In  salva g <> wrote:
>
>
> Hi I'm working with this code in order to control relay switch, (the 
> TS-Relay8 Board) on a TS7800,
>
> #include <netinet/in.h>
>  #include <arpa/inet.h>
>  #include <unistd.h>
>  #include <time.h>
>  #include <ctype.h>
>  #include <sys/mman.h>
>  #include <fcntl.h>
> 
>  #define RELAYBASE 0xEE000140
>     
>  int main() 
> {
>       volatile unsigned int *PBDR;
>       unsigned char state; 
>       unsigned char *start; 
>       int fd = open("/dev/mem", O_RDWR|O_SYNC);
>       start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 
> RELAYBASE);
>       PBDR = (unsigned int *)(start + 0x02);
>       state = *PBDR;
>       printf("Result: %x\n",state);
>       return 0;
> }
>
> Can be compiled, but return Segmentation Faults when it runs. Instead, with 
> the shell I can do peek16 0xEE000142 with no problem.
> Any ideas please?
>                                        
> _________________________________________________________________
> Infórmate, mantente en contacto y encuéntralo todo, a la vez. Con la nueva 
> Toolbar de MSN  nunca has tenido tantas ventajas en tan poco espacio.
> http://toolbar.es.msn.com/
>




------------------------------------

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/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU