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/ibm561.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: ibm561.c,v 1.7 2005/12/11 12:21:27 christos Exp $ */
    2 
    3 /*-
    4  * Copyright (c) 2001 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Roland C. Dowdeswell of Ponte, Inc.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. All advertising materials mentioning features or use of this software
   19  *    must display the following acknowledgement:
   20  *      This product includes software developed by the NetBSD
   21  *      Foundation, Inc. and its contributors.
   22  * 4. Neither the name of The NetBSD Foundation nor the names of its
   23  *    contributors may be used to endorse or promote products derived
   24  *    from this software without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   36  * POSSIBILITY OF SUCH DAMAGE.
   37  */
   38 
   39 #include <sys/cdefs.h>
   40 __KERNEL_RCSID(0, "$NetBSD: ibm561.c,v 1.7 2005/12/11 12:21:27 christos Exp $");
   41 
   42 #include <sys/param.h>
   43 #include <sys/systm.h>
   44 #include <sys/device.h>
   45 #include <sys/buf.h>
   46 #include <sys/kernel.h>
   47 #include <sys/malloc.h>
   48 
   49 #include <uvm/uvm_extern.h>
   50 
   51 #include <dev/pci/pcivar.h>
   52 #include <dev/ic/ibm561reg.h>
   53 #include <dev/ic/ibm561var.h>
   54 #include <dev/ic/ramdac.h>
   55 
   56 #include <dev/wscons/wsconsio.h>
   57 
   58 /*
   59  * Functions exported via the RAMDAC configuration table.
   60  */
   61 void    ibm561_init(struct ramdac_cookie *);
   62 int     ibm561_set_cmap(struct ramdac_cookie *, struct wsdisplay_cmap *);
   63 int     ibm561_get_cmap(struct ramdac_cookie *, struct wsdisplay_cmap *);
   64 int     ibm561_set_cursor(struct ramdac_cookie *, struct wsdisplay_cursor *);
   65 int     ibm561_get_cursor(struct ramdac_cookie *, struct wsdisplay_cursor *);
   66 int     ibm561_set_curpos(struct ramdac_cookie *, struct wsdisplay_curpos *);
   67 int     ibm561_get_curpos(struct ramdac_cookie *, struct wsdisplay_curpos *);
   68 int     ibm561_get_curmax(struct ramdac_cookie *, struct wsdisplay_curpos *);
   69 int     ibm561_set_dotclock(struct ramdac_cookie *, unsigned);
   70 
   71 /* XXX const */
   72 struct ramdac_funcs ibm561_funcsstruct = {
   73         "IBM561",
   74         ibm561_register,
   75         ibm561_init,
   76         ibm561_set_cmap,
   77         ibm561_get_cmap,
   78         ibm561_set_cursor,
   79         ibm561_get_cursor,
   80         ibm561_set_curpos,
   81         ibm561_get_curpos,
   82         ibm561_get_curmax,
   83         NULL,                   /* check_curcmap; not needed */
   84         NULL,                   /* set_curcmap; not needed */
   85         NULL,                   /* get_curcmap; not needed */
   86         ibm561_set_dotclock,
   87 };
   88 
   89 /*
   90  * Private data.
   91  */
   92 struct ibm561data {
   93         void            *cookie;
   94 
   95         int             (*ramdac_sched_update)(void *, void (*)(void *));
   96         void            (*ramdac_wr)(void *, u_int, u_int8_t);
   97         u_int8_t        (*ramdac_rd)(void *, u_int);
   98 
   99 #define CHANGED_CURCMAP         0x0001  /* cursor cmap */
  100 #define CHANGED_CMAP            0x0002  /* color map */
  101 #define CHANGED_WTYPE           0x0004  /* window types */
  102 #define CHANGED_DOTCLOCK        0x0008  /* dot clock */
  103 #define CHANGED_ALL             0x000f  /* or of all above */
  104         u_int8_t        changed;
  105 
  106         /* dotclock parameters */
  107         u_int8_t        vco_div;
  108         u_int8_t        pll_ref;
  109         u_int8_t        div_dotclock;
  110 
  111         /* colormaps et al. */
  112         u_int8_t        curcmap_r[2];
  113         u_int8_t        curcmap_g[2];
  114         u_int8_t        curcmap_b[2];
  115 
  116         u_int8_t        cmap_r[IBM561_NCMAP_ENTRIES];
  117         u_int8_t        cmap_g[IBM561_NCMAP_ENTRIES];
  118         u_int8_t        cmap_b[IBM561_NCMAP_ENTRIES];
  119 
  120         u_int16_t       gamma_r[IBM561_NGAMMA_ENTRIES];
  121         u_int16_t       gamma_g[IBM561_NGAMMA_ENTRIES];
  122         u_int16_t       gamma_b[IBM561_NGAMMA_ENTRIES];
  123 
  124         u_int16_t       wtype[IBM561_NWTYPES];
  125 };
  126 
  127 /*
  128  * private functions
  129  */
  130 void    ibm561_update(void *);
  131 static void ibm561_load_cmap(struct ibm561data *);
  132 static void ibm561_load_dotclock(struct ibm561data *);
  133 static void ibm561_regbegin(struct ibm561data *, u_int16_t);
  134 static void ibm561_regcont(struct ibm561data *, u_int16_t, u_int8_t);
  135 static void ibm561_regcont10bit(struct ibm561data *, u_int16_t, u_int16_t);
  136 static void ibm561_regwr(struct ibm561data *, u_int16_t, u_int8_t);
  137 
  138 struct ramdac_funcs *
  139 ibm561_funcs(void)
  140 {
  141         return &ibm561_funcsstruct;
  142 }
  143 
  144 struct ramdac_cookie *
  145 ibm561_register(v, sched_update, wr, rd)
  146         void *v;
  147         int (*sched_update)(void *, void (*)(void *));
  148         void (*wr)(void *, u_int, u_int8_t);
  149         u_int8_t (*rd)(void *, u_int);
  150 {
  151         struct ibm561data *data;
  152 
  153         data = malloc(sizeof *data, M_DEVBUF, M_WAITOK|M_ZERO);
  154         data->cookie = v;
  155         data->ramdac_sched_update = sched_update;
  156         data->ramdac_wr = wr;
  157         data->ramdac_rd = rd;
  158         return (struct ramdac_cookie *)data;
  159 }
  160 
  161 /*
  162  * This function exists solely to provide a means to init
  163  * the RAMDAC without first registering.  It is useful for
  164  * initializing the console early on.
  165  */
  166 
  167 struct ibm561data *saved_console_data;
  168 
  169 void
  170 ibm561_cninit(v, sched_update, wr, rd, dotclock)
  171         void *v;
  172         int (*sched_update)(void *, void (*)(void *));
  173         void (*wr)(void *, u_int, u_int8_t);
  174         u_int8_t (*rd)(void *, u_int);
  175         u_int dotclock;
  176 {
  177         struct ibm561data tmp, *data = &tmp;
  178         memset(data, 0x0, sizeof *data);
  179         data->cookie = v;
  180         data->ramdac_sched_update = sched_update;
  181         data->ramdac_wr = wr;
  182         data->ramdac_rd = rd;
  183         ibm561_set_dotclock((struct ramdac_cookie *)data, dotclock);
  184         saved_console_data = data;
  185         ibm561_init((struct ramdac_cookie *)data);
  186         saved_console_data = NULL;
  187 }
  188 
  189 void
  190 ibm561_init(rc)
  191         struct ramdac_cookie *rc;
  192 {
  193         struct  ibm561data *data = (struct ibm561data *)rc;
  194         int     i;
  195 
  196         /* XXX this is _essential_ */
  197 
  198         ibm561_load_dotclock(data);
  199 
  200         /* XXXrcd: bunch of magic of which I have no current clue */
  201         ibm561_regwr(data, IBM561_CONFIG_REG1, 0x2a);
  202         ibm561_regwr(data, IBM561_CONFIG_REG3, 0x41);
  203         ibm561_regwr(data, IBM561_CONFIG_REG4, 0x20);
  204 
  205         /* initialize the card a bit */
  206         ibm561_regwr(data, IBM561_SYNC_CNTL, 0x1);
  207         ibm561_regwr(data, IBM561_CONFIG_REG2, 0x19);
  208 
  209         ibm561_regwr(data, IBM561_CONFIG_REG1, 0x2a);
  210         ibm561_regwr(data, IBM561_CONFIG_REG4, 0x20);
  211 
  212         ibm561_regbegin(data, IBM561_WAT_SEG_REG);
  213         ibm561_regcont(data, IBM561_CMD, 0x00);
  214         ibm561_regcont(data, IBM561_CMD, 0x00);
  215         ibm561_regcont(data, IBM561_CMD, 0x00);
  216         ibm561_regcont(data, IBM561_CMD, 0x00);
  217         ibm561_regbegin(data, IBM561_CHROMAKEY0);
  218         ibm561_regcont(data, IBM561_CMD, 0x00);
  219         ibm561_regcont(data, IBM561_CMD, 0x00);
  220         ibm561_regcont(data, IBM561_CMD, 0x00);
  221         ibm561_regcont(data, IBM561_CMD, 0x00);
  222 
  223         ibm561_regwr(data, IBM561_CURS_CNTL_REG, 0x00); /* XXX off? */
  224 
  225         /* cursor `hot spot' registers */
  226         ibm561_regbegin(data, IBM561_HOTSPOT_REG);
  227         ibm561_regcont(data, IBM561_CMD, 0x00);
  228         ibm561_regcont(data, IBM561_CMD, 0x00);
  229         ibm561_regcont(data, IBM561_CMD, 0xff);
  230         ibm561_regcont(data, IBM561_CMD, 0x00);
  231         ibm561_regcont(data, IBM561_CMD, 0xff);
  232         ibm561_regcont(data, IBM561_CMD, 0x00);
  233 
  234         /* VRAM Mask Registers (diagnostics) */
  235         ibm561_regbegin(data, IBM561_VRAM_MASK_REG);
  236         ibm561_regcont(data, IBM561_CMD, 0xff);
  237         ibm561_regcont(data, IBM561_CMD, 0xff);
  238         ibm561_regcont(data, IBM561_CMD, 0xff);
  239         ibm561_regcont(data, IBM561_CMD, 0xff);
  240         ibm561_regcont(data, IBM561_CMD, 0xff);
  241         ibm561_regcont(data, IBM561_CMD, 0xff);
  242         ibm561_regcont(data, IBM561_CMD, 0xff);
  243 
  244         /* let's set up some decent default colour maps and gammas */
  245         for (i=0; i < IBM561_NCMAP_ENTRIES; i++)
  246                 data->cmap_r[i] = data->cmap_g[i] = data->cmap_b[i] = 0xff;
  247         data->cmap_r[0]   = data->cmap_g[0]   = data->cmap_b[0]   = 0x00;
  248         data->cmap_r[256] = data->cmap_g[256] = data->cmap_b[256] = 0x00;
  249         data->cmap_r[512] = data->cmap_g[512] = data->cmap_b[512] = 0x00;
  250         data->cmap_r[768] = data->cmap_g[768] = data->cmap_b[768] = 0x00;
  251 
  252         data->gamma_r[0] = data->gamma_g[0] = data->gamma_b[0] = 0x00;
  253         for (i=0; i < IBM561_NGAMMA_ENTRIES; i++)
  254                 data->gamma_r[i] = data->gamma_g[i] = data->gamma_b[i] = 0xff;
  255 
  256         for (i=0; i < IBM561_NWTYPES; i++)
  257                 data->wtype[i] = 0x0036;
  258         data->wtype[1] = 0x0028;
  259 
  260         /* the last step: */
  261         data->changed = CHANGED_ALL;
  262         data->ramdac_sched_update(data->cookie, ibm561_update);
  263 }
  264 
  265 int
  266 ibm561_set_cmap(rc, cmapp)
  267         struct ramdac_cookie *rc;
  268         struct wsdisplay_cmap *cmapp;
  269 {
  270         struct ibm561data *data = (struct ibm561data *)rc;
  271         u_int count, index;
  272         uint8_t r[IBM561_NCMAP_ENTRIES];
  273         uint8_t g[IBM561_NCMAP_ENTRIES];
  274         uint8_t b[IBM561_NCMAP_ENTRIES];
  275         int s, error;
  276 
  277         if (cmapp->index >= IBM561_NCMAP_ENTRIES ||
  278             cmapp->count > IBM561_NCMAP_ENTRIES - cmapp->index)
  279                 return (EINVAL);
  280 
  281         index = cmapp->index;
  282         count = cmapp->count;
  283         error = copyin(cmapp->red, &r[index], count);
  284         if (error)
  285                 return error;
  286         error = copyin(cmapp->green, &g[index], count);
  287         if (error)
  288                 return error;
  289         error = copyin(cmapp->blue, &b[index], count);
  290         if (error)
  291                 return error;
  292         s = spltty();
  293         memcpy(&data->cmap_r[index], &r[index], count);
  294         memcpy(&data->cmap_g[index], &g[index], count);
  295         memcpy(&data->cmap_b[index], &b[index], count);
  296         data->changed |= CHANGED_CMAP;
  297         data->ramdac_sched_update(data->cookie, ibm561_update);
  298         splx(s);
  299         return (0);
  300 }
  301 
  302 int
  303 ibm561_get_cmap(rc, cmapp)
  304         struct ramdac_cookie *rc;
  305         struct wsdisplay_cmap *cmapp;
  306 {
  307         struct ibm561data *data = (struct ibm561data *)rc;
  308         u_int count, index;
  309         int error;
  310 
  311         if (cmapp->index >= IBM561_NCMAP_ENTRIES ||
  312             cmapp->count > IBM561_NCMAP_ENTRIES - cmapp->index)
  313                 return (EINVAL);
  314         count = cmapp->count;
  315         index = cmapp->index;
  316         error = copyout(&data->cmap_r[index], cmapp->red, count);
  317         if (error)
  318                 return (error);
  319         error = copyout(&data->cmap_g[index], cmapp->green, count);
  320         if (error)
  321                 return (error);
  322         error = copyout(&data->cmap_b[index], cmapp->blue, count);
  323         return (error);
  324 }
  325 
  326 /*
  327  * XXX:
  328  *  I am leaving these functions returning EINVAL, as they are
  329  *  not strictly necessary for the correct functioning of the
  330  *  card and in fact are not used on the other TGA variants, except
  331  *  they are exported via ioctl(2) to userland, which does not in
  332  *  fact use them.
  333  */
  334 
  335 int
  336 ibm561_set_cursor(rc, cursorp)
  337         struct ramdac_cookie *rc;
  338         struct wsdisplay_cursor *cursorp;
  339 {
  340         return EINVAL;
  341 }
  342 
  343 int
  344 ibm561_get_cursor(rc, cursorp)
  345         struct ramdac_cookie *rc;
  346         struct wsdisplay_cursor *cursorp;
  347 {
  348         return EINVAL;
  349 }
  350 
  351 int
  352 ibm561_set_curpos(rc, curposp)
  353         struct ramdac_cookie *rc;
  354         struct wsdisplay_curpos *curposp;
  355 {
  356         return EINVAL;
  357 }
  358 
  359 int
  360 ibm561_get_curpos(rc, curposp)
  361         struct ramdac_cookie *rc;
  362         struct wsdisplay_curpos *curposp;
  363 {
  364         return EINVAL;
  365 }
  366 
  367 int
  368 ibm561_get_curmax(rc, curposp)
  369         struct ramdac_cookie *rc;
  370         struct wsdisplay_curpos *curposp;
  371 {
  372         return EINVAL;
  373 }
  374 
  375 int
  376 ibm561_set_dotclock(rc, dotclock)
  377         struct ramdac_cookie *rc;
  378         unsigned dotclock;
  379 {
  380         struct ibm561data *data = (struct ibm561data *)rc;
  381 
  382         /* XXXrcd:  a couple of these are a little hazy, vis a vis
  383          *          check 175MHz and 202MHz, which are wrong...
  384          */
  385         switch (dotclock) {
  386         case  25175000: data->vco_div = 0x3e; data->pll_ref = 0x09; break;
  387         case  31500000: data->vco_div = 0x17; data->pll_ref = 0x05; break;
  388         case  40000000: data->vco_div = 0x42; data->pll_ref = 0x06; break;
  389         case  50000000: data->vco_div = 0x45; data->pll_ref = 0x05; break;
  390         case  65000000: data->vco_div = 0xac; data->pll_ref = 0x0c; break;
  391         case  69000000: data->vco_div = 0xa9; data->pll_ref = 0x0b; break;
  392         case  74000000: data->vco_div = 0x9c; data->pll_ref = 0x09; break;
  393         case  75000000: data->vco_div = 0x93; data->pll_ref = 0x08; break;
  394         case 103994000: data->vco_div = 0x96; data->pll_ref = 0x06; break;
  395         case 108180000: data->vco_div = 0xb8; data->pll_ref = 0x08; break;
  396         case 110000000: data->vco_div = 0xba; data->pll_ref = 0x08; break;
  397         case 119840000: data->vco_div = 0x82; data->pll_ref = 0x04; break;
  398         case 130808000: data->vco_div = 0xc8; data->pll_ref = 0x08; break;
  399         case 135000000: data->vco_div = 0xc1; data->pll_ref = 0x07; break;
  400         case 175000000: data->vco_div = 0xe2; data->pll_ref = 0x07; break;
  401         case 202500000: data->vco_div = 0xe2; data->pll_ref = 0x07; break;
  402         default:
  403                 return EINVAL;
  404         }
  405 
  406         data->div_dotclock = 0xb0;
  407         data->changed |= CHANGED_DOTCLOCK;
  408         return 0;
  409 }
  410 
  411 /*
  412  * Internal Functions
  413  */
  414 
  415 void
  416 ibm561_update(vp)
  417         void *vp;
  418 {
  419         struct ibm561data *data = (struct ibm561data *)vp;
  420         int     i;
  421 
  422         /* XXX see comment above ibm561_cninit() */
  423         if (!data)
  424                 data = saved_console_data;
  425 
  426         if (data->changed & CHANGED_WTYPE) {
  427                 ibm561_regbegin(data, IBM561_FB_WINTYPE);
  428                 for (i=0; i < IBM561_NWTYPES; i++)
  429                         ibm561_regcont10bit(data, IBM561_CMD_FB_WAT, data->wtype[i]);
  430 
  431                 /* XXXrcd:  quick hack here for AUX FB table */
  432                 ibm561_regbegin(data, IBM561_AUXFB_WINTYPE);
  433                 for (i=0; i < IBM561_NWTYPES; i++)
  434                         ibm561_regcont(data, IBM561_CMD, 0x04);
  435 
  436                 /* XXXrcd:  quick hack here for OL WAT table */
  437                 ibm561_regbegin(data, IBM561_OL_WINTYPE);
  438                 for (i=0; i < IBM561_NWTYPES; i++)
  439                         ibm561_regcont10bit(data, IBM561_CMD_FB_WAT, 0x0231);
  440 
  441                 /* XXXrcd:  quick hack here for AUX OL WAT table */
  442                 ibm561_regbegin(data, IBM561_AUXOL_WINTYPE);
  443                 for (i=0; i < IBM561_NWTYPES; i++)
  444                         ibm561_regcont(data, IBM561_CMD, 0x0c);
  445         }
  446 
  447         if (data->changed & CHANGED_CMAP)
  448                 ibm561_load_cmap(data);
  449 
  450         /* XXX:  I am not sure in what situations it is safe to
  451          *       change the dotclock---hope this is good.
  452          */
  453         if (data->changed & CHANGED_DOTCLOCK)
  454                 ibm561_load_dotclock(data);
  455 }
  456 
  457 static void
  458 ibm561_load_cmap(struct ibm561data *data)
  459 {
  460         int     i;
  461 
  462         ibm561_regbegin(data, IBM561_CMAP_TABLE);
  463         for (i=0; i < IBM561_NCMAP_ENTRIES; i++) {
  464                 ibm561_regcont(data, IBM561_CMD_CMAP, data->cmap_r[i]);
  465                 ibm561_regcont(data, IBM561_CMD_CMAP, data->cmap_g[i]);
  466                 ibm561_regcont(data, IBM561_CMD_CMAP, data->cmap_b[i]);
  467         }
  468 
  469         ibm561_regbegin(data, IBM561_RED_GAMMA_TABLE);
  470         for (i=0; i < 256; i++)
  471                 ibm561_regcont10bit(data, IBM561_CMD_GAMMA, data->gamma_r[i]);
  472 
  473         ibm561_regbegin(data, IBM561_GREEN_GAMMA_TABLE);
  474         for (i=1; i < 256; i++)
  475                 ibm561_regcont10bit(data, IBM561_CMD_GAMMA, data->gamma_g[i]);
  476 
  477         ibm561_regbegin(data, IBM561_BLUE_GAMMA_TABLE);
  478         for (i=1; i < 256; i++)
  479                 ibm561_regcont10bit(data, IBM561_CMD_GAMMA, data->gamma_b[i]);
  480 
  481 }
  482 
  483 static void
  484 ibm561_load_dotclock(struct ibm561data *data)
  485 {
  486         /* XXX
  487          * we should probably be more pro-active here, but it shouldn't
  488          * actually happen...
  489          */
  490         if (!data->vco_div || !data->pll_ref || ! data->div_dotclock) {
  491                 panic("ibm561_load_dotclock: called uninitialized");
  492         }
  493 
  494         ibm561_regwr(data, IBM561_PLL_VCO_DIV,  data->vco_div);
  495         ibm561_regwr(data, IBM561_PLL_REF_REG, data->pll_ref);
  496         ibm561_regwr(data, IBM561_DIV_DOTCLCK, data->div_dotclock);
  497 }
  498 
  499 static void
  500 ibm561_regcont10bit(struct ibm561data *data, u_int16_t reg, u_int16_t val)
  501 {
  502         data->ramdac_wr(data->cookie, IBM561_CMD_GAMMA, (val >> 2) & 0xff);
  503         data->ramdac_wr(data->cookie, IBM561_CMD_GAMMA, (val & 0x3) << 6);
  504 }
  505 
  506 static void
  507 ibm561_regbegin(struct ibm561data *data, u_int16_t reg)
  508 {
  509         data->ramdac_wr(data->cookie, IBM561_ADDR_LOW, reg & 0xff);
  510         data->ramdac_wr(data->cookie, IBM561_ADDR_HIGH, (reg >> 8) & 0xff);
  511 }
  512 
  513 static void
  514 ibm561_regcont(struct ibm561data *data, u_int16_t reg, u_int8_t val)
  515 {
  516         data->ramdac_wr(data->cookie, reg, val);
  517 }
  518 
  519 static void
  520 ibm561_regwr(struct ibm561data *data, u_int16_t reg, u_int8_t val)
  521 {
  522         ibm561_regbegin(data, reg);
  523         ibm561_regcont(data, IBM561_CMD, val);
  524 }

Cache object: 9681331742c2d4e4b364f1c116494d4e


[ 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.