Line data Source code
1 : /* $OpenBSD: pcdisplayvar.h,v 1.12 2017/05/30 08:24:56 fcambus Exp $ */
2 : /* $NetBSD: pcdisplayvar.h,v 1.8 2000/01/25 02:44:03 ad Exp $ */
3 :
4 : /*
5 : * Copyright (c) 1998
6 : * Matthias Drochner. All rights reserved.
7 : *
8 : * Redistribution and use in source and binary forms, with or without
9 : * modification, are permitted provided that the following conditions
10 : * are met:
11 : * 1. Redistributions of source code must retain the above copyright
12 : * notice, this list of conditions and the following disclaimer.
13 : * 2. Redistributions in binary form must reproduce the above copyright
14 : * notice, this list of conditions and the following disclaimer in the
15 : * documentation and/or other materials provided with the distribution.
16 : *
17 : * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 : * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 : * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 : * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 : * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 : * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 : * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 : * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 : * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 : * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 : *
28 : */
29 :
30 : struct pcdisplayscreen {
31 : struct pcdisplay_handle *hdl;
32 :
33 : const struct wsscreen_descr *type;
34 :
35 : int active; /* currently displayed */
36 : u_int16_t *mem; /* backing store for contents */
37 :
38 : int cursoron; /* cursor displayed? */
39 : #ifdef PCDISPLAY_SOFTCURSOR
40 : int cursortmp; /* glyph & attribute behind software cursor */
41 : #endif
42 : int vc_ccol, vc_crow; /* current cursor position */
43 :
44 : int dispoffset; /* offset of displayed area in video mem */
45 : int visibleoffset;
46 : };
47 :
48 : struct pcdisplay_handle {
49 : bus_space_tag_t ph_iot, ph_memt;
50 : bus_space_handle_t ph_ioh_6845, ph_memh;
51 : };
52 :
53 : static inline u_int8_t _pcdisplay_6845_read(struct pcdisplay_handle *, int);
54 : static inline void _pcdisplay_6845_write(struct pcdisplay_handle *,
55 : int, u_int8_t);
56 :
57 : static inline u_int8_t
58 0 : _pcdisplay_6845_read(struct pcdisplay_handle *ph, int reg)
59 : {
60 0 : bus_space_write_1(ph->ph_iot, ph->ph_ioh_6845, MC6845_INDEX, reg);
61 0 : return (bus_space_read_1(ph->ph_iot, ph->ph_ioh_6845, MC6845_DATA));
62 : }
63 :
64 : static inline void
65 0 : _pcdisplay_6845_write(struct pcdisplay_handle *ph, int reg, u_int8_t val)
66 : {
67 0 : bus_space_write_1(ph->ph_iot, ph->ph_ioh_6845, MC6845_INDEX, reg);
68 0 : bus_space_write_1(ph->ph_iot, ph->ph_ioh_6845, MC6845_DATA, val);
69 0 : }
70 :
71 : #define pcdisplay_6845_read(ph, reg) \
72 : _pcdisplay_6845_read(ph, offsetof(struct reg_mc6845, reg))
73 : #define pcdisplay_6845_write(ph, reg, val) \
74 : _pcdisplay_6845_write(ph, offsetof(struct reg_mc6845, reg), val)
75 :
76 : void pcdisplay_cursor_init(struct pcdisplayscreen *, int);
77 : void pcdisplay_cursor_reset(struct pcdisplayscreen *);
78 : int pcdisplay_cursor(void *, int, int, int);
79 : int pcdisplay_mapchar(void *, int, unsigned int *);
80 : int pcdisplay_putchar(void *, int, int, u_int, long);
81 : struct wsdisplay_charcell;
82 : int pcdisplay_getchar(void *, int, int, struct wsdisplay_charcell *);
83 : int pcdisplay_copycols(void *, int, int, int,int);
84 : int pcdisplay_erasecols(void *, int, int, int, long);
85 : int pcdisplay_copyrows(void *, int, int, int);
86 : int pcdisplay_eraserows(void *, int, int, long);
|