Download Amiga Rom Kernel Reference Manual - tele
Transcript
struct ExpansionRom cd_Rom;
/* copy of board’s expansion ROM */
APTR
cd_BoardAddr; /* memory where board was placed */
ULONG
cd_BoardSize; /* size of board in bytes */
UWORD
cd_SlotAddr; /* which slot number (PRIVATE) */
UWORD
cd_SlotSize; /* number of slots (PRIVATE) */
APTR
cd_Driver;
/* pointer to node of driver */
struct ConfigDev
*cd_NextCD;
/* linked list of drivers to config */
ULONG
cd_Unused[4]; /* for whatever the driver wants */
};
/* cd_Flags */
#define CDB_SHUTUP
#define CDB_CONFIGME
0
1
#define CDF_SHUTUP
#define CDF_CONFIGME
0x01
0x02
/* this board has been shut up */
/* this board needs a driver to claim it */
The ExpansionRom structure within ConfigDev contains the board identification information that is read from the
board’s PAL or ROM at expansion time. The actual onboard identification information of a Zorro II board appears
in the high nibbles of the first $40 words at the start of the board. Except for the first nibble pair ($00/$02) which
when combined form er_Type, the information is stored in inverted ("ones-complement") format where binary 1’s
are represented as 0’s and 0’s are represented as 1’s. The expansion.library reads the nibbles of expansion
information from the board, un-inverts them (except for $00/$02 er_Type which is already un-inverted), and
combines them to form the elements of the ExpansionRom structure.
756 Amiga ROM Kernel Reference Manual: Libraries
The ExpansionRom structure is defined in <libraries/configregs.h> and <.i>:
struct ExpansionRom {
UBYTE er_Type;
UBYTE er_Product;
UBYTE er_Flags;
UBYTE er_Reserved03;
UWORD er_Manufacturer;
ULONG er_SerialNumber;
UWORD er_InitDiagVec;
UBYTE er_Reserved0c;
UBYTE er_Reserved0d;
UBYTE er_Reserved0e;
UBYTE er_Reserved0f;
};
/*
/*
/*
/*
/*
/*
/*
/* First 16 bytes of the expansion ROM */
Board type, size and flags */
Product number, assigned by manufacturer */
Flags */
Must be zero ($ff inverted) */
Unique ID,ASSIGNED BY COMMODORE-AMIGA! */
Available for use by manufacturer */
Offset to optional "DiagArea" structure */
Simple Expansion Library Example
The following example uses FindConfigDev() to print out information about all of the configured expansion
peripherals in the system. FindConfigDev() searches the system’s list of ConfigDev structures and returns a
pointer to the ConfigDev structure matching a specified board:
newconfigdev = struct ConfigDev * FindConfigDev( struct ConfigDev *oldconfigdev,
LONG manufacturer, LONG product )
The oldconfigdev argument may be set to NULL to begin searching at the top of the system list or, if it points to a
valid ConfigDev, searching will begin after that entry in the system list. The manufacturer and product
arguments can be set to search for a specific manufacturer and product by number, or, if these are set to -1, the
function will match any board.
;/* findboards.c - Execute me to compile me with SAS C 5.10
LC -b1 -cfistq -v -y -j73 findboards.c
Blink FROM LIB:c.o,findboards.o TO findboards LIBRARY LIB:LC.lib,LIB:Amiga.lib
quit
*/
#include <exec/types.h>
#include <exec/memory.h>
#include <libraries/dos.h>