ts-7000
[Top] [All Lists]

[ts-7000] TS-7KV PLD Registers - simple code seg faults - ne suggestions

To:
Subject: [ts-7000] TS-7KV PLD Registers - simple code seg faults - ne suggestions
From: "mattsaintdev" <>
Date: Wed, 23 Aug 2006 15:06:57 -0000
Hi all,

Spotted the rewrite of the Getting Started with the TS-7KV manual and 
must say its much clearer now - thanks.

Wrote the following test program to learn how to read the PLD regs, 
but the only output is the first two printf lines. As soon as the 
code accesses the PLD_REGS i get a segfault.

Ne suggestions?

Matt



#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>


volatile unsigned char *pld_regs;



int main(int argc, char **argv)
{

   char base7;
   int mem_handle=open("/dev/mem", O_RDWR | O_SYNC);
   //
   // 0x11E0_0000 = PLD Register base address
   pld_regs=(unsigned char *)mmap(0, 0xFF , PROT_READ|PROT_WRITE, 
MAP_SHARED, mem_handle, 0x11E00000);
   //
   //
   //
   printf("TS-7KV Register settings probe \n");
   printf("------------------------------ \n\n");
   printf("BASE+0 Board ID #1 = %X (documented as 0x41)\n", pld_regs
[0xE0] );
   printf("BASE+1 Board ID #2 = %X (documented as 0x20)\n", pld_regs
[0xE1] );

   base7=pld_regs[0xE7];
   if (base7 & 0x80) printf("ADC option is installed\n");
   if (base7 & 0x40) printf("CAN option is installed\n");
   if (base7 & 0x20) printf("J5 Set\n");
   if (base7 & 0x10) printf("J4 Set\n");
   if (base7 & 0x08) printf("J3 Set\n");
   if (base7 & 0x04) printf("J2 Set\n");
   if (base7 & 0x02) printf("J1 Set\n");
   //
   //
   return 0;
}






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> 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