simple programming on CL EP9302?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View


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 );

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


Re: simple programming on CL EP9302?
Hello,

Quoted text here. Click to load it

correct me if i am wrong: but i think outb was for x86 processors (or at
least processors with a separate IO bus).

Try something like this instead:

#define PORTH      (*((volatile unsigned long *) 0x80840040))

PORTH = 0xf:

This gives you a memory access to your given address.

Regards,

        Martin





Re: simple programming on CL EP9302?


: 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......

 http://www.comp.leeds.ac.uk/jj/linux/arm-sbc.html

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


Site Timeline