|
|
1.1 root 1: /*
2: * Mach Operating System
3: * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4: * All Rights Reserved.
5: *
6: * Permission to use, copy, modify and distribute this software and its
7: * documentation is hereby granted, provided that both the copyright
8: * notice and this permission notice appear in all copies of the
9: * software, derivative works or modified versions, and any portions
10: * thereof, and that both notices appear in supporting documentation.
11: *
12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15: *
16: * Carnegie Mellon requests users of this software to return to
17: *
18: * Software Distribution Coordinator or [email protected]
19: * School of Computer Science
20: * Carnegie Mellon University
21: * Pittsburgh PA 15213-3890
22: *
23: * any improvements or extensions that they make and grant Carnegie Mellon
24: * the rights to redistribute these changes.
25: */
26: /*
27: * File: dc503.h
28: * Author: Alessandro Forin, Carnegie Mellon University
29: * Date: 9/90
30: *
31: * Routines for the DEC DC503 Programmable Cursor Chip
32: */
33: #include <platforms.h>
34:
35: #include <chips/pm_defs.h>
36: #include <chips/dc503.h>
37:
38:
39: #if defined(DECSTATION) || defined(VAXSTATION)
40:
41: typedef struct {
42: volatile unsigned short pcc_cmdr; /* all regs are wo */
43: short pad0;
44: volatile unsigned short pcc_xpos;
45: short pad1;
46: volatile unsigned short pcc_ypos;
47: short pad2;
48: volatile unsigned short pcc_xmin1;
49: short pad3;
50: volatile unsigned short pcc_xmax1;
51: short pad4;
52: volatile unsigned short pcc_ymin1;
53: short pad5;
54: volatile unsigned short pcc_ymax1;
55: short pad6[9];
56: volatile unsigned short pcc_xmin2;
57: short pad7;
58: volatile unsigned short pcc_xmax2;
59: short pad8;
60: volatile unsigned short pcc_ymin2;
61: short pad9;
62: volatile unsigned short pcc_ymax2;
63: short pad10;
64: volatile unsigned short pcc_memory;
65: short pad11;
66: } dc503_padded_regmap_t;
67:
68: #else
69:
70: typedef dc503_regmap_t dc503_padded_regmap_t;
71:
72: #endif
73:
74: #ifdef VAXSTATION
75: #define X_CSHIFT 216
76: #define Y_CSHIFT 34
77: #define wbflush()
78: #define PCC_STATE (DC503_CMD_ENPA | DC503_CMD_ENPB | DC503_CMD_HSHI)
79: #endif /*VAXSTATION*/
80:
81: /* defaults, for the innocents */
82:
83: #ifndef X_CSHIFT
84: #define X_CSHIFT 212
85: #define Y_CSHIFT 34
86: #define PCC_STATE (DC503_CMD_ENPA | DC503_CMD_ENPB)
87: #endif
88:
89: /*
90: * Cursor
91: */
92: dc503_pos_cursor( regs, x, y)
93: dc503_padded_regmap_t *regs;
94: {
95: regs->pcc_xpos = x + X_CSHIFT;
96: regs->pcc_ypos = y + Y_CSHIFT;
97: wbflush();
98: }
99:
100: dc503_load_cursor( pm, cursor)
101: pm_softc_t *pm;
102: unsigned short *cursor;
103: {
104: dc503_padded_regmap_t *regs;
105: register int i;
106:
107: regs = (dc503_padded_regmap_t*)pm->cursor_registers;
108:
109: pm->cursor_state |= DC503_CMD_LODSA;
110: regs->pcc_cmdr = pm->cursor_state;
111: wbflush();
112: for (i = 0; i < 32; i++) {
113: regs->pcc_memory = *cursor++;
114: wbflush();
115: }
116: pm->cursor_state &= ~DC503_CMD_LODSA;
117: regs->pcc_cmdr = pm->cursor_state;
118: }
119:
120:
121: unsigned short dc503_default_cursor[16+16] = {
122: /* Plane A */
123: 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
124: 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
125: /* Plane B */
126: 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
127: 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff
128: };
129:
130: /*
131: * Vert retrace interrupt
132: */
133: dc503_vretrace( pm, on)
134: pm_softc_t *pm;
135: {
136: if (on)
137: pm->cursor_state |= DC503_CMD_ENRG2;
138: else
139: pm->cursor_state &= ~DC503_CMD_ENRG2;
140: ((dc503_padded_regmap_t*)pm->cursor_registers)->pcc_cmdr = pm->cursor_state;
141: }
142:
143: /*
144: * Video on/off
145: */
146: dc503_video_on( pm, up)
147: pm_softc_t *pm;
148: {
149: pm->cursor_state = DC503_CMD_ENPA | (pm->cursor_state & ~DC503_CMD_FOPB);
150: ((dc503_padded_regmap_t*)pm->cursor_registers)->pcc_cmdr = pm->cursor_state;
151: }
152:
153: dc503_video_off( pm, up)
154: pm_softc_t *pm;
155: {
156: pm->cursor_state = DC503_CMD_FOPB | (pm->cursor_state & ~DC503_CMD_ENPA);
157: ((dc503_padded_regmap_t*)pm->cursor_registers)->pcc_cmdr = pm->cursor_state;
158: }
159:
160:
161: /*
162: * Initialization
163: */
164: dc503_init( pm )
165: pm_softc_t *pm;
166: {
167: dc503_padded_regmap_t *regs;
168:
169: regs = (dc503_padded_regmap_t*)pm->cursor_registers;
170:
171: dc503_load_cursor( pm, dc503_default_cursor);
172: dc503_pos_cursor( regs, 0, 0); /* XXX off screen */
173:
174: regs->pcc_xmin1 = 0; /* test only */
175: regs->pcc_xmax1 = 0;
176: regs->pcc_ymin1 = 0;
177: regs->pcc_ymax1 = 0;
178:
179: regs->pcc_xmin2 = 212; /* vert retrace detector */
180: regs->pcc_xmax2 = 212+1023;
181: regs->pcc_ymin2 = 34+863;
182: regs->pcc_ymax2 = 34+863;
183:
184: #if 0
185: regs->pcc_cmdr = DC503_CMD_FOPB | DC503_CMD_VBHI;/* reset */
186: #endif
187: pm->cursor_state = PCC_STATE;
188: regs->pcc_cmdr = pm->cursor_state;
189: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.