require '_h2ph_pre.ph';

unless(defined(&_MAC68K_INTR_H_)) {
    eval 'sub _MAC68K_INTR_H_ () {1;}' unless defined(&_MAC68K_INTR_H_);
    if(defined(&_KERNEL)) {
	eval 'sub _spl {
	    local($s) = @_;
    	    eval q(({  &register \'int\'  &_spl_r;  &__asm  &__volatile (\\"clrl %0; movew sr,%0; movew %1,sr\\" : \\"=&d\\" ( &_spl_r) : \\"di\\" ($s));  &_spl_r; }));
	}' unless defined(&_spl);
	eval 'sub _splraise {
	    local($s) = @_;
    	    eval q(({ \'int\'  &_spl_r;  &__asm  &__volatile (\\"								clrl	d0					;			movw	sr,d0					;			movl	d0,%0					;			andw	#0x700,d0				;			movw	%1,d1					;			andw	#0x700,d1				;			cmpw	d0,d1					;			jle	1f					;			movw	%1,sr					;		    1:\\" : \\"=&d\\" ( &_spl_r) : \\"di\\" ($s) : \\"d0\\", \\"d1\\");  &_spl_r; }));
	}' unless defined(&_splraise);
	eval 'sub spl1 () {
	    eval q( &_spl( &PSL_S| &PSL_IPL1));
	}' unless defined(&spl1);
	eval 'sub spl2 () {
	    eval q( &_spl( &PSL_S| &PSL_IPL2));
	}' unless defined(&spl2);
	eval 'sub spl3 () {
	    eval q( &_spl( &PSL_S| &PSL_IPL3));
	}' unless defined(&spl3);
	eval 'sub spl4 () {
	    eval q( &_spl( &PSL_S| &PSL_IPL4));
	}' unless defined(&spl4);
	eval 'sub spl5 () {
	    eval q( &_spl( &PSL_S| &PSL_IPL5));
	}' unless defined(&spl5);
	eval 'sub spl6 () {
	    eval q( &_spl( &PSL_S| &PSL_IPL6));
	}' unless defined(&spl6);
	eval 'sub spl7 () {
	    eval q( &_spl( &PSL_S| &PSL_IPL7));
	}' unless defined(&spl7);
	eval 'sub spladb () {
	    eval q( &splhigh());
	}' unless defined(&spladb);
	eval 'sub splzs () {
	    eval q( &splserial());
	}' unless defined(&splzs);
	eval 'sub splsoft () {
	    eval q( &spl1());
	}' unless defined(&splsoft);
	eval 'sub splsoftclock () {
	    eval q( &splsoft());
	}' unless defined(&splsoftclock);
	eval 'sub splsoftnet () {
	    eval q( &splsoft());
	}' unless defined(&splsoftnet);
	eval 'sub spltty () {
	    eval q( &_splraise( &mac68k_ttyipl));
	}' unless defined(&spltty);
	eval 'sub splbio () {
	    eval q( &_splraise( &mac68k_bioipl));
	}' unless defined(&splbio);
	eval 'sub splnet () {
	    eval q( &_splraise( &mac68k_netipl));
	}' unless defined(&splnet);
	eval 'sub splimp () {
	    eval q( &_splraise( &mac68k_impipl));
	}' unless defined(&splimp);
	eval 'sub splclock () {
	    eval q( &_splraise( &mac68k_clockipl));
	}' unless defined(&splclock);
	eval 'sub splstatclock () {
	    eval q( &_splraise( &mac68k_statclockipl));
	}' unless defined(&splstatclock);
	eval 'sub splsched () {
	    eval q( &_splsched( &mac68k_schedipl));
	}' unless defined(&splsched);
	eval 'sub splserial () {
	    eval q( &spl4());
	}' unless defined(&splserial);
	eval 'sub splhigh () {
	    eval q( &spl7());
	}' unless defined(&splhigh);
	eval 'sub splx {
	    local($s) = @_;
    	    eval q((($s) &  &PSL_IPL ?  &_spl($s) :  &spl0()));
	}' unless defined(&splx);
	eval 'sub SIR_NET () {0x01;}' unless defined(&SIR_NET);
	eval 'sub SIR_CLOCK () {0x02;}' unless defined(&SIR_CLOCK);
	eval 'sub SIR_SERIAL () {0x04;}' unless defined(&SIR_SERIAL);
	eval 'sub SIR_DTMGR () {0x08;}' unless defined(&SIR_DTMGR);
	eval 'sub SIR_ADB () {0x10;}' unless defined(&SIR_ADB);
	eval 'sub siron {
	    local($mask) = @_;
    	    eval q( &__asm  &__volatile ( \\"orb %0,_ssir\\" : : \\"i\\" ($mask)));
	}' unless defined(&siron);
	eval 'sub siroff {
	    local($mask) = @_;
    	    eval q( &__asm  &__volatile ( \\"andb %0,_ssir\\" : : \\"ir\\" (~($mask))););
	}' unless defined(&siroff);
	eval 'sub setsoftnet () {
	    eval q( &siron( &SIR_NET));
	}' unless defined(&setsoftnet);
	eval 'sub setsoftclock () {
	    eval q( &siron( &SIR_CLOCK));
	}' unless defined(&setsoftclock);
	eval 'sub setsoftserial () {
	    eval q( &siron( &SIR_SERIAL));
	}' unless defined(&setsoftserial);
	eval 'sub setsoftdtmgr () {
	    eval q( &siron( &SIR_DTMGR));
	}' unless defined(&setsoftdtmgr);
	eval 'sub setsoftadb () {
	    eval q( &siron( &SIR_ADB));
	}' unless defined(&setsoftadb);
    }
}
1;
