FreeBSD/Linux Kernel Cross Reference
sys/chips/dc503.c
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 Software.Distribution@CS.CMU.EDU
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 * HISTORY
28 * $Log: dc503.c,v $
29 * Revision 2.8 93/02/05 08:05:06 danner
30 * Everybody needs this because of the cursor, simplified
31 * defines.
32 * [93/02/04 01:24:17 af]
33 *
34 * Revision 2.7 91/08/24 11:51:38 af
35 * Moved padding of regmap here. Rid of "struct pcc" hack, now
36 * we understand a pm_softc, and compatibles.
37 * [91/08/02 02:27:53 af]
38 *
39 * Revision 2.6 91/06/19 11:47:22 rvb
40 * mips->DECSTATION; vax->VAXSTATION
41 * [91/06/12 14:01:22 rvb]
42 *
43 * File moved here from mips/PMAX since it tries to be generic;
44 * it is used on the PMAX and the Vax3100.
45 * [91/06/04 rvb]
46 *
47 * Revision 2.5 91/05/14 17:20:33 mrt
48 * Correcting copyright
49 *
50 * Revision 2.4 91/02/05 17:40:14 mrt
51 * Added author notices
52 * [91/02/04 11:12:34 mrt]
53 *
54 * Changed to use new Mach copyright
55 * [91/02/02 12:10:24 mrt]
56 *
57 * Revision 2.3 90/12/05 23:30:42 af
58 * Works now.
59 * [90/12/03 23:12:48 af]
60 *
61 * Revision 2.1.1.1 90/11/01 03:43:21 af
62 * Created, from the DEC specs:
63 * "DECstation 3100 Desktop Workstation Functional Specification"
64 * Workstation Systems Engineering, Palo Alto, CA. Aug 28, 1990.
65 * [90/09/03 af]
66 */
67 /*
68 * File: dc503.h
69 * Author: Alessandro Forin, Carnegie Mellon University
70 * Date: 9/90
71 *
72 * Routines for the DEC DC503 Programmable Cursor Chip
73 */
74 #include <platforms.h>
75
76 #include <chips/pm_defs.h>
77 #include <chips/dc503.h>
78
79
80 #if defined(DECSTATION) || defined(VAXSTATION)
81
82 typedef struct {
83 volatile unsigned short pcc_cmdr; /* all regs are wo */
84 short pad0;
85 volatile unsigned short pcc_xpos;
86 short pad1;
87 volatile unsigned short pcc_ypos;
88 short pad2;
89 volatile unsigned short pcc_xmin1;
90 short pad3;
91 volatile unsigned short pcc_xmax1;
92 short pad4;
93 volatile unsigned short pcc_ymin1;
94 short pad5;
95 volatile unsigned short pcc_ymax1;
96 short pad6[9];
97 volatile unsigned short pcc_xmin2;
98 short pad7;
99 volatile unsigned short pcc_xmax2;
100 short pad8;
101 volatile unsigned short pcc_ymin2;
102 short pad9;
103 volatile unsigned short pcc_ymax2;
104 short pad10;
105 volatile unsigned short pcc_memory;
106 short pad11;
107 } dc503_padded_regmap_t;
108
109 #else
110
111 typedef dc503_regmap_t dc503_padded_regmap_t;
112
113 #endif
114
115 #ifdef VAXSTATION
116 #define X_CSHIFT 216
117 #define Y_CSHIFT 34
118 #define wbflush()
119 #define PCC_STATE (DC503_CMD_ENPA | DC503_CMD_ENPB | DC503_CMD_HSHI)
120 #endif /*VAXSTATION*/
121
122 /* defaults, for the innocents */
123
124 #ifndef X_CSHIFT
125 #define X_CSHIFT 212
126 #define Y_CSHIFT 34
127 #define PCC_STATE (DC503_CMD_ENPA | DC503_CMD_ENPB)
128 #endif
129
130 /*
131 * Cursor
132 */
133 dc503_pos_cursor( regs, x, y)
134 dc503_padded_regmap_t *regs;
135 {
136 regs->pcc_xpos = x + X_CSHIFT;
137 regs->pcc_ypos = y + Y_CSHIFT;
138 wbflush();
139 }
140
141 dc503_load_cursor( pm, cursor)
142 pm_softc_t *pm;
143 unsigned short *cursor;
144 {
145 dc503_padded_regmap_t *regs;
146 register int i;
147
148 regs = (dc503_padded_regmap_t*)pm->cursor_registers;
149
150 pm->cursor_state |= DC503_CMD_LODSA;
151 regs->pcc_cmdr = pm->cursor_state;
152 wbflush();
153 for (i = 0; i < 32; i++) {
154 regs->pcc_memory = *cursor++;
155 wbflush();
156 }
157 pm->cursor_state &= ~DC503_CMD_LODSA;
158 regs->pcc_cmdr = pm->cursor_state;
159 }
160
161
162 unsigned short dc503_default_cursor[16+16] = {
163 /* Plane A */
164 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
165 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
166 /* Plane B */
167 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
168 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff
169 };
170
171 /*
172 * Vert retrace interrupt
173 */
174 dc503_vretrace( pm, on)
175 pm_softc_t *pm;
176 {
177 if (on)
178 pm->cursor_state |= DC503_CMD_ENRG2;
179 else
180 pm->cursor_state &= ~DC503_CMD_ENRG2;
181 ((dc503_padded_regmap_t*)pm->cursor_registers)->pcc_cmdr = pm->cursor_state;
182 }
183
184 /*
185 * Video on/off
186 */
187 dc503_video_on( pm, up)
188 pm_softc_t *pm;
189 {
190 pm->cursor_state = DC503_CMD_ENPA | (pm->cursor_state & ~DC503_CMD_FOPB);
191 ((dc503_padded_regmap_t*)pm->cursor_registers)->pcc_cmdr = pm->cursor_state;
192 }
193
194 dc503_video_off( pm, up)
195 pm_softc_t *pm;
196 {
197 pm->cursor_state = DC503_CMD_FOPB | (pm->cursor_state & ~DC503_CMD_ENPA);
198 ((dc503_padded_regmap_t*)pm->cursor_registers)->pcc_cmdr = pm->cursor_state;
199 }
200
201
202 /*
203 * Initialization
204 */
205 dc503_init( pm )
206 pm_softc_t *pm;
207 {
208 dc503_padded_regmap_t *regs;
209
210 regs = (dc503_padded_regmap_t*)pm->cursor_registers;
211
212 dc503_load_cursor( pm, dc503_default_cursor);
213 dc503_pos_cursor( regs, 0, 0); /* XXX off screen */
214
215 regs->pcc_xmin1 = 0; /* test only */
216 regs->pcc_xmax1 = 0;
217 regs->pcc_ymin1 = 0;
218 regs->pcc_ymax1 = 0;
219
220 regs->pcc_xmin2 = 212; /* vert retrace detector */
221 regs->pcc_xmax2 = 212+1023;
222 regs->pcc_ymin2 = 34+863;
223 regs->pcc_ymax2 = 34+863;
224
225 #if 0
226 regs->pcc_cmdr = DC503_CMD_FOPB | DC503_CMD_VBHI;/* reset */
227 #endif
228 pm->cursor_state = PCC_STATE;
229 regs->pcc_cmdr = pm->cursor_state;
230 }
Cache object: 3efc0c5edaa9d3be3ac721156c973883
|