require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_DEV_IC_VICVAR_H)) {
    eval 'sub _DEV_IC_VICVAR_H () {1;}' unless defined(&_DEV_IC_VICVAR_H);
    eval 'sub VIC_DEBUG () {1;}' unless defined(&VIC_DEBUG);
    eval 'sub VIC_BAR0 () {0x10;}' unless defined(&VIC_BAR0);
    eval 'sub VIC_NBUF () {100;}' unless defined(&VIC_NBUF);
    eval 'sub VIC_NBUF_MAX () {128;}' unless defined(&VIC_NBUF_MAX);
    eval 'sub VIC_MAX_SCATTER () {1;}' unless defined(&VIC_MAX_SCATTER);
    eval 'sub VIC_QUEUE_SIZE () { &VIC_NBUF_MAX;}' unless defined(&VIC_QUEUE_SIZE);
    eval 'sub VIC_QUEUE2_SIZE () {1;}' unless defined(&VIC_QUEUE2_SIZE);
    eval 'sub VIC_INC {
        local($_x, $_y) = @_;
	    eval q(($_x) = (($_x) + 1) % ($_y));
    }' unless defined(&VIC_INC);
    eval 'sub VIC_INC_POS {
        local($_x, $_y) = @_;
	    eval q(($_x) = (++($_x)) % ($_y) ? ($_x) : 1);
    }' unless defined(&VIC_INC_POS);
    eval 'sub VIC_TX_TIMEOUT () {5;}' unless defined(&VIC_TX_TIMEOUT);
    eval 'sub VIC_TIMER_DELAY () {2;}' unless defined(&VIC_TIMER_DELAY);
    eval 'sub VIC_TIMER_MS {
        local($_ms) = @_;
	    eval q(($_ms *  &hz / 1000));
    }' unless defined(&VIC_TIMER_MS);
    eval 'sub VIC_TXURN_WARN {
        local($_sc) = @_;
	    eval q((($_sc)-> &sc_txpending >= (($_sc)-> &sc_ntxbuf - 5)));
    }' unless defined(&VIC_TXURN_WARN);
    eval 'sub VIC_TXURN {
        local($_sc) = @_;
	    eval q((($_sc)-> &sc_txpending >= ($_sc)-> &sc_ntxbuf));
    }' unless defined(&VIC_TXURN);
    eval 'sub VIC_OFF_RXDESC {
        local($_n) = @_;
	    eval q(($sizeof{\'struct vic_data\'} + (($_n) * $sizeof{\'struct vic_rxdesc\'})));
    }' unless defined(&VIC_OFF_RXDESC);
    eval 'sub VIC_OFF_TXDESC {
        local($_n) = @_;
	    eval q(($sizeof{\'struct vic_data\'} + (( ($sc->{sc_nrxbuf}) +  &VIC_QUEUE2_SIZE) * $sizeof{\'struct vic_rxdesc\'}) + (($_n) * $sizeof{\'struct vic_txdesc\'})));
    }' unless defined(&VIC_OFF_TXDESC);
    eval 'sub VIC_WRITE {
        local($_reg, $_val) = @_;
	    eval q( &bus_space_write_4( ($sc->{sc_st}),  ($sc->{sc_sh}), ($_reg), ($_val)));
    }' unless defined(&VIC_WRITE);
    eval 'sub VIC_READ {
        local($_reg) = @_;
	    eval q( &bus_space_read_4( ($sc->{sc_st}),  ($sc->{sc_sh}), ($_reg)));
    }' unless defined(&VIC_READ);
    eval 'sub VIC_WRITE8 {
        local($_reg, $_val) = @_;
	    eval q( &bus_space_write_1( ($sc->{sc_st}),  ($sc->{sc_sh}), ($_reg), ($_val)));
    }' unless defined(&VIC_WRITE8);
    eval 'sub VIC_READ8 {
        local($_reg) = @_;
	    eval q( &bus_space_read_1( ($sc->{sc_st}),  ($sc->{sc_sh}), ($_reg)));
    }' unless defined(&VIC_READ8);
}
1;
