summaryrefslogtreecommitdiff
path: root/chips/sfb_misc.c
blob: a51e9a433a015bc333092543f48cb3c3fd9324aa (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
/* 
 * Mach Operating System
 * Copyright (c) 1992 Carnegie Mellon University
 * All Rights Reserved.
 * 
 * Permission to use, copy, modify and distribute this software and its
 * documentation is hereby granted, provided that both the copyright
 * notice and this permission notice appear in all copies of the
 * software, derivative works or modified versions, and any portions
 * thereof, and that both notices appear in supporting documentation.
 * 
 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
 * 
 * Carnegie Mellon requests users of this software to return to
 * 
 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
 *  School of Computer Science
 *  Carnegie Mellon University
 *  Pittsburgh PA 15213-3890
 * 
 * any improvements or extensions that they make and grant Carnegie Mellon
 * the rights to redistribute these changes.
 */
/*
 *	File: sfb_misc.c
 * 	Author: Alessandro Forin, Carnegie Mellon University
 *	Date: 11/92
 *
 *	Driver for the PMAGB-BA smart color framebuffer
 *
 */

#include <sfb.h>
#if	(NSFB > 0)
#include <platforms.h>

/*
 * NOTE: This driver relies heavily on the pm one, as well as the cfb.
 */

#include <device/device_types.h>
#include <chips/screen_defs.h>
#include <chips/pm_defs.h>
typedef pm_softc_t	sfb_softc_t;

#include <chips/bt459.h>
#define	bt459		cursor_registers

#ifdef	DECSTATION
#include <mips/PMAX/pmagb_ba.h>
#endif

#ifdef	FLAMINGO
#include <mips/PMAX/pmagb_ba.h>		/* XXXX */
#endif

/*
 * Initialize color map, for kernel use
 */
#define	sfb_init_colormap		cfb_init_colormap

/*
 * Position cursor
 */
sfb_pos_cursor(
	bt459_regmap_t	*regs,
	int		x,
	int		y)
{
	bt459_pos_cursor( regs, x + 368 - 219, y + 37 - 34);
}

/*
 * Large viz small cursor
 */
#define	sfb_small_cursor_to_large	cfb_small_cursor_to_large

/*
 * Device-specific set status
 */
#define sfb_set_status			cfb_set_status

/*
 * Hardware initialization
 */
sfb_init_screen(
	sfb_softc_t *sfb)
{
	bt459_init( sfb->bt459,
		    sfb->bt459 + (SFB_OFFSET_RESET - SFB_OFFSET_BT459),
		    4 /* 4:1 MUX */);
}

/*
 * Do what's needed when X exits
 */
sfb_soft_reset(
	screen_softc_t	sc)
{
	sfb_softc_t	*sfb = (sfb_softc_t*) sc->hw_state;
	user_info_t	*up =  sc->up;
	extern cursor_sprite_t	dc503_default_cursor;

	/*
	 * Restore params in mapped structure
	 */
	pm_init_screen_params(sc,up);
	up->row = up->max_row - 1;

	up->dev_dep_2.pm.x26 = 2; /* you do not want to know */
	up->dev_dep_1.pm.x18 = (short*)2;

	/*
	 * Restore RAMDAC chip to default state
	 */
	sfb_init_screen(sfb);

	/*
	 * Load kernel's cursor sprite: just use the same pmax one
	 */
	sfb_small_cursor_to_large(up, dc503_default_cursor);
	bt459_cursor_sprite(sfb->bt459, up->dev_dep_2.pm.cursor_sprite);

	/*
	 * Color map and cursor color
	 */
	sfb_init_colormap(sc);
}


#endif	(NSFB > 0)