1: #ifndef TYPE_H
   2: #define TYPE_H
   3: 
   4: typedef _PROTOTYPE( void task_t, (void) );
   5: typedef _PROTOTYPE( int (*rdwt_t), (message *m_ptr) );
   6: typedef _PROTOTYPE( void (*watchdog_t), (void) );
   7: 
   8: struct tasktab {
   9:   task_t *initial_pc;
  10:   int stksize;
  11:   char name[8];
  12: };
  13: 
  14: struct memory {
  15:   phys_clicks base;
  16:   phys_clicks size;
  17: };
  18: 
  19: /* Administration for clock polling. */
  20: struct micro_state {
  21:   unsigned long accum_count;    /* accumulated clock ticks */
  22:   unsigned prev_count;          /* previous clock value */
  23: };
  24: 
  25: struct timer;
  26: typedef void (*tmr_func_t)(struct timer *tp);
  27: typedef union { int ta_int; void *ta_ptr; } tmr_arg_t;
  28: 
  29: typedef struct timer
  30: {
  31:   struct timer  *tmr_next;      /* next in a timer chain */
  32:   int           tmr_task;       /* task this timer belongs to */
  33:   clock_t       tmr_exp_time;   /* expiry time */
  34:   tmr_func_t    tmr_func;       /* function to call when expired */
  35:   tmr_arg_t     tmr_arg;        /* random argument */
  36: } timer_t;
  37: 
  38: #define TMR_NEVER LONG_MAX      /* timer not active. */
  39: 
  40: #if (CHIP == INTEL)
  41: typedef u16_t port_t;
  42: typedef U16_t Port_t;
  43: typedef unsigned reg_t;         /* machine register */
  44: 
  45: /* The stack frame layout is determined by the software, but for efficiency
  46:  * it is laid out so the assembly code to use it is as simple as possible.
  47:  * 80286 protected mode and all real modes use the same frame, built with
  48:  * 16-bit registers.  Real mode lacks an automatic stack switch, so little
  49:  * is lost by using the 286 frame for it.  The 386 frame differs only in
  50:  * having 32-bit registers and more segment registers.  The same names are
  51:  * used for the larger registers to avoid differences in the code.
  52:  */
  53: struct stackframe_s {           /* proc_ptr points here */
  54: #if _WORD_SIZE == 4
  55:   u16_t gs;                     /* last item pushed by save */
  56:   u16_t fs;                     /*  ^ */
  57: #endif
  58:   u16_t es;                     /*  | */
  59:   u16_t ds;                     /*  | */
  60:   reg_t di;                     /* di through cx are not accessed in C */
  61:   reg_t si;                     /* order is to match pusha/popa */
  62:   reg_t fp;                     /* bp */
  63:   reg_t st;                     /* hole for another copy of sp */
  64:   reg_t bx;                     /*  | */
  65:   reg_t dx;                     /*  | */
  66:   reg_t cx;                     /*  | */
  67:   reg_t retreg;                 /* ax and above are all pushed by save */
  68:   reg_t retadr;                 /* return address for assembly code save() */
  69:   reg_t pc;                     /*  ^  last item pushed by interrupt */
  70:   reg_t cs;                     /*  | */
  71:   reg_t psw;                    /*  | */
  72:   reg_t sp;                     /*  | */
  73:   reg_t ss;                     /* these are pushed by CPU during interrupt */
  74: };
  75: 
  76: struct segdesc_s {              /* segment descriptor for protected mode */
  77:   u16_t limit_low;
  78:   u16_t base_low;
  79:   u8_t base_middle;
  80:   u8_t access;                  /* |P|DL|1|X|E|R|A| */
  81:   u8_t granularity;             /* |G|X|0|A|LIMT| */
  82:   u8_t base_high;
  83: };
  84: 
  85: typedef struct irq_hook {
  86:   struct irq_hook *next;
  87:   int (*handler)(struct irq_hook *);
  88:   int irq;
  89:   int id;
  90: } irq_hook_t;
  91: 
  92: typedef int (*irq_handler_t)(struct irq_hook *);
  93: 
  94: #endif /* (CHIP == INTEL) */
  95: 
  96: #if (CHIP == M68000)
  97: typedef _PROTOTYPE( void (*dmaint_t), (void) );
  98: 
  99: typedef u32_t reg_t;            /* machine register */
 100: 
 101: /* The name and fields of this struct were chosen for PC compatibility. */
 102: struct stackframe_s {
 103:   reg_t retreg;                 /* d0 */
 104:   reg_t d1;
 105:   reg_t d2;
 106:   reg_t d3;
 107:   reg_t d4;
 108:   reg_t d5;
 109:   reg_t d6;
 110:   reg_t d7;
 111:   reg_t a0;
 112:   reg_t a1;
 113:   reg_t a2;
 114:   reg_t a3;
 115:   reg_t a4;
 116:   reg_t a5;
 117:   reg_t fp;                     /* also known as a6 */
 118:   reg_t sp;                     /* also known as a7 */
 119:   reg_t pc;
 120:   u16_t psw;
 121:   u16_t dummy;                  /* make size multiple of reg_t for system.c */
 122: };
 123: 
 124: struct fsave {
 125:   struct cpu_state {
 126:         u16_t i_format;
 127:         u32_t i_addr;
 128:         u16_t i_state[4];
 129:   } cpu_state;
 130:   struct state_frame {
 131:         u8_t frame_type;
 132:         u8_t frame_size;
 133:         u16_t reserved;
 134:         u8_t frame[212];
 135:   } state_frame;
 136:   struct fpp_model {
 137:         u32_t fpcr;
 138:         u32_t fpsr;
 139:         u32_t fpiar;
 140:         struct fpN {
 141:                 u32_t high;
 142:                 u32_t low;
 143:                 u32_t mid;
 144:         } fpN[8];
 145:   } fpp_model;
 146: };
 147: #endif /* (CHIP == M68000) */
 148: 
 149: #endif /* TYPE_H */