: Hello,
: I'm trying to write a simple program for the Cirrus Logic EP9302 : processor. This processor is based on an ARM920T core. The problem is : that I don't have any good documentation (and I don't really know what : I'm doing). I'm running Linux 2.4.21. CL provided the operating : system, but no information about system calls etc. Does anyone know : where I can get documentation for system calls and the like?
: I get a segmentation fault when I execute the following code:
: unsigned long base = 0x80840040; /* port H */ : unsigned char one = 0xf; : outb( base, one );
If you are running linux, you are running this in user space. The problem is that your user space program has it's memory space mapped, so accessing such addresses can'tr be done as you would in a PIC or similar.
You need to use the mmap function to map memory for you. It maps stuff on page boundaries, so you have to split you address into a the pge part and an offset - here's a fragment.......
unsigned char *ptrbase,*porth;
iofd=open("/dev/mem", O_RDWR); if (iofd==-1) { return(errno); }
ptrbase=(unsigned char *)mmap(0,getpagesize(),PROT_READ|PROT_WRITE,\ MAP_SHARED, iofd, 0x80840000 ));
porth=ptrbase+0x40;
You can access the 8 io ports on port H by using the pointer porth
byte=*porth
*porth=byte
I have some software for the Technologics TS7200 which uses an EP9301 (or EP9302 in modern versions of the product). Check out the TS7200 software section of of this URL......
formatting link
The vasrious bits of source should help you get started.
Jim
: The man page for outb from the Mandarke 10 manpages isn't much help. : It doesn't even give the parameters. Do I have the parameters in the : wrong position? Maybe base is wrong. Is there some mapping from the : specified GPIO address map to software I/O space? Do I need to call : ioperm() or iopl()?
: Any help you can give me would be greatly appreciated.
: --- Tim