require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_SDMMCVAR_H_)) {
    eval 'sub _SDMMCVAR_H_ () {1;}' unless defined(&_SDMMCVAR_H_);
    require 'sys/queue.ph';
    require 'scsi/scsi_all.ph';
    require 'scsi/scsiconf.ph';
    require 'dev/sdmmc/sdmmcchip.ph';
    require 'dev/sdmmc/sdmmcreg.ph';
    eval 'sub sdmmc_init_task {
        my($xtask, $xfunc, $xarg) = @_;
	    eval q( &do { ($xtask)-> &func = ($xfunc); ($xtask)-> &arg = ($xarg); ($xtask)-> &onqueue = 0; ($xtask)-> &sc =  &NULL; }  &while (0));
    }' unless defined(&sdmmc_init_task);
    eval 'sub sdmmc_task_pending {
        my($xtask) = @_;
	    eval q((($xtask)-> &onqueue));
    }' unless defined(&sdmmc_task_pending);
    eval 'sub SCF_ITSDONE () {0x1;}' unless defined(&SCF_ITSDONE);
    eval 'sub SCF_CMD_AC () {0x;}' unless defined(&SCF_CMD_AC);
    eval 'sub SCF_CMD_ADTC () {0x10;}' unless defined(&SCF_CMD_ADTC);
    eval 'sub SCF_CMD_BC () {0x20;}' unless defined(&SCF_CMD_BC);
    eval 'sub SCF_CMD_BCR () {0x30;}' unless defined(&SCF_CMD_BCR);
    eval 'sub SCF_CMD_READ () {0x40;}' unless defined(&SCF_CMD_READ);
    eval 'sub SCF_RSP_BSY () {0x100;}' unless defined(&SCF_RSP_BSY);
    eval 'sub SCF_RSP_136 () {0x200;}' unless defined(&SCF_RSP_136);
    eval 'sub SCF_RSP_CRC () {0x400;}' unless defined(&SCF_RSP_CRC);
    eval 'sub SCF_RSP_IDX () {0x800;}' unless defined(&SCF_RSP_IDX);
    eval 'sub SCF_RSP_PRESENT () {0x1000;}' unless defined(&SCF_RSP_PRESENT);
    eval 'sub SCF_RSP_R0 () {0;}' unless defined(&SCF_RSP_R0);
    eval 'sub SCF_RSP_R1 () {( &SCF_RSP_PRESENT| &SCF_RSP_CRC| &SCF_RSP_IDX);}' unless defined(&SCF_RSP_R1);
    eval 'sub SCF_RSP_R2 () {( &SCF_RSP_PRESENT| &SCF_RSP_CRC| &SCF_RSP_136);}' unless defined(&SCF_RSP_R2);
    eval 'sub SCF_RSP_R3 () {( &SCF_RSP_PRESENT);}' unless defined(&SCF_RSP_R3);
    eval 'sub SCF_RSP_R4 () {( &SCF_RSP_PRESENT);}' unless defined(&SCF_RSP_R4);
    eval 'sub SCF_RSP_R5 () {( &SCF_RSP_PRESENT| &SCF_RSP_CRC| &SCF_RSP_IDX);}' unless defined(&SCF_RSP_R5);
    eval 'sub SCF_RSP_R5B () {( &SCF_RSP_PRESENT| &SCF_RSP_CRC| &SCF_RSP_IDX| &SCF_RSP_BSY);}' unless defined(&SCF_RSP_R5B);
    eval 'sub SCF_RSP_R6 () {( &SCF_RSP_PRESENT| &SCF_RSP_CRC);}' unless defined(&SCF_RSP_R6);
    eval 'sub SDMMC_VENDOR_INVALID () {0xffff;}' unless defined(&SDMMC_VENDOR_INVALID);
    eval 'sub SDMMC_PRODUCT_INVALID () {0xffff;}' unless defined(&SDMMC_PRODUCT_INVALID);
    eval 'sub SDMMC_FUNCTION_INVALID () {0xff;}' unless defined(&SDMMC_FUNCTION_INVALID);
    eval 'sub SFF_ERROR () {0x1;}' unless defined(&SFF_ERROR);
    eval 'sub SDMMCDEVNAME {
        my($sc) = @_;
	    eval q((($sc)-> ($sc_dev->{dv_xname})));
    }' unless defined(&SDMMCDEVNAME);
    eval 'sub SMF_SD_MODE () {0x1;}' unless defined(&SMF_SD_MODE);
    eval 'sub SMF_IO_MODE () {0x2;}' unless defined(&SMF_IO_MODE);
    eval 'sub SMF_MEM_MODE () {0x4;}' unless defined(&SMF_MEM_MODE);
    eval 'sub SMF_CARD_PRESENT () {0x10;}' unless defined(&SMF_CARD_PRESENT);
    eval 'sub SMF_CARD_ATTACHED () {0x20;}' unless defined(&SMF_CARD_ATTACHED);
    eval 'sub IPL_SDMMC () { &IPL_BIO;}' unless defined(&IPL_SDMMC);
    eval 'sub splsdmmc () {
        eval q( &splbio());
    }' unless defined(&splsdmmc);
    eval 'sub SDMMC_LOCK {
        my($sc) = @_;
	    eval q( &lockmgr(($sc)-> &sc_lock,  &LK_EXCLUSIVE,  &NULL));
    }' unless defined(&SDMMC_LOCK);
    eval 'sub SDMMC_UNLOCK {
        my($sc) = @_;
	    eval q( &lockmgr(($sc)-> &sc_lock,  &LK_RELEASE,  &NULL));
    }' unless defined(&SDMMC_UNLOCK);
    require 'sys/ioccom.ph';
    eval 'sub SDIOCEXECMMC () { &_IOWR(ord(\'S\'),0, \'struct bio_sdmmc_command\');}' unless defined(&SDIOCEXECMMC);
    eval 'sub SDIOCEXECAPP () { &_IOWR(ord(\'S\'),1, \'struct bio_sdmmc_command\');}' unless defined(&SDIOCEXECAPP);
    eval 'sub SDIOCSETDEBUG () { &_IOWR(ord(\'S\'),2, \'struct bio_sdmmc_debug\');}' unless defined(&SDIOCSETDEBUG);
}
1;
