require '_h2ph_pre.ph';

unless(defined(&_DEV_IEEE1394_FWOHCIVAR_H_)) {
    eval 'sub _DEV_IEEE1394_FWOHCIVAR_H_ () {1;}' unless defined(&_DEV_IEEE1394_FWOHCIVAR_H_);
    if(defined(&__NetBSD__)) {
	require 'sys/callout.ph';
    } else {
	require 'sys/timeout.ph';
    }
    require 'sys/queue.ph';
    require 'machine/bus.ph';
    eval 'sub OHCI_PAGE_SIZE () {0x800;}' unless defined(&OHCI_PAGE_SIZE);
    eval 'sub OHCI_BUF_ARRQ_CNT () {16;}' unless defined(&OHCI_BUF_ARRQ_CNT);
    eval 'sub OHCI_BUF_ARRS_CNT () {8;}' unless defined(&OHCI_BUF_ARRS_CNT);
    eval 'sub OHCI_BUF_ATRQ_CNT () {(8*8);}' unless defined(&OHCI_BUF_ATRQ_CNT);
    eval 'sub OHCI_BUF_ATRS_CNT () {(8*8);}' unless defined(&OHCI_BUF_ATRS_CNT);
    eval 'sub OHCI_BUF_IR_CNT () {8;}' unless defined(&OHCI_BUF_IR_CNT);
    eval 'sub OHCI_BUF_CNT () {( &OHCI_BUF_ARRQ_CNT +  &OHCI_BUF_ARRS_CNT +  &OHCI_BUF_ATRQ_CNT +  &OHCI_BUF_ATRS_CNT +  &OHCI_BUF_IR_CNT + 1+ 1);}' unless defined(&OHCI_BUF_CNT);
    eval 'sub OHCI_LOOP () {1000;}' unless defined(&OHCI_LOOP);
    eval 'sub OHCI_SELFID_TIMEOUT () {(3*  &hz);}' unless defined(&OHCI_SELFID_TIMEOUT);
    eval 'sub OHCI_ASYNC_STREAM () {0x40;}' unless defined(&OHCI_ASYNC_STREAM);
    if(0) {
    }
    if(defined(&__NetBSD__)) {
    } else {
    }
    eval 'sub OHCI_CSR_WRITE {
        local($sc, $reg, $val) = @_;
	    eval q( &bus_space_write_4(($sc)-> &sc_memt, ($sc)-> &sc_memh, $reg,  &htole32($val)));
    }' unless defined(&OHCI_CSR_WRITE);
    if(defined(&__NetBSD__)) {
	eval 'sub OHCI_CSR_READ {
	    local($sc, $reg) = @_;
    	    eval q( &le32toh( &bus_space_read_4(($sc)-> &sc_memt, ($sc)-> &sc_memh, $reg)));
	}' unless defined(&OHCI_CSR_READ);
    } else {
	eval 'sub OHCI_CSR_READ {
	    local($sc, $reg) = @_;
    	    eval q( &letoh32( &bus_space_read_4(($sc)-> &sc_memt, ($sc)-> &sc_memh, $reg)));
	}' unless defined(&OHCI_CSR_READ);
    }
    eval 'sub FWOHCI_CTX_ASYNC () {0;}' unless defined(&FWOHCI_CTX_ASYNC);
    eval 'sub FWOHCI_CTX_ISO_SINGLE () {1;}' unless defined(&FWOHCI_CTX_ISO_SINGLE);
    eval 'sub FWOHCI_CTX_ISO_MULTI () {2;}' unless defined(&FWOHCI_CTX_ISO_MULTI);
    if(defined(&__NetBSD__)) {
	require 'locators.ph';
    } else {
	eval 'sub FWBUSCF_IDHI_DEFAULT () {(-1);}' unless defined(&FWBUSCF_IDHI_DEFAULT);
	eval 'sub FWBUSCF_IDLO_DEFAULT () {(-1);}' unless defined(&FWBUSCF_IDLO_DEFAULT);
	eval 'sub FWBUSCF_IDHI () {1;}' unless defined(&FWBUSCF_IDHI);
	eval 'sub FWBUSCF_IDLO () {0;}' unless defined(&FWBUSCF_IDLO);
    }
    eval 'sub fwbuscf_idhi () { $cf_loc[ &FWBUSCF_IDHI];}' unless defined(&fwbuscf_idhi);
    eval 'sub FWBUS_UNK_IDHI () { &FWBUSCF_IDHI_DEFAULT;}' unless defined(&FWBUS_UNK_IDHI);
    eval 'sub fwbuscf_idlo () { $cf_loc[ &FWBUSCF_IDLO];}' unless defined(&fwbuscf_idlo);
    eval 'sub FWBUS_UNK_IDLO () { &FWBUSCF_IDLO_DEFAULT;}' unless defined(&FWBUS_UNK_IDLO);
}
1;
