require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_MACHINE_AUTOCONF_H_)) {
    eval 'sub _MACHINE_AUTOCONF_H_ () {1;}' unless defined(&_MACHINE_AUTOCONF_H_);
    require 'machine/bus.ph';
    eval 'sub MAX_CPUS () {4;}' unless defined(&MAX_CPUS);
    eval 'sub COM_FREQ () {( ($sys_config->{cons_baudclk}));}' unless defined(&COM_FREQ);
    eval 'sub CONCOM_FREQ () {( ($sys_config->{cons_baudclk}));}' unless defined(&CONCOM_FREQ);
    eval 'sub CONADDR () {( ($sys_config->{cons_ioaddr[0]}));}' unless defined(&CONADDR);
    eval 'sub BUS_MAIN () {1;}' unless defined(&BUS_MAIN);
    eval 'sub BUS_LOCAL () {2;}' unless defined(&BUS_LOCAL);
    eval 'sub BUS_ISABR () {3;}' unless defined(&BUS_ISABR);
    eval 'sub BUS_PLCHLDR () {4;}' unless defined(&BUS_PLCHLDR);
    eval 'sub BUS_PCIBR () {5;}' unless defined(&BUS_PCIBR);
    eval 'sub BUS_INTR_ESTABLISH {
        my($ca, $a, $b, $c, $d, $e, $f, $h) = @_;
	    eval q((*($ca)-> ($c$a_bus->{a$b_intr_establish}))(($a),($b),($c),($d),($e),($f),($h)));
    }' unless defined(&BUS_INTR_ESTABLISH);
    eval 'sub BUS_INTR_DISESTABLISH {
        my($ca) = @_;
	    eval q((*($ca)-> ($ca_bus->{ab_intr_establish}))($ca));
    }' unless defined(&BUS_INTR_DISESTABLISH);
    eval 'sub BUS_MATCHNAME {
        my($ca, $name) = @_;
	    eval q(((($ca)-> ($ca_bus->{ab_matchname})) ? (*($ca)-> ($ca_bus->{ab_matchname}))(($ca), ($name)) : -1));
    }' unless defined(&BUS_MATCHNAME);
}
1;
