1 |
8 |
hellwig |
/*
|
2 |
|
|
* common.h -- common definitions
|
3 |
|
|
*/
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
#ifndef _COMMON_H_
|
7 |
|
|
#define _COMMON_H_
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
#define K 1024 /* Kilo */
|
11 |
|
|
#define M (K * K) /* Mega */
|
12 |
|
|
|
13 |
|
|
#define RAM_BASE 0x00000000 /* physical RAM base address */
|
14 |
|
|
#define RAM_SIZE_MAX (512 * M) /* maximum RAM size */
|
15 |
|
|
#define RAM_SIZE_DFL (4 * M) /* default RAM size */
|
16 |
|
|
#define ROM_BASE 0x20000000 /* physical ROM base address */
|
17 |
|
|
#define ROM_SIZE_MAX (256 * M) /* maximum ROM size */
|
18 |
|
|
#define ROM_SIZE (256 * K) /* actual ROM size */
|
19 |
|
|
#define IO_BASE 0x30000000 /* physical I/O base address */
|
20 |
|
|
#define IO_SIZE_MAX (256 * M) /* maximum I/O size */
|
21 |
|
|
|
22 |
|
|
#define IO_DEV_MASK 0x3FF00000 /* I/O device mask */
|
23 |
|
|
#define IO_REG_MASK 0x000FFFFF /* I/O register mask */
|
24 |
|
|
#define IO_GRAPH_MASK 0x003FFFFF /* I/O graphics mask */
|
25 |
|
|
|
26 |
|
|
#define TIMER_BASE 0x30000000 /* physical timer base address */
|
27 |
|
|
#define DISPLAY_BASE 0x30100000 /* physical display base address */
|
28 |
|
|
#define KEYBOARD_BASE 0x30200000 /* physical keyboard base address */
|
29 |
246 |
hellwig |
#define SERIAL_BASE 0x30300000 /* physical serial line base address */
|
30 |
|
|
#define MAX_NSERIALS 2 /* max number of serial lines */
|
31 |
8 |
hellwig |
#define DISK_BASE 0x30400000 /* physical disk base address */
|
32 |
|
|
#define OUTPUT_BASE 0x3F000000 /* physical output device address */
|
33 |
25 |
hellwig |
#define SHUTDOWN_BASE 0x3F100000 /* physical shutdown device address */
|
34 |
8 |
hellwig |
#define GRAPH_BASE 0x3FC00000 /* physical grahics base address */
|
35 |
|
|
/* extends to end of address space */
|
36 |
|
|
|
37 |
|
|
#define PAGE_SIZE (4 * K) /* size of a page and a page frame */
|
38 |
|
|
#define OFFSET_MASK (PAGE_SIZE - 1) /* mask for offset within a page */
|
39 |
285 |
hellwig |
#define PAGE_MASK (~OFFSET_MASK) /* mask for page number */
|
40 |
|
|
#define FRAME_MASK (PAGE_MASK & ~0xC0000000) /* mask for frame number */
|
41 |
8 |
hellwig |
|
42 |
25 |
hellwig |
#define CC_PER_USEC 50 /* clock cycles per microsecond */
|
43 |
|
|
#define CC_PER_INSTR 18 /* clock cycles per instruction */
|
44 |
8 |
hellwig |
|
45 |
|
|
|
46 |
|
|
typedef enum { false, true } Bool; /* truth values */
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
typedef unsigned char Byte; /* 8 bit quantities */
|
50 |
|
|
typedef unsigned short Half; /* 16 bit quantities */
|
51 |
|
|
typedef unsigned int Word; /* 32 bit quantities */
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
#endif /* _COMMON_H_ */
|