The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/bt463.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* $NetBSD: bt463.c,v 1.13 2008/04/28 20:23:49 martin Exp $ */
    2 
    3 /*-
    4  * Copyright (c) 1998 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
    9  * NASA Ames Research Center.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   30  * POSSIBILITY OF SUCH DAMAGE.
   31  */
   32 
   33 /*
   34  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
   35  * All rights reserved.
   36  *
   37  * Author: Chris G. Demetriou
   38  *
   39  * Permission to use, copy, modify and distribute this software and
   40  * its documentation is hereby granted, provided that both the copyright
   41  * notice and this permission notice appear in all copies of the
   42  * software, derivative works or modified versions, and any portions
   43  * thereof, and that both notices appear in supporting documentation.
   44  *
   45  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   46  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
   47  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   48  *
   49  * Carnegie Mellon requests users of this software to return to
   50  *
   51  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   52  *  School of Computer Science
   53  *  Carnegie Mellon University
   54  *  Pittsburgh PA 15213-3890
   55  *
   56  * any improvements or extensions that they make and grant Carnegie the
   57  * rights to redistribute these changes.
   58  */
   59 
   60  /* This code was derived from and originally located in sys/dev/pci/
   61   *      NetBSD: tga_bt463.c,v 1.5 2000/03/04 10:27:59 elric Exp
   62   */
   63 
   64 #include <sys/cdefs.h>
   65 __KERNEL_RCSID(0, "$NetBSD: bt463.c,v 1.13 2008/04/28 20:23:49 martin Exp $");
   66 
   67 #include <sys/param.h>
   68 #include <sys/systm.h>
   69 #include <sys/device.h>
   70 #include <sys/buf.h>
   71 #include <sys/kernel.h>
   72 #include <sys/malloc.h>
   73 
   74 #include <uvm/uvm_extern.h>
   75 
   76 #include <dev/pci/pcivar.h>
   77 #include <dev/pci/tgareg.h>
   78 #include <dev/pci/tgavar.h>
   79 #include <dev/ic/bt463reg.h>
   80 #include <dev/ic/bt463var.h>
   81 
   82 #include <dev/wscons/wsconsio.h>
   83 
   84 /*
   85  * Functions exported via the RAMDAC configuration table.
   86  */
   87 void    bt463_init(struct ramdac_cookie *);
   88 int     bt463_set_cmap(struct ramdac_cookie *, struct wsdisplay_cmap *);
   89 int     bt463_get_cmap(struct ramdac_cookie *, struct wsdisplay_cmap *);
   90 int     bt463_set_cursor(struct ramdac_cookie *, struct wsdisplay_cursor *);
   91 int     bt463_get_cursor(struct ramdac_cookie *, struct wsdisplay_cursor *);
   92 int     bt463_set_curpos(struct ramdac_cookie *, struct wsdisplay_curpos *);
   93 int     bt463_get_curpos(struct ramdac_cookie *, struct wsdisplay_curpos *);
   94 int     bt463_get_curmax(struct ramdac_cookie *, struct wsdisplay_curpos *);
   95 int     bt463_check_curcmap(struct ramdac_cookie *,
   96             struct wsdisplay_cursor *cursorp);
   97 void    bt463_set_curcmap(struct ramdac_cookie *,
   98             struct wsdisplay_cursor *cursorp);
   99 int     bt463_get_curcmap(struct ramdac_cookie *,
  100             struct wsdisplay_cursor *cursorp);
  101 
  102 #ifdef BT463_DEBUG
  103 int bt463_store(void *);
  104 int bt463_debug(void *);
  105 int bt463_readback(void *);
  106 void    bt463_copyback(void *);
  107 #endif
  108 
  109 struct ramdac_funcs bt463_funcsstruct = {
  110         "Bt463",
  111         bt463_register,
  112         bt463_init,
  113         bt463_set_cmap,
  114         bt463_get_cmap,
  115         bt463_set_cursor,
  116         bt463_get_cursor,
  117         bt463_set_curpos,
  118         bt463_get_curpos,
  119         bt463_get_curmax,
  120         bt463_check_curcmap,
  121         bt463_set_curcmap,
  122         bt463_get_curcmap,
  123         NULL,
  124 };
  125 
  126 /*
  127  * Private data.
  128  */
  129 struct bt463data {
  130         void            *cookie;        /* This is what is passed
  131                                          * around, and is probably
  132                                          * struct tga_devconfig *
  133                                          */
  134 
  135         int             (*ramdac_sched_update)(void *, void (*)(void *));
  136         void            (*ramdac_wr)(void *, u_int, u_int8_t);
  137         u_int8_t        (*ramdac_rd)(void *, u_int);
  138 
  139         int     changed;                        /* what changed; see below */
  140         char curcmap_r[2];                      /* cursor colormap */
  141         char curcmap_g[2];
  142         char curcmap_b[2];
  143         char tmpcurcmap_r[2];                   /* tmp cursor colormap */
  144         char tmpcurcmap_g[2];
  145         char tmpcurcmap_b[2];
  146         char cmap_r[BT463_NCMAP_ENTRIES];       /* colormap */
  147         char cmap_g[BT463_NCMAP_ENTRIES];
  148         char cmap_b[BT463_NCMAP_ENTRIES];
  149         int window_type[16]; /* 16 24-bit window type table entries */
  150 };
  151 
  152 /* When we're doing console initialization, there's no
  153  * way to get our cookie back to the video card's softc
  154  * before we call sched_update. So we stash it here,
  155  * and bt463_update will look for it here first.
  156  */
  157 static struct bt463data *console_data;
  158 
  159 
  160 #define BTWREG(data, addr, val) do { bt463_wraddr((data), (addr)); \
  161         (data)->ramdac_wr((data)->cookie, BT463_REG_IREG_DATA, (val)); } while (0)
  162 #define BTWNREG(data, val) (data)->ramdac_wr((data)->cookie, \
  163         BT463_REG_IREG_DATA, (val))
  164 #define BTRREG(data, addr) (bt463_wraddr((data), (addr)), \
  165         (data)->ramdac_rd((data)->cookie, BT463_REG_IREG_DATA))
  166 #define BTRNREG(data) ((data)->ramdac_rd((data)->cookie, BT463_REG_IREG_DATA))
  167 
  168 #define DATA_CURCMAP_CHANGED    0x01    /* cursor colormap changed */
  169 #define DATA_CMAP_CHANGED       0x02    /* colormap changed */
  170 #define DATA_WTYPE_CHANGED      0x04    /* window type table changed */
  171 #define DATA_ALL_CHANGED        0x07
  172 
  173 /*
  174  * Internal functions.
  175  */
  176 inline void bt463_wraddr(struct bt463data *, u_int16_t);
  177 
  178 void    bt463_update(void *);
  179 
  180 
  181 /*****************************************************************************/
  182 
  183 /*
  184  * Functions exported via the RAMDAC configuration table.
  185  */
  186 
  187 struct ramdac_funcs *
  188 bt463_funcs(void)
  189 {
  190         return &bt463_funcsstruct;
  191 }
  192 
  193 struct ramdac_cookie *
  194 bt463_register(v, sched_update, wr, rd)
  195         void *v;
  196         int (*sched_update)(void *, void (*)(void *));
  197         void (*wr)(void *, u_int, u_int8_t);
  198         u_int8_t (*rd)(void *, u_int);
  199 {
  200         struct bt463data *data;
  201         /*
  202          * XXX -- comment out of date.  rcd.
  203          * If we should allocate a new private info struct, do so.
  204          * Otherwise, use the one we have (if it's there), or
  205          * use the temporary one on the stack.
  206          */
  207         data = malloc(sizeof *data, M_DEVBUF, M_WAITOK);
  208         /* XXX -- if !data */
  209         data->cookie = v;
  210         data->ramdac_sched_update = sched_update;
  211         data->ramdac_wr = wr;
  212         data->ramdac_rd = rd;
  213         return (struct ramdac_cookie *)data;
  214 }
  215 
  216 /*
  217  * This function exists solely to provide a means to init
  218  * the RAMDAC without first registering.  It is useful for
  219  * initializing the console early on.
  220  */
  221 void
  222 bt463_cninit(v, sched_update, wr, rd)
  223         void *v;
  224         int (*sched_update)(void *, void (*)(void *));
  225         void (*wr)(void *, u_int, u_int8_t);
  226         u_int8_t (*rd)(void *, u_int);
  227 {
  228         struct bt463data tmp, *data = &tmp;
  229         data->cookie = v;
  230         data->ramdac_sched_update = sched_update;
  231         data->ramdac_wr = wr;
  232         data->ramdac_rd = rd;
  233         /* Set up console_data so that when bt463_update is called back,
  234          * it can use the right information.
  235          */
  236         console_data = data;
  237         bt463_init((struct ramdac_cookie *)data);
  238         console_data = NULL;
  239 }
  240 
  241 void
  242 bt463_init(rc)
  243         struct ramdac_cookie *rc;
  244 {
  245         struct bt463data *data = (struct bt463data *)rc;
  246 
  247         int i;
  248 
  249         /*
  250          * Init the BT463 for normal operation.
  251          */
  252 
  253 
  254         /*
  255          * Setup:
  256          * reg 0: 4:1 multiplexing, 25/75 blink.
  257          * reg 1: Overlay mapping: mapped to common palette,
  258          *        14 window type entries, 24-plane configuration mode,
  259          *        4 overlay planes, underlays disabled, no cursor.
  260          * reg 2: sync-on-green enabled, pedestal enabled.
  261          */
  262 
  263         BTWREG(data, BT463_IREG_COMMAND_0, 0x40);
  264         BTWREG(data, BT463_IREG_COMMAND_1, 0x48);
  265         BTWREG(data, BT463_IREG_COMMAND_2, 0x40);
  266 
  267         /*
  268          * Initialize the read mask.
  269          */
  270         bt463_wraddr(data, BT463_IREG_READ_MASK_P0_P7);
  271         for (i = 0; i < 4; i++)
  272                 BTWNREG(data, 0xff);
  273 
  274         /*
  275          * Initialize the blink mask.
  276          */
  277         bt463_wraddr(data, BT463_IREG_BLINK_MASK_P0_P7);
  278         for (i = 0; i < 4; i++)
  279                 BTWNREG(data, 0);
  280 
  281 
  282         /*
  283          * Clear test register
  284          */
  285         BTWREG(data, BT463_IREG_TEST, 0);
  286 
  287         /*
  288          * Initialize the RAMDAC info struct to hold all of our
  289          * data, and fill it in.
  290          */
  291         data->changed = DATA_ALL_CHANGED;
  292 
  293         /* initial cursor colormap: 0 is black, 1 is white */
  294         data->curcmap_r[0] = data->curcmap_g[0] = data->curcmap_b[0] = 0;
  295         data->curcmap_r[1] = data->curcmap_g[1] = data->curcmap_b[1] = 0xff;
  296 
  297         /* Initial colormap: 0 is black, everything else is white */
  298         data->cmap_r[0] = data->cmap_g[0] = data->cmap_b[0] = 0;
  299         for (i = 1; i < 256; i++)
  300                 data->cmap_r[i] = data->cmap_g[i] = data->cmap_b[i] = 255;
  301 
  302 
  303         /* Initialize the window type table:
  304          *
  305          * Entry 0: 24-plane truecolor, overlays enabled, bypassed.
  306          *
  307          *  Lookup table bypass:      yes (    1 << 23 & 0x800000)  800000
  308          *  Colormap address:       0x000 (0x000 << 17 & 0x7e0000)       0
  309          *  Overlay mask:             0xf (  0xf << 13 & 0x01e000)   1e000
  310          *  Overlay location:    P<27:24> (    0 << 12 & 0x001000)       0
  311          *  Display mode:       Truecolor (    0 <<  9 & 0x000e00)     000
  312          *  Number of planes:           8 (    8 <<  5 & 0x0001e0)     100
  313          *  Plane shift:                0 (    0 <<  0 & 0x00001f)       0
  314          *                                                        --------
  315          *                                                        0x81e100
  316          */
  317         data->window_type[0] = 0x81e100;
  318 
  319         /* Entry 1: 8-plane pseudocolor in the bottom 8 bits,
  320          *          overlays enabled, colormap starting at 0.
  321          *
  322          *  Lookup table bypass:       no (    0 << 23 & 0x800000)       0
  323          *  Colormap address:       0x000 (0x000 << 17 & 0x7e0000)       0
  324          *  Overlay mask:             0xf (  0xf << 13 & 0x01e000) 0x1e000
  325          *  Overlay location:    P<27:24> (    0 << 12 & 0x001000)       0
  326          *  Display mode:     Pseudocolor (    1 <<  9 & 0x000e00)   0x200
  327          *  Number of planes:           8 (    8 <<  5 & 0x0001e0)   0x100
  328          *  Plane shift:               16 ( 0x10 <<  0 & 0x00001f)      10
  329          *                                                        --------
  330          *                                                        0x01e310
  331          */
  332         data->window_type[1] = 0x01e310;
  333 
  334         /* The colormap interface to the world only supports one colormap,
  335          * so having an entry for the 'alternate' colormap in the bt463
  336          * probably isn't useful.
  337          */
  338 
  339         /* Fill the remaining table entries with clones of entry 0 until we
  340          * figure out a better use for them.
  341          */
  342 
  343         for (i = 2; i < BT463_NWTYPE_ENTRIES; i++) {
  344                 data->window_type[i] = 0x81e100;
  345         }
  346 
  347         data->ramdac_sched_update(data->cookie, bt463_update);
  348 
  349 }
  350 
  351 int
  352 bt463_set_cmap(rc, cmapp)
  353         struct ramdac_cookie *rc;
  354         struct wsdisplay_cmap *cmapp;
  355 {
  356         struct bt463data *data = (struct bt463data *)rc;
  357         u_int count, index;
  358         uint8_t r[BT463_NCMAP_ENTRIES];
  359         uint8_t g[BT463_NCMAP_ENTRIES];
  360         uint8_t b[BT463_NCMAP_ENTRIES];
  361         int s, error;
  362 
  363         if (cmapp->index >= BT463_NCMAP_ENTRIES ||
  364             cmapp->count > BT463_NCMAP_ENTRIES - cmapp->index)
  365                 return (EINVAL);
  366 
  367         index = cmapp->index;
  368         count = cmapp->count;
  369         error = copyin(cmapp->red, &r[index], count);
  370         if (error)
  371                 return error;
  372         error = copyin(cmapp->green, &g[index], count);
  373         if (error)
  374                 return error;
  375         error = copyin(cmapp->blue, &b[index], count);
  376         if (error)
  377                 return error;
  378         s = spltty();
  379         memcpy(&data->cmap_r[index], &r[index], count);
  380         memcpy(&data->cmap_g[index], &g[index], count);
  381         memcpy(&data->cmap_b[index], &b[index], count);
  382         data->changed |= DATA_CMAP_CHANGED;
  383         data->ramdac_sched_update(data->cookie, bt463_update);
  384         splx(s);
  385         return (0);
  386 }
  387 
  388 int
  389 bt463_get_cmap(rc, cmapp)
  390         struct ramdac_cookie *rc;
  391         struct wsdisplay_cmap *cmapp;
  392 {
  393         struct bt463data *data = (struct bt463data *)rc;
  394         u_int count, index;
  395         int error;
  396 
  397         if (cmapp->index >= BT463_NCMAP_ENTRIES ||
  398             cmapp->count > BT463_NCMAP_ENTRIES - cmapp->index)
  399                 return (EINVAL);
  400 
  401         count = cmapp->count;
  402         index = cmapp->index;
  403 
  404         error = copyout(&data->cmap_r[index], cmapp->red, count);
  405         if (error)
  406                 return (error);
  407         error = copyout(&data->cmap_g[index], cmapp->green, count);
  408         if (error)
  409                 return (error);
  410         error = copyout(&data->cmap_b[index], cmapp->blue, count);
  411         return (error);
  412 }
  413 
  414 int
  415 bt463_check_curcmap(rc, cursorp)
  416         struct ramdac_cookie *rc;
  417         struct wsdisplay_cursor *cursorp;
  418 {
  419         struct bt463data *data = (struct bt463data *)rc;
  420         int count, index, error;
  421 
  422         if (cursorp->cmap.index > 2 ||
  423             (cursorp->cmap.index + cursorp->cmap.count) > 2)
  424                 return (EINVAL);
  425         count = cursorp->cmap.count;
  426         index = cursorp->cmap.index;
  427         error = copyin(cursorp->cmap.red, &data->tmpcurcmap_r[index], count);
  428         if (error)
  429                 return error;
  430         error = copyin(cursorp->cmap.green, &data->tmpcurcmap_g[index], count);
  431         if (error)
  432                 return error;
  433         error = copyin(cursorp->cmap.blue, &data->tmpcurcmap_b[index], count);
  434         if (error)
  435                 return error;
  436         return (0);
  437 }
  438 
  439 void
  440 bt463_set_curcmap(rc, cursorp)
  441         struct ramdac_cookie *rc;
  442         struct wsdisplay_cursor *cursorp;
  443 {
  444         struct bt463data *data = (struct bt463data *)rc;
  445         int count, index;
  446 
  447         count = cursorp->cmap.count;
  448         index = cursorp->cmap.index;
  449         memcpy(&data->curcmap_r[index], &data->tmpcurcmap_r[index], count);
  450         memcpy(&data->curcmap_g[index], &data->tmpcurcmap_g[index], count);
  451         memcpy(&data->curcmap_b[index], &data->tmpcurcmap_b[index], count);
  452         data->changed |= DATA_CURCMAP_CHANGED;
  453         data->ramdac_sched_update(data->cookie, bt463_update);
  454 }
  455 
  456 int
  457 bt463_get_curcmap(rc, cursorp)
  458         struct ramdac_cookie *rc;
  459         struct wsdisplay_cursor *cursorp;
  460 {
  461         struct bt463data *data = (struct bt463data *)rc;
  462         int error;
  463 
  464         cursorp->cmap.index = 0;        /* DOCMAP */
  465         cursorp->cmap.count = 2;
  466         if (cursorp->cmap.red != NULL) {
  467                 error = copyout(data->curcmap_r, cursorp->cmap.red, 2);
  468                 if (error)
  469                         return (error);
  470         }
  471         if (cursorp->cmap.green != NULL) {
  472                 error = copyout(data->curcmap_g, cursorp->cmap.green, 2);
  473                 if (error)
  474                         return (error);
  475         }
  476         if (cursorp->cmap.blue != NULL) {
  477                 error = copyout(data->curcmap_b, cursorp->cmap.blue, 2);
  478                 if (error)
  479                         return (error);
  480         }
  481         return (0);
  482 }
  483 
  484 
  485 /*****************************************************************************/
  486 
  487 /*
  488  * Internal functions.
  489  */
  490 
  491 #ifdef BT463_DEBUG
  492 int bt463_store(void *v)
  493 {
  494         struct bt463data *data = (struct bt463data *)v;
  495 
  496         data->changed = DATA_ALL_CHANGED;
  497         data->ramdac_sched_update(data->cookie, bt463_update);
  498         printf("Scheduled bt463 store\n");
  499 
  500         return 0;
  501 }
  502 
  503 
  504 int bt463_readback(void *v)
  505 {
  506         struct bt463data *data = (struct bt463data *)v;
  507 
  508         data->ramdac_sched_update(data->cookie, bt463_copyback);
  509         printf("Scheduled bt463 copyback\n");
  510         return 0;
  511 }
  512 
  513 int
  514 bt463_debug(v)
  515         void *v;
  516 {
  517         struct bt463data *data = (struct bt463data *)v;
  518         int i;
  519         u_int8_t val;
  520 
  521         printf("BT463 main regs:\n");
  522         for (i = 0x200; i < 0x20F; i ++) {
  523           val = BTRREG(data, i);
  524           printf("  $%04x %02x\n", i, val);
  525         }
  526 
  527         printf("BT463 revision register:\n");
  528           val = BTRREG(data, 0x220);
  529           printf("  $%04x %02x\n", 0x220, val);
  530 
  531         printf("BT463 window type table (from softc):\n");
  532 
  533         for (i = 0; i < BT463_NWTYPE_ENTRIES; i++) {
  534           printf("%02x %06x\n", i, data->window_type[i]);
  535         }
  536 
  537         return 0;
  538 }
  539 
  540 void
  541 bt463_copyback(p)
  542          void *p;
  543 {
  544         struct bt463data *data = (struct bt463data *)p;
  545         int i;
  546 
  547                 for (i = 0; i < BT463_NWTYPE_ENTRIES; i++) {
  548                         bt463_wraddr(data, BT463_IREG_WINDOW_TYPE_TABLE + i);
  549                         data->window_type[i] = (BTRNREG(data) & 0xff);        /* B0-7   */
  550                         data->window_type[i] |= (BTRNREG(data) & 0xff) << 8;  /* B8-15  */
  551                         data->window_type[i] |= (BTRNREG(data) & 0xff) << 16; /* B16-23 */
  552                 }
  553 }
  554 #endif
  555 
  556 inline void
  557 bt463_wraddr(data, ireg)
  558         struct bt463data *data;
  559         u_int16_t ireg;
  560 {
  561         data->ramdac_wr(data->cookie, BT463_REG_ADDR_LOW, ireg & 0xff);
  562         data->ramdac_wr(data->cookie, BT463_REG_ADDR_HIGH, (ireg >> 8) & 0xff);
  563 }
  564 
  565 void
  566 bt463_update(p)
  567         void *p;
  568 {
  569         struct bt463data *data = (struct bt463data *)p;
  570         int i, v;
  571 
  572         if (console_data != NULL) {
  573                 /* The cookie passed in from sched_update is incorrect. Use the
  574                  * right one.
  575                  */
  576                 data = console_data;
  577         }
  578 
  579         v = data->changed;
  580 
  581         /* The Bt463 won't accept window type data except during a blanking
  582          * interval, so we do this early in the interrupt.
  583          * Blanking the screen might also be a good idea, but it can cause
  584          * unpleasant flashing and is hard to do from this side of the
  585          * ramdac interface.
  586          */
  587         if (v & DATA_WTYPE_CHANGED) {
  588                 /* spit out the window type data */
  589                 for (i = 0; i < BT463_NWTYPE_ENTRIES; i++) {
  590                         bt463_wraddr(data, BT463_IREG_WINDOW_TYPE_TABLE + i);
  591                         BTWNREG(data, (data->window_type[i]) & 0xff);       /* B0-7   */
  592                         BTWNREG(data, (data->window_type[i] >> 8) & 0xff);  /* B8-15   */
  593                         BTWNREG(data, (data->window_type[i] >> 16) & 0xff); /* B16-23  */
  594                 }
  595         }
  596 
  597         if (v & DATA_CURCMAP_CHANGED) {
  598                 bt463_wraddr(data, BT463_IREG_CURSOR_COLOR_0);
  599                 /* spit out the cursor data */
  600                 for (i = 0; i < 2; i++) {
  601                         BTWNREG(data, data->curcmap_r[i]);
  602                         BTWNREG(data, data->curcmap_g[i]);
  603                         BTWNREG(data, data->curcmap_b[i]);
  604                 }
  605         }
  606 
  607         if (v & DATA_CMAP_CHANGED) {
  608                 bt463_wraddr(data, BT463_IREG_CPALETTE_RAM);
  609                 /* spit out the colormap data */
  610                 for (i = 0; i < BT463_NCMAP_ENTRIES; i++) {
  611                         data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA,
  612                                 data->cmap_r[i]);
  613                         data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA,
  614                                 data->cmap_g[i]);
  615                         data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA,
  616                                 data->cmap_b[i]);
  617                 }
  618         }
  619 
  620         data->changed = 0;
  621 }
  622 
  623 int     bt463_set_cursor (rc, cur)
  624         struct ramdac_cookie *rc;
  625         struct wsdisplay_cursor *cur;
  626 {
  627         struct bt463data *data = (struct bt463data *)rc;
  628         return tga_builtin_set_cursor(data->cookie, cur);
  629 }
  630 
  631 int     bt463_get_cursor (rc, cur)
  632         struct ramdac_cookie *rc;
  633         struct wsdisplay_cursor *cur;
  634 {
  635         struct bt463data *data = (struct bt463data *)rc;
  636         return tga_builtin_get_cursor(data->cookie, cur);
  637 }
  638 
  639 int     bt463_set_curpos (rc, cur)
  640         struct ramdac_cookie *rc;
  641         struct wsdisplay_curpos *cur;
  642 {
  643         struct bt463data *data = (struct bt463data *)rc;
  644         return tga_builtin_set_curpos(data->cookie, cur);
  645 }
  646 
  647 int     bt463_get_curpos (rc, cur)
  648         struct ramdac_cookie *rc;
  649         struct wsdisplay_curpos *cur;
  650 {
  651         struct bt463data *data = (struct bt463data *)rc;
  652         return tga_builtin_get_curpos(data->cookie, cur);
  653 }
  654 
  655 int     bt463_get_curmax (rc, cur)
  656         struct ramdac_cookie *rc;
  657         struct wsdisplay_curpos *cur;
  658 {
  659         struct bt463data *data = (struct bt463data *)rc;
  660         return tga_builtin_get_curmax(data->cookie, cur);
  661 }

Cache object: 1351ac76393a7b377623f06d855449cc


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.