Acorn port of ispCODE routines
==============================

ispCODE version v5.001,
Acorn port v1.00

This is essentially an Acorn port of Lattice's embedded PLD programming code,
ispCODE (specifically ispcode.c)  It should be able to program all of the
ispLSI, ispGAL and ispGDS series devices, in mixed chains if necessary,
although I've not been able to test it on anything other than the ispLSI2000
series.

The programming process
-----------------------

Before you get your hopes up too high, in thinking that I've ported the
entire development system, including schematic capture, compilation and
optimisation, I haven't.  This is a port of the embedded programming routines
(ispCODE) that Lattice have released to the public.  You still need to enter
your design using the Windows (or Unix, although I haven't used it) software,
compile and fit it, to produce a JEDEC file.

Having done this, you then need to separately create a .DLD file, which
contains details of the device chain on the board you're programming.  This
can be done using the ispDOWNLOAD software, which will detect the device
types for you, and then requires you to select a JEDEC file for each device.

The .DLD file then needs to be passed through Lattice's DOS utility
dld2isp.exe, which compiles the ASCII .DLD and JEDEC files into a single
binary data stream, ready to be programmed.  This .ISP (aka ispSTREAM) file
can then be fed into my Acorn xturbo executable.

Command line options
--------------------

Typing *xturbo on it's own will explain the command line options, but the
help is also listed below:

Usage: xturbo [drive:][path]isp_filename [operation]
Example: xturbo my_file.isp pv

isp_filename         The ispSTREAM File Created From A Valid 
                     Daisy Chain Configuration File
operation            "pv" = program and verify
                     "v" = Verify only
                     "uv" = Verify UES only
                     "ud" = Read and display UES from devices.
                     Default to pv if operation is not entered.

Note that as few changes as possible have been made to Lattice's source, so a
more relevant Acorn example would be:

xturbo ADFS::HardDisc.$.Logic.AddressDec pv

ie no /isp or .isp is required, and xturbo doesn't alter the filename you
supply.

The source file generation process, and more details about the ispCODE
routines are supplied in ISPCODE.PDF, which is available from
http://www.latticesemi.com/, or on one of Lattice's ISP Encyclopaedia CDs.

The hardware
------------

To do the programming, you need a parallel port In-System Programming
cable - either the one supplied from Lattice for about 60, or a self-built
version for about 2 (see Lattice's App Note 8003 for the schematic).

This code uses Parallel_Op SWIs, so should work on the motherboard parallel
port.  Since it needs to read data into the machine it will only work on
bidirectional parallel ports, so is A5000 and later only.  I've tested it on
a Risc PC and an A4, and it works happily on both of them.  The parallel port
routines are fairly easy to change, if anyone wants to try and port to any
other interface, such as a user port.

Acorn port
----------

I perhaps should point out that the port I've done is highly suboptimal
- it requires millisecond timing routines, and I round these values up to
centiseconds and use OS_ReadMonotonicTime for timing.  The isp devices are
quite flexible about timing, so the only effect of this is that programming
is slightly slower than in the ispDOWNLOAD Windows app.

The code is compiled using Acorn's Norcroft C v4, using the stubs and
SharedCLibrary - it doesn't use any fancy options, but a sample compile line
is shown in Build.  The code should compile with other compilers, but you may
need to change the SWI calls, which currently use _kernel_swi(), to use the
SWI veneer of your choice.

Licence conditions
------------------

Lattice have given me permission to release this publicly, on the condition
that they can provide no support for it.  All code remains copyright of
Lattice Semiconductor Corp. and I claim no ownership of it - see the header
in ispCODE.c for more details.  Lattice say they have provided this code for
their customers to use,  so it may be freely distributed without charge.

Later versions may appear somewhere on http://www.markettos.org.uk/, if
I port them once they have been release by Lattice.

Theo Markettos
23rd December 2000

theo@markettos.org.uk