require '_h2ph_pre.ph';

unless(defined(&_OPENBSD_OS_H_)) {
    eval 'sub _OPENBSD_OS_H_ () {1;}' unless defined(&_OPENBSD_OS_H_);
    eval 'sub ASSERT {
        local($x) = @_;
	    eval q( &if(!($x))  &panic(\\"EM: x\\"));
    }' unless defined(&ASSERT);
    eval 'sub usec_delay {
        local($x) = @_;
	    eval q( &DELAY($x));
    }' unless defined(&usec_delay);
    eval 'sub msec_delay {
        local($x) = @_;
	    eval q( &DELAY(1000*($x)));
    }' unless defined(&msec_delay);
    eval 'sub MSGOUT {
        local($S, $A, $B) = @_;
	    eval q( &printf($S \\"\\\\n\\", $A, $B));
    }' unless defined(&MSGOUT);
    eval 'sub DEBUGFUNC {
        local($F) = @_;
	    eval q( &DEBUGOUT($F););
    }' unless defined(&DEBUGFUNC);
    if((defined(&DBG) ? &DBG : 0)) {
	eval 'sub DEBUGOUT {
	    local($S) = @_;
    	    eval q( &printf($S \\"\\\\n\\"));
	}' unless defined(&DEBUGOUT);
	eval 'sub DEBUGOUT1 {
	    local($S,$A) = @_;
    	    eval q( &printf($S \\"\\\\n\\",$A));
	}' unless defined(&DEBUGOUT1);
	eval 'sub DEBUGOUT2 {
	    local($S,$A,$B) = @_;
    	    eval q( &printf($S \\"\\\\n\\",$A,$B));
	}' unless defined(&DEBUGOUT2);
	eval 'sub DEBUGOUT3 {
	    local($S,$A,$B,$C) = @_;
    	    eval q( &printf($S \\"\\\\n\\",$A,$B,$C));
	}' unless defined(&DEBUGOUT3);
	eval 'sub DEBUGOUT7 {
	    local($S,$A,$B,$C,$D,$E,$F,$G) = @_;
    	    eval q( &printf($S \\"\\\\n\\",$A,$B,$C,$D,$E,$F,$G));
	}' unless defined(&DEBUGOUT7);
    } else {
	eval 'sub DEBUGOUT {
	    local($S) = @_;
    	    eval q();
	}' unless defined(&DEBUGOUT);
	eval 'sub DEBUGOUT1 {
	    local($S,$A) = @_;
    	    eval q();
	}' unless defined(&DEBUGOUT1);
	eval 'sub DEBUGOUT2 {
	    local($S,$A,$B) = @_;
    	    eval q();
	}' unless defined(&DEBUGOUT2);
	eval 'sub DEBUGOUT3 {
	    local($S,$A,$B,$C) = @_;
    	    eval q();
	}' unless defined(&DEBUGOUT3);
	eval 'sub DEBUGOUT7 {
	    local($S,$A,$B,$C,$D,$E,$F,$G) = @_;
    	    eval q();
	}' unless defined(&DEBUGOUT7);
    }
    eval 'sub FALSE () {0;}' unless defined(&FALSE);
    eval 'sub TRUE () {1;}' unless defined(&TRUE);
    eval 'sub CMD_MEM_WRT_INVALIDATE () {0x10;}' unless defined(&CMD_MEM_WRT_INVALIDATE);
    eval 'sub PCI_COMMAND_REGISTER () { &PCI_COMMAND_STATUS_REG;}' unless defined(&PCI_COMMAND_REGISTER);
    eval 'sub E1000_READ_REG {
        local($hw, $reg) = @_;
	    eval q( &bus_space_read_4( (-> &back)-> &em_btag, (($hw)-> &back)-> &em_bhandle, (($hw)-> &mac_type >=  &em_82543) ?  &E1000_$reg :  &E1000_82542_$reg));
    }' unless defined(&E1000_READ_REG);
    eval 'sub E1000_WRITE_REG {
        local($hw, $reg, $value) = @_;
	    eval q( &bus_space_write_4( (-> &back)-> &em_btag, (($hw)-> &back)-> &em_bhandle, (($hw)-> &mac_type >=  &em_82543) ?  &E1000_$reg :  &E1000_82542_$reg, $value));
    }' unless defined(&E1000_WRITE_REG);
    eval 'sub E1000_READ_REG_ARRAY {
        local($sc, $reg, $offset) = @_;
	    eval q( &bus_space_read_4( (-> &back)-> &em_btag, (( &hw)-> &back)-> &em_bhandle, (( &hw)-> &mac_type >=  &em_82543) ? ( &E1000_$reg + (($offset) << 2)) : ( &E1000_82542_$reg + (($offset) << 2)) ));
    }' unless defined(&E1000_READ_REG_ARRAY);
    eval 'sub E1000_WRITE_REG_ARRAY {
        local($sc, $reg, $offset, $value) = @_;
	    eval q( &bus_space_write_4( (-> &back)-> &em_btag, (( &hw)-> &back)-> &em_bhandle, (( &hw)-> &mac_type >=  &em_82543) ? ( &E1000_$reg + (($offset) << 2)) : ( &E1000_82542_$reg + (($offset) << 2)), $value));
    }' unless defined(&E1000_WRITE_REG_ARRAY);
}
1;
