arcs.h
5.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
typedef enum {
SystemClass,
ProcessorClass,
CacheClass,
MemoryClass,
AdapterClass,
ControllerClass,
PeripheralClass
} _ConfigClass;
typedef enum {
ARC,
CPU,
FPU,
PrimaryICache,
PrimaryDCache,
SecondaryICache,
SecondaryDCache,
SecondaryCache,
Memory,
EISAAdapter,
TCAdapter,
SCSIAdapter,
DTIAdapter,
MultiFunctionAdapter,
DiskController,
TapeController,
CDROMController,
WORMController,
SerialController,
NetworkController,
DisplayController,
ParallelController,
PointerController,
KeyboardController,
AudioController,
OtherController,
DiskPeripheral,
FloppyDiskPeripheral,
TapePeripheral,
ModemPeripheral,
MonitorPeripheral,
PrinterPeripheral,
PointerPeripheral,
KeyboardPeripheral,
TerminalPeripheral,
LinePeripheral,
NetworkPeripheral,
OtherPeripheral
} _ConfigType;
typedef enum {
Failed = 1,
ReadOnly = 2,
Removable = 4,
ConsoleIn = 8,
ConsoleOut = 16,
Input = 32,
Output = 64
} _IdentifierFlag;
typedef struct {
_ConfigClass Class;
_ConfigType Type;
_IdentifierFlag Flags;
unsigned short Version;
unsigned short Revision;
unsigned long Key;
unsigned long AffinityMask;
unsigned long ConfigurationDataSize;
unsigned long IdentifierLength;
char *Identifier;
} _Component;
typedef struct {
long long StartingAddress;
long long EndingAddress;
long long CurrentAddress;
_ConfigType Type;
unsigned long FilenameLength;
unsigned char Attributes;
char FileName[32];
} _FileInformation;
typedef struct {
char VendorId[8];
char ProductId[8];
} _SystemId;
typedef enum {
ExceptionBlock,
SPBPage, /* ARCS == SystemParameterBlock */
FreeContiguous,
FreeMemory,
BadMemory,
LoadedProgram,
FirmwareTemporary,
FirmwarePermanent
} _MemoryType;
typedef struct {
_MemoryType Type;
long BasePage;
long PageCount;
} _MemoryDescriptor;
typedef struct {
unsigned short Year;
unsigned short Month;
unsigned short Day;
unsigned short Hour;
unsigned short Minutes;
unsigned short Seconds;
unsigned short Milliseconds;
} _TimeInfo;
#define StandardIn 0
#define StandardOut 1
#define FileNameLengthMax (32)
typedef struct {
unsigned long FileNameLength;
unsigned char FileAttribute;
char FileName[FileNameLengthMax];
} _DirectoryEntry;
typedef enum {
OpenReadOnly,
OpenWriteOnly,
OpenReadWrite,
CreateWriteOnly,
CreateReadWrite,
SupersedeWriteOnly,
SupersedeReadWrite,
OpenDirectory,
CreateDirectory
} _OpenMode;
typedef enum { SeekAbsolute, SeekRelative } _SeekMode;
typedef enum { LoadMedia, UnloadMedia } _MountOperation;
/* ARCS Firmware Vector */
typedef struct {
long (*Load)(char *, unsigned long,
unsigned long *, unsigned long *);
long (*Invoke)(unsigned long, unsigned long,
long, char *[], char *[]);
long (*Execute)(char *, long, char *[], char *[]);
void (*Halt)(void);
void (*PowerDown)(void);
void (*Restart)(void);
void (*Reboot)(void);
void (*EnterInteractiveMode)(void);
int reserved1;
_Component *(*GetPeer)(_Component *);
_Component *(*GetChild)(_Component *);
_Component *(*GetParent)(_Component *);
long (*GetConfigData)(void *, _Component *);
_Component *(*AddChild)(_Component *, _Component *, void *);
long (*DeleteComponent)(_Component *);
_Component *(*GetComponent)(char *);
long (*SaveConfiguration)(void);
_SystemId *(*GetSystemId)(void);
_MemoryDescriptor *(*GetMemoryDesc)(_MemoryDescriptor *);
long reserved2;
_TimeInfo *(*GetTime)(void);
unsigned long (*GetRelativeTime)(void);
long (*GetDirEntry)(unsigned long, _DirectoryEntry *,
unsigned long, unsigned long *);
long (*Open)(char *, _OpenMode, unsigned long *);
long (*Close)(unsigned long);
long (*Read)(unsigned long, void *,
unsigned long, unsigned long *);
long (*GetReadStatus)(unsigned long);
long (*Write)(unsigned long, void *,
unsigned long, unsigned long *);
long (*Seek)(unsigned long, long long *, _SeekMode);
long (*Mount)(char *, _MountOperation);
char *(*GetEnvironmentVariable)(char *);
long (*SetEnvironmentVariable)(char *, char *);
long (*GetFileInformation)(unsigned long,
_FileInformation *);
long (*SetFileInformation)(unsigned long, unsigned long,
unsigned long);
void (*FlushAllCaches)(void);
} FirmwareVector;
/*
* ARCS system parameter block sits at a well known location,
* and provides a place to get system information.
*/
typedef struct {
long Signature; /* SPBMAGIC */
unsigned long Length;
unsigned short Version;
unsigned short Revision;
long *RestartBlock;
long *DebugBlock;
long *GEVector;
long *UTLBMissVector;
unsigned long TVLength;
FirmwareVector *TransferVector;
unsigned long PTVLength;
long *PrivateVector;
long AdapterCount;
long AdapterType0;
long AdapterVectorCount0;
long *AdapterVector0;
long AdapterType1;
long AdapterVectorCount1;
long *AdapterVector1;
/* more adapter vectors up to 0x2000 (end of page) */
} _SystemParameterBlock;
typedef struct debug_block {
unsigned int db_magic; /* DB_MAGIC */
void (*db_bpaddr)(); /* Breakpoint handler in debugger */
unsigned int db_idbgbase; /* Idbg table address in client */
int (*db_printf)(); /* Debugger console print routine */
unsigned int db_brkpttbl; /* breakpoint list for client use */
unsigned int db_flush; /* MP cache invalidate requests */
unsigned int db_nametab;
unsigned int db_symtab;
} db_t;
#define SPB ((_SystemParameterBlock *)(0x80001000))
#define __TV SPB->TransferVector
extern long _ArcsOpen(char *, _OpenMode, unsigned long *);
extern long _ArcsClose(unsigned long);
extern long _ArcsRead(unsigned long, void *, unsigned long, unsigned long *);
extern long _ArcsWrite(unsigned long, void *, unsigned long, unsigned long *);
extern void _ArcsPerror(long, char *);