require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_DEV_PCI_PCIIDE_AMD_REG_H_)) {
    eval 'sub _DEV_PCI_PCIIDE_AMD_REG_H_ () {1;}' unless defined(&_DEV_PCI_PCIIDE_AMD_REG_H_);
    eval 'sub AMD756_CHIPREV_D2 () {3;}' unless defined(&AMD756_CHIPREV_D2);
    eval 'sub AMD756_CHIPREV_DISABLEDMA {
        my($product, $rev) = @_;
	    eval q((($product) ==  &PCI_PRODUCT_AMD_PBC756_IDE  && ($rev) <=  &AMD756_CHIPREV_D2));
    }' unless defined(&AMD756_CHIPREV_DISABLEDMA);
    eval 'sub AMD756_CHANSTATUS_EN () {0x40;}' unless defined(&AMD756_CHANSTATUS_EN);
    eval 'sub AMD756_CHAN_EN {
        my($chan) = @_;
	    eval q((0x1 << (1- ($chan))));
    }' unless defined(&AMD756_CHAN_EN);
    eval 'sub AMD756_CABLE {
        my($chan, $drive) = @_;
	    eval q((0x10000 << (($chan) * 2+ ($drive))));
    }' unless defined(&AMD756_CABLE);
    eval 'sub AMD756_DATATIM () {0x48;}' unless defined(&AMD756_DATATIM);
    eval 'sub AMD756_DATATIM_MASK {
        my($channel) = @_;
	    eval q((0xffff << ((1- ($channel)) << 4)));
    }' unless defined(&AMD756_DATATIM_MASK);
    eval 'sub AMD756_DATATIM_RECOV {
        my($channel, $drive, $x) = @_;
	    eval q(((($x) & 0xf) << (((1- ($channel)) << 4) + ((1- ($drive)) << 3))));
    }' unless defined(&AMD756_DATATIM_RECOV);
    eval 'sub AMD756_DATATIM_PULSE {
        my($channel, $drive, $x) = @_;
	    eval q(((($x) & 0xf) << (((1- ($channel)) << 4) + ((1- ($drive)) << 3) + 4)));
    }' unless defined(&AMD756_DATATIM_PULSE);
    eval 'sub AMD756_UDMA () {0x50;}' unless defined(&AMD756_UDMA);
    eval 'sub AMD756_UDMA_MASK {
        my($channel) = @_;
	    eval q((0xffff << ((1- ($channel)) << 4)));
    }' unless defined(&AMD756_UDMA_MASK);
    eval 'sub AMD756_UDMA_TIME {
        my($channel, $drive, $x) = @_;
	    eval q(((($x) & 0x7) << (((1- ($channel)) << 4) + ((1- ($drive)) << 3))));
    }' unless defined(&AMD756_UDMA_TIME);
    eval 'sub AMD756_UDMA_EN {
        my($channel, $drive) = @_;
	    eval q((0x40 << (((1- ($channel)) << 4) + ((1- ($drive)) << 3))));
    }' unless defined(&AMD756_UDMA_EN);
    eval 'sub AMD756_UDMA_EN_MTH {
        my($channel, $drive) = @_;
	    eval q((0x80 << (((1- ($channel)) << 4) + ((1- ($drive)) << 3))));
    }' unless defined(&AMD756_UDMA_EN_MTH);
}
1;
