dma.c
sys/dma.h
sys/io.h
ubixos/types.h
sys/dma.h
ubixos/types.h
sys/_types.h
src/sys/sys/dma.c
sys/io.h
highByte
x
((x & 0xFF00) >> 8)
_dmaXfer
lowByte
x
(x & 0x00FF)
_dmaXfer
void void _dmaXfer (uInt8 dmaChannel, uInt8 page, uInt offset, uInt length, uInt8 mode) _dmaXfer uInt8 dmaChannel uInt8 page uInt offset uInt length uInt8 mode addrPort clearReg countPort highByte lowByte maskReg modeReg outportByte pagePort dmaXfer
void void dmaXfer (uInt8 channel, uInt32 address, uInt length, uInt8 read) dmaXfer uInt8 channel uInt32 address uInt length uInt8 read _dmaXfer fdcRw
uInt8 uInt8 addrPort[8] [8] addrPort { 0x00, 0x02, 0x04, 0x06, 0xC0, 0xC4, 0xC8, 0xCC } _dmaXfer
uInt8 uInt8 clearReg[8] [8] clearReg { 0x0C, 0x0C, 0x0C, 0x0C, 0xD8, 0xD8, 0xD8, 0xD8 } _dmaXfer
uInt8 uInt8 countPort[8] [8] countPort { 0x01, 0x03, 0x05, 0x07, 0xC2, 0xC6, 0xCA, 0xCE } _dmaXfer
uInt8 uInt8 maskReg[8] [8] maskReg { 0x0A, 0x0A, 0x0A, 0x0A, 0xD4, 0xD4, 0xD4, 0xD4 } _dmaXfer
uInt8 uInt8 modeReg[8] [8] modeReg { 0x0B, 0x0B, 0x0B, 0x0B, 0xD6, 0xD6, 0xD6, 0xD6 } _dmaXfer
uInt8 uInt8 pagePort[8] [8] pagePort { 0x87, 0x83, 0x81, 0x82, 0x8F, 0x8B, 0x89, 0x8A } _dmaXfer

    /*****************************************************************************************
    Copyright(c)2002-2005TheUbixOSProject
    Allrightsreserved.

    Redistributionanduseinsourceandbinaryforms,withorwithoutmodification,are
    permittedprovidedthatthefollowingconditionsaremet:

    Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistof
    conditions,thefollowingdisclaimerandthelistofauthors.Redistributionsinbinary
    formmustreproducetheabovecopyrightnotice,thislistofconditions,thefollowing
    disclaimerandthelistofauthorsinthedocumentationand/orothermaterialsprovided
    withthedistribution.NeitherthenameoftheUbixOSProjectnorthenamesofits
    contributorsmaybeusedtoendorseorpromoteproductsderivedfromthissoftware
    withoutspecificpriorwrittenpermission.

    THISSOFTWAREISPROVIDEDBYTHECOPYRIGHTHOLDERSANDCONTRIBUTORS"ASIS"ANDANY
    EXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF
    MERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDISCLAIMED.INNOEVENTSHALL
    THECOPYRIGHTOWNERORCONTRIBUTORSBELIABLEFORANYDIRECT,INDIRECT,INCIDENTAL,
    SPECIAL,EXEMPLARY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENT
    OFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)
    HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,OR
    TORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHIS
    SOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE.

    $Id: dma_8c.xml 88 2016-01-12 00:11:29Z reddawg $

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

    #include<sys/dma.h>
    #include<sys/io.h>
    #include<ubixos/types.h>

    #definelowByte(x)(x&0x00FF)
    #definehighByte(x)((x&0xFF00)>>8)

    staticuInt8maskReg[8]={0x0A,0x0A,0x0A,0x0A,0xD4,0xD4,0xD4,0xD4};
    staticuInt8clearReg[8]={0x0C,0x0C,0x0C,0x0C,0xD8,0xD8,0xD8,0xD8};
    staticuInt8modeReg[8]={0x0B,0x0B,0x0B,0x0B,0xD6,0xD6,0xD6,0xD6};
    staticuInt8addrPort[8]={0x00,0x02,0x04,0x06,0xC0,0xC4,0xC8,0xCC};
    staticuInt8pagePort[8]={0x87,0x83,0x81,0x82,0x8F,0x8B,0x89,0x8A};
    staticuInt8countPort[8]={0x01,0x03,0x05,0x07,0xC2,0xC6,0xCA,0xCE};

    voiddmaXfer(uInt8channel,uInt32address,uIntlength,uInt8read){
    unsignedcharpage=0,mode=0;
    unsignedintoffset=0;
    if(read){
    mode=0x48+channel;
    }
    else{
    mode=0x44+channel;
    }
    page=address>>16;
    offset=address&0xFFFF;
    length--;
    _dmaXfer(channel,page,offset,length,mode);
    }

    void_dmaXfer(uInt8dmaChannel,uInt8page,uIntoffset,uIntlength,uInt8mode){
    //asm("cli");
    outportByte(maskReg[dmaChannel],0x04|dmaChannel);
    outportByte(clearReg[dmaChannel],0x00);
    outportByte(modeReg[dmaChannel],mode);
    outportByte(addrPort[dmaChannel],lowByte(offset));
    outportByte(addrPort[dmaChannel],highByte(offset));
    outportByte(pagePort[dmaChannel],page);
    outportByte(countPort[dmaChannel],lowByte(length));
    outportByte(countPort[dmaChannel],highByte(length));
    outportByte(maskReg[dmaChannel],dmaChannel);
    //asm("sti");
    }

    /***
    END
    ***/