ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/tardev.h
Revision: 1.1
Committed: Thu Feb 2 10:49:01 1989 UTC (35 years, 3 months ago) by greg
Content type: text/plain
Branch: MAIN
Log Message:
Initial revision

File Contents

# User Rev Content
1 greg 1.1 /*
2    
3     /* SCCSid "$SunId$ LBL" */
4     #include "mk_crefs.h"
5     */
6    
7     /*
8     * Board types used for targa->boardType
9     */
10     #define TYPE_8 8
11     #define TYPE_16 16
12     #define TYPE_24 24
13     #define TYPE_32 32
14     #define TYPE_M8 -8
15    
16     /*
17     * TARGA: 400 to 482 rows x 512 pixels/row X 16 bits/pixel
18     */
19    
20     #define XMIN 0
21     #define YMIN 0
22     #define XMAX 512 /* maximum X value */
23     #define YMAX 512 /* maximum Y value */
24     #define XRES 512 /* X resolution */
25     #define YRES 512 /* Y Resolution */
26     #define YVISMAX (2*targa->LinesPerField) /* Maximum visible Y coordinate */
27     #define YVISMIN 0 /* Minimum visible Y coordiate */
28     #define DEF_ROWS 400 /* Default number of rows */
29    
30    
31     #define DEF_IOBASE 0x220
32     #define IOBASE targa->iobase /* io base location of graphics registers */
33     #define MEMSEG targa->memloc /* use the variable so we can use */
34     #define SCNSEG targa->memloc /* the one defined in TARGA */
35     #define SRCBANK (targa->memloc+0x0800) /* use high-bank as source bank */
36     #define DESTBANK targa->memloc /* use lo-bank as destination bank */
37     #define DEF_MEMSEG 0xa000 /* Default screen memory */
38    
39     /*
40     * Output register definitions
41     */
42     #define MODEREG (IOBASE+0xC00) /* Mode Register address */
43     #define MASKREG (IOBASE+0x800) /* Mask Registers */
44     #define UNDERREG (IOBASE+0x800) /* Underscan register */
45     #define OVERREG (IOBASE+0x802) /* overscan register */
46     #define DESTREG (IOBASE+0x802) /* Address of Page Select Lower Register */
47     #define SRCREG (IOBASE+0x803) /* Address of Page Select Upper Register */
48     #define VCRCON (IOBASE+0x400) /* Address of Contrast/VidSrc Register */
49     #define BLNDREG VCRCON
50     #define SATHUE (IOBASE+0x402) /* Satuation/Hue Register address */
51     #define DRREG (IOBASE+0x401) /* ADDRESS OF Controller Write Register */
52     #define VERTPAN (IOBASE+0x403) /* Address of Vertical Pan Register */
53     #define BORDER (IOBASE) /* Address of Page Select Lower Register */
54    
55    
56     /*
57     * Input register definitions
58     */
59     #define VIDEOSTATUS (IOBASE+0xC02) /* Video Status Register */
60     #define RASTERREG (IOBASE+0xC00) /* Raster counter register */
61    
62    
63    
64     /*
65     * Default register values
66     */
67     #define DEF_MODE 1 /* Default mode register value */
68     /* Memory selected, 512x512, 1x */
69     /* Display mode */
70     #define DEF_MASK 0 /* default memory mask */
71     #define DEF_SATURATION 0x4 /* default saturation value */
72     #define DEF_HUE 0x10 /* default hue value */
73     #define DEF_CONTRAST 0x10 /* default contrast value */
74     #define DEF_VIDSRC 0 /* default video source value - Composite */
75     #define DEF_VERTPAN 56 /* assumes 400-line output */
76     #define DEF_BORDER 0 /* default border color */
77    
78    
79     /*
80     * MASK AND SHIFT VALUE FOR REGISTERS CONTAINING SUBFIELDS
81     */
82     /*
83     * ******************************************************
84     * MODE REGISTERS
85     * ******************************************************
86     */
87     #define MSK_MSEL 0xfffC /* memory select bits */
88     #define SHF_MSEL 0x0000
89     #define MSEL 1
90    
91     #define MSK_IBIT 0xfffb /* Interlace bit */
92     #define SHF_IBIT 2
93    
94     #define MSK_RES 0xFFC7 /* disp. resolution and screen select bits */
95     #define SHF_RES 3
96     #define S0_512X512_0 0 /* 512x512 resolution screen */
97     #define S1_512X512_1 1
98     #define S2_512X256_0 2 /* 512x256 resolution screen 0 */
99     #define S3_512X256_1 3 /* 512x256 resolution screen 1 */
100     #define S4_256X256_0 4 /* 256x256 resolution screen 0 */
101     #define S5_256X256_1 5 /* .... */
102     #define S6_256X256_2 6
103     #define S7_256X256_3 7
104    
105     #define MSK_REGWRITE 0xFFBF /* mask for display register write */
106     #define SHF_REGWRITE 6
107     #define REGINDEX 0 /* to write an index value */
108     #define REGVALUE 1 /* to write a value */
109    
110     #define MSK_BIT9 0xFF7F /* maks for high-order bit of DR's */
111     #define SHF_BIT9 7
112    
113     #define MSK_TAPBITS 0xFCFF /* mask for setting the tap bits */
114     #define SHF_TAPBITS 8
115    
116     #define MSK_ZOOM 0xF3FF /* Mask for zoom factor */
117     #define SHF_ZOOM 10
118    
119     #define MSK_DISPLAY 0xCFFF /* Mask for display mode */
120     #define SHF_DISPLAY 12
121     #define MEMORY_MODE 0
122     #define LIVE_FIXED 1
123     #define OVERLAY_MODE 2
124     #define LIVE_LIVE 3
125     #define DEF_DISPLAY 0
126    
127     #define MSK_CAPTURE 0xBFFF /* Mask for capture bit */
128     #define SHF_CAPTURE 14
129    
130     #define MSK_GENLOCK 0x7FFF /* MASK FOR GENLOCK */
131     #define SHF_GENLOCK 15
132     #define DEF_GENLOCK 0
133     /*
134     * Video status input register
135     */
136     #define FIELDBIT 0x0001
137     #define VIDEOLOSS 0x0002
138     /*
139     * VIDEO SOURCE/CONTROL REGISTER
140     */
141     #define MSK_CONTRAST 0xFFC1
142     #define SHF_CONTRAST 1
143     #define MAX_CONTRAST 0x1f
144    
145     #define MSK_RGBORCV 0xBF
146     #define SHF_RGBORCV 6
147     #define RGB 1
148     #define CV 0
149    
150     #define MSK_VCRORCAMERA 0x7F
151     #define SHF_VCRORCAMERA 7
152     #define VCR 1
153     #define CAMERA 0
154    
155     /*
156     * HUE/SATUATION REGISTER
157     */
158     #define MSK_HUE 0xE0
159     #define SHF_HUE 0
160     #define MAX_HUE 0x1f
161    
162     #define MSK_SATURATION 0x1F
163     #define SHF_SATURATION 5
164     #define MAX_SATURATION 0x07
165    
166    
167     /*
168     * *********************************************
169     * Display register settings
170     * *********************************************
171     *
172     * Screen Positioning Registers:
173     * DR 0-3
174     */
175     #define LEFTBORDER 0
176     #define DEF_LEFT 85
177     #define MIN_LEFT 75
178     #define MAX_LEFT 95
179     #define RIGHTBORDER 1
180     #define DEF_RIGHT (DEF_LEFT+256)
181     #define TOPBORDER 2
182     #define DEF_TOP 40
183     #define MIN_TOP 20
184     #define BOTTOMBORDER 3
185     #define DEF_BOTTOM (DEFTOP+DEFROWS/2)
186     #define MAX_BOTTOM 261
187    
188     /*
189     * REgisters which track 0-3
190     */
191     #define DR8 8
192     #define PRESHIFT DR8
193     #define EQU_DR8 DR0
194     #define DR9 9
195     #define EQU_DR9 DR1
196     #define DR10 10
197     #define EQU_DR10 DR2
198     #define DR11 11
199     #define EQU_DR11 DR3
200    
201     /*
202     * REQUIRED REGISTERS
203     */
204     #define DR4 4
205     #define DEF_DR4 352
206     #define DR5 5
207     #define DEF_DR5 1
208     #define DR6 6
209     #define DEF_DR6 0
210     #define DR7 7
211     #define DEF_DR7 511
212     #define DR12 12
213     #define DEF_DR12 20
214     #define DR13 13
215     #define DEF_DR13 22
216     #define DR14 14
217     #define DEF_DR14 0
218     #define DR15 15
219     #define DEF_DR15 511
220     #define DR16 16
221     #define DEF_DR16 0
222     #define DR17 17
223     #define DEF_DR17 0
224     #define DR18 18
225     #define DEF_DR18 0
226     #define DR19 19
227     #define DEF_DR19 4
228    
229     /* interlace mode register & parameters */
230     #define DR20 20
231     #define INTREG 0x14
232     #define DEF_INT 0 /* default to interlace mode 0 */
233     #define MSK_INTERLACE 0x0003
234    
235    
236    
237     struct TARStruct {
238     /* Board Configuration */
239     int memloc; /* memory segment */
240     int iobase; /* IOBASE segment */
241     int BytesPerPixel; /* number of words per pixel */
242     int RowsPerBank; /* number of row per 64K bank */
243     int MaxBanks; /* maximum bank id */
244     int AddressShift; /* number of bits to shift address */
245    
246     /* Control registers */
247     int mode; /* mode register */
248     int Mask; /* mask register */
249     int PageMode; /* current page mode (screen res. and page) */
250     unsigned PageLower; /* Lower Page Select register */
251     unsigned PageUpper; /* upper Page select register */
252     int VCRCon; /* VCRContract register */
253     int SatHue; /* Hue and Saturation register */
254     long BorderColor; /* Border color register */
255     int VertShift; /* Vertical Pan Register */
256    
257     int PanXOrig, PanYOrig; /* x,y pan origin */
258    
259     /* TARGA-SET PARAMETERS */
260     int boardType; /* See TYPE_XX IN THIS FILE */
261     /* FOR DEFINITION OF Board Types */
262     int xOffset; /* X-offset */
263     int yOffset; /* Y-Offset */
264     int LinesPerField; /* maximum visible row count */
265     int InterlaceMode; /* desired interlace mode */
266     int AlwaysGenLock; /* Genlock always on or not */
267     int Contrast; /* Desired Contrast */
268     int Hue; /* Desired Hue */
269     int Saturation; /* Desired Satuation */
270     int RGBorCV; /* CV or RGB Input */
271     int VCRorCamera; /* VCR or Camera */
272     int ovrscnAvail, ovrscnOn; /* ovrscnAvail 1 if Overscan installed */
273     /* ovrscnOn 1 if overscan is stretching */
274    
275     /* Display Registers */
276     int DisplayRegister[22];
277     };
278    
279     struct M8Struct {
280     int there; /* flag to indicate if m8 is present */
281     /* logical true if M8 present (i.e. 1) */
282     /* and logical false (0) otherwise */
283     int inOffset; /* input offset */
284     int inGain; /* input gain */
285     int inputMux; /* input channel */
286     int modeRegister; /* value of the mode register on the M8 top */
287     int inMap, outMap; /* active input/output color map */
288     int loopThru; /* logical flag if M8 loop-through is desired */
289     /* of CGA input 1---YES, 0---No */
290     int topFunction; /* currently selected top function */
291     int CGAInterlace; /* interlace mode for a CGA if used */
292     };
293    
294     #define M8MODE 0x400 /* IO Offset for writes to M8 Mode register */
295     #define M8WRITE 0x402 /* Offset for writes to M8 function registers */
296     #define M8READ 0x802 /* Offset for reads from M8 function registers */
297    
298     #define DEF_M8MODE 2
299     #define DEF_M8GAIN 50
300     #define DEF_M8OFFSET 50
301     #define DEF_M8MUX 0
302     #define DEF_M8INMAP 0
303     #define DEF_M8OUTMAP 0
304     #define DEF_CGAINTERLACE 3
305    
306    
307     struct hdStruct {
308     char textSize;
309     char mapType;
310     char dataType;
311     int mapOrig;
312     int mapLength;
313     char CMapBits;
314     int XOffset;
315     int YOffset;
316     int x;
317     int y;
318     int dataBits, imType;
319     } ;
320    
321    
322     /* stroke font file */
323    
324     typedef struct{
325     int width; /* width of character */
326     int height; /* height of char from baseline */
327     int descent; /* descent below baseline */
328     int index; /* index into stroke table */
329     } SFONTCHAR;
330    
331     typedef struct {
332     int dx; /* dx of character */
333     int dy; /* dy of character */
334     int dd; /* dy of descenders */
335     int first; /* value of first char in font */
336     int last; /* value of last char in font */
337     int *strokes; /* where the strokes are located */
338     SFONTCHAR *info; /* info on each character */
339     } SFONT;