Un-ignored: the dev drive is the ground truth the restoration and emulator work constantly reference (DPL3/LIBDPL + VRENDER i860 renderer source, BT/RP live+dev game trees, VGL_LABS pod boot, scene/audio content). Kept in-repo for the pod-owner community. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
343 lines
8.7 KiB
C++
343 lines
8.7 KiB
C++
/*{{{ Copyright*/
|
|
/**************************************************************************/
|
|
/* */
|
|
/* DIVISION */
|
|
/* -------- */
|
|
/* */
|
|
/* (C) Copyright 1990, 1991 DIVISION Limited */
|
|
/* */
|
|
/**************************************************************************/
|
|
|
|
/*
|
|
PROJECT: BLASTER
|
|
SUBSYSTEM: CM100 IO
|
|
|
|
MODULE: CM100IO_H
|
|
FILE: cm100io.h
|
|
|
|
AUTHOR: CHRG
|
|
DATE: 22:03:90
|
|
|
|
|
|
|
|
|
|
MODIFIED:
|
|
|
|
*/
|
|
/*}}} */
|
|
/*{{{ Function*/
|
|
/*
|
|
|
|
FUNCTION:- Defines IO_CONTROL structure and position
|
|
of Command Control Blocks etc.
|
|
|
|
|
|
|
|
*/
|
|
/*}}} */
|
|
|
|
#include "dtypes.h"
|
|
|
|
#ifndef CM200IO_H
|
|
#define CM200IO_H
|
|
|
|
/*
|
|
860 <-> transputer io control register
|
|
*/
|
|
|
|
#define IO_CONTROL_BASE 0x00000000
|
|
|
|
/*{{{ typedefs*/
|
|
typedef struct SUBSYTEM {
|
|
|
|
union RE {
|
|
word error; /* subsystem error READ ONLY */
|
|
word reset; /* subsystem reset WRITE ONLY*/
|
|
} re;
|
|
|
|
union AN {
|
|
word analyse; /* subsys analyse WRITE ONLY*/
|
|
word spare; /* spare */
|
|
} an;
|
|
} SUBSYSTEM;
|
|
|
|
typedef struct I860INT {
|
|
word clearInt; /* clear i860 Int. on READ */
|
|
word spare;
|
|
} I860INT;
|
|
|
|
typedef union CONTROL {
|
|
|
|
SUBSYSTEM subsytem;/* subsystem control */
|
|
|
|
I860INT i_860; /* i860 Int clear control */
|
|
|
|
} CONTROL;
|
|
|
|
|
|
typedef struct IO_CONTROL {
|
|
|
|
CONTROL control; /* subsystem control */
|
|
|
|
word ireset; /* 860 reset */
|
|
word ihold; /* 860 hold */
|
|
|
|
word tevent; /* transputer event */
|
|
|
|
word spare1;
|
|
|
|
word ievent; /* 860 interrupt */
|
|
|
|
word spare2;
|
|
} IO_CONTROL;
|
|
|
|
|
|
/*}}} */
|
|
|
|
/*{{{ future upgrades*/
|
|
#ifdef future
|
|
|
|
/*
|
|
|
|
NBB For Beta 1.0 we will stick with the above original
|
|
IO_CONTROL. The functions are correct but difficult to
|
|
follow.
|
|
|
|
For Beta 1.1 we will upgrade to the scheme below
|
|
*/
|
|
|
|
|
|
typedef struct READ_CONTROL {
|
|
|
|
word sub_error; /* subsystem error */
|
|
word i860_clear_int; /* initialise i860 Interrupt */
|
|
word clear_event; /* clear event condition */
|
|
word spare1;
|
|
word spare2;
|
|
word spare3;
|
|
word spare4;
|
|
} READ_CONTROL;
|
|
|
|
typedef struct WRITE_CONTROL {
|
|
|
|
word sub_analyse; /* subsystem analyse */
|
|
word sub_reset; /* subsystem reset */
|
|
word i860_reset; /* i860 reset */
|
|
word i860_hold; /* lock i860 off bus */
|
|
word spare2;
|
|
word spare3;
|
|
word i860_int; /* interrupt i860 */
|
|
} WRITE_CONTROL;
|
|
|
|
typedef struct IO_CONTROL {
|
|
|
|
union {
|
|
READ_CONTROL read;
|
|
WRITE_CONTROL write;
|
|
};
|
|
} IO_CONTROL;
|
|
|
|
#endif
|
|
|
|
|
|
/*}}} */
|
|
/*{{{ on the ccb's*/
|
|
|
|
/*
|
|
Two blocks of shared memory are assigned to command
|
|
transfer. These blocks are defined as Command Control Blocks
|
|
CCB's. One is always used for transputer commands
|
|
initiated by the i860, the other for i860 commands
|
|
initiated by the transputer.
|
|
|
|
The command control blocks currently sit right at the
|
|
top of memory just below the peripheral address space.
|
|
Cacheing is disabled for the CCB page.
|
|
|
|
Each CCB is protected by a simple Spin Lock. When the
|
|
i860 application attempts an output, the Wait() is called
|
|
on the output_ccb.Lock. This will spin until the Lock is
|
|
clear. The Lock is then set and Wait() returns. The
|
|
output_ccb is then updated, and the I/O processor evented.
|
|
At this point the i860 output routine returns (note the
|
|
Lock is still set). Once the I/O processor event routine
|
|
has finished with the output_ccb it calls Signal() to clear
|
|
the Lock. A similar handshake occurs on input.
|
|
|
|
|
|
*/
|
|
|
|
/*}}} */
|
|
/*{{{ ccb structure*/
|
|
#define INPUT_CCB 0xFFFFF000
|
|
#define OUTPUT_CCB 0xFFFFF300
|
|
#define CCB_DATA_LENGTH 256
|
|
#ifdef IBUG
|
|
#define CLEAR_INT 0xFFFFF000
|
|
#define INT_CLEARED 0xFFFFF004
|
|
#endif
|
|
|
|
typedef struct CCB {
|
|
|
|
word lock; /* CCB Lock */
|
|
word spare; /* NBB trash area for unlock */
|
|
int command_no; /* unique command instance no.*/
|
|
int command_type; /* command type */
|
|
word ack; /* acknowledge data */
|
|
int control; /* control data */
|
|
byte data[CCB_DATA_LENGTH]; /* command data */
|
|
|
|
} CCB;
|
|
/*}}} */
|
|
#if 0
|
|
/*{{{ ccb structure*/
|
|
#define INPUT_CCB 0xFFFFE000
|
|
#define OUTPUT_CCB 0xFFFFE800
|
|
#define CCB_DATA_LENGTH 256
|
|
#ifdef IBUG
|
|
#define CLEAR_INT 0xFFFFF000
|
|
#define INT_CLEARED 0xFFFFF004
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct CCB {
|
|
|
|
word lock; /* CCB Lock */
|
|
word spare; /* NBB trash area for unlock */
|
|
int command_no; /* unique command instance no.*/
|
|
int command_type; /* command type */
|
|
word ack; /* acknowledge data */
|
|
int control; /* control data */
|
|
byte data[CCB_DATA_LENGTH]; /* command data */
|
|
|
|
} CCB;
|
|
|
|
/*}}} */
|
|
#endif
|
|
/*{{{ command types*/
|
|
/* Command Types */
|
|
|
|
#define IO_BREAK 1
|
|
#define IO_ACK 2
|
|
#define IO_STRING 3
|
|
#define IO_CHAR 4
|
|
|
|
/* Library Entries */
|
|
|
|
#define IO_MATHADV_REQ 5
|
|
|
|
#define IO_BLOCK_OUT 6
|
|
#define IO_BLOCK_IN 7
|
|
#define IO_DIVNET_IN 8
|
|
#define IO_DIVNET_OUT 9
|
|
#define IO_DIVNET_NODE 10
|
|
#define IO_LINK_OUT 11 /* obsolete these */
|
|
#define IO_LINK_RAST_OUT 12
|
|
#define IO_FFILE 13
|
|
#define IO_TIMER 16
|
|
|
|
/* true entries for dncd library */
|
|
|
|
#define IO_DNC_SEND 30
|
|
#define IO_DNC_RECEIVE 31
|
|
#define IO_DNC_MYID 32
|
|
#define IO_DNC_NODES 33
|
|
#define IO_DNC_POLL 34
|
|
|
|
/* entries for concurrent link driver */
|
|
|
|
#define IO_LD_RUN_CCB_DRIVER 41 /* sorry about these gaps chaps */
|
|
#define IO_LD_RUN_DRIVER 42 /* sorry about these gaps chaps */
|
|
#define IO_LD_LINK_IN 43 /* these calls use the spawned link driver */
|
|
#define IO_LD_LINK_OUT 44 /* this should obsolete IO_LINK_OUT */
|
|
#define IO_LD_LINK_IN_2D 45
|
|
#define IO_LD_LINK_OUT_2D 46 /* this should obsolete IO_LINK_RAST_OUT */
|
|
#define IO_LD_LINK_STATUS 47
|
|
#define IO_LD_CCB_LINK_OUT 48 /* same as LINK_OUT, forces copy from CCB */
|
|
|
|
/* superVision ! */
|
|
|
|
#define IO_RASTER_SV 49 /* supervision raster */
|
|
|
|
#define IO_GETPACKET 50
|
|
#define IO_PUTPACKET 51
|
|
|
|
#define IO_PXPL5 52
|
|
|
|
#define IO_LD_STATUS_IDLE 0
|
|
#define IO_LD_STATUS_INPUTTING 1
|
|
#define IO_LD_STATUS_OUTPUTTING 2
|
|
|
|
|
|
#define IO_ISERVER 15
|
|
|
|
/* types of IO_FFILE */
|
|
#define F_FORMREAD 0
|
|
#define F_FORMWRITE 1
|
|
#define F_CLOSE 2
|
|
#define F_EXIT 3
|
|
|
|
/* Test Entries */
|
|
|
|
#define IO_TESTINT 20
|
|
#define IO_TESTEVENT 21
|
|
|
|
/*}}} */
|
|
/*{{{ define trap vector*/
|
|
|
|
/*
|
|
The i860 TRAP VECTOR resides at the top of memory.
|
|
The processor continues execution at this address on TRAP and RESET
|
|
*/
|
|
|
|
#define TRAP_VECTOR 0xFFFFFF00
|
|
|
|
/*}}} */
|
|
/*{{{ declare externs*/
|
|
|
|
/*
|
|
EXTERNAL DATA DECLARATION
|
|
*/
|
|
|
|
|
|
|
|
extern IO_CONTROL *ioc;
|
|
extern CCB *input_ccb;
|
|
extern CCB *output_ccb;
|
|
extern int command_no;
|
|
#ifdef IBUG
|
|
extern word *ClearInt;
|
|
extern word *IntCleared;
|
|
#endif
|
|
|
|
|
|
/*
|
|
FUNCTION DECLARATIONS
|
|
*/
|
|
|
|
extern void buslock(int state);
|
|
extern void reset860(int state);
|
|
extern void setbootmode8(void);
|
|
extern void setbootmode64(void);
|
|
extern void init860Int(void);
|
|
extern void initTEvent(void);
|
|
extern void clear860Int(void);
|
|
extern void clearEvent(void);
|
|
extern void interrupt_860(void);
|
|
extern void init_ccbs(void);
|
|
extern void Wait(word *lock);
|
|
extern void Signal(word *lock);
|
|
extern void gen_ack(int ackno, word data);
|
|
|
|
|
|
extern void cnbreak(void);
|
|
extern void cnputs(char *);
|
|
extern void cnputc(char);
|
|
extern int cngetc(void);
|
|
/*}}} */
|
|
|
|
#endif
|
|
|
|
/*END*/
|