|
|
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: cfb_hdw.c ! 28: * Author: Alessandro Forin, Carnegie Mellon University ! 29: * Date: 9/90 ! 30: * ! 31: * Driver for the 3max Color Frame Buffer Display, ! 32: * hardware-level operations. ! 33: */ ! 34: ! 35: #include <cfb.h> ! 36: #if (NCFB > 0) ! 37: ! 38: #include <platforms.h> ! 39: ! 40: #include <machine/machspl.h> ! 41: #include <mach/std_types.h> ! 42: #include <chips/busses.h> ! 43: #include <chips/screen_defs.h> ! 44: #include <chips/pm_defs.h> ! 45: ! 46: typedef pm_softc_t cfb_softc_t; ! 47: ! 48: #ifdef DECSTATION ! 49: #include <mips/PMAX/pmag_ba.h> ! 50: #include <mips/PMAX/tc.h> ! 51: #endif ! 52: ! 53: #ifdef FLAMINGO ! 54: #include <mips/PMAX/pmag_ba.h> /* XXX fixme */ ! 55: #include <alpha/DEC/tc.h> ! 56: #endif ! 57: ! 58: /* ! 59: * Definition of the driver for the auto-configuration program. ! 60: */ ! 61: ! 62: int cfb_probe(), cfb_intr(); ! 63: static void cfb_attach(); ! 64: ! 65: vm_offset_t cfb_std[NCFB] = { 0 }; ! 66: struct bus_device *cfb_info[NCFB]; ! 67: struct bus_driver cfb_driver = ! 68: { cfb_probe, 0, cfb_attach, 0, cfb_std, "cfb", cfb_info, ! 69: 0, 0, BUS_INTR_DISABLED}; ! 70: ! 71: /* ! 72: * Probe/Attach functions ! 73: */ ! 74: ! 75: cfb_probe( /* reg, ui */) ! 76: { ! 77: static probed_once = 0; ! 78: ! 79: /* ! 80: * Probing was really done sweeping the TC long ago ! 81: */ ! 82: if (tc_probe("cfb") == 0) ! 83: return 0; ! 84: if (probed_once++ > 1) ! 85: printf("[mappable] "); ! 86: return 1; ! 87: } ! 88: ! 89: static void ! 90: cfb_attach(ui) ! 91: struct bus_device *ui; ! 92: { ! 93: /* ... */ ! 94: printf(": color display"); ! 95: } ! 96: ! 97: ! 98: /* ! 99: * Interrupt routine ! 100: */ ! 101: ! 102: cfb_intr(unit,spllevel) ! 103: spl_t spllevel; ! 104: { ! 105: register volatile char *ack; ! 106: ! 107: /* acknowledge interrupt */ ! 108: ack = (volatile char *) cfb_info[unit]->address + CFB_OFFSET_IREQ; ! 109: *ack = 0; ! 110: ! 111: #ifdef mips ! 112: splx(spllevel); ! 113: #endif ! 114: lk201_led(unit); ! 115: } ! 116: ! 117: cfb_vretrace(cfb, on) ! 118: cfb_softc_t *cfb; ! 119: { ! 120: int i; ! 121: ! 122: for (i = 0; i < NCFB; i++) ! 123: if (cfb_info[i]->address == (vm_offset_t)cfb->framebuffer) ! 124: break; ! 125: if (i == NCFB) return; ! 126: ! 127: (*tc_enable_interrupt)(cfb_info[i]->adaptor, on, 0); ! 128: } ! 129: ! 130: /* ! 131: * Boot time initialization: must make device ! 132: * usable as console asap. ! 133: */ ! 134: extern int ! 135: cfb_soft_reset(), cfb_set_status(), ! 136: bt459_pos_cursor(), bt459_video_on(), ! 137: bt459_video_off(), cfb_vretrace(), ! 138: pm_get_status(), pm_char_paint(), ! 139: pm_insert_line(), pm_remove_line(), ! 140: pm_clear_bitmap(), pm_map_page(); ! 141: ! 142: static struct screen_switch cfb_sw = { ! 143: screen_noop, /* graphic_open */ ! 144: cfb_soft_reset, /* graphic_close */ ! 145: cfb_set_status, /* set_status */ ! 146: pm_get_status, /* get_status */ ! 147: pm_char_paint, /* char_paint */ ! 148: bt459_pos_cursor, /* pos_cursor */ ! 149: pm_insert_line, /* insert_line */ ! 150: pm_remove_line, /* remove_line */ ! 151: pm_clear_bitmap, /* clear_bitmap */ ! 152: bt459_video_on, /* video_on */ ! 153: bt459_video_off, /* video_off */ ! 154: cfb_vretrace, /* intr_enable */ ! 155: pm_map_page /* map_page */ ! 156: }; ! 157: ! 158: cfb_cold_init(unit, up) ! 159: user_info_t *up; ! 160: { ! 161: cfb_softc_t *cfb; ! 162: screen_softc_t sc = screen(unit); ! 163: int base = tc_probe("cfb"); ! 164: ! 165: bcopy(&cfb_sw, &sc->sw, sizeof(sc->sw)); ! 166: sc->flags |= COLOR_SCREEN; ! 167: sc->frame_scanline_width = 1024; ! 168: sc->frame_height = 1024; ! 169: sc->frame_visible_width = 1024; ! 170: sc->frame_visible_height = 864; ! 171: ! 172: pm_init_screen_params(sc,up); ! 173: (void) screen_up(unit, up); ! 174: ! 175: cfb = pm_alloc(unit, base + CFB_OFFSET_BT459, base + CFB_OFFSET_VRAM, -1); ! 176: ! 177: screen_default_colors(up); ! 178: ! 179: cfb_soft_reset(sc); ! 180: ! 181: /* ! 182: * Clearing the screen at boot saves from scrolling ! 183: * much, and speeds up booting quite a bit. ! 184: */ ! 185: screen_blitc( unit, 'C'-'@');/* clear screen */ ! 186: } ! 187: ! 188: #endif (NCFB > 0)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.