Annotation of Examples/DriverKit/TsengLabsET4000/TsengLabsET4000_psdrvr.tproj/SVGACustom.c, revision 1.1

1.1     ! root        1: /*****************************************************************************
        !             2: 
        !             3:     SVGACustom.c for TsengLabsET4000
        !             4: 
        !             5: ******************************************************************************/
        !             6: 
        !             7: #import "SVGAConstants.h"
        !             8: #import <driverkit/svgaPSExtension.h>
        !             9: #import <driverkit/i386/displayRegisters.h>
        !            10: 
        !            11: 
        !            12: void SetReadSegment(unsigned char num)
        !            13: // Description:        Select which 64K segment we intend to read from.
        !            14: {
        !            15:     char tmp;
        !            16:     tmp = inb(EIDR_GCR_SEGS);
        !            17:     tmp &= GCR_TS_GWR;
        !            18:     tmp |= ((num << 4) & GCR_TS_GRD);
        !            19:     outb(EIDR_GCR_SEGS, tmp);
        !            20: }
        !            21: 
        !            22: 
        !            23: void SetWriteSegment(unsigned char num)
        !            24: // Description:        Select which 64K segment we intend to write to.
        !            25: {
        !            26:     char tmp;
        !            27:     tmp = inb(EIDR_GCR_SEGS);
        !            28:     tmp &= GCR_TS_GRD;
        !            29:     tmp |= (num & GCR_TS_GWR);
        !            30:     outb(EIDR_GCR_SEGS, tmp);
        !            31: }
        !            32: 
        !            33: 
        !            34: void SetReadPlane(unsigned char num)
        !            35: // Description:        Select which of 4 bit planes to read from in planar
        !            36: //             modes - only one plane can be active at a time.
        !            37: {
        !            38:     char tmp;
        !            39: 
        !            40:     //
        !            41:     // Select plane we are reading from
        !            42:     //
        !            43:     tmp = IOReadRegister(EIDR_GCR_ADDR, GCR_AT_READ_MAPS);
        !            44:     tmp &= ~GCR_AT_RMS;
        !            45:     tmp |= (num & GCR_AT_RMS);
        !            46:     IOWriteRegister(EIDR_GCR_ADDR, GCR_AT_READ_MAPS, tmp);
        !            47: }
        !            48: 
        !            49: 
        !            50: void SetWritePlane(unsigned char num)
        !            51: // Description:        Select one of 4 bit planes to write to in planar modes.
        !            52: //             Although more than one plane can be active at a time,
        !            53: //             this routine only allows access to 1 plane at a time.
        !            54: {
        !            55:     char tmp, plane = 0x01;
        !            56:     
        !            57:     //
        !            58:     // Convert plane num to bit enable.
        !            59:     //
        !            60:     plane = plane << (num & 0x03);
        !            61: 
        !            62:     //
        !            63:     // Select plane we are writing to
        !            64:     //
        !            65:     tmp = IOReadRegister(EIDR_SEQ_ADDR, SEQ_AT_MPK);
        !            66:     tmp &= ~(SEQ_AT_EM3 | SEQ_AT_EM2 | SEQ_AT_EM1 | SEQ_AT_EM0);
        !            67:     tmp |= plane;
        !            68:     IOWriteRegister(EIDR_SEQ_ADDR, SEQ_AT_MPK, tmp);
        !            69: }
        !            70: 
        !            71: 
        !            72: int IOSetSVGAFunctions(IOSVGAFunctions *functs)
        !            73: {
        !            74:     functs->setReadSegment = SetReadSegment;
        !            75:     functs->setWriteSegment = SetWriteSegment;
        !            76:     functs->setReadPlane = SetReadPlane;
        !            77:     functs->setWritePlane = SetWritePlane;
        !            78:     
        !            79:     return 0;
        !            80: }

unix.superglobalmegacorp.com

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