Annotation of Examples/DriverKit/CirrusLogicGD542X/CirrusLogicGD542X_psdrvr.tproj/SVGACustom.c, revision 1.1

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

unix.superglobalmegacorp.com

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