Annotation of Gnu-Mach/chips/fb_hdw.c, revision 1.1.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: fb_hdw.c
                     28:  *     Author: Alessandro Forin, Carnegie Mellon University
                     29:  *     Date:   7/91
                     30:  *
                     31:  *     Driver for the 3max Monochrome Frame Buffer Display,
                     32:  *     hardware-level operations.
                     33:  */
                     34: 
                     35: #include <mfb.h>
                     36: #if    (NMFB > 0)
                     37: #include <platforms.h>
                     38: 
                     39: #include <machine/machspl.h>
                     40: #include <mach/std_types.h>
                     41: #include <chips/busses.h>
                     42: 
                     43: #include <chips/screen_defs.h>
                     44: 
                     45: #include <chips/pm_defs.h>
                     46: typedef pm_softc_t     fb_softc_t;
                     47: 
                     48: 
                     49: #ifdef DECSTATION
                     50: #include <mips/PMAX/pmag_aa.h>
                     51: #include <mips/PMAX/tc.h>
                     52: #endif
                     53: 
                     54: #ifdef FLAMINGO
                     55: #include <mips/PMAX/pmag_aa.h>         /* XXX fixme */
                     56: #include <alpha/DEC/tc.h>
                     57: #endif
                     58: 
                     59: /*
                     60:  * Definition of the driver for the auto-configuration program.
                     61:  */
                     62: 
                     63: int    fb_probe(), fb_intr();
                     64: static void    fb_attach();
                     65: 
                     66: vm_offset_t    fb_std[NMFB] = { 0 };
                     67: struct bus_device *fb_info[NMFB];
                     68: struct bus_driver fb_driver = 
                     69:         { fb_probe, 0, fb_attach, 0, fb_std, "fb", fb_info,
                     70:          0, 0, BUS_INTR_DISABLED};
                     71: 
                     72: /*
                     73:  * Probe/Attach functions
                     74:  */
                     75: 
                     76: fb_probe( /* reg, ui */)
                     77: {
                     78:        static probed_once = 0;
                     79: 
                     80:        /*
                     81:         * Probing was really done sweeping the TC long ago
                     82:         */
                     83:        if (tc_probe("fb") == 0)
                     84:                return 0;
                     85:        if (probed_once++ > 1)
                     86:                printf("[mappable] ");
                     87:        return 1;
                     88: }
                     89: 
                     90: static void
                     91: fb_attach(ui)
                     92:        struct bus_device *ui;
                     93: {
                     94:        /* ... */
                     95:        printf(": monochrome display");
                     96: }
                     97: 
                     98: 
                     99: /*
                    100:  * Interrupt routine
                    101:  */
                    102: 
                    103: fb_intr(unit,spllevel)
                    104:        spl_t   spllevel;
                    105: {
                    106:        register volatile char *ack;
                    107: 
                    108:        /* acknowledge interrupt */
                    109:        ack = (volatile char *) fb_info[unit]->address + FB_OFFSET_IREQ;
                    110:        *ack = 0;
                    111: 
                    112: #if    mips
                    113:        splx(spllevel);
                    114: #endif
                    115:        lk201_led(unit);
                    116: }
                    117: 
                    118: fb_vretrace(fb, on)
                    119:        fb_softc_t      *fb;
                    120: {
                    121:        int i;
                    122: 
                    123:        for (i = 0; i < NMFB; i++)
                    124:                if (fb_info[i]->address == (vm_offset_t)fb->framebuffer)
                    125:                        break;
                    126:        if (i == NMFB) return;
                    127: 
                    128:        (*tc_enable_interrupt)(fb_info[i]->adaptor, on, 0);
                    129: }
                    130: 
                    131: /*
                    132:  * Video on/off
                    133:  */
                    134: fb_video_on(fb, up)
                    135:        fb_softc_t      *fb;
                    136:        user_info_t     *up;
                    137: {
                    138:        if (!fb->cursor_state)  /* video is "on" at boot */
                    139:                return;
                    140:        bt455_video_on(fb->vdac_registers, up);
                    141:        bt431_cursor_on(fb->cursor_registers);
                    142:        fb->cursor_state = 0;
                    143: }
                    144: 
                    145: fb_video_off(fb, up)
                    146:        fb_softc_t      *fb;
                    147:        user_info_t     *up;
                    148: {
                    149:        if (fb->cursor_state)
                    150:                return;
                    151:        bt455_video_off(fb->vdac_registers, up);
                    152:        bt431_cursor_off(fb->cursor_registers);
                    153:        fb->cursor_state = 1;
                    154: }
                    155: 
                    156: /*
                    157:  * Boot time initialization: must make device
                    158:  * usable as console asap.
                    159:  */
                    160: extern int
                    161:        fb_soft_reset(), fb_set_status(),
                    162:        bt431_pos_cursor(), fb_video_on(),
                    163:        fb_video_off(), fb_vretrace(),
                    164:        pm_get_status(), pm_char_paint(),
                    165:        pm_insert_line(), pm_remove_line(),
                    166:        pm_clear_bitmap(), pm_map_page();
                    167: 
                    168: static struct screen_switch fb_sw = {
                    169:        screen_noop,            /* graphic_open */
                    170:        fb_soft_reset,          /* graphic_close */
                    171:        fb_set_status,          /* set_status */
                    172:        pm_get_status,          /* get_status */
                    173:        pm_char_paint,          /* char_paint */
                    174:        bt431_pos_cursor,       /* pos_cursor */
                    175:        pm_insert_line,         /* insert_line */
                    176:        pm_remove_line,         /* remove_line */
                    177:        pm_clear_bitmap,        /* clear_bitmap */
                    178:        fb_video_on,            /* video_on */
                    179:        fb_video_off,   /* video_off */
                    180:        fb_vretrace,            /* intr_enable */
                    181:        pm_map_page             /* map_page */
                    182: };
                    183: 
                    184: fb_cold_init(unit, up)
                    185:        user_info_t     *up;
                    186: {
                    187:        fb_softc_t      *fb;
                    188:        screen_softc_t  sc = screen(unit);
                    189:        vm_offset_t     base = tc_probe("fb");
                    190: 
                    191:        bcopy(&fb_sw, &sc->sw, sizeof(sc->sw));
                    192: #if 0
                    193:        sc->flags |= MONO_SCREEN;
                    194: #else
                    195:        sc->flags |= COLOR_SCREEN;
                    196: #endif
                    197:        sc->frame_scanline_width = 2048;
                    198:        sc->frame_height = 1024;
                    199:        sc->frame_visible_width = 1280;
                    200:        sc->frame_visible_height = 1024;
                    201: 
                    202:        pm_init_screen_params(sc, up);
                    203:        (void) screen_up(unit, up);
                    204: 
                    205:        fb = pm_alloc(unit, base+FB_OFFSET_BT431, base+FB_OFFSET_VRAM, -1);
                    206:        fb->vdac_registers = (char*) base + FB_OFFSET_BT455;
                    207: 
                    208:        screen_default_colors(up);
                    209: 
                    210:        fb_soft_reset(sc);
                    211: 
                    212:        /*
                    213:         * Clearing the screen at boot saves from scrolling
                    214:         * much, and speeds up booting quite a bit.
                    215:         */
                    216:        screen_blitc( unit, 'C'-'@');/* clear screen */
                    217: }
                    218: 
                    219: #endif (NMFB > 0)

unix.superglobalmegacorp.com

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