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/bt455.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:        bt455.c,v $
   29  * Revision 2.4  92/05/22  15:46:33  jfriedl
   30  *      Some fields in user_info_t got renamed.
   31  *      [92/05/13  20:41:18  af]
   32  * 
   33  * Revision 2.3  92/05/05  10:03:55  danner
   34  *      Only use the 4 most significant bits in the Colormap, or
   35  *      cursor color when setting the registers.
   36  *      [92/04/10            moore]
   37  * 
   38  * Revision 2.2  91/08/24  11:50:21  af
   39  *      Cleaned up a bit, avoid use of poorly documented add_clr register.
   40  *      Catched various minor bloopers.
   41  *      [91/08/22  11:02:18  af]
   42  * 
   43  *      Created, from Brooktree specs:
   44  *      "Graphics And Imaging Product Databook 1991"
   45  *      "Bt454/Bt455 170 Mhz Monolithic CMOS 16 Color Palette RAMDAC"
   46  *      Brooktree Corp. San Diego, CA, 3rd Ed.
   47  *      [91/07/25            af]
   48  * 
   49  */
   50 /*
   51  *      File: bt455.c
   52  *      Author: Alessandro Forin, Carnegie Mellon University
   53  *      Date:   7/91
   54  *
   55  *      Routines for the bt454/bt455 RAMDAC
   56  */
   57 
   58 #include <platforms.h>
   59 
   60 #include <chips/bt455.h>
   61 #include <chips/screen.h>
   62 
   63 #ifdef  DECSTATION
   64 
   65 typedef struct {
   66         volatile unsigned char  addr_cmap;
   67         char                                            pad0[3];
   68         volatile unsigned char  addr_cmap_data;
   69         char                                            pad1[3];
   70         volatile unsigned char  addr_clr;
   71         char                                            pad2[3];
   72         volatile unsigned char  addr_ovly;
   73         char                                            pad3[3];
   74 } bt455_padded_regmap_t;
   75 
   76 #else   /*DECSTATION*/
   77 
   78 typedef bt455_regmap_t  bt455_padded_regmap_t;
   79 #define wbflush()
   80 
   81 #endif  /*DECSTATION*/
   82 
   83 
   84 /*
   85  * Generic register access
   86  */
   87 #define bt455_select_entry(regs, regno)                 \
   88         {                                               \
   89                 (regs)->addr_cmap = (regno)&0x0f;       \
   90                 wbflush();                              \
   91         }
   92 
   93 
   94 /*
   95  * Color map
   96  */
   97 bt455_load_colormap( regs, map)
   98         bt455_padded_regmap_t   *regs;
   99         color_map_t     *map;
  100 {
  101         register int    i;
  102 
  103         bt455_select_entry(regs, 0);
  104 
  105         for (i = 0; i < 16; i++, map++) {
  106                 regs->addr_cmap_data = map->red >> 4;
  107                 wbflush();
  108                 regs->addr_cmap_data = map->green >> 4;
  109                 wbflush();
  110                 regs->addr_cmap_data = map->blue >> 4;
  111                 wbflush();
  112         }
  113 }
  114 
  115 bt455_load_colormap_entry( regs, entry, map)
  116         register bt455_padded_regmap_t  *regs;
  117         register color_map_t    *map;
  118 {
  119         bt455_select_entry(regs, entry);
  120 
  121         regs->addr_cmap_data = map->red >> 4;
  122         wbflush();
  123         regs->addr_cmap_data = map->green >> 4;
  124         wbflush();
  125         regs->addr_cmap_data = map->blue >> 4;
  126         wbflush();
  127 }
  128 
  129 bt455_init_colormap( regs)
  130         bt455_padded_regmap_t   *regs;
  131 {
  132         register int    i;
  133         color_map_t     m[2];
  134 
  135         m[0].red = m[0].green = m[0].blue = 0;
  136         m[1].red = m[1].green = m[1].blue = 0xff;
  137 
  138         for (i = 0; i < 16; i++)
  139                 bt455_load_colormap_entry(regs, i, &m[0]);
  140 
  141         bt455_load_colormap_entry(regs, 1, &m[1]);
  142 
  143         bt455_cursor_color( regs, &m[0]);
  144 }
  145 
  146 #if     1/*debug*/
  147 bt455_print_colormap( regs)
  148         bt455_padded_regmap_t   *regs;
  149 {
  150         register int    i;
  151 
  152         for (i = 0; i < 16; i++) {
  153                 register unsigned char red, green, blue;
  154 
  155                 bt455_select_entry(regs, i);
  156                 red   = regs->addr_cmap_data;
  157                 green = regs->addr_cmap_data;
  158                 blue  = regs->addr_cmap_data;
  159                 printf("%x->[x%x x%x x%x]\n", i,
  160                         red, green, blue);
  161 
  162         }
  163 }
  164 #endif
  165 
  166 /*
  167  * Video on/off
  168  */
  169 bt455_video_off(regs, up)
  170         bt455_padded_regmap_t   *regs;
  171         user_info_t     *up;
  172 {
  173         color_map_t             m;
  174         unsigned char           *save;
  175 
  176                                 /* Yes, this is awful */
  177         save = (unsigned char *)up->dev_dep_2.gx.colormap;
  178 
  179         bt455_select_entry( regs, 0);
  180 
  181         *save++ = regs->addr_cmap_data;         /* entry 0 */
  182         *save++ = regs->addr_cmap_data;
  183         *save++ = regs->addr_cmap_data;
  184 
  185         *save++ = regs->addr_cmap_data;         /* entry 1 */
  186         *save++ = regs->addr_cmap_data;
  187         *save++ = regs->addr_cmap_data;
  188 
  189         m.red = m.green = m.blue = 0;
  190         bt455_load_colormap_entry(regs, 0, &m);
  191         bt455_load_colormap_entry(regs, 1, &m);
  192 }
  193 
  194 bt455_video_on(regs, up)
  195         bt455_padded_regmap_t   *regs;
  196         user_info_t     *up;
  197 {
  198         unsigned char           *save;
  199 
  200                                 /* Like I said.. */
  201         save = (unsigned char *)up->dev_dep_2.gx.colormap;
  202 
  203         bt455_select_entry( regs, 0);
  204 
  205         regs->addr_cmap_data = *save++; wbflush();
  206         regs->addr_cmap_data = *save++; wbflush();
  207         regs->addr_cmap_data = *save++; wbflush();
  208 
  209         regs->addr_cmap_data = *save++; wbflush();
  210         regs->addr_cmap_data = *save++; wbflush();
  211         regs->addr_cmap_data = *save;
  212 
  213 }
  214 
  215 /*
  216  * Cursor 'color' [as used on DEC's board]
  217  */
  218 bt455_cursor_color( regs, color)
  219         bt455_padded_regmap_t   *regs;
  220         color_map_t     *color;
  221 {
  222         register int    i;
  223 
  224         /* Bg is the first in color */
  225         bt455_load_colormap_entry( regs, 8, color);
  226         bt455_load_colormap_entry( regs, 9, color);
  227 
  228         /* Fg is overlay */
  229         color++;
  230         regs->addr_ovly = color->red >> 4;
  231         wbflush();
  232         regs->addr_ovly = color->green >> 4;
  233         wbflush();
  234         regs->addr_ovly = color->blue >> 4;
  235         wbflush();
  236 }
  237 
  238 /*
  239  * Initialization
  240  */
  241 bt455_init(regs)
  242         bt455_padded_regmap_t   *regs;
  243 {
  244         /* Nothing really needed */
  245 }
  246 

Cache object: 9b4efc6b49b7d126dfd68a4425857f6a


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