lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Re: [lwip] Porting to eZ80


From: Robert
Subject: [lwip-users] Re: [lwip] Porting to eZ80
Date: Thu, 09 Jan 2003 00:09:38 -0000

On Mon, 2 Dec 2002, Kieran Mansley wrote:
> > Hello, I am working on a project that uses the eZ80 microprocessor.  

> I've not got any particular advice for your processor, but many people
> have ported to other architectures, and you may be able to learn from
> their questions and problems.  The mailing list archive is available at
> http://www.sics.se/mailing-lists/lwip.html/threads.html although it hasn't
> been updated to include the last few weeks messages.

Great!  Its wonderful to have a resource when doing this.  I have been
attacking the low level driver code for starts.  The biggest areas to
change relate to the eZ80 using 8 bit transfers, so the CS8900a must be in
the 8 bit mode.  Secondly, the Zilog IDE/compiler is unable to cope with
some of the code.

So far I have a working version of cs8900_init().  I had to change 16 bit
I/O writes to a macros and the reads to a subroutine, so the C code could
be both efficient and look reasonably close to Leon's version.  So when
writing 16 bits to the chip, I have statements like this:

  // set RESET bit
  PACKETPP(CS_PP_SELFCTL);
  PPDATA(0x0055U);

Both of these are macros. They are defined as follows:

#define PACKETPP(x)  CS8900A_PPP_H = x/256;  CS8900A_PPP_L = x & 255;
#define   PPDATA(x)  CS8900A_PPD_H = x/256;  CS8900A_PPD_L = x & 255;

The complier turns this into the following asm statements:

                           A   484    ;   27      // set RESET bit
                           A   485    ;   28      PACKETPP(CS_PP_SELFCTL);
000009 40010B03            A   491      LD.SIS  BC,779
00000D 3E01                A   492      LD      A,1
00000F ED79                A   493      OUT     (BC),A
000011 40010A03            A   494      LD.SIS  BC,778
000015 3E14                A   495      LD      A,20
000017 ED79                A   496      OUT     (BC),A

                           A   497    ;   29      PPDATA(0x0055U);
000019 40010D03            A   500      LD.SIS  BC,781
00001D AF                  A   501      XOR     A,A
00001E ED79                A   502      OUT     (BC),A
000020 40010C03            A   503      LD.SIS  BC,780
000024 3E55                A   504      LD      A,85
000026 ED79                A   505      OUT     (BC),A

Which are about as good as you can get with the eZ80 instruction set.



Reading 16 bits from the PPD, turned out to be best done with an asm
subroutine.  So the C statements look like this:  

         unsigned  int   rPPDATA(void);

I have some concerns about which byte (of the 2 bytes making up the 16
bits) to read/write first.  The CS8900A docs indicate that the order is
important, but seems to not always be the same, ie not always low then
high, for example.

--------------------

One question I have for the group...I do not understand the directory 
setup for this project.  Is there a writeup to explain it?  There seem to 
be a great many directories, descending many levels, some with names 
matching subroutines under other directories.  The include files are 
scattered as are the .c files.  Anyway, I am sure it all makes sense, but 
I am having trouble getting a handle on it.  Also, my IDE is going to have 
trouble with the include files being in so many places.  I may be forced 
to reorganize, which will make staying up with new versions quite awkward.
I do not have a traditional MAKE facility.

-- 
Best Regards,
Robert Laughlin


[This message was sent through the lwip discussion list.]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]