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