Greetings! I am trying to get the 9700 Analog board working with the
new 7800. I have posted some code below that I would appreciate some
comments or suggestions on. I am a little new to the ARM9 on a pc/104
environment but have plenty of Linux experience and other embedded
environments.
What I am trying to do is enable the standard pc/104 bus and then
access the 9700 board. It seems like it should be pretty straight
forward, but all I get back when I try to read from the board is 0xff
and any commands to the DAC don't do anything. Also, I am compiling
with -mcpu=arm9, which I would guess is a common problem.
I am guessing that I am simply doing something fundamentally wrong.
Any help or suggestions would be appreciated. Thanks.
Also, on a side note. In the manuals when they talk about PC/104
expansion addresses they include an underscore: 0xEE00_0000. Why is that?
Output from compile command:
make all
Building file: ../adc-test.c
Invoking: GCC C Compiler
/root/software/cross-compile/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc
-O0 -g3 -Wall -c -fmessage-length=0 -mcpu=arm9 -MMD -MP
-MF"adc-test.d" -MT"adc-test.d" -o"adc-test.o" "../adc-test.c"
Finished building: ../adc-test.c
Building target: helloworld-arm
Invoking: GCC C++ Linker
/root/software/cross-compile/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++
-L/root/software/cross-compile/arm-none-linux-gnueabi/lib/gcc/arm-none-linux-gnueabi/3.4.4/install-tools
-L/root/software/cross-compile/arm-none-linux-gnueabi/lib -static
-o"helloworld-arm" ./adc-test.o
Finished building target: helloworld-arm
---------- Source Code ----------------
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <assert.h>
#include <string.h>
#define BASE 0xEE000000
#define ADBASE 0x160
#define ID ADBASE + 1
#define DAC ADBASE + 4
typedef unsigned char byte;
//-----------------
// Main function
//-----------------
int main(int argc, char **argv) {
int devmem;
unsigned int *regs;
//Open the memory device
devmem = open("/dev/mem", O_RDWR|O_SYNC);
assert(devmem != -1);
//Get pointer to base address
regs = (unsigned int *)mmap(0, getpagesize(), PROT_READ|PROT_WRITE,
MAP_SHARED, devmem, 0xe8000000);
//Set the PC104 bus to ISA so we can talk to peripheral devices
regs[0x30] = 0x55555555;
regs[0x34] = 0x55555555;
regs[0x38] = 0x55555;
regs[0x3C] = 0x55555;
usleep(100);
//Output a DAC value
byte *base;
volatile byte *ldac;
volatile byte *hdac;
unsigned short int val;
base = (byte*)mmap(0,getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED,
devmem, BASE);
ldac = base + DAC;
hdac = base + DAC + 1;
val = 1345;
val |= (0x0 << 14);
*ldac = 0x25;
*hdac = 0x00;
printf("The PC104 is set to ISA\n");
printf("Output: %x\n", *ldac);
sleep(10);
return 0;
}
---------------------------------------------------------
Thanks again!!
------------------------------------
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/
|