summaryrefslogtreecommitdiff
path: root/os/ks32/dat.h
blob: 70422b636317ff4e91daaa421ce7924df8b19495 (plain)
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
typedef struct Conf	Conf;
typedef struct FPU	FPU;
typedef struct FPenv	FPenv;
typedef struct Label	Label;
typedef struct Lock	Lock;
typedef struct Mach	Mach;
typedef struct Ureg	Ureg;
typedef struct ISAConf	ISAConf;
typedef struct PCMmap	PCMmap;
typedef struct PCIcfg	PCIcfg;
typedef struct TouchPnt TouchPnt;
typedef struct TouchTrans TouchTrans;
typedef struct TouchCal TouchCal;
typedef struct Vmode Vmode;

typedef ulong Instr;

#define ISAOPTLEN 16
#define NISAOPT 8
struct Conf
{
	ulong	nmach;			/* processors */
	ulong	nproc;			/* processes */
	ulong	npage0;			/* total physical pages of memory */
	ulong	npage1;			/* total physical pages of memory */
	ulong	topofmem;		/* highest physical address + 1 */
	ulong	npage;			/* total physical pages of memory */
	ulong	base0;			/* base of bank 0 */
	ulong	base1;			/* base of bank 1 */
	ulong	ialloc;			/* max interrupt time allocation in bytes */
	ulong	flashbase;
	ulong	cpuspeed;
	ulong	pagetable;

	int		useminicache;		/* screen.c/lcd.c */
	int		cansetbacklight;	/* screen.c/lcd.c */
	int		cansetcontrast;		/* screen.c/lcd.c */
	int		remaplo;			/* use alt ivec */
	int		textwrite;			/* writeable text segment, for debug */
};

struct ISAConf {
	char	type[KNAMELEN];
	ulong	port;
	ulong	irq;
	ulong	sairq;
	ulong	dma;
	ulong	mem;
	ulong	size;
	ulong	freq;

	int	nopt;
	char	opt[NISAOPT][ISAOPTLEN];
};

/*
 * FPenv.status
 */
enum
{
	FPINIT,
	FPACTIVE,
	FPINACTIVE,
};

struct	FPenv
{
	ulong	status;
	ulong	control;
	ushort	fpistate;	/* emulated fp */
	ulong	regs[8][3];	/* emulated fp */	
};

/*
 * This structure must agree with fpsave and fprestore asm routines
 */
struct	FPU
{
	FPenv	env;
	uchar	regs[80];	/* floating point registers */
};

struct Label
{
	ulong	sp;
	ulong	pc;
};

struct Lock
{
	ulong	key;
	ulong	sr;
	ulong	pc;
	int	pri;
};

#include "../port/portdat.h"

/*
 *  machine dependent definitions not used by ../port/dat.h
 */
struct Mach
{
	ulong	ticks;			/* of the clock since boot time */
	Proc	*proc;			/* current process on this processor */
	Label	sched;			/* scheduler wakeup */
	Lock	alarmlock;		/* access to alarm list */
	void	*alarm;			/* alarms bound to this clock */
	int	machno;
	int	nrdy;

	int	stack[1];
};

#define	MACHP(n)	(n == 0 ? (Mach*)(MACHADDR) : (Mach*)0)

extern Mach Mach0;
extern Mach *m;
extern Proc *up;

typedef struct MemBank {
	uint	pbase;
	uint	plimit;
	uint	vbase;
	uint	vlimit;
} MemBank;

enum {
	// DMA configuration parameters

	 // DMA Direction
	DmaOUT=		0,
	DmaIN=		1,

	 // dma endianess
	DmaLittle=	0,
	DmaBig=		1,

	 // dma devices
	DmaUDC=		0,
	DmaSDLC=	2,
	DmaUART0=	4,
	DmaHSSP=	6,
	DmaUART1=	7,	// special case (is really 6)
	DmaUART2=	8,
	DmaMCPaudio=	10,
	DmaMCPtelecom=	12,
	DmaSSP=		14,
};

enum touch_source {
	TOUCH_READ_X1, TOUCH_READ_X2, TOUCH_READ_X3, TOUCH_READ_X4,
	TOUCH_READ_Y1, TOUCH_READ_Y2, TOUCH_READ_Y3, TOUCH_READ_Y4,
	TOUCH_READ_P1, TOUCH_READ_P2,
	TOUCH_READ_RX1, TOUCH_READ_RX2,
	TOUCH_READ_RY1, TOUCH_READ_RY2,
	TOUCH_NUMRAWCAL = 10,
};

struct TouchPnt {
	int	x;
	int	y;
};

struct TouchTrans {
	int	xxm;
	int	xym;
	int	yxm;
	int	yym;
	int	xa;
	int	ya;
};

struct TouchCal {
	TouchPnt	p[4];	// screen points
	TouchPnt	r[4][4];// raw points
	TouchTrans 	t[4];	// transformations
	TouchPnt	err;	// maximum error
	TouchPnt	var;	// usual maximum variance for readings
	int 		ptp;	// pressure threshold for press
	int		ptr;	// pressure threshold for release
};

extern TouchCal touchcal;

struct Vmode {
	int	wid;	/* 0 -> default or any match for all fields */
	int	hgt;
	uchar	d;
	uchar	hz;
	ushort	flags;
};

enum {
	VMODE_MONO = 0x0001,    /* monochrome display */
	VMODE_COLOR = 0x0002,   /* color (RGB) display */
	VMODE_TFT = 0x0004,	/* TFT (active matrix) display */
	VMODE_STATIC = 0x0010,  /* fixed palette */
	VMODE_PSEUDO = 0x0020,  /* changeable palette */
	VMODE_LINEAR = 0x0100,  /* linear frame buffer */
	VMODE_PAGED = 0x0200,   /* paged frame buffer */
	VMODE_PLANAR = 0x1000,  /* pixel bits split between planes */
	VMODE_PACKED = 0x2000,  /* pixel bits packed together */
	VMODE_LILEND = 0x4000,	/* little endian pixel layout */
	VMODE_BIGEND = 0x8000,	/* big endian pixel layout */
};

/*
 *	Interface to PCMCIA stubs
 */
enum {
	/* argument to pcmpin() */
	PCMready,
	PCMeject,
	PCMstschng,
};

#define	swcursor	1