require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_DEV_PCI_PCIIDE_APOLLO_REG_H_)) {
    eval 'sub _DEV_PCI_PCIIDE_APOLLO_REG_H_ () {1;}' unless defined(&_DEV_PCI_PCIIDE_APOLLO_REG_H_);
    eval 'sub APO_IDECONF () {0x40;}' unless defined(&APO_IDECONF);
    eval 'sub APO_IDECONF_EN {
        my($channel) = @_;
	    eval q((0x1 << (1- ($channel))));
    }' unless defined(&APO_IDECONF_EN);
    eval 'sub APO_IDECONF_SERR_EN () {0x100;}' unless defined(&APO_IDECONF_SERR_EN);
    eval 'sub APO_IDECONF_DS_SOURCE () {0x200;}' unless defined(&APO_IDECONF_DS_SOURCE);
    eval 'sub APO_IDECONF_ALT_INTR_EN () {0x400;}' unless defined(&APO_IDECONF_ALT_INTR_EN);
    eval 'sub APO_IDECONF_PERR_EN () {0x800;}' unless defined(&APO_IDECONF_PERR_EN);
    eval 'sub APO_IDECONF_WR_BUFF_EN {
        my($channel) = @_;
	    eval q((0x1000 << ((1- ($channel)) << 1)));
    }' unless defined(&APO_IDECONF_WR_BUFF_EN);
    eval 'sub APO_IDECONF_RD_PREF_EN {
        my($channel) = @_;
	    eval q((0x2000 << ((1- ($channel)) << 1)));
    }' unless defined(&APO_IDECONF_RD_PREF_EN);
    eval 'sub APO_IDECONF_DEVSEL_TME () {0x10000;}' unless defined(&APO_IDECONF_DEVSEL_TME);
    eval 'sub APO_IDECONF_MAS_CMD_MON () {0x20000;}' unless defined(&APO_IDECONF_MAS_CMD_MON);
    eval 'sub APO_IDECONF_IO_NAT {
        my($channel) = @_;
	    eval q((0x400000 << (1- ($channel))));
    }' unless defined(&APO_IDECONF_IO_NAT);
    eval 'sub APO_IDECONF_FIFO_TRSH {
        my($channel, $x) = @_;
	    eval q((($x) & 0x3) << ((1- ($channel)) << 1+ 24));
    }' unless defined(&APO_IDECONF_FIFO_TRSH);
    eval 'sub APO_IDECONF_FIFO_CONF_MASK () {0x60000000;}' unless defined(&APO_IDECONF_FIFO_CONF_MASK);
    eval 'sub APO_CTLMISC () {0x44;}' unless defined(&APO_CTLMISC);
    eval 'sub APO_CTLMISC_BM_STS_RTY () {0x8;}' unless defined(&APO_CTLMISC_BM_STS_RTY);
    eval 'sub APO_CTLMISC_FIFO_HWS () {0x10;}' unless defined(&APO_CTLMISC_FIFO_HWS);
    eval 'sub APO_CTLMISC_WR_IRDY_WS () {0x20;}' unless defined(&APO_CTLMISC_WR_IRDY_WS);
    eval 'sub APO_CTLMISC_RD_IRDY_WS () {0x40;}' unless defined(&APO_CTLMISC_RD_IRDY_WS);
    eval 'sub APO_CTLMISC_INTR_SWP () {0x4000;}' unless defined(&APO_CTLMISC_INTR_SWP);
    eval 'sub APO_CTLMISC_DRDY_TIME_MASK () {0x30000;}' unless defined(&APO_CTLMISC_DRDY_TIME_MASK);
    eval 'sub APO_CTLMISC_FIFO_FLSH_RD {
        my($channel) = @_;
	    eval q((0x100000 << (1- ($channel))));
    }' unless defined(&APO_CTLMISC_FIFO_FLSH_RD);
    eval 'sub APO_CTLMISC_FIFO_FLSH_DMA {
        my($channel) = @_;
	    eval q((0x400000 << (1- ($channel))));
    }' unless defined(&APO_CTLMISC_FIFO_FLSH_DMA);
    eval 'sub APO_DATATIM () {0x48;}' unless defined(&APO_DATATIM);
    eval 'sub APO_DATATIM_MASK {
        my($channel) = @_;
	    eval q((0xffff << ((1- ($channel)) << 4)));
    }' unless defined(&APO_DATATIM_MASK);
    eval 'sub APO_DATATIM_RECOV {
        my($channel, $drive, $x) = @_;
	    eval q(((($x) & 0xf) << (((1- ($channel)) << 4) + ((1- ($drive)) << 3))));
    }' unless defined(&APO_DATATIM_RECOV);
    eval 'sub APO_DATATIM_PULSE {
        my($channel, $drive, $x) = @_;
	    eval q(((($x) & 0xf) << (((1- ($channel)) << 4) + ((1- ($drive)) << 3) + 4)));
    }' unless defined(&APO_DATATIM_PULSE);
    eval 'sub APO_MISCTIM () {0x4c;}' unless defined(&APO_MISCTIM);
    eval 'sub APO_UDMA () {0x50;}' unless defined(&APO_UDMA);
    eval 'sub APO_UDMA_MASK {
        my($channel) = @_;
	    eval q((0xffff << ((1- ($channel)) << 4)));
    }' unless defined(&APO_UDMA_MASK);
    eval 'sub APO_UDMA_TIME {
        my($channel, $drive, $x) = @_;
	    eval q(((($x) & 0xf) << (((1- ($channel)) << 4) + ((1- ($drive)) << 3))));
    }' unless defined(&APO_UDMA_TIME);
    eval 'sub APO_UDMA_PIO_MODE {
        my($channel, $drive) = @_;
	    eval q((0x20 << (((1- ($channel)) << 4) + ((1- ($drive)) << 3))));
    }' unless defined(&APO_UDMA_PIO_MODE);
    eval 'sub APO_UDMA_EN {
        my($channel, $drive) = @_;
	    eval q((0x40 << (((1- ($channel)) << 4) + ((1- ($drive)) << 3))));
    }' unless defined(&APO_UDMA_EN);
    eval 'sub APO_UDMA_EN_MTH {
        my($channel, $drive) = @_;
	    eval q((0x80 << (((1- ($channel)) << 4) + ((1- ($drive)) << 3))));
    }' unless defined(&APO_UDMA_EN_MTH);
    eval 'sub APO_UDMA_CLK66 {
        my($channel) = @_;
	    eval q((0x8 << ((1- ($channel)) << 4)));
    }' unless defined(&APO_UDMA_CLK66);
}
1;
