xref: /inferno-os/os/ks32/dat.h (revision 74a4d8c26dd3c1e9febcb717cfd6cb6512991a7a)
1 typedef struct Conf	Conf;
2 typedef struct FPU	FPU;
3 typedef struct FPenv	FPenv;
4 typedef struct Label	Label;
5 typedef struct Lock	Lock;
6 typedef struct Mach	Mach;
7 typedef struct Ureg	Ureg;
8 typedef struct ISAConf	ISAConf;
9 typedef struct PCMmap	PCMmap;
10 typedef struct PCIcfg	PCIcfg;
11 typedef struct TouchPnt TouchPnt;
12 typedef struct TouchTrans TouchTrans;
13 typedef struct TouchCal TouchCal;
14 typedef struct Vmode Vmode;
15 
16 typedef ulong Instr;
17 
18 #define ISAOPTLEN 16
19 #define NISAOPT 8
20 struct Conf
21 {
22 	ulong	nmach;			/* processors */
23 	ulong	nproc;			/* processes */
24 	ulong	npage0;			/* total physical pages of memory */
25 	ulong	npage1;			/* total physical pages of memory */
26 	ulong	topofmem;		/* highest physical address + 1 */
27 	ulong	npage;			/* total physical pages of memory */
28 	ulong	base0;			/* base of bank 0 */
29 	ulong	base1;			/* base of bank 1 */
30 	ulong	ialloc;			/* max interrupt time allocation in bytes */
31 	ulong	flashbase;
32 	ulong	cpuspeed;
33 	ulong	pagetable;
34 
35 	int		useminicache;		/* screen.c/lcd.c */
36 	int		cansetbacklight;	/* screen.c/lcd.c */
37 	int		cansetcontrast;		/* screen.c/lcd.c */
38 	int		remaplo;			/* use alt ivec */
39 	int		textwrite;			/* writeable text segment, for debug */
40 };
41 
42 struct ISAConf {
43 	char	type[KNAMELEN];
44 	ulong	port;
45 	ulong	irq;
46 	ulong	sairq;
47 	ulong	dma;
48 	ulong	mem;
49 	ulong	size;
50 	ulong	freq;
51 
52 	int	nopt;
53 	char	opt[NISAOPT][ISAOPTLEN];
54 };
55 
56 /*
57  * FPenv.status
58  */
59 enum
60 {
61 	FPINIT,
62 	FPACTIVE,
63 	FPINACTIVE,
64 };
65 
66 struct	FPenv
67 {
68 	ulong	status;
69 	ulong	control;
70 	ushort	fpistate;	/* emulated fp */
71 	ulong	regs[8][3];	/* emulated fp */
72 };
73 
74 /*
75  * This structure must agree with fpsave and fprestore asm routines
76  */
77 struct	FPU
78 {
79 	FPenv	env;
80 	uchar	regs[80];	/* floating point registers */
81 };
82 
83 struct Label
84 {
85 	ulong	sp;
86 	ulong	pc;
87 };
88 
89 struct Lock
90 {
91 	ulong	key;
92 	ulong	sr;
93 	ulong	pc;
94 	int	pri;
95 };
96 
97 #include "../port/portdat.h"
98 
99 /*
100  *  machine dependent definitions not used by ../port/dat.h
101  */
102 struct Mach
103 {
104 	ulong	ticks;			/* of the clock since boot time */
105 	Proc	*proc;			/* current process on this processor */
106 	Label	sched;			/* scheduler wakeup */
107 	Lock	alarmlock;		/* access to alarm list */
108 	void	*alarm;			/* alarms bound to this clock */
109 	int	machno;
110 	int	nrdy;
111 
112 	int	stack[1];
113 };
114 
115 #define	MACHP(n)	(n == 0 ? (Mach*)(MACHADDR) : (Mach*)0)
116 
117 extern Mach Mach0;
118 extern Mach *m;
119 extern Proc *up;
120 
121 typedef struct MemBank {
122 	uint	pbase;
123 	uint	plimit;
124 	uint	vbase;
125 	uint	vlimit;
126 } MemBank;
127 
128 enum {
129 	// DMA configuration parameters
130 
131 	 // DMA Direction
132 	DmaOUT=		0,
133 	DmaIN=		1,
134 
135 	 // dma endianess
136 	DmaLittle=	0,
137 	DmaBig=		1,
138 
139 	 // dma devices
140 	DmaUDC=		0,
141 	DmaSDLC=	2,
142 	DmaUART0=	4,
143 	DmaHSSP=	6,
144 	DmaUART1=	7,	// special case (is really 6)
145 	DmaUART2=	8,
146 	DmaMCPaudio=	10,
147 	DmaMCPtelecom=	12,
148 	DmaSSP=		14,
149 };
150 
151 enum touch_source {
152 	TOUCH_READ_X1, TOUCH_READ_X2, TOUCH_READ_X3, TOUCH_READ_X4,
153 	TOUCH_READ_Y1, TOUCH_READ_Y2, TOUCH_READ_Y3, TOUCH_READ_Y4,
154 	TOUCH_READ_P1, TOUCH_READ_P2,
155 	TOUCH_READ_RX1, TOUCH_READ_RX2,
156 	TOUCH_READ_RY1, TOUCH_READ_RY2,
157 	TOUCH_NUMRAWCAL = 10,
158 };
159 
160 struct TouchPnt {
161 	int	x;
162 	int	y;
163 };
164 
165 struct TouchTrans {
166 	int	xxm;
167 	int	xym;
168 	int	yxm;
169 	int	yym;
170 	int	xa;
171 	int	ya;
172 };
173 
174 struct TouchCal {
175 	TouchPnt	p[4];	// screen points
176 	TouchPnt	r[4][4];// raw points
177 	TouchTrans 	t[4];	// transformations
178 	TouchPnt	err;	// maximum error
179 	TouchPnt	var;	// usual maximum variance for readings
180 	int 		ptp;	// pressure threshold for press
181 	int		ptr;	// pressure threshold for release
182 };
183 
184 extern TouchCal touchcal;
185 
186 struct Vmode {
187 	int	wid;	/* 0 -> default or any match for all fields */
188 	int	hgt;
189 	uchar	d;
190 	uchar	hz;
191 	ushort	flags;
192 };
193 
194 enum {
195 	VMODE_MONO = 0x0001,    /* monochrome display */
196 	VMODE_COLOR = 0x0002,   /* color (RGB) display */
197 	VMODE_TFT = 0x0004,	/* TFT (active matrix) display */
198 	VMODE_STATIC = 0x0010,  /* fixed palette */
199 	VMODE_PSEUDO = 0x0020,  /* changeable palette */
200 	VMODE_LINEAR = 0x0100,  /* linear frame buffer */
201 	VMODE_PAGED = 0x0200,   /* paged frame buffer */
202 	VMODE_PLANAR = 0x1000,  /* pixel bits split between planes */
203 	VMODE_PACKED = 0x2000,  /* pixel bits packed together */
204 	VMODE_LILEND = 0x4000,	/* little endian pixel layout */
205 	VMODE_BIGEND = 0x8000,	/* big endian pixel layout */
206 };
207 
208 /*
209  *	Interface to PCMCIA stubs
210  */
211 enum {
212 	/* argument to pcmpin() */
213 	PCMready,
214 	PCMeject,
215 	PCMstschng,
216 };
217 
218 #define	swcursor	1
219