ts-7000
[Top] [All Lists]

[ts-7000] help with /dev/mem access in TS-7250

To:
Subject: [ts-7000] help with /dev/mem access in TS-7250
From: Ricardo Wiggers <>
Date: Mon, 22 Jan 2007 18:30:55 -0200
Hi.

I'm working with this simple code in a TS-7200 board. The problem is
that it is generating a hardware access from the base address+0x300 to
base address+0x31E, instead of a single access to base+0x300. I mean,
instead of a single mem access, it generates 16. Since I'm working with
fifos, that´s not good... I've tried it with the precompiled
crosstoolchain for cygwin from embededarm and with an arm9tdmi crosstool
for cygwin built with glibc2.3.2, gcc 4.1.1 with the crosstool script.
The disassembly seems like a single memory access. Could it have
something to do with the cache? If so, is there a way to disable it for
the PC-104 mem map?

This is the compiler command line:
arm-9tdmi-linux-gnu-g++ -c  -mcpu=arm9tdmi  -I. -gdwarf-2   -O2 -Wall
-Wcast-align -Wcast-qual -Wimplicit  -Wpointer-arith -Wswitch
-Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=main.lst  
-MD -MP -MF .dep/main.o.d  main.cpp -o main.o

int main(int argc,char *argv[])
{
  int mem_fd;
  unsigned short *addr;
  unsigned long io_base_pcm;
  unsigned long len;
  volatile unsigned short *work;
  float th;


  if ((mem_fd = open("/dev/mem",O_RDWR))<0) {
    printf("E: Can't open /dev/mem!\n");
    exit(1);
  }

  //MAPEAMENTO

  io_base_pcm = 0x21e00000;
  len = 0x00001000;
  addr = (unsigned short int *)mmap(0, len, PROT_READ | PROT_WRITE,
MAP_SHARED, mem_fd, io_base_pcm);
  printf("1: Endereco fisico : %#x\n",   (unsigned int)io_base_pcm);
  printf("1: Endereco virtual: %#x\n",   (unsigned int)addr);
  printf("1: Tamanho         : %#x\n\n", (unsigned int)len);

  //READ WRITE 

  work = addr + (0x00000300 / (sizeof(*work)));

  *work;

  if (munmap(0, len) < 0) {
    printf("E: Can't unmmap!\n");
    exit(1);
  }

  printf("Fim!\n");
  close(mem_fd);
  return 0;
}

Thanks,
Ricardo.




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>
  • [ts-7000] help with /dev/mem access in TS-7250, Ricardo Wiggers <=
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