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/chips/bt478.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 /*
    2  * Mach Operating System
    3  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie Mellon
   24  * the rights to redistribute these changes.
   25  */
   26 /*
   27  * HISTORY
   28  * $Log:        bt478.c,v $
   29  * Revision 2.7  91/08/24  11:50:34  af
   30  *      Moved padding of regmap here.  Add a couple of clarifications.
   31  *      [91/08/02  02:06:15  af]
   32  * 
   33  * Revision 2.6  91/06/19  11:46:13  rvb
   34  *      File moved here from mips/PMAX since it tries to be generic.
   35  *      [91/06/04            rvb]
   36  * 
   37  * Revision 2.5  91/05/14  17:19:36  mrt
   38  *      Correcting copyright
   39  * 
   40  * Revision 2.4  91/02/05  17:39:51  mrt
   41  *      Added author notices
   42  *      [91/02/04  11:12:03  mrt]
   43  * 
   44  *      Changed to use new Mach copyright
   45  *      [91/02/02  12:09:46  mrt]
   46  * 
   47  * Revision 2.3  90/12/05  23:30:28  af
   48  *      Minor interface tweaks, for uniformity.
   49  *      [90/12/03  23:09:02  af]
   50  * 
   51  * Revision 2.1.1.1  90/11/01  03:36:45  af
   52  *      Created, from DEC specs and Brooktree data sheets:
   53  *      "Product Databook 1989"
   54  *      "Bt478 80 MHz 256 Color Palette RAMDAC"
   55  *      Brooktree Corp. San Diego, CA
   56  *      LA78001 Rev. M
   57  *      [90/09/03            af]
   58  */
   59 /*
   60  *      File: bt478.c
   61  *      Author: Alessandro Forin, Carnegie Mellon University
   62  *      Date:   9/90
   63  *
   64  *      Routines for the bt478 Cursor/RAMDAC chip
   65  */
   66 
   67 #include <platforms.h>
   68 
   69 #include <chips/bt478.h>
   70 #include <chips/screen.h>
   71 
   72 #ifdef  DECSTATION
   73 
   74 typedef struct {
   75         volatile unsigned char  addr_mapwa;
   76         char                                            pad0[3];
   77         volatile unsigned char  addr_map;
   78         char                                            pad1[3];
   79         volatile unsigned char  addr_mask;
   80         char                                            pad2[3];
   81         volatile unsigned char  addr_mapra;
   82         char                                            pad3[3];
   83         volatile unsigned char  addr_overwa;
   84         char                                            pad4[3];
   85         volatile unsigned char  addr_over;
   86         char                                            pad5[3];
   87         volatile unsigned char  addr_xxxx;
   88         char                                            pad6[3];
   89         volatile unsigned char  addr_overra;
   90         char                                            pad7[3];
   91 } bt478_padded_regmap_t;
   92 
   93 #else   /*DECSTATION*/
   94 
   95 typedef bt478_regmap_t  bt478_padded_regmap_t;
   96 #define wbflush()
   97 
   98 #endif  /*DECSTATION*/
   99 
  100 
  101 /*
  102  * Cursor color
  103  */
  104 static
  105 bt478_load_cc(bt478, bg, fg)
  106         register bt478_padded_regmap_t  *bt478;
  107         unsigned int            *bg, *fg;
  108 {
  109         register int    i;
  110 
  111         /* See init function for gotchas */
  112 
  113         bt478->addr_overwa = 4;
  114         wbflush();
  115         for (i = 0; i < 3; i++) {
  116                 bt478->addr_over = (*bg++) >> 8;
  117                 wbflush();
  118         }
  119 
  120         bt478->addr_overwa = 8;
  121         wbflush();
  122         bt478->addr_over = 0x00;
  123         wbflush();
  124         bt478->addr_over = 0x00;
  125         wbflush();
  126         bt478->addr_over = 0x7f;
  127         wbflush();
  128 
  129         bt478->addr_overwa = 12;
  130         wbflush();
  131         for (i = 0; i < 3; i++) {
  132                 bt478->addr_over = (*fg++) >> 8;
  133                 wbflush();
  134         }
  135 
  136 }
  137 
  138 
  139 bt478_cursor_color(bt478, color)
  140         bt478_padded_regmap_t   *bt478;
  141         cursor_color_t  *color;
  142 {
  143         register int            i;
  144         register unsigned int   *p;
  145 
  146         /* Do it twice, in case of collisions */
  147 
  148         bt478_load_cc(bt478, color->Bg_rgb, color->Fg_rgb);
  149 
  150         p = color->Bg_rgb;
  151         for (i = 0; i < 3; i++) {
  152                 bt478->addr_over = (*p++) >> 8;
  153                 wbflush();
  154         }
  155 
  156         p = color->Fg_rgb;
  157         for (i = 0; i < 3; i++) {
  158                 bt478->addr_over = (*p++) >> 8;
  159                 wbflush();
  160         }
  161 
  162         bt478_load_cc(bt478, color->Bg_rgb, color->Fg_rgb);
  163 }
  164 
  165 /*
  166  * Color map
  167  */
  168 bt478_load_colormap( regs, map)
  169         bt478_padded_regmap_t   *regs;
  170         color_map_t     *map;
  171 {
  172         register int i;
  173 
  174         regs->addr_mapwa = 0;
  175         wbflush();
  176         for (i = 0; i < 256; i++, map++) {
  177                 regs->addr_map = map->red;
  178                 wbflush();
  179                 regs->addr_map = map->green;
  180                 wbflush();
  181                 regs->addr_map = map->blue;
  182                 wbflush();
  183         }
  184 }
  185 
  186 bt478_load_colormap_entry( regs, entry, map)
  187         bt478_padded_regmap_t   *regs;
  188         color_map_t     *map;
  189 {
  190         regs->addr_mapwa = entry & 0xff;
  191         wbflush();
  192         regs->addr_map = map->red;
  193         wbflush();
  194         regs->addr_map = map->green;
  195         wbflush();
  196         regs->addr_map = map->blue;
  197         wbflush();
  198 }
  199 
  200 /*
  201  * Video on/off (unused)
  202  */
  203 bt478_video_on(pregs, up)
  204         bt478_padded_regmap_t   **pregs;
  205 {
  206         (*pregs)->addr_mask = 0xff;
  207 }
  208 
  209 bt478_video_off(pregs, up)
  210         bt478_padded_regmap_t   **pregs;
  211 {
  212         (*pregs)->addr_mask = 0;
  213 }
  214 
  215 /*
  216  * Initialization
  217  */
  218 static
  219 bt478_overlay(regs, plane)
  220         bt478_padded_regmap_t   *regs;
  221         unsigned char   *plane;
  222 {
  223         *plane = 0xff;
  224 
  225         /* Overlay planes 0 and 1 are wired zero, overlay plane 2
  226            is plane "B" of the cursor (second half of it), plane 3
  227            is plane "A" of the cursor.  Soo, we get three colors
  228            for the cursor, at map entries 4, 8 and 12 */
  229 #       define  ovv(i,r,g,b)                    \
  230         regs->addr_overwa = i; wbflush();       \
  231         regs->addr_over = r; wbflush();         \
  232         regs->addr_over = b; wbflush();         \
  233         regs->addr_over = g; wbflush();
  234 
  235         ovv(4,0,0,0); ovv(8,0,0,0x7f); ovv(12,0xff,0xff,0xff);
  236 
  237 #       undef ovv
  238 
  239         /* enable data input */
  240         regs->addr_mask = 0xff;
  241 }
  242 
  243 bt478_init_bw_map(regs, plane)
  244         bt478_padded_regmap_t   *regs;
  245 {
  246         register int i;
  247 
  248         /* Set overlay color registers */
  249         bt478_overlay(regs, plane);
  250 
  251         /* loadup vdac map */
  252 #       define mvv(i,v) {                       \
  253         regs->addr_mapwa = i; wbflush();        \
  254         regs->addr_map = v; wbflush();          \
  255         regs->addr_map = v; wbflush();          \
  256         regs->addr_map = v; wbflush();}
  257 
  258         for (i = 0; i < 128; i++) mvv(i,0x00);
  259         for (i = i; i < 256; i++) mvv(i,0xff);
  260 
  261 }
  262 
  263 bt478_init_color_map( regs, plane)
  264         bt478_padded_regmap_t   *regs;
  265 {
  266         register int    i;
  267 
  268         bt478_overlay(regs, plane);
  269 
  270         mvv(0,0);
  271         mvv(1,0xff);
  272         mvv(255,0xff);
  273 
  274 #       undef mvv
  275 }
  276 

Cache object: abe2dd88a6735ffb6884e900659b4714


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