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/fb_misc.c

Version: -  FREEBSD  -  FREEBSD10  -  FREEBSD9  -  FREEBSD92  -  FREEBSD91  -  FREEBSD90  -  FREEBSD8  -  FREEBSD82  -  FREEBSD81  -  FREEBSD80  -  FREEBSD7  -  FREEBSD74  -  FREEBSD73  -  FREEBSD72  -  FREEBSD71  -  FREEBSD70  -  FREEBSD6  -  FREEBSD64  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
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:        fb_misc.c,v $
   29  * Revision 2.7  93/02/05  08:06:50  danner
   30  *      Removed commented include.
   31  *      [93/02/04  01:29:39  af]
   32  * 
   33  *      Removed dead code.
   34  *      [92/11/29            af]
   35  * 
   36  * Revision 2.6  92/05/22  15:47:58  jfriedl
   37  *      Avoid spls and use SCREEN_BEING_UPDATED instead.
   38  *      [92/05/21  18:51:46  af]
   39  * 
   40  * Revision 2.5  92/04/01  15:14:19  rpd
   41  *      Put spl protections around setstatus playing with cursor
   42  *      and vdac.
   43  *      [92/03/11  16:04:49  af]
   44  * 
   45  * Revision 2.4  92/03/02  18:32:33  rpd
   46  *      When first positioning the cursor use the max_row info.
   47  *      [92/03/02  01:50:43  af]
   48  * 
   49  * Revision 2.3  92/01/17  11:44:50  rpd
   50  *      Got cursor colored right.
   51  *      [92/01/06            af]
   52  * 
   53  * Revision 2.2  91/08/24  11:51:58  af
   54  *      Got cursor mirrored right.
   55  *      [91/08/22  11:05:12  af]
   56  * 
   57  *      Created, from .. NO SPECS AT ALL.  A little experimentation
   58  *      with ddb, and a lot of past experience did the magic.
   59  *      I guess this screen driver really is portable.
   60  *      BTW, the cursor is still mirrored, ahem.
   61  *      [91/01/25            af]
   62  * 
   63  */
   64 /*
   65  *      File: fb_misc.c
   66  *      Author: Alessandro Forin, Carnegie Mellon University
   67  *      Date:   7/91
   68  *
   69  *      Driver for the PMAG-AA simple mono framebuffer
   70  *
   71  */
   72 
   73 #include <mfb.h>
   74 #if     (NMFB > 0)
   75 
   76 /*
   77  * NOTE: This driver relies heavily on the pm one.
   78  */
   79 
   80 #include <device/device_types.h>
   81 #include <chips/screen_defs.h>
   82 #include <chips/pm_defs.h>
   83 typedef pm_softc_t      fb_softc_t;
   84 
   85 #include <chips/bt455.h>
   86 
   87 /*
   88  * Initialize color map, for kernel use
   89  */
   90 fb_init_colormap(sc)
   91         screen_softc_t  sc;
   92 {
   93         fb_softc_t      *fb = (fb_softc_t*)sc->hw_state;
   94         user_info_t     *up = sc->up;
   95         color_map_t     Bg_Fg[2];
   96         register int    i;
   97 
   98         bt455_init_colormap( fb->vdac_registers );
   99 
  100         /* init bg/fg colors */
  101         for (i = 0; i < 3; i++) {
  102                 up->dev_dep_2.pm.Bg_color[i] = 0x00;
  103                 up->dev_dep_2.pm.Fg_color[i] = 0xff;
  104         }
  105 
  106         Bg_Fg[0].red = Bg_Fg[0].green = Bg_Fg[0].blue = 0x00;
  107         Bg_Fg[1].red = Bg_Fg[1].green = Bg_Fg[1].blue = 0xff;
  108         bt455_cursor_color( fb->vdac_registers, Bg_Fg);
  109 }
  110 
  111 /*
  112  * Large viz small cursor
  113  */
  114 fb_small_cursor_to_large(up, cursor)
  115         user_info_t     *up;
  116         cursor_sprite_t cursor;
  117 {
  118         unsigned char   *curbytes, *sprite;
  119         int             i;
  120         /* Our cursor turns out mirrored, donno why */
  121         static unsigned char    mirror[256] = {
  122                 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 
  123                 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 
  124                 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 
  125                 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 
  126                 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 
  127                 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 
  128                 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 
  129                 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 
  130                 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 
  131                 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 
  132                 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 
  133                 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 
  134                 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 
  135                 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 
  136                 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 
  137                 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 
  138                 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 
  139                 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 
  140                 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 
  141                 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 
  142                 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 
  143                 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 
  144                 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 
  145                 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 
  146                 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 
  147                 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 
  148                 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 
  149                 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 
  150                 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 
  151                 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 
  152                 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 
  153                 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
  154         };
  155 
  156         /* Clear out old cursor */
  157         bzero(  up->dev_dep_2.pm.cursor_sprite,
  158                 sizeof(up->dev_dep_2.pm.cursor_sprite));
  159 
  160         /* small cursor is 32x2 bytes, image(fg) first then mask(bg) */
  161         curbytes = (unsigned char *) cursor;
  162 
  163         /* we have even byte --> image, odd byte --> mask;
  164            line size is 8 bytes instead of 2 */
  165         sprite   = (unsigned char *) up->dev_dep_2.pm.cursor_sprite;
  166 
  167         for (i = 0; i < 32; i += 2) {
  168                 *sprite++ = mirror[curbytes[i]];        /* fg */
  169                 *sprite++ = mirror[curbytes[i + 32]];   /* bg */
  170                 *sprite++ = mirror[curbytes[i + 1]];    /* fg */
  171                 *sprite++ = mirror[curbytes[i + 33]];   /* bg */
  172                 sprite += 12; /* skip rest of the line */
  173         }
  174 }
  175 
  176 /*
  177  * Device-specific set status
  178  */
  179 fb_set_status(sc, flavor, status, status_count)
  180         screen_softc_t  sc;
  181         int             flavor;
  182         dev_status_t    status;
  183         unsigned int    status_count;
  184 {
  185         fb_softc_t              *fb = (fb_softc_t*) sc->hw_state;
  186 
  187         switch (flavor) {
  188 
  189         case SCREEN_ADJ_MAPPED_INFO:
  190                 return pm_set_status(sc, flavor, status, status_count);
  191 
  192         case SCREEN_LOAD_CURSOR:
  193 
  194                 if (status_count < sizeof(cursor_sprite_t)/sizeof(int))
  195                         return D_INVALID_SIZE;
  196                 fb_small_cursor_to_large(sc->up, (cursor_sprite_t*) status);
  197 
  198                 /* Fall through */
  199 
  200         case SCREEN_LOAD_CURSOR_LONG: { /* 3max/3min only */
  201 
  202                 sc->flags |= SCREEN_BEING_UPDATED;
  203                 bt431_cursor_sprite(fb->cursor_registers, sc->up->dev_dep_2.pm.cursor_sprite);
  204                 sc->flags &= ~SCREEN_BEING_UPDATED;
  205 
  206                 break;
  207         }
  208              
  209         case SCREEN_SET_CURSOR_COLOR: {
  210                 color_map_t             c[2];
  211                 register cursor_color_t *cc = (cursor_color_t*) status;
  212 
  213                 c[0].red   = cc->Bg_rgb[0];
  214                 c[0].green = cc->Bg_rgb[1];
  215                 c[0].blue  = cc->Bg_rgb[2];
  216                 c[1].red   = cc->Fg_rgb[0];
  217                 c[1].green = cc->Fg_rgb[1];
  218                 c[1].blue  = cc->Fg_rgb[2];
  219 
  220                 sc->flags |= SCREEN_BEING_UPDATED;
  221                 bt455_cursor_color (fb->vdac_registers, c );
  222                 sc->flags &= ~SCREEN_BEING_UPDATED;
  223 
  224                 break;
  225         }
  226 
  227         case SCREEN_SET_CMAP_ENTRY: {
  228                 color_map_entry_t       *e = (color_map_entry_t*) status;
  229 
  230                 if (e->index < 8) { /* 8&9 are fg&bg, do not touch */
  231                         sc->flags |= SCREEN_BEING_UPDATED;
  232                         bt455_load_colormap_entry( fb->vdac_registers, e->index, &e->value);
  233                         sc->flags &= ~SCREEN_BEING_UPDATED;
  234                 }
  235                 break;
  236         }
  237 
  238         default:
  239                 return D_INVALID_OPERATION;
  240         }
  241         return D_SUCCESS;
  242 }
  243 
  244 /*
  245  * Do what's needed when X exits
  246  */
  247 fb_soft_reset(sc)
  248         screen_softc_t  sc;
  249 {
  250         fb_softc_t      *fb = (fb_softc_t*) sc->hw_state;
  251         user_info_t     *up =  sc->up;
  252         extern cursor_sprite_t  bt431_default_cursor;
  253 
  254         /*
  255          * Restore params in mapped structure
  256          */
  257         pm_init_screen_params(sc,up);
  258         up->row = up->max_row - 1;
  259 
  260         up->dev_dep_2.pm.x26 = 2; /* you do not want to know */
  261         up->dev_dep_1.pm.x18 = (short*)2;
  262 
  263         /*
  264          * Restore RAMDAC chip to default state, and init cursor
  265          */
  266         bt455_init(fb->vdac_registers);
  267         bt431_init(fb->cursor_registers);
  268 
  269         /*
  270          * Load kernel's cursor sprite
  271          */
  272         bt431_cursor_sprite(fb->cursor_registers, bt431_default_cursor);
  273 
  274         /*
  275          * Color map and cursor color
  276          */
  277         fb_init_colormap(sc);
  278 }
  279 
  280 #endif  (NMFB > 0)

Cache object: f6f86c6f9a5b020ecf85ef0a8cdb3035


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