home *** CD-ROM | disk | FTP | other *** search
- /*
- CacheCard V1.0
- Copyright 1989 by Dave Haynie
-
- MAIN HEADER FILE
- */
-
-
- #define PROGRAM_VERSION 100
-
- #include <exec/types.h>
- #include <exec/execbase.h>
- #include <exec/nodes.h>
- #include <exec/lists.h>
- #include <exec/memory.h>
- #include <libraries/expansionbase.h>
- #include <libraries/configregs.h>
- #include <libraries/configvars.h>
- #include <libraries/dosextens.h>
- #include <functions.h>
- #include <stdio.h>
- #include <ctype.h>
-
- /* ====================================================================== */
-
- /* Define important bits used in various MMU registers. */
-
- /* Here are the TC definitions. The TC register is 32 bits long. */
-
- #define TC_ENB (1L<<31) /* Enable the MMU */
- #define TC_SRE (1L<<25) /* For separate Supervisor */
- #define TC_FCL (1L<<24) /* Use function codes? */
- #define TC_PS(x) ((ULONG)((x)&0x0f)<<20) /* Page size */
- #define TC_IS(x) ((ULONG)((x)&0x0f)<<16) /* Logical shift */
- #define TC_TIA(x) ((ULONG)((x)&0x0f)<<12) /* Table indices */
- #define TC_TIB(x) ((ULONG)((x)&0x0f)<<8)
- #define TC_TIC(x) ((ULONG)((x)&0x0f)<<4)
- #define TC_TID(x) ((ULONG)((x)&0x0f)<<0)
-
- /* Here are the page descriptor definitions, for short desctriptors only,
- since that's all I'm using at this point. */
-
- #define PD_ADDR(x) ((ULONG)(x)&~0x0fL) /* Translated Address */
- #define IV_ADDR(x) ((ULONG)(x)&~0x03L) /* Invalid unused field */
- #define PD_CI (1L<<6) /* Cache inhibit */
- #define PD_WP (1L<<2) /* Write protect it! */
- #define PD_DT_TYPE 0x03 /* Page descriptor type */
- #define PD_DT_INVALID 0x00 /* Invalid root descriptor */
- #define PD_DT_PAGE 0x01 /* Fixed offset, auto-genned */
- #define PD_DT_V4BYTE 0x02 /* Short root descriptor */
- #define PD_DT_V8BYTE 0x03 /* Long root descriptor */
-
- /* This is needed for identification of bogus systems that test positive
- for MMUs. */
-
- #define SizeOf(x) ((ULONG)sizeof(x))
-
- /* ====================================================================== */
-
- /* From the 030STUFF.A module */
-
- extern void GetCRP();
- extern ULONG GetTC(),
- GetMMUType();
-
- /* ====================================================================== */
-
- /* This section describes the system tag structure, where I stick all the
- information that I like to keep around. */
-
- #define ROM_NOP 0x0000 /* No ROM operation called for */
- #define ROM_FAST 0x0002 /* Normally installed FASTROM image */
- #define ROM_KICK 0x0003 /* Installed as a KICK image */
- #define ROM_FKICK 0x0004 /* A KICK image made into a FAST image */
-
- #define TABLE_REV 1 /* MMU table compatibility revision */
-
- /* This is the special descriptor stored by SetCPU to help it find itself
- and figure out just what it's done. The GetSysTag() routine knows how
- to find this structure on a properly SetCPU-ed system. Anyone making
- modifications to this program and expecting to work with SetCPU now
- and in the future must check the "tagsize", "progver" and "tablerev"
- fields to ensure they don't make mistakes. The "tagsize" field tell you
- how large the tag is; it'll probably grow in future versions. The
- "progver" identifies the version of SetCPU that built the tables; the
- "progver" field will be 150 for SetCPU 1.50. The "tablerev" field is
- indicates the revision level of the MMU table. So far, the table is
- revision 1; all version of SetCPU use this type of table (check the
- tagsize first; currenly released version of SetCPU, like V1.50, have a
- smaller systag). */
-
- struct systag {
- ULONG tagsize; /* Size of this tag */
- ULONG progver; /* The program version */
- ULONG *maintable; /* The main ROM table */
- ULONG *romimage; /* The main ROM image */
- UWORD romtype; /* Type of MMU ROM */
- UWORD patches; /* The number of other patches applied */
- struct MemChunk *patchlist; /* List of installed patches */
- struct ExpROMData *devs; /* Translated device ROMs */
- ULONG TC; /* Precomputed TC used for KICK. */
- ULONG CRP[2]; /* Precomputed CRP used for KICK. */
- UWORD config; /* Configuration status. */
- ULONG BerrSize; /* Size of bus error handler. */
- char *OldBerr; /* The old BERR routine. */
- char *BerrHandler; /* My BERR routine. */
- short wrapup; /* Upper address wrap bound. */
- short wrapdown; /* Lower address wrap bound. */
- ULONG tablesize; /* Main table size. */
- char *ResetCode; /* Actual reset routine */
- ULONG tablerev; /* Revision of table structure */
- };
-
- extern struct systag *GetSysTag();
-
-