|
|
1.1.1.2 ! root 1: /* $Id: sun-fb.h,v 1.3 2007/03/29 01:48:13 fredette Exp $ */ 1.1 root 2: 3: /* machine/sun/sun-fb.h - header file for Sun framebuffer emulation: */ 4: 5: /* 1.1.1.2 ! root 6: * Copyright (c) 2004, 2006 Matt Fredette 1.1 root 7: * All rights reserved. 8: * 9: * Redistribution and use in source and binary forms, with or without 10: * modification, are permitted provided that the following conditions 11: * are met: 12: * 1. Redistributions of source code must retain the above copyright 13: * notice, this list of conditions and the following disclaimer. 14: * 2. Redistributions in binary form must reproduce the above copyright 15: * notice, this list of conditions and the following disclaimer in the 16: * documentation and/or other materials provided with the distribution. 17: * 3. All advertising materials mentioning features or use of this software 18: * must display the following acknowledgement: 19: * This product includes software developed by Matt Fredette. 20: * 4. The name of the author may not be used to endorse or promote products 21: * derived from this software without specific prior written permission. 22: * 23: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26: * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 27: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 29: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 32: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33: * POSSIBILITY OF SUCH DAMAGE. 34: */ 35: 36: #ifndef _MACHINE_SUN_FB_H 37: #define _MACHINE_SUN_FB_H 38: 39: #include <tme/common.h> 1.1.1.2 ! root 40: _TME_RCSID("$Id: sun-fb.h,v 1.3 2007/03/29 01:48:13 fredette Exp $"); 1.1 root 41: 42: /* includes: */ 43: #include <tme/generic/bus.h> 1.1.1.2 ! root 44: #include <tme/generic/bus-device.h> ! 45: #include <tme/generic/fb.h> ! 46: #include <tme/ic/bt458.h> 1.1 root 47: 48: /* macros: */ 49: 1.1.1.2 ! root 50: /* Sun framebuffer sizes: */ ! 51: /* NB: TME_SUNFB_SIZE_1152_900 should be first, since whatever size is ! 52: first is what most framebuffers will default to: */ ! 53: #define TME_SUNFB_SIZE_NULL (0) ! 54: #define TME_SUNFB_SIZE_1152_900 TME_BIT(0) ! 55: #define TME_SUNFB_SIZE_1024_1024 TME_BIT(1) ! 56: #define TME_SUNFB_SIZE_1280_1024 TME_BIT(2) ! 57: #define TME_SUNFB_SIZE_1600_1280 TME_BIT(3) ! 58: #define TME_SUNFB_SIZE_1440_1440 TME_BIT(4) ! 59: #define TME_SUNFB_SIZE_1024_768 TME_BIT(5) ! 60: #define TME_SUNFB_SIZE_640_480 TME_BIT(6) 1.1 root 61: 1.1.1.2 ! root 62: /* P4 register framebuffer identifiers: */ ! 63: #define TME_SUNFB_P4_ID_MASK (0xf0000000) ! 64: #define TME_SUNFB_P4_ID_BWTWO (0x00000000) ! 65: #define TME_SUNFB_P4_ID_CGFOUR (0x40000000) ! 66: #define TME_SUNFB_P4_ID_CGEIGHT (0x45000000) ! 67: #define TME_SUNFB_P4_ID_CGSIX (0x60000000) ! 68: ! 69: /* offsets in many P4 framebuffers: */ ! 70: #define TME_SUNFB_P4_OFFSET_P4 (0x00000000) ! 71: #define TME_SUNFB_P4_OFFSET_BITMAP (0x00100000) ! 72: ! 73: /* offsets in many S4 framebuffers: */ ! 74: #define TME_SUNFB_S4_OFFSET_REGS (0x00400000) ! 75: #define TME_SUNFB_S4_OFFSET_MEMORY (0x00800000) ! 76: ! 77: /* flags: */ ! 78: #define TME_SUNFB_FLAG_BT458_CMAP_PACKED TME_BIT(0) ! 79: #define TME_SUNFB_FLAG_BT458_BYTE_D0_D7 (0) ! 80: #define TME_SUNFB_FLAG_BT458_BYTE_D24_D31 TME_BIT(1) ! 81: ! 82: /* callout flags: */ ! 83: #define TME_SUNFB_CALLOUT_RUNNING TME_BIT(0) ! 84: #define TME_SUNFB_CALLOUTS_MASK (-2) ! 85: #define TME_SUNFB_CALLOUT_MODE_CHANGE TME_BIT(1) ! 86: #define TME_SUNFB_CALLOUT_INT TME_BIT(2) ! 87: ! 88: /* the maximum number of bus subregions for registers that a Sun ! 89: framebuffer can have: */ ! 90: #define TME_SUNFB_BUS_SUBREGIONS_MAX (8) ! 91: ! 92: /* a Sun framebuffer: */ ! 93: struct tme_sunfb { ! 94: ! 95: /* our simple bus device header: */ ! 96: struct tme_bus_device tme_sunfb_device; ! 97: #define tme_sunfb_element tme_sunfb_device.tme_bus_device_element ! 98: ! 99: /* the mutex protecting the card: */ ! 100: tme_mutex_t tme_sunfb_mutex; ! 101: ! 102: /* the rwlock protecting the card: */ ! 103: tme_rwlock_t tme_sunfb_rwlock; ! 104: ! 105: /* the framebuffer connection: */ ! 106: struct tme_fb_connection *tme_sunfb_fb_connection; ! 107: ! 108: /* more bus subregions: */ ! 109: struct tme_bus_subregion tme_sunfb_bus_subregions[TME_SUNFB_BUS_SUBREGIONS_MAX]; ! 110: ! 111: /* bus cycle handlers for the subregions: */ ! 112: tme_bus_cycle_handler tme_sunfb_bus_handlers[TME_SUNFB_BUS_SUBREGIONS_MAX]; ! 113: ! 114: /* some of the bus subregions have specific purposes: */ ! 115: #define tme_sunfb_bus_subregion_memory tme_sunfb_device.tme_bus_device_subregions ! 116: #define tme_sunfb_bus_subregion_regs tme_sunfb_bus_subregions[0] ! 117: #define tme_sunfb_bus_handler_regs tme_sunfb_bus_handlers[0] ! 118: ! 119: /* the class of the framebuffer: */ ! 120: unsigned int tme_sunfb_class; ! 121: ! 122: /* the depth of the framebuffer: */ ! 123: unsigned int tme_sunfb_depth; ! 124: ! 125: /* the size of the framebuffer: */ ! 126: tme_uint32_t tme_sunfb_size; ! 127: ! 128: /* framebuffer flags: */ ! 129: tme_uint32_t tme_sunfb_flags; ! 130: ! 131: /* the callout flags: */ ! 132: int tme_sunfb_callout_flags; ! 133: ! 134: /* this is nonzero if the interrupt is asserted: */ ! 135: int tme_sunfb_int_asserted; ! 136: ! 137: /* the callout thread condition: */ ! 138: tme_cond_t tme_sunfb_callout_cond; ! 139: ! 140: /* the (relative) bus address of the last byte of displayed ! 141: framebuffer memory: */ ! 142: tme_bus_addr_t tme_sunfb_memory_address_last_displayed; ! 143: ! 144: /* the memory. usually, this memory is displayed directly, but this ! 145: won't be the case when there is an overlay plane, for example: */ ! 146: tme_uint8_t *tme_sunfb_memory; ! 147: ! 148: /* any memory pad: */ ! 149: tme_uint8_t *tme_sunfb_memory_pad; ! 150: ! 151: /* a framebuffer memory update function: */ ! 152: int (*tme_sunfb_memory_update)(struct tme_fb_connection *conn_fb); ! 153: ! 154: /* this forces the next update to be a full one: */ ! 155: void (*tme_sunfb_update_full) _TME_P((struct tme_sunfb *)); ! 156: ! 157: /* these are used for index-mapping pixel values or pixel subfield ! 158: values to intensities, or vice-versa. if these are NULL, ! 159: everything is linearly mapped: */ ! 160: void *tme_sunfb_cmap_primaries[3]; ! 161: #define tme_sunfb_cmap_g tme_sunfb_cmap_primaries[0] ! 162: #define tme_sunfb_cmap_r tme_sunfb_cmap_primaries[1] ! 163: #define tme_sunfb_cmap_b tme_sunfb_cmap_primaries[2] ! 164: ! 165: /* a P4 register: */ ! 166: tme_uint32_t tme_sunfb_p4; ! 167: ! 168: /* many Sun 8-bit framebuffers use the Brooktree Bt458 RAMDAC: */ ! 169: struct tme_bt458 tme_sunfb_bt458; ! 170: ! 171: /* S4 basic registers: */ ! 172: struct { ! 173: tme_uint8_t tme_sunfb_s4_regs_control; ! 174: #define tme_sunfb_s4_regs_first tme_sunfb_s4_regs_control ! 175: tme_uint8_t tme_sunfb_s4_regs_status; ! 176: tme_uint8_t tme_sunfb_s4_regs_cursor_start; ! 177: tme_uint8_t tme_sunfb_s4_regs_cursor_end; ! 178: tme_uint8_t tme_sunfb_s4_regs_h_blank_set; ! 179: tme_uint8_t tme_sunfb_s4_regs_h_blank_clear; ! 180: tme_uint8_t tme_sunfb_s4_regs_h_sync_set; ! 181: tme_uint8_t tme_sunfb_s4_regs_h_sync_clear; ! 182: tme_uint8_t tme_sunfb_s4_regs_comp_sync_clear; ! 183: tme_uint8_t tme_sunfb_s4_regs_v_blank_set_high; ! 184: tme_uint8_t tme_sunfb_s4_regs_v_blank_set_low; ! 185: tme_uint8_t tme_sunfb_s4_regs_v_blank_clear; ! 186: tme_uint8_t tme_sunfb_s4_regs_v_sync_set; ! 187: tme_uint8_t tme_sunfb_s4_regs_v_sync_clear; ! 188: tme_uint8_t tme_sunfb_s4_regs_xfer_holdoff_set; ! 189: tme_uint8_t tme_sunfb_s4_regs_xfer_holdoff_clear; ! 190: } tme_sunfb_s4_regs; ! 191: ! 192: /* if the given type is valid, it returns NULL and updates the ! 193: framebuffer structure, else it returns a string of valid types: */ ! 194: const char *(*tme_sunfb_type_set) _TME_P((struct tme_sunfb *, const char *)); ! 195: }; 1.1 root 196: 197: /* prototypes: */ 1.1.1.2 ! root 198: ! 199: /* miscellaneous: */ ! 200: tme_uint32_t tme_sunfb_size _TME_P((const char *)); ! 201: tme_uint32_t tme_sunfb_size_width _TME_P((tme_uint32_t)); ! 202: tme_uint32_t tme_sunfb_size_height _TME_P((tme_uint32_t)); ! 203: ! 204: /* this creates a new Sun framebuffer: */ ! 205: int tme_sunfb_new(struct tme_sunfb *sunfb, const char * const *args, char **_output); ! 206: ! 207: /* some standard register bus cycle handlers: */ ! 208: int tme_sunfb_bus_cycle_p4 _TME_P((void *, struct tme_bus_cycle *)); ! 209: int tme_sunfb_bus_cycle_s4 _TME_P((void *, struct tme_bus_cycle *)); ! 210: ! 211: /* this is called before the framebuffer's display is updated: */ ! 212: int tme_sunfb_memory_update _TME_P((struct tme_fb_connection *)); 1.1 root 213: 214: #endif /* !_MACHINE_SUN_FB_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.