require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_EVBARM_INTR_H_)) {
    eval 'sub _EVBARM_INTR_H_ () {1;}' unless defined(&_EVBARM_INTR_H_);
    if(defined(&_KERNEL)) {
	eval 'sub IPL_NONE () {0;}' unless defined(&IPL_NONE);
	eval 'sub IPL_SOFTCLOCK () {1;}' unless defined(&IPL_SOFTCLOCK);
	eval 'sub IPL_SOFTBIO () {2;}' unless defined(&IPL_SOFTBIO);
	eval 'sub IPL_SOFTNET () {3;}' unless defined(&IPL_SOFTNET);
	eval 'sub IPL_SOFTSERIAL () {4;}' unless defined(&IPL_SOFTSERIAL);
	eval 'sub IPL_VM () {5;}' unless defined(&IPL_VM);
	eval 'sub IPL_SCHED () {6;}' unless defined(&IPL_SCHED);
	eval 'sub IPL_HIGH () {7;}' unless defined(&IPL_HIGH);
	eval 'sub NIPL () {8;}' unless defined(&NIPL);
	eval 'sub IST_NONE () {0;}' unless defined(&IST_NONE);
	eval 'sub IST_PULSE () {1;}' unless defined(&IST_PULSE);
	eval 'sub IST_EDGE () {2;}' unless defined(&IST_EDGE);
	eval 'sub IST_LEVEL () {3;}' unless defined(&IST_LEVEL);
	eval 'sub IST_LEVEL_LOW () { &IST_LEVEL;}' unless defined(&IST_LEVEL_LOW);
	eval 'sub IST_LEVEL_HIGH () {4;}' unless defined(&IST_LEVEL_HIGH);
	eval 'sub IST_EDGE_FALLING () { &IST_EDGE;}' unless defined(&IST_EDGE_FALLING);
	eval 'sub IST_EDGE_RISING () {5;}' unless defined(&IST_EDGE_RISING);
	eval 'sub IST_EDGE_BOTH () {6;}' unless defined(&IST_EDGE_BOTH);
	eval 'sub IST_SOFT () {7;}' unless defined(&IST_SOFT);
	eval 'sub IST_MPSAFE () {0x100;}' unless defined(&IST_MPSAFE);
	unless(defined(&_LOCORE)) {
	    require 'sys/queue.ph';
	    if(defined(&_MODULE)) {
	    } else {
		require './evbarm/opt_arm_intr_impl.ph';
		if(defined(&ARM_INTR_IMPL)) {
		} else {
		    die("ARM_INTR_IMPL\ not\ defined\.");
		}
	    }
	    eval 'sub makeiplcookie {
	        my($ipl) = @_;
    		eval q({ ( &ipl_cookie_t){. &_ipl = $ipl}; });
	    }' unless defined(&makeiplcookie);
	    eval 'sub splraiseipl {
	        my($icookie) = @_;
    		eval q({  &_splraise( ($icookie->{_ipl})); });
	    }' unless defined(&splraiseipl);
	    eval 'sub spl0 () {
	        eval q( &_spllower( &IPL_NONE));
	    }' unless defined(&spl0);
	    require 'sys/spl.ph';
	}
    }
}
1;
