File:  [NeXTSTEP 3.3 examples] / Examples / DriverKit / CirrusLogicGD542X / CirrusLogicGD542X_psdrvr.tproj / SVGACustom.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:49:00 2018 UTC (8 years, 1 month ago) by root
Branches: NeXT, MAIN
CVS tags: NeXTSTEP33, HEAD
Sample Programs from NeXSTEP 3.3

/*****************************************************************************

    SVGACustom.c for CirrusLogicGD542X

******************************************************************************/

#import "SVGAConstants.h"
#import <driverkit/svgaPSExtension.h>
#import <driverkit/i386/displayRegisters.h>


void SetReadSegment(unsigned char num)
// Description:	Select which 64K segment we intend to read from.
{
    outb(0x03ce,0x09);
    outb(0x03cf,(num << 4));
}


void SetWriteSegment(unsigned char num)
// Description:	Select which 64K segment we intend to write to.
{
    outb(0x03ce,0x09);
    outb(0x03cf,(num << 4));
}


void SetReadPlane(unsigned char num)
// Description:	Select which of 4 bit planes to read from in planar
//		modes - only one plane can be active at a time.
{
    char tmp;

    //
    // Select plane we are reading from
    //
    tmp = IOReadRegister(EIDR_GCR_ADDR, GCR_AT_READ_MAPS);
    tmp &= ~GCR_AT_RMS;
    tmp |= (num & GCR_AT_RMS);
    IOWriteRegister(EIDR_GCR_ADDR, GCR_AT_READ_MAPS, tmp);
}


void SetWritePlane(unsigned char num)
// Description:	Select one of 4 bit planes to write to in planar modes.
//		Although more than one plane can be active at a time,
//		this routine only allows access to 1 plane at a time.
{
    char tmp, plane = 0x01;
    
    //
    // Convert plane num to bit enable.
    //
    plane = plane << (num & 0x03);

    //
    // Select plane we are writing to
    //
    tmp = IOReadRegister(EIDR_SEQ_ADDR, SEQ_AT_MPK);
    tmp &= ~(SEQ_AT_EM3 | SEQ_AT_EM2 | SEQ_AT_EM1 | SEQ_AT_EM0);
    tmp |= plane;
    IOWriteRegister(EIDR_SEQ_ADDR, SEQ_AT_MPK, tmp);
}


int IOSetSVGAFunctions(IOSVGAFunctions *functs)
{
    functs->setReadSegment = SetReadSegment;
    functs->setWriteSegment = SetWriteSegment;
    functs->setReadPlane = SetReadPlane;
    functs->setWritePlane = SetWritePlane;
    
    return 0;
}

unix.superglobalmegacorp.com

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