require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_DEV_PCI_PCIIDE_ACARD_REG_H_)) {
    eval 'sub _DEV_PCI_PCIIDE_ACARD_REG_H_ () {1;}' unless defined(&_DEV_PCI_PCIIDE_ACARD_REG_H_);
    eval 'sub ATP850_IDETIME {
        my($channel) = @_;
	    eval q((0x40 + ($channel) * 4));
    }' unless defined(&ATP850_IDETIME);
    eval 'sub ATP860_IDETIME () {0x40;}' unless defined(&ATP860_IDETIME);
    eval 'sub ATP850_SETTIME {
        my($drive, $act, $rec) = @_;
	    eval q(((((($act) & 0xf) << 8) | (($rec) & 0xf)) << (($drive) * 16)));
    }' unless defined(&ATP850_SETTIME);
    eval 'sub ATP860_SETTIME {
        my($channel, $drive, $act, $rec) = @_;
	    eval q(((((($act) & 0xf) << 4) | (($rec) & 0xf)) << (($channel) * 16+ ($drive) * 8)));
    }' unless defined(&ATP860_SETTIME);
    eval 'sub ATP860_SETTIME_MASK {
        my($channel) = @_;
	    eval q((0xffff << (($channel) * 16)));
    }' unless defined(&ATP860_SETTIME_MASK);
    eval 'sub ATP850_UDMA () {0x54;}' unless defined(&ATP850_UDMA);
    eval 'sub ATP860_UDMA () {0x44;}' unless defined(&ATP860_UDMA);
    eval 'sub ATP850_UDMA_MODE {
        my($channel, $drive, $x) = @_;
	    eval q(((($x) & 0x3) << (($channel) * 4+ ($drive) * 2)));
    }' unless defined(&ATP850_UDMA_MODE);
    eval 'sub ATP860_UDMA_MODE {
        my($channel, $drive, $x) = @_;
	    eval q(((($x) & 0xf) << (($channel) * 8+ ($drive) * 4)));
    }' unless defined(&ATP860_UDMA_MODE);
    eval 'sub ATP850_UDMA_MASK {
        my($channel) = @_;
	    eval q((0xf << (($channel) * 4)));
    }' unless defined(&ATP850_UDMA_MASK);
    eval 'sub ATP860_UDMA_MASK {
        my($channel) = @_;
	    eval q((0xff << (($channel) * 8)));
    }' unless defined(&ATP860_UDMA_MASK);
    eval 'sub ATP8x0_CTRL () {0x48;}' unless defined(&ATP8x0_CTRL);
    eval 'sub ATP8x0_CTRL_EN {
        my($chan) = @_;
	    eval q((0x20000 << ($chan)));
    }' unless defined(&ATP8x0_CTRL_EN);
    eval 'sub ATP860_CTRL_INT () {0x10000;}' unless defined(&ATP860_CTRL_INT);
    eval 'sub ATP860_CTRL_80P {
        my($chan) = @_;
	    eval q((0x100 << ($chan)));
    }' unless defined(&ATP860_CTRL_80P);
}
1;
