Annotation of Gnu-Mach/chips/xcfb_hdw.c, revision 1.1

1.1     ! root        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  [email protected]
        !            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:  *     File: xcfb_hdw.c
        !            28:  *     Author: Alessandro Forin, Carnegie Mellon University
        !            29:  *     Date:   1/92
        !            30:  *
        !            31:  *     Driver for the MAXine Color Frame Buffer Display,
        !            32:  *     hardware-level operations.
        !            33:  */
        !            34: 
        !            35: #include <xcfb.h>
        !            36: #if    (NXCFB > 0)
        !            37: 
        !            38: #include <platforms.h>
        !            39: 
        !            40: #include <machine/machspl.h>
        !            41: #include <mach/std_types.h>
        !            42: #include <chips/busses.h>
        !            43: 
        !            44: #include <chips/screen_defs.h>
        !            45: #include <chips/pm_defs.h>
        !            46: #include <machine/machspl.h>
        !            47: 
        !            48: #ifdef MAXINE
        !            49: 
        !            50: #include <chips/xcfb_monitor.h>
        !            51: 
        !            52: #include <mips/PMAX/pmag_xine.h>
        !            53: #include <mips/PMAX/tc.h>
        !            54: #define        enable_interrupt(s,o,x) (*tc_enable_interrupt)(s,o,x)
        !            55: 
        !            56: #else  /* MAXINE */
        !            57: You must say the magic words to get the coockies:
        !            58: #define enable_interrupt(slot,on,xx)
        !            59: #define        IMS332_ADDRESS
        !            60: #define        VRAM_OFFSET
        !            61: #define        IMS332_RESET_ADDRESS
        !            62: #endif /* MAXINE */
        !            63: 
        !            64: typedef pm_softc_t     xcfb_softc_t;
        !            65: 
        !            66: 
        !            67: /*
        !            68:  * Definition of the driver for the auto-configuration program.
        !            69:  */
        !            70: 
        !            71: int    xcfb_probe(), xcfb_intr();
        !            72: static void    xcfb_attach();
        !            73: 
        !            74: vm_offset_t    xcfb_std[NXCFB] = { 0 };
        !            75: struct bus_device *xcfb_info[NXCFB];
        !            76: struct bus_driver xcfb_driver = 
        !            77:         { xcfb_probe, 0, xcfb_attach, 0, xcfb_std, "xcfb", xcfb_info,
        !            78:          0, 0, BUS_INTR_DISABLED};
        !            79: 
        !            80: /*
        !            81:  * Probe/Attach functions
        !            82:  */
        !            83: 
        !            84: xcfb_probe( /* reg, ui */)
        !            85: {
        !            86:        static probed_once = 0;
        !            87: 
        !            88:        /*
        !            89:         * Probing was really done sweeping the TC long ago
        !            90:         */
        !            91:        if (tc_probe("xcfb") == 0)
        !            92:                return 0;
        !            93:        if (probed_once++ > 1)
        !            94:                printf("[mappable] ");
        !            95:        return 1;
        !            96: }
        !            97: 
        !            98: static void
        !            99: xcfb_attach(ui)
        !           100:        struct bus_device *ui;
        !           101: {
        !           102:        /* ... */
        !           103:        printf(": color display");
        !           104: }
        !           105: 
        !           106: 
        !           107: /*
        !           108:  * Interrupt routine
        !           109:  */
        !           110: 
        !           111: xcfb_intr(unit,spllevel)
        !           112:        spl_t   spllevel;
        !           113: {
        !           114:        /* interrupt has been acknowledge already */
        !           115: #if 0
        !           116:        splx(spllevel);
        !           117:        /* XXX make it load the unsafe things */
        !           118: #endif
        !           119: }
        !           120: 
        !           121: xcfb_vretrace(xcfb, on)
        !           122:        xcfb_softc_t    *xcfb;
        !           123: {
        !           124:        int i;
        !           125: 
        !           126:        for (i = 0; i < NXCFB; i++)
        !           127:                if (xcfb_info[i]->address == (vm_offset_t)xcfb->framebuffer)
        !           128:                        break;
        !           129:        if (i == NXCFB) return;
        !           130: 
        !           131:        enable_interrupt(xcfb_info[i]->adaptor, on, 0);
        !           132: }
        !           133: 
        !           134: /*
        !           135:  * Boot time initialization: must make device
        !           136:  * usable as console asap.
        !           137:  */
        !           138: 
        !           139: /* some of these values are made up using ad hocery */
        !           140: static struct xcfb_monitor_type monitors[] = {
        !           141:        { "VRM17", 1024, 768, 1024, 1024, 16, 33,
        !           142:                  6, 2, 2, 21, 326, 16, 10, 10 },
        !           143:        /* XXX Add VRC16 */
        !           144:        { "VR262", 1024, 864, 1024, 1024, 16, 35,
        !           145:                  5, 3, 3, 37, 330, 16, 10, 10 },
        !           146:        { "VR299", 1024, 864, 1024, 1024, 16, 35,
        !           147:                  5, 3, 3, 37, 330, 16, 10, 10 },
        !           148:        { 0 }};
        !           149: 
        !           150: /* set from prom command line */
        !           151: extern unsigned char *monitor_types[4];
        !           152: 
        !           153: xcfb_monitor_type_t xcfb_get_monitor_type()
        !           154: {
        !           155:        xcfb_monitor_type_t     m;
        !           156: 
        !           157:        m = monitors;
        !           158:        if (monitor_types[3])
        !           159:                while (m->name) {       
        !           160:                        /* xcfb is always on the motherboard (slot 3),
        !           161:                           fix if you need */
        !           162:                        if (!strcmp(monitor_types[3], m->name))
        !           163:                                break;
        !           164:                        m++;
        !           165:                }
        !           166:        if (!m->name)           /* the first is the default */
        !           167:                m = monitors;
        !           168:        return m;
        !           169: }
        !           170:        
        !           171: 
        !           172: extern int
        !           173:        xcfb_soft_reset(), xcfb_set_status(),
        !           174:        ims332_pos_cursor(), ims332_video_on(),
        !           175:        ims332_video_off(), xcfb_vretrace(),
        !           176:        pm_get_status(), pm_char_paint(),
        !           177:        pm_insert_line(), pm_remove_line(),
        !           178:        pm_clear_bitmap(), pm_map_page();
        !           179: 
        !           180: static struct screen_switch xcfb_sw = {
        !           181:        screen_noop,            /* graphic_open */
        !           182:        xcfb_soft_reset,        /* graphic_close */
        !           183:        xcfb_set_status,        /* set_status */
        !           184:        pm_get_status,          /* get_status */
        !           185:        pm_char_paint,          /* char_paint */
        !           186:        ims332_pos_cursor,      /* pos_cursor */
        !           187:        pm_insert_line,         /* insert_line */
        !           188:        pm_remove_line,         /* remove_line */
        !           189:        pm_clear_bitmap,        /* clear_bitmap */
        !           190:        ims332_video_on,        /* video_on */
        !           191:        ims332_video_off,       /* video_off */
        !           192:        xcfb_vretrace,          /* intr_enable */
        !           193:        pm_map_page             /* map_page */
        !           194: };
        !           195: 
        !           196: xcfb_cold_init(unit, up)
        !           197:        user_info_t     *up;
        !           198: {
        !           199:        xcfb_softc_t    *xcfb;
        !           200:        screen_softc_t  sc = screen(unit);
        !           201:        int             base = tc_probe("xcfb");
        !           202:        xcfb_monitor_type_t m = xcfb_get_monitor_type();
        !           203: 
        !           204:        bcopy(&xcfb_sw, &sc->sw, sizeof(sc->sw));
        !           205: 
        !           206:        sc->flags |= COLOR_SCREEN; /* XXX should come from m->flags? */
        !           207:        sc->frame_scanline_width = m->frame_scanline_width;
        !           208:        sc->frame_height = m->frame_height;
        !           209:        sc->frame_visible_width = m->frame_visible_width;
        !           210:        sc->frame_visible_height = m->frame_visible_height;
        !           211: 
        !           212:        pm_init_screen_params(sc, up);
        !           213:        (void) screen_up(unit, up);
        !           214: 
        !           215:        xcfb = pm_alloc(unit, IMS332_ADDRESS, base + VRAM_OFFSET, 0);
        !           216:        xcfb->vdac_registers = (char *)IMS332_RESET_ADDRESS;
        !           217: 
        !           218:        screen_default_colors(up);
        !           219: 
        !           220:        xcfb_soft_reset(sc);
        !           221: 
        !           222:        /*
        !           223:         * Clearing the screen at boot saves from scrolling
        !           224:         * much, and speeds up booting quite a bit.
        !           225:         */
        !           226:        screen_blitc( unit, 'C'-'@');/* clear screen */
        !           227: }
        !           228: 
        !           229: 
        !           230: #endif (NXCFB > 0)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.