home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 294.lha / CacheCard_v1.0 / cachecard.h < prev    next >
C/C++ Source or Header  |  1989-10-08  |  4KB  |  116 lines

  1. /*
  2.     CacheCard V1.0
  3.     Copyright 1989 by Dave Haynie
  4.  
  5.     MAIN HEADER FILE
  6. */
  7.  
  8.  
  9. #define PROGRAM_VERSION    100
  10.  
  11. #include <exec/types.h>
  12. #include <exec/execbase.h>
  13. #include <exec/nodes.h>
  14. #include <exec/lists.h>
  15. #include <exec/memory.h>
  16. #include <libraries/expansionbase.h>
  17. #include <libraries/configregs.h>
  18. #include <libraries/configvars.h>
  19. #include <libraries/dosextens.h>
  20. #include <functions.h>
  21. #include <stdio.h>
  22. #include <ctype.h>
  23.  
  24. /* ====================================================================== */
  25.  
  26. /* Define important bits used in various MMU registers. */
  27.  
  28. /* Here are the TC definitions.  The TC register is 32 bits long. */
  29.  
  30. #define    TC_ENB        (1L<<31)        /* Enable the MMU */
  31. #define    TC_SRE        (1L<<25)        /* For separate Supervisor */
  32. #define    TC_FCL        (1L<<24)        /* Use function codes? */
  33. #define    TC_PS(x)    ((ULONG)((x)&0x0f)<<20)    /* Page size */
  34. #define TC_IS(x)    ((ULONG)((x)&0x0f)<<16)    /* Logical shift */
  35. #define    TC_TIA(x)    ((ULONG)((x)&0x0f)<<12)    /* Table indices */
  36. #define    TC_TIB(x)    ((ULONG)((x)&0x0f)<<8)
  37. #define TC_TIC(x)    ((ULONG)((x)&0x0f)<<4)
  38. #define    TC_TID(x)    ((ULONG)((x)&0x0f)<<0)
  39.  
  40. /* Here are the page descriptor definitions, for short desctriptors only,
  41.    since that's all I'm using at this point. */
  42.    
  43. #define    PD_ADDR(x)    ((ULONG)(x)&~0x0fL)    /* Translated Address */
  44. #define IV_ADDR(x)    ((ULONG)(x)&~0x03L)    /* Invalid unused field */
  45. #define PD_CI        (1L<<6)            /* Cache inhibit */
  46. #define    PD_WP        (1L<<2)            /* Write protect it! */
  47. #define PD_DT_TYPE    0x03            /* Page descriptor type */
  48. #define PD_DT_INVALID    0x00            /* Invalid root descriptor */
  49. #define    PD_DT_PAGE    0x01            /* Fixed offset, auto-genned */
  50. #define PD_DT_V4BYTE    0x02            /* Short root descriptor */
  51. #define    PD_DT_V8BYTE    0x03            /* Long root descriptor */
  52.  
  53. /* This is needed for identification of bogus systems that test positive
  54.    for MMUs. */
  55.  
  56. #define SizeOf(x)    ((ULONG)sizeof(x))
  57.  
  58. /* ====================================================================== */
  59.  
  60. /* From the 030STUFF.A module */
  61.  
  62. extern void             GetCRP();
  63. extern ULONG             GetTC(),
  64.                 GetMMUType();
  65.  
  66. /* ====================================================================== */
  67.  
  68. /* This section describes the system tag structure, where I stick all the
  69.    information that I like to keep around.  */
  70.    
  71. #define ROM_NOP            0x0000    /* No ROM operation called for */
  72. #define ROM_FAST        0x0002    /* Normally installed FASTROM image */
  73. #define ROM_KICK        0x0003    /* Installed as a KICK image */
  74. #define ROM_FKICK        0x0004    /* A KICK image made into a FAST image */
  75.  
  76. #define TABLE_REV        1    /* MMU table compatibility revision */
  77.  
  78. /* This is the special descriptor stored by SetCPU to help it find itself
  79.    and figure out just what it's done.  The GetSysTag() routine knows how
  80.    to find this structure on a properly SetCPU-ed system.  Anyone making
  81.    modifications to this program and expecting to work with SetCPU now
  82.    and in the future must check the "tagsize", "progver" and "tablerev" 
  83.    fields to ensure they don't make mistakes.  The "tagsize" field tell you
  84.    how large the tag is; it'll probably grow in future versions.  The
  85.    "progver" identifies the version of SetCPU that built the tables; the
  86.    "progver" field will be 150 for SetCPU 1.50.  The "tablerev" field is
  87.    indicates the revision level of the MMU table.  So far, the table is
  88.    revision 1; all version of SetCPU use this type of table (check the
  89.    tagsize first; currenly released version of SetCPU, like V1.50, have a
  90.    smaller systag).  */
  91.  
  92. struct systag {
  93.    ULONG         tagsize;    /* Size of this tag */
  94.    ULONG         progver;    /* The program version */
  95.    ULONG        *maintable;    /* The main ROM table */
  96.    ULONG        *romimage;    /* The main ROM image */
  97.    UWORD         romtype;    /* Type of MMU ROM */
  98.    UWORD         patches;    /* The number of other patches applied */
  99.    struct MemChunk     *patchlist;    /* List of installed patches */
  100.    struct ExpROMData    *devs;        /* Translated device ROMs */
  101.    ULONG        TC;        /* Precomputed TC used for KICK. */
  102.    ULONG        CRP[2];        /* Precomputed CRP used for KICK. */
  103.    UWORD        config;        /* Configuration status. */
  104.    ULONG        BerrSize;    /* Size of bus error handler. */
  105.    char            *OldBerr;    /* The old BERR routine. */
  106.    char            *BerrHandler;    /* My BERR routine. */
  107.    short        wrapup;        /* Upper address wrap bound. */
  108.    short        wrapdown;    /* Lower address wrap bound. */
  109.    ULONG        tablesize;    /* Main table size. */
  110.    char            *ResetCode;    /* Actual reset routine */
  111.    ULONG        tablerev;    /* Revision of table structure */
  112. };
  113.  
  114. extern struct systag *GetSysTag();
  115.  
  116.