/* $XFree86: xc/programs/Xserver/hw/xfree86/mono/drivers/apollo/apollodriv.c,v 3.2 1995/04/24 05:21:19 dawes Exp $ */ /* * MONO: Driver family for interlaced and banked monochrome video adaptors * Pascal Haible 8/93, 3/94, 4/94 haible@IZFM.Uni-Stuttgart.DE * * mono/driver/apollo/apollodriv.c * Hamish Coleman 11/93 hamish@zot.apana.org.au * * derived from: * bdm2/hgc1280/* * Pascal Haible 8/93, haible@izfm.uni-stuttgart.de * hga2/* * Author: Davor Matic, dmatic@athena.mit.edu * and * vga256/* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * * Thanks to Herb Peyerl (hpeyerl@novatel.ca) for the information on * programming this card. * * see mono/COPYRIGHT for copyright and disclaimers. */ #include "X.h" #include "input.h" #include "screenint.h" #include "compiler.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86_Config.h" #include "mono.h" #include "apolloHW.h" #ifdef NOTYET #include "mfbfuncs.h" #endif static int apollo_Current_mode = apollo_Textmode; /* * Define the Apollo I/O Ports */ unsigned Apollo_IOBASE = AP_PORT_BASE; static unsigned Apollo_IOPorts[16] = {AP_PORT_BASE, AP_PORT_BASE + 1, AP_PORT_BASE + 2, AP_PORT_BASE + 3, AP_PORT_BASE + 4, AP_PORT_BASE + 5, AP_PORT_BASE + 6, AP_PORT_BASE + 7, AP_PORT_BASE + 8, AP_PORT_BASE + 9, AP_PORT_BASE + 0x0a, AP_PORT_BASE + 0x0b, AP_PORT_BASE + 0x0c, AP_PORT_BASE + 0x0d, AP_PORT_BASE + 0x0e, AP_PORT_BASE + 0x0f}; static int Num_Apollo_IOPorts = (sizeof(Apollo_IOPorts)/sizeof(Apollo_IOPorts[0])); Bool ApolloProbe( #if NeedFunctionPrototypes void #endif ); char *ApolloIdent( #if NeedFunctionPrototypes int #endif ); pointer ApolloInit( #if NeedFunctionPrototypes DisplayModePtr #endif ); void ApolloEnterLeave( #if NeedFunctionPrototypes Bool /* enter */ #endif ); pointer ApolloSave( #if NeedFunctionPrototypes pointer #endif ); void ApolloRestore( #if NeedFunctionPrototypes pointer #endif ); void ApolloAdjust( #if NeedFunctionPrototypes int /* x */, int /* y*/ #endif ); Bool ApolloSaveScreen( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, Bool /* on */ #endif ); void ApolloFbInit( #if NeedFunctionPrototypes void #endif ); void ApolloClearScreen( #if NeedFunctionPrototypes void #endif ); PixelType * ApolloScanlineOffsetA( #if NeedFunctionPrototypes PixelType * /* pointer */, int /* offset */ #endif ); PixelType * ApolloScanlineOffsetB( #if NeedFunctionPrototypes PixelType * /* pointer */, int /* offset */ #endif ); #ifdef NOTYET extern int ApolloDoBitblt(); #endif /* * structure for accessing the video chip`s functions */ monoVideoChipRec APOLLO = { /* Functions */ ApolloProbe, ApolloIdent, ApolloInit, ApolloFbInit, /* Initialize acclerated functions */ ApolloEnterLeave, ApolloSave, ApolloRestore, ApolloAdjust, ApolloSaveScreen, ApolloClearScreen, /* ClearScreen */ ApolloScanlineOffsetA, /* SetBankA */ ApolloScanlineOffsetB, /* SetBankB */ (unsigned char *)AP_BANK_BOTTOM, /* BankABottom */ (unsigned char *)AP_BANK_TOP, /* BankATop */ (unsigned char *)AP_BANK_BOTTOM, /* BankBBottom */ (unsigned char *)AP_BANK_TOP, /* BankBTop */ (unsigned char *)AP_MAP_BASE, /* MapBase */ AP_MAP_SIZE, /* MapSize */ AP_HDISPLAY, /* HDisplay */ AP_VDISPLAY, /* VDisplay */ AP_SCAN_LINE_WIDTH, /* ScanLineWidth */ {0,}, /* ChipOptionFlags */ }; /* * ApolloIdent */ char * ApolloIdent(n) int n; { static char *chipsets[] = {"apollo9"}; if (n >= sizeof(chipsets) / sizeof(char *)) return(NULL); else return(chipsets[n]); } /* * ApolloProbe -- * check whether an Apollo ID-9 board is installed */ Bool ApolloProbe() { /* * Set up I/O ports to be used by this card */ if (OFLG_ISSET(OPTION_SECONDARY, &monoInfoRec.options)) { int i; /* option "secondary" */ Apollo_IOBASE = AP_PORT_ALTERNATE; APOLLO.ChipMapBase = (unsigned char *)AP_MAP_ALTERNATE; for (i=0;i