require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_DEV_PCI_PCIIDE_PDC202XX_REG_H_)) {
    eval 'sub _DEV_PCI_PCIIDE_PDC202XX_REG_H_ () {1;}' unless defined(&_DEV_PCI_PCIIDE_PDC202XX_REG_H_);
    eval 'sub PDC2xx_STATE () {0x50;}' unless defined(&PDC2xx_STATE);
    eval 'sub PDC2xx_STATE_IDERAID () {0x1;}' unless defined(&PDC2xx_STATE_IDERAID);
    eval 'sub PDC2xx_STATE_NATIVE () {0x80;}' unless defined(&PDC2xx_STATE_NATIVE);
    eval 'sub PDC246_STATE_SHIPID () {0x8000;}' unless defined(&PDC246_STATE_SHIPID);
    eval 'sub PDC246_STATE_IOCHRDY () {0x400;}' unless defined(&PDC246_STATE_IOCHRDY);
    eval 'sub PDC246_STATE_LBA {
        my($channel) = @_;
	    eval q((0x100 << ($channel)));
    }' unless defined(&PDC246_STATE_LBA);
    eval 'sub PDC246_STATE_ISAIRQ () {0x8;}' unless defined(&PDC246_STATE_ISAIRQ);
    eval 'sub PDC246_STATE_EN {
        my($channel) = @_;
	    eval q((0x2 << ($channel)));
    }' unless defined(&PDC246_STATE_EN);
    eval 'sub PDC262_STATE_EN {
        my($chan) = @_;
	    eval q((0x1000 << ($chan)));
    }' unless defined(&PDC262_STATE_EN);
    eval 'sub PDC262_STATE_80P {
        my($chan) = @_;
	    eval q((0x400 << ($chan)));
    }' unless defined(&PDC262_STATE_80P);
    eval 'sub PDC2xx_TIM {
        my($channel, $drive) = @_;
	    eval q((0x60 + 4* ($drive) + 8* ($channel)));
    }' unless defined(&PDC2xx_TIM);
    eval 'sub PDC2xx_TIM_SET_PA {
        my($r, $x) = @_;
	    eval q(((($r) & 0xfffffff0) | (($x) & 0xf)));
    }' unless defined(&PDC2xx_TIM_SET_PA);
    eval 'sub PDC2xx_TIM_SET_PB {
        my($r, $x) = @_;
	    eval q(((($r) & 0xffffe0ff) | ((($x) & 0x1f) << 8)));
    }' unless defined(&PDC2xx_TIM_SET_PB);
    eval 'sub PDC2xx_TIM_SET_MB {
        my($r, $x) = @_;
	    eval q(((($r) & 0xffff1fff) | ((($x) & 0x7) << 13)));
    }' unless defined(&PDC2xx_TIM_SET_MB);
    eval 'sub PDC2xx_TIM_SET_MC {
        my($r, $x) = @_;
	    eval q(((($r) & 0xfff0ffff) | ((($x) & 0xf) << 16)));
    }' unless defined(&PDC2xx_TIM_SET_MC);
    eval 'sub PDC2xx_TIM_PRE () {0x10;}' unless defined(&PDC2xx_TIM_PRE);
    eval 'sub PDC2xx_TIM_IORDY () {0x20;}' unless defined(&PDC2xx_TIM_IORDY);
    eval 'sub PDC2xx_TIM_ERRDY () {0x40;}' unless defined(&PDC2xx_TIM_ERRDY);
    eval 'sub PDC2xx_TIM_SYNC () {0x80;}' unless defined(&PDC2xx_TIM_SYNC);
    eval 'sub PDC2xx_TIM_DMAW () {0x100000;}' unless defined(&PDC2xx_TIM_DMAW);
    eval 'sub PDC2xx_TIM_DMAR () {0x200000;}' unless defined(&PDC2xx_TIM_DMAR);
    eval 'sub PDC2xx_TIM_IORDYp () {0x400000;}' unless defined(&PDC2xx_TIM_IORDYp);
    eval 'sub PDC2xx_TIM_DMARQp () {0x800000;}' unless defined(&PDC2xx_TIM_DMARQp);
    eval 'sub PDC262_U66 () {0x11;}' unless defined(&PDC262_U66);
    eval 'sub PDC262_U66_EN {
        my($chan) = @_;
	    eval q((0x2 << (($chan) *2)));
    }' unless defined(&PDC262_U66_EN);
    eval 'sub PDC2xx_PM () {0x1a;}' unless defined(&PDC2xx_PM);
    eval 'sub PDC2xx_SM () {0x1b;}' unless defined(&PDC2xx_SM);
    eval 'sub PDC2xx_SCR () {0x1c;}' unless defined(&PDC2xx_SCR);
    eval 'sub PDC2xx_SCR_SET_GEN {
        my($r,$x) = @_;
	    eval q(((($r) & 0xffffff00) | (($x) & 0xff)));
    }' unless defined(&PDC2xx_SCR_SET_GEN);
    eval 'sub PDC2xx_SCR_EMPTY {
        my($channel) = @_;
	    eval q((0x100 << (4* $channel)));
    }' unless defined(&PDC2xx_SCR_EMPTY);
    eval 'sub PDC2xx_SCR_FULL {
        my($channel) = @_;
	    eval q((0x200 << (4* $channel)));
    }' unless defined(&PDC2xx_SCR_FULL);
    eval 'sub PDC2xx_SCR_INT {
        my($channel) = @_;
	    eval q((0x400 << (4* $channel)));
    }' unless defined(&PDC2xx_SCR_INT);
    eval 'sub PDC2xx_SCR_ERR {
        my($channel) = @_;
	    eval q((0x800 << (4* $channel)));
    }' unless defined(&PDC2xx_SCR_ERR);
    eval 'sub PDC2xx_SCR_SET_I2C {
        my($r,$x) = @_;
	    eval q(((($r) & 0xfff0ffff) | ((($x) & 0xf) << 16)));
    }' unless defined(&PDC2xx_SCR_SET_I2C);
    eval 'sub PDC2xx_SCR_SET_POLL {
        my($r,$x) = @_;
	    eval q(((($r) & 0xff0fffff) | ((($x) & 0xf) << 20)));
    }' unless defined(&PDC2xx_SCR_SET_POLL);
    eval 'sub PDC2xx_SCR_DMA () {0x1000000;}' unless defined(&PDC2xx_SCR_DMA);
    eval 'sub PDC2xx_SCR_IORDY () {0x2000000;}' unless defined(&PDC2xx_SCR_IORDY);
    eval 'sub PDC2xx_SCR_G2FD () {0x4000000;}' unless defined(&PDC2xx_SCR_G2FD);
    eval 'sub PDC2xx_SCR_FLOAT () {0x8000000;}' unless defined(&PDC2xx_SCR_FLOAT);
    eval 'sub PDC2xx_SCR_RSET () {0x10000000;}' unless defined(&PDC2xx_SCR_RSET);
    eval 'sub PDC2xx_SCR_TST () {0x20000000;}' unless defined(&PDC2xx_SCR_TST);
    eval 'sub PDC262_SCR_GEN_LAT () {0x20;}' unless defined(&PDC262_SCR_GEN_LAT);
    eval 'sub PDC262_ATAPI {
        my($chan) = @_;
	    eval q((0x20 + (4* ($chan))));
    }' unless defined(&PDC262_ATAPI);
    eval 'sub PDC262_ATAPI_WC_MASK () {0xfff;}' unless defined(&PDC262_ATAPI_WC_MASK);
    eval 'sub PDC262_ATAPI_DMA_READ () {0x1000;}' unless defined(&PDC262_ATAPI_DMA_READ);
    eval 'sub PDC262_ATAPI_DMA_WRITE () {0x2000;}' unless defined(&PDC262_ATAPI_DMA_WRITE);
    eval 'sub PDC262_ATAPI_UDMA () {0x4000;}' unless defined(&PDC262_ATAPI_UDMA);
    eval 'sub PDC262_ATAPI_LBA48_READ () {0x5000000;}' unless defined(&PDC262_ATAPI_LBA48_READ);
    eval 'sub PDC262_ATAPI_LBA48_WRITE () {0x6000000;}' unless defined(&PDC262_ATAPI_LBA48_WRITE);
    eval 'sub PDC268_INDEX {
        my($chan) = @_;
	    eval q((0x1 +  &IDEDMA_SCH_OFFSET * ($chan)));
    }' unless defined(&PDC268_INDEX);
    eval 'sub PDC268_DATA {
        my($chan) = @_;
	    eval q((0x3 +  &IDEDMA_SCH_OFFSET * ($chan)));
    }' unless defined(&PDC268_DATA);
    eval 'sub PDC268_CABLE () {0x4;}' unless defined(&PDC268_CABLE);
    eval 'sub PDC268_INTR () {0x20;}' unless defined(&PDC268_INTR);
    eval 'sub PDC203xx_NCHANNELS () {4;}' unless defined(&PDC203xx_NCHANNELS);
    eval 'sub PDC203xx_BAR_IDEREGS () {0x1c;}' unless defined(&PDC203xx_BAR_IDEREGS);
    eval 'sub PDC40718_NCHANNELS () {4;}' unless defined(&PDC40718_NCHANNELS);
    eval 'sub PDC20575_NCHANNELS () {3;}' unless defined(&PDC20575_NCHANNELS);
    eval 'sub PDC205_REGADDR {
        my($base,$ch) = @_;
	    eval q((($base)+(($ch)<<8)));
    }' unless defined(&PDC205_REGADDR);
    eval 'sub PDC205_SSTATUS {
        my($ch) = @_;
	    eval q( &PDC205_REGADDR(0x400,$ch));
    }' unless defined(&PDC205_SSTATUS);
    eval 'sub PDC205_SERROR {
        my($ch) = @_;
	    eval q( &PDC205_REGADDR(0x404,$ch));
    }' unless defined(&PDC205_SERROR);
    eval 'sub PDC205_SCONTROL {
        my($ch) = @_;
	    eval q( &PDC205_REGADDR(0x408,$ch));
    }' unless defined(&PDC205_SCONTROL);
    eval 'sub PDC205_MULTIPLIER {
        my($ch) = @_;
	    eval q( &PDC205_REGADDR(0x4e8,$ch));
    }' unless defined(&PDC205_MULTIPLIER);
    eval 'sub SCONTROL_WRITE {
        my($ps,$channel,$scontrol) = @_;
	    eval q( &bus_space_write_4(($ps)-> &ba5_st, ($ps)-> &ba5_sh,  &PDC205_SCONTROL($channel), $scontrol));
    }' unless defined(&SCONTROL_WRITE);
    eval 'sub SSTATUS_READ {
        my($sc,$channel) = @_;
	    eval q( &bus_space_read_4(( &ps)-> &ba5_st, ( &ps)-> &ba5_sh,  &PDC205_SSTATUS($channel)));
    }' unless defined(&SSTATUS_READ);
}
1;
