require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_USB_PORT_H)) {
    eval 'sub _USB_PORT_H () {1;}' unless defined(&_USB_PORT_H);
    require 'sys/timeout.ph';
    if(defined(&__HAVE_GENERIC_SOFT_INTERRUPTS)) {
	eval 'sub USB_USE_SOFTINTR () {1;}' unless defined(&USB_USE_SOFTINTR);
    } else {
	undef(&USB_USE_SOFTINTR) if defined(&USB_USE_SOFTINTR);
    }
    if(defined(&USB_DEBUG)) {
	eval 'sub UKBD_DEBUG () {1;}' unless defined(&UKBD_DEBUG);
	eval 'sub UHIDEV_DEBUG () {1;}' unless defined(&UHIDEV_DEBUG);
	eval 'sub UHID_DEBUG () {1;}' unless defined(&UHID_DEBUG);
	eval 'sub OHCI_DEBUG () {1;}' unless defined(&OHCI_DEBUG);
	eval 'sub UGEN_DEBUG () {1;}' unless defined(&UGEN_DEBUG);
	eval 'sub UHCI_DEBUG () {1;}' unless defined(&UHCI_DEBUG);
	eval 'sub UHUB_DEBUG () {1;}' unless defined(&UHUB_DEBUG);
	eval 'sub ULPT_DEBUG () {1;}' unless defined(&ULPT_DEBUG);
	eval 'sub UCOM_DEBUG () {1;}' unless defined(&UCOM_DEBUG);
	eval 'sub UPLCOM_DEBUG () {1;}' unless defined(&UPLCOM_DEBUG);
	eval 'sub UMCT_DEBUG () {1;}' unless defined(&UMCT_DEBUG);
	eval 'sub UMODEM_DEBUG () {1;}' unless defined(&UMODEM_DEBUG);
	eval 'sub UAUDIO_DEBUG () {1;}' unless defined(&UAUDIO_DEBUG);
	eval 'sub AUE_DEBUG () {1;}' unless defined(&AUE_DEBUG);
	eval 'sub CUE_DEBUG () {1;}' unless defined(&CUE_DEBUG);
	eval 'sub KUE_DEBUG () {1;}' unless defined(&KUE_DEBUG);
	eval 'sub UDAV_DEBUG () {1;}' unless defined(&UDAV_DEBUG);
	eval 'sub UMASS_DEBUG () {1;}' unless defined(&UMASS_DEBUG);
	eval 'sub UVISOR_DEBUG () {1;}' unless defined(&UVISOR_DEBUG);
	eval 'sub UPL_DEBUG () {1;}' unless defined(&UPL_DEBUG);
	eval 'sub UZCOM_DEBUG () {1;}' unless defined(&UZCOM_DEBUG);
	eval 'sub URIO_DEBUG () {1;}' unless defined(&URIO_DEBUG);
	eval 'sub UFTDI_DEBUG () {1;}' unless defined(&UFTDI_DEBUG);
	eval 'sub USCANNER_DEBUG () {1;}' unless defined(&USCANNER_DEBUG);
	eval 'sub USSCANNER_DEBUG () {1;}' unless defined(&USSCANNER_DEBUG);
	eval 'sub UISDATA_DEBUG () {1;}' unless defined(&UISDATA_DEBUG);
	eval 'sub UDSBR_DEBUG () {1;}' unless defined(&UDSBR_DEBUG);
	eval 'sub UIPAQ_DEBUG () {1;}' unless defined(&UIPAQ_DEBUG);
    }
    eval 'sub Static () {1;}' unless defined(&Static);
    eval 'sub UMASS_ATAPISTR () {"atapiscsi";}' unless defined(&UMASS_ATAPISTR);
    eval 'sub PQUIRK_NOSENSE () { &ADEV_NOSENSE;}' unless defined(&PQUIRK_NOSENSE);
    eval 'sub PQUIRK_ONLYBIG () { &SDEV_ONLYBIG;}' unless defined(&PQUIRK_ONLYBIG);
    eval 'sub sel_klist () { &si_note;}' unless defined(&sel_klist);
    eval 'sub UCOMBUSCF_PORTNO () {0;}' unless defined(&UCOMBUSCF_PORTNO);
    eval 'sub UCOMBUSCF_PORTNO_DEFAULT () {-1;}' unless defined(&UCOMBUSCF_PORTNO_DEFAULT);
    eval 'sub UHIDBUSCF_REPORTID () {0;}' unless defined(&UHIDBUSCF_REPORTID);
    eval 'sub UHIDBUSCF_REPORTID_DEFAULT () {-1;}' unless defined(&UHIDBUSCF_REPORTID_DEFAULT);
    eval 'sub bswap32 {
        my($x) = @_;
	    eval q( &swap32($x));
    }' unless defined(&bswap32);
    eval 'sub bswap16 {
        my($x) = @_;
	    eval q( &swap16($x));
    }' unless defined(&bswap16);
    eval 'sub mstohz {
        my($ms) = @_;
	    eval q((($ms) *  &hz / 1000));
    }' unless defined(&mstohz);
    if(defined( &letoh32)) {
	eval 'sub le32toh {
	    my($x) = @_;
    	    eval q( &letoh32($x));
	}' unless defined(&le32toh);
	eval 'sub le16toh {
	    my($x) = @_;
    	    eval q( &letoh16($x));
	}' unless defined(&le16toh);
    }
    eval 'sub sel_klist () { &si_note;}' unless defined(&sel_klist);
    eval 'sub Ether_ifattach {
        my($ifp, $eaddr) = @_;
	    eval q( &ether_ifattach($ifp));
    }' unless defined(&Ether_ifattach);
    eval 'sub if_deactivate {
        my($x) = @_;
	    eval q();
    }' unless defined(&if_deactivate);
    eval 'sub IF_INPUT {
        my($ifp, $m) = @_;
	    eval q( &ether_input_mbuf(($ifp), ($m)));
    }' unless defined(&IF_INPUT);
    eval 'sub logprintf () { &printf;}' unless defined(&logprintf);
    eval 'sub swap_bytes_change_sign16_le () { &swap_bytes_change_sign16;}' unless defined(&swap_bytes_change_sign16_le);
    eval 'sub change_sign16_swap_bytes_le () { &change_sign16_swap_bytes;}' unless defined(&change_sign16_swap_bytes_le);
    eval 'sub change_sign16_le () { &change_sign16;}' unless defined(&change_sign16_le);
    eval 'sub ulinear8_to_slinear16_le () { &ulinear8_to_linear16_le;}' unless defined(&ulinear8_to_slinear16_le);
    eval 'sub ulinear8_to_slinear16_be () { &ulinear8_to_linear16_be;}' unless defined(&ulinear8_to_slinear16_be);
    eval 'sub slinear16_to_ulinear8_le () { &linear16_to_ulinear8_le;}' unless defined(&slinear16_to_ulinear8_le);
    eval 'sub slinear16_to_ulinear8_be () { &linear16_to_ulinear8_be;}' unless defined(&slinear16_to_ulinear8_be);
    eval 'sub USBBASEDEVICE () {\'struct device\';}' unless defined(&USBBASEDEVICE);
    eval 'sub USBDEV {
        my($bdev) = @_;
	    eval q((($bdev)));
    }' unless defined(&USBDEV);
    eval 'sub USBDEVNAME {
        my($bdev) = @_;
	    eval q((($bdev). &dv_xname));
    }' unless defined(&USBDEVNAME);
    eval 'sub USBDEVUNIT {
        my($bdev) = @_;
	    eval q((($bdev). &dv_unit));
    }' unless defined(&USBDEVUNIT);
    eval 'sub USBDEVPTRNAME {
        my($bdevptr) = @_;
	    eval q((($bdevptr)-> &dv_xname));
    }' unless defined(&USBDEVPTRNAME);
    eval 'sub USBGETSOFTC {
        my($d) = @_;
	    eval q((( &void *)($d)));
    }' unless defined(&USBGETSOFTC);
    eval 'sub DECLARE_USB_DMA_T () {\'struct usb_dma_block\';  &typedef \'struct struct\' { \'struct usb_dma_block\' * &block; \'u_int\'  &offs; }  &usb_dma_t;}' unless defined(&DECLARE_USB_DMA_T);
    eval 'sub usb_callout_init {
        my($h) = @_;
	    eval q( &timeout_set(($h),  &NULL,  &NULL));
    }' unless defined(&usb_callout_init);
    eval 'sub usb_callout {
        my($h, $t, $f, $d) = @_;
	    eval q( &do {  &timeout_del(($h));  &timeout_set(($h), ($f), ($d));  &timeout_add(($h), ($t)); }  &while (0));
    }' unless defined(&usb_callout);
    eval 'sub usb_callout_pending {
        my($h) = @_;
	    eval q( &timeout_pending(($h)));
    }' unless defined(&usb_callout_pending);
    eval 'sub usb_uncallout {
        my($h, $f, $d) = @_;
	    eval q( &timeout_del(($h)));
    }' unless defined(&usb_uncallout);
    eval 'sub usb_lockmgr {
        my($l, $f, $sl, $p) = @_;
	    eval q( &lockmgr(($l), ($f), ($sl)));
    }' unless defined(&usb_lockmgr);
    eval 'sub USB_DECLARE_DRIVER_CLASS {
        my($dname, $devclass) = @_;
	    eval q(\'int\'  &__CONCAT($dname, &_match)(\'struct device\' *,  &void *,  &void *);  &void  &__CONCAT($dname, &_attach)(\'struct device\' *, \'struct device\' *,  &void *); \'int\'  &__CONCAT($dname, &_detach)(\'struct device\' *, \'int\'); \'int\'  &__CONCAT($dname, &_activate)(\'struct device\' *,  &enum  &devact); \'struct cfdriver\'  &__CONCAT($dname, &_cd) = {  &NULL, $dname, $devclass };  &const \'struct cfattach\'  &__CONCAT($dname, &_ca) = { $sizeof{ &struct __CONCAT($dname, &_softc)},  &__CONCAT($dname, &_match),  &__CONCAT($dname, &_attach),  &__CONCAT($dname, &_detach),  &__CONCAT($dname, &_activate), });
    }' unless defined(&USB_DECLARE_DRIVER_CLASS);
    eval 'sub USB_DECLARE_DRIVER {
        my($dname) = @_;
	    eval q( &USB_DECLARE_DRIVER_CLASS($dname,  &DV_DULL));
    }' unless defined(&USB_DECLARE_DRIVER);
    eval 'sub USB_MATCH {
        my($dname) = @_;
	    eval q(\'int\'  &__CONCAT($dname, &_match)( &parent,  &match,  &aux) \'struct device\' * &parent;  &void * &match;  &void * &aux;);
    }' unless defined(&USB_MATCH);
    eval 'sub USB_MATCH_START {
        my($dname, $uaa) = @_;
	    eval q(\'struct usb_attach_arg\' *$uaa =  &aux);
    }' unless defined(&USB_MATCH_START);
    eval 'sub USB_ATTACH {
        my($dname) = @_;
	    eval q( &void  &__CONCAT($dname, &_attach)( &parent,  &self,  &aux) \'struct device\' * &parent; \'struct device\' * &self;  &void * &aux;);
    }' unless defined(&USB_ATTACH);
    eval 'sub USB_ATTACH_START {
        my($dname, $sc, $uaa) = @_;
	    eval q( &struct __CONCAT($dname, &_softc) *$sc = ( &struct __CONCAT($dname, &_softc) *) &self; \'struct usb_attach_arg\' *$uaa =  &aux);
    }' unless defined(&USB_ATTACH_START);
    eval 'sub USB_ATTACH_ERROR_RETURN () { &return;}' unless defined(&USB_ATTACH_ERROR_RETURN);
    eval 'sub USB_ATTACH_SUCCESS_RETURN () { &return;}' unless defined(&USB_ATTACH_SUCCESS_RETURN);
    eval 'sub USB_ATTACH_SETUP () { &printf("\\n");}' unless defined(&USB_ATTACH_SETUP);
    eval 'sub USB_DETACH {
        my($dname) = @_;
	    eval q(\'int\'  &__CONCAT($dname, &_detach)( &self,  &flags) \'struct device\' * &self; \'int\'  &flags;);
    }' unless defined(&USB_DETACH);
    eval 'sub USB_DETACH_START {
        my($dname, $sc) = @_;
	    eval q( &struct __CONCAT($dname, &_softc) *$sc = ( &struct __CONCAT($dname, &_softc) *) &self);
    }' unless defined(&USB_DETACH_START);
    eval 'sub USB_GET_SC_OPEN {
        my($dname, $unit, $sc) = @_;
	    eval q( &if ($unit >=  &__CONCAT($dname, &_cd). &cd_ndevs)  &return ( &ENXIO); $sc =  &__CONCAT($dname, &_cd). $cd_devs[$unit];  &if ($sc ==  &NULL)  &return ( &ENXIO));
    }' unless defined(&USB_GET_SC_OPEN);
    eval 'sub USB_GET_SC {
        my($dname, $unit, $sc) = @_;
	    eval q($sc =  &__CONCAT($dname, &_cd). $cd_devs[$unit]);
    }' unless defined(&USB_GET_SC);
    eval 'sub USB_DO_ATTACH {
        my($dev, $bdev, $parent, $args, $print, $sub) = @_;
	    eval q(( &config_found_sm($parent, $args, $print, $sub)));
    }' unless defined(&USB_DO_ATTACH);
}
1;
