require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_DEV_PCI_PCIIDE_CMD_REG_H_)) {
    eval 'sub _DEV_PCI_PCIIDE_CMD_REG_H_ () {1;}' unless defined(&_DEV_PCI_PCIIDE_CMD_REG_H_);
    eval 'sub CMD0646U2_REV () {0x5;}' unless defined(&CMD0646U2_REV);
    eval 'sub CMD0646U_REV () {0x3;}' unless defined(&CMD0646U_REV);
    eval 'sub CMD_CONF () {0x50;}' unless defined(&CMD_CONF);
    eval 'sub CMD_CONF_REV_MASK () {0x3;}' unless defined(&CMD_CONF_REV_MASK);
    eval 'sub CMD_CONF_DRV0_INTR () {0x4;}' unless defined(&CMD_CONF_DRV0_INTR);
    eval 'sub CMD_CONF_DEVID () {0x18;}' unless defined(&CMD_CONF_DEVID);
    eval 'sub CMD_CONF_VESAPRT () {0x20;}' unless defined(&CMD_CONF_VESAPRT);
    eval 'sub CMD_CONF_DSA1 () {0x40;}' unless defined(&CMD_CONF_DSA1);
    eval 'sub CMD_CONF_DSA0 () {0x80;}' unless defined(&CMD_CONF_DSA0);
    eval 'sub CMD_CTRL () {0x51;}' unless defined(&CMD_CTRL);
    eval 'sub CMD_CTRL_HR_FIFO () {0x1;}' unless defined(&CMD_CTRL_HR_FIFO);
    eval 'sub CMD_CTRL_HW_FIFO () {0x2;}' unless defined(&CMD_CTRL_HW_FIFO);
    eval 'sub CMD_CTRL_DEVSEL () {0x4;}' unless defined(&CMD_CTRL_DEVSEL);
    eval 'sub CMD_CTRL_2PORT () {0x8;}' unless defined(&CMD_CTRL_2PORT);
    eval 'sub CMD_CTRL_PAR () {0x10;}' unless defined(&CMD_CTRL_PAR);
    eval 'sub CMD_CTRL_HW_HLD () {0x20;}' unless defined(&CMD_CTRL_HW_HLD);
    eval 'sub CMD_CTRL_DRV0_RAHEAD () {0x40;}' unless defined(&CMD_CTRL_DRV0_RAHEAD);
    eval 'sub CMD_CTRL_DRV1_RAHEAD () {0x80;}' unless defined(&CMD_CTRL_DRV1_RAHEAD);
    eval 'sub CMD_DATA_TIM {
        my($chan, $drive) = @_;
	    eval q(((($chan) == 0) ? (($drive) == 0) ? 0x54: 0x56 : (($drive) == 0) ? 0x58 : 0x5b));
    }' unless defined(&CMD_DATA_TIM);
    eval 'sub CMD_ARTTIM23 () {0x57;}' unless defined(&CMD_ARTTIM23);
    eval 'sub CMD_ARTTIM23_IRQ () {0x10;}' unless defined(&CMD_ARTTIM23_IRQ);
    eval 'sub CMD_ARTTIM23_RHAEAD {
        my($d) = @_;
	    eval q(((0x4) << ($d)));
    }' unless defined(&CMD_ARTTIM23_RHAEAD);
    eval 'sub CMD_DMA_MODE () {0x71;}' unless defined(&CMD_DMA_MODE);
    eval 'sub CMD_DMA_MASK () {0x3;}' unless defined(&CMD_DMA_MASK);
    eval 'sub CMD_DMA () {0x;}' unless defined(&CMD_DMA);
    eval 'sub CMD_DMA_MULTIPLE () {0x1;}' unless defined(&CMD_DMA_MULTIPLE);
    eval 'sub CMD_DMA_LINE () {0x3;}' unless defined(&CMD_DMA_LINE);
    eval 'sub CMD_DMA_IRQ {
        my($chan) = @_;
	    eval q((0x4 << ($chan)));
    }' unless defined(&CMD_DMA_IRQ);
    eval 'sub CMD_DMA_IRQ_DIS {
        my($chan) = @_;
	    eval q((0x10 << ($chan)));
    }' unless defined(&CMD_DMA_IRQ_DIS);
    eval 'sub CMD_DMA_RST () {0x40;}' unless defined(&CMD_DMA_RST);
    eval 'sub CMD_BICSR () {0x79;}' unless defined(&CMD_BICSR);
    eval 'sub CMD_BICSR_80 {
        my($chan) = @_;
	    eval q((0x1 << ($chan)));
    }' unless defined(&CMD_BICSR_80);
    eval 'sub CMD_UDMATIM {
        my($channel) = @_;
	    eval q((0x73 + (8* ($channel))));
    }' unless defined(&CMD_UDMATIM);
    eval 'sub CMD_UDMATIM_UDMA {
        my($drive) = @_;
	    eval q((0x1 << ($drive)));
    }' unless defined(&CMD_UDMATIM_UDMA);
    eval 'sub CMD_UDMATIM_UDMA33 {
        my($drive) = @_;
	    eval q((0x4 << ($drive)));
    }' unless defined(&CMD_UDMATIM_UDMA33);
    eval 'sub CMD_UDMATIM_TIM_MASK () {0x3;}' unless defined(&CMD_UDMATIM_TIM_MASK);
    eval 'sub CMD_UDMATIM_TIM_OFF {
        my($drive) = @_;
	    eval q((4+ (($drive) * 2)));
    }' unless defined(&CMD_UDMATIM_TIM_OFF);
}
1;
