--- In Jim Jackson <> wrote:
>
>
> On Tue, 22 Mar 2011, jmahler_tx wrote:
>
> > I am trying to access the PLD registers on a ts-gsm1 modem from a ts-7260
> > board in a C program, but I cannot find the correct address to map the
> > registers to. I have attempted using mmap() to map the following
> > addresses: 0x11800000, 0x11A00000, 0x11C00000, 0x11E00000. I have
> > attempted the following offsets for each of these starting addresses:
> > 0x000, 0x140, 0x190, 0x3E8. The modem jumpers are configured to COM3, and
> > jumpers 4 and 5 are off. If anybody is familiar with the base and offset
> > addresses needed to access these PLD registers, help would be greatly
> > appreciated.
>
> I've done this. I left the board as configured. JP4 on
>
> Here are a set of C functions for accessing some of the registers...
>
> /* Modem power control functions.....
> *
> * This is in PC104 address space - 0x11e00000 for 8 bit IO
> *
> * modempwrinit() set up register pointers etc
> * 0x140 Board ID always 0x09
> * 0x141 PLD version 1st read -> 0x06, 2nd -> 0x07, 3rd -> 0x08,
> * 4th -> Version number
> * 0x142 Jumpers Bit 0 - JP1 com/io decode 1 on; 0 off;
> * Bit 1 - JP2 ditto
> * Bit 2 - JP3 ditto
> * Bit 3 - JP4 PLD base address setting
> * 0x143 Status Bit 0 - Modem Power Control (R/W)
> * Bit 1 - Modem Power Status (RO)
> * Bit 2 - LED Status
> * Bit 3 - JP5 status 1 on; 0 off;
> * 0x148 Baud Bit 0 = 1 baud clock is doubled (R/W) allows 230 KBaud
> */
>
> #define PC104_8BIT_IO (0x11e00000)
> #define PC104_16BIT_IO (0x21e00000)
> #define PC104_8BIT_MEM (0x11A00000)
> #define PC104_16BIT_MEM (0x21A00000)
>
> char *gsmcomiostr[]={ "0x3f8 COM1", "0x2f8 COM2", "0x3e8 COM3", "0x2e8
> COM4",
> "0x3a8 COM5", "0x2a8 COM6", "0x3a0 COM7", "0x2a0
> COM8" };
>
> volatile unsigned char *pc104base=NULL;
> volatile unsigned char *gsmid;
> volatile unsigned char *gsmjp;
> volatile unsigned char *gsmstat;
> volatile unsigned char *gsmbaud;
>
> int gsmpwrinit() {
> int iofd;
>
> iofd=open("/dev/mem", O_RDWR|O_SYNC);
> if (iofd<0) { return(-1); }
> pc104base=(unsigned char *)mmap(0, getpagesize(), PROT_READ|PROT_WRITE,
> MAP_SHARED, iofd, PC104_8BIT_IO);
> if (pc104base==MAP_FAILED) { return(-1); }
> gsmid=pc104base+0x140;
> if (*gsmid != 0x09) { errno=ENODEV ; return(-1); }
> gsmjp=pc104base+0x142;
> gsmstat=pc104base+0x143;
> gsmbaud=pc104base+0x148;
> return(0);
> }
>
> int gsmpwron() {
> if (pc104base==NULL) { errno=ENODEV ; return(-1); }
> *gsmstat=(0x01); /* set power on */
> usleep(4000000); /* wait for power change to happen */
> return 0;
> }
>
> int gsmpwroff() {
> if (pc104base==NULL) { errno=ENODEV ; return(-1); }
> *gsmstat=0; /* set power off */
> usleep(4000000); /* wait for power change to happen */
> return 0;
> }
>
> int gsmgetjp() {
> if (pc104base==NULL) { errno=ENODEV ; return(-1); }
> return( *gsmjp & 0x0f );
> }
>
> int gsmgetstat() {
> if (pc104base==NULL) { errno=ENODEV ; return(-1); }
> return( *gsmstat & 0x0f );
> }
>
> int gsmgetbaud() {
> if (pc104base==NULL) { errno=ENODEV ; return(-1); }
> return( *gsmbaud & 0x01 );
> }
>
Awesome that worked! Thanks a lot
------------------------------------
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/
|