require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_DEV_PCI_PCIIDE_ITE_REG_H_)) {
    eval 'sub _DEV_PCI_PCIIDE_ITE_REG_H_ () {1;}' unless defined(&_DEV_PCI_PCIIDE_ITE_REG_H_);
    eval 'sub IT_CFG () {0x40;}' unless defined(&IT_CFG);
    eval 'sub IT_CFG_MASK () {0xffff;}' unless defined(&IT_CFG_MASK);
    eval 'sub IT_CFG_IORDY {
        my($chan) = @_;
	    eval q((0x1 << ($chan)));
    }' unless defined(&IT_CFG_IORDY);
    eval 'sub IT_CFG_BLID {
        my($chan) = @_;
	    eval q((0x4 << ($chan)));
    }' unless defined(&IT_CFG_BLID);
    eval 'sub IT_CFG_CABLE {
        my($chan, $drive) = @_;
	    eval q((0x10 << (($chan) * 2+ ($drive))));
    }' unless defined(&IT_CFG_CABLE);
    eval 'sub IT_CFG_DECODE {
        my($chan) = @_;
	    eval q((0x8000 >> (($chan) * 2)));
    }' unless defined(&IT_CFG_DECODE);
    eval 'sub IT_MODE () {0x50;}' unless defined(&IT_MODE);
    eval 'sub IT_MODE_MASK () {0xffff;}' unless defined(&IT_MODE_MASK);
    eval 'sub IT_MODE_CPU () {0x1;}' unless defined(&IT_MODE_CPU);
    eval 'sub IT_MODE_50MHZ {
        my($chan) = @_;
	    eval q((0x2 << ($chan)));
    }' unless defined(&IT_MODE_50MHZ);
    eval 'sub IT_MODE_DMA {
        my($chan, $drive) = @_;
	    eval q((0x8 << (($chan) * 2+ ($drive))));
    }' unless defined(&IT_MODE_DMA);
    eval 'sub IT_MODE_RESET () {0x80;}' unless defined(&IT_MODE_RESET);
    eval 'sub IT_MODE_RAID1 () {0x100;}' unless defined(&IT_MODE_RAID1);
    eval 'sub IT_TIM {
        my($chan) = @_;
	    eval q((($chan) ? 0x58 : 0x54));
    }' unless defined(&IT_TIM);
    eval 'sub IT_TIM_UDMA5 {
        my($drive) = @_;
	    eval q((0x800000 << ($drive) * 8));
    }' unless defined(&IT_TIM_UDMA5);
}
1;
