root/dev/ic/vgavar.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. _vga_attr_read
  2. _vga_attr_write
  3. _vga_ts_read
  4. _vga_ts_write
  5. _vga_gdc_read
  6. _vga_gdc_write

    1 /* $OpenBSD: vgavar.h,v 1.8 2002/07/12 20:17:03 mickey Exp $ */
    2 /* $NetBSD: vgavar.h,v 1.4 2000/06/17 07:11:50 soda Exp $ */
    3 
    4 /*
    5  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
    6  * All rights reserved.
    7  *
    8  * Author: Chris G. Demetriou
    9  * 
   10  * Permission to use, copy, modify and distribute this software and
   11  * its documentation is hereby granted, provided that both the copyright
   12  * notice and this permission notice appear in all copies of the
   13  * software, derivative works or modified versions, and any portions
   14  * thereof, and that both notices appear in supporting documentation.
   15  * 
   16  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
   17  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
   18  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   19  * 
   20  * Carnegie Mellon requests users of this software to return to
   21  *
   22  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   23  *  School of Computer Science
   24  *  Carnegie Mellon University
   25  *  Pittsburgh PA 15213-3890
   26  *
   27  * any improvements or extensions that they make and grant Carnegie the
   28  * rights to redistribute these changes.
   29  */
   30 
   31 #include <sys/timeout.h>
   32 
   33 struct vga_handle {
   34         struct pcdisplay_handle vh_ph;
   35         bus_space_handle_t vh_ioh_vga, vh_allmemh;
   36         int vh_mono;
   37 };
   38 #define vh_iot vh_ph.ph_iot
   39 #define vh_memt vh_ph.ph_memt
   40 #define vh_ioh_6845 vh_ph.ph_ioh_6845
   41 #define vh_memh vh_ph.ph_memh
   42 
   43 struct vga_config {
   44         struct vga_handle hdl;
   45 
   46         struct device *vc_softc;
   47         int vc_type;
   48         int nscreens;
   49         LIST_HEAD(, vgascreen) screens;
   50         struct vgascreen *active; /* current display */
   51         const struct wsscreen_descr *currenttype;
   52         int currentfontset1, currentfontset2;
   53 
   54         struct vgafont *vc_fonts[8];
   55 
   56         struct vgascreen *wantedscreen;
   57         void (*switchcb)(void *, int, int);
   58         void *switchcbarg;
   59 
   60         paddr_t (*vc_mmap)(void *, off_t, int);
   61 
   62         struct timeout vc_switch_timeout;
   63 };
   64 
   65 static inline u_int8_t _vga_attr_read(struct vga_handle *, int);
   66 static inline void _vga_attr_write(struct vga_handle *, int, u_int8_t);
   67 static inline u_int8_t _vga_ts_read(struct vga_handle *, int);
   68 static inline void _vga_ts_write(struct vga_handle *, int, u_int8_t);
   69 static inline u_int8_t _vga_gdc_read(struct vga_handle *, int);
   70 static inline void _vga_gdc_write(struct vga_handle *, int, u_int8_t);
   71 
   72 static inline u_int8_t _vga_attr_read(vh, reg)
   73         struct vga_handle *vh;
   74         int reg;
   75 {
   76         u_int8_t res;
   77 
   78         /* reset state */
   79         (void) bus_space_read_1(vh->vh_iot, vh->vh_ioh_6845, 10);
   80 
   81         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_ATC_INDEX, reg);
   82         res = bus_space_read_1(vh->vh_iot, vh->vh_ioh_vga, VGA_ATC_DATAR);
   83 
   84         /* reset state XXX unneeded? */
   85         (void) bus_space_read_1(vh->vh_iot, vh->vh_ioh_6845, 10);
   86 
   87         /* enable */
   88         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, 0, 0x20);
   89 
   90         return (res);
   91 }
   92 
   93 static inline void _vga_attr_write(vh, reg, val)
   94         struct vga_handle *vh;
   95         int reg;
   96         u_int8_t val;
   97 {
   98         /* reset state */
   99         (void) bus_space_read_1(vh->vh_iot, vh->vh_ioh_6845, 10);
  100 
  101         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_ATC_INDEX, reg);
  102         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_ATC_DATAW, val);
  103 
  104         /* reset state XXX unneeded? */
  105         (void) bus_space_read_1(vh->vh_iot, vh->vh_ioh_6845, 10);
  106 
  107         /* enable */
  108         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, 0, 0x20);
  109 }
  110 
  111 static inline u_int8_t _vga_ts_read(vh, reg)
  112         struct vga_handle *vh;
  113         int reg;
  114 {
  115         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_TS_INDEX, reg);
  116         return (bus_space_read_1(vh->vh_iot, vh->vh_ioh_vga, VGA_TS_DATA));
  117 }
  118 
  119 static inline void _vga_ts_write(vh, reg, val)
  120         struct vga_handle *vh;
  121         int reg;
  122         u_int8_t val;
  123 {
  124         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_TS_INDEX, reg);
  125         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_TS_DATA, val);
  126 }
  127 
  128 static inline u_int8_t _vga_gdc_read(vh, reg)
  129         struct vga_handle *vh;
  130         int reg;
  131 {
  132         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_GDC_INDEX, reg);
  133         return (bus_space_read_1(vh->vh_iot, vh->vh_ioh_vga, VGA_GDC_DATA));
  134 }
  135 
  136 static inline void _vga_gdc_write(vh, reg, val)
  137         struct vga_handle *vh;
  138         int reg;
  139         u_int8_t val;
  140 {
  141         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_GDC_INDEX, reg);
  142         bus_space_write_1(vh->vh_iot, vh->vh_ioh_vga, VGA_GDC_DATA, val);
  143 }
  144 
  145 #define vga_attr_read(vh, reg) \
  146         _vga_attr_read(vh, offsetof(struct reg_vgaattr, reg))
  147 #define vga_attr_write(vh, reg, val) \
  148         _vga_attr_write(vh, offsetof(struct reg_vgaattr, reg), val)
  149 #define vga_ts_read(vh, reg) \
  150         _vga_ts_read(vh, offsetof(struct reg_vgats, reg))
  151 #define vga_ts_write(vh, reg, val) \
  152         _vga_ts_write(vh, offsetof(struct reg_vgats, reg), val)
  153 #define vga_gdc_read(vh, reg) \
  154         _vga_gdc_read(vh, offsetof(struct reg_vgagdc, reg))
  155 #define vga_gdc_write(vh, reg, val) \
  156         _vga_gdc_write(vh, offsetof(struct reg_vgagdc, reg), val)
  157 
  158 #define vga_6845_read(vh, reg) \
  159         pcdisplay_6845_read(&(vh)->vh_ph, reg)
  160 #define vga_6845_write(vh, reg, val) \
  161         pcdisplay_6845_write(&(vh)->vh_ph, reg, val)
  162 
  163 int     vga_common_probe(bus_space_tag_t, bus_space_tag_t);
  164 void    vga_common_attach(struct device *, bus_space_tag_t,
  165                                bus_space_tag_t, int);
  166 void    vga_extended_attach(struct device *, bus_space_tag_t,
  167     bus_space_tag_t, int, paddr_t (*)(void *, off_t, int));
  168 int     vga_is_console(bus_space_tag_t, int);
  169 int     vga_cnattach(bus_space_tag_t, bus_space_tag_t, int, int);
  170 
  171 struct wsscreen_descr;
  172 void vga_loadchars(struct vga_handle *, int, int, int, int, char *);
  173 void vga_setfontset(struct vga_handle *, int, int);
  174 void vga_setscreentype(struct vga_handle *,
  175                        const struct wsscreen_descr *);
  176 #if NVGA_PCI > 0
  177 int vga_pci_ioctl(void *, u_long, caddr_t, int, struct proc *); 
  178 #endif

/* [<][>][^][v][top][bottom][index][help] */