require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_FLASHVAR_H_)) {
    eval 'sub _FLASHVAR_H_ () {1;}' unless defined(&_FLASHVAR_H_);
    if(defined(&_KERNEL)) {
	eval 'sub FLASH_REG_DATA () {0x;}' unless defined(&FLASH_REG_DATA);
	eval 'sub FLASH_REG_COL () {0x1;}' unless defined(&FLASH_REG_COL);
	eval 'sub FLASH_REG_ROW () {0x2;}' unless defined(&FLASH_REG_ROW);
	eval 'sub FLASH_REG_CMD () {0x3;}' unless defined(&FLASH_REG_CMD);
	eval 'sub FLASH_REG_ALE () {0x4;}' unless defined(&FLASH_REG_ALE);
	eval 'sub FLASH_REG_CLE () {0x5;}' unless defined(&FLASH_REG_CLE);
	eval 'sub FLASH_REG_CE () {0x6;}' unless defined(&FLASH_REG_CE);
	eval 'sub FLASH_REG_WP () {0x7;}' unless defined(&FLASH_REG_WP);
	eval 'sub FLASH_REG_READY () {0xf;}' unless defined(&FLASH_REG_READY);
	eval 'sub FLASH_DEVICE {
	    my($v,$d) = @_;
    	    eval q((( &FLASH_VENDOR_$v << 8) | ($d)));
	}' unless defined(&FLASH_DEVICE);
	eval 'sub FLASH_VENDOR_SAMSUNG () {0xec;}' unless defined(&FLASH_VENDOR_SAMSUNG);
	eval 'sub FLASH_DEVICE_SAMSUNG_K9F2808U0C () { &FLASH_DEVICE( &SAMSUNG, 0x73);}' unless defined(&FLASH_DEVICE_SAMSUNG_K9F2808U0C);
	eval 'sub FLASH_DEVICE_SAMSUNG_K9F1G08U0A () { &FLASH_DEVICE( &SAMSUNG, 0xf1);}' unless defined(&FLASH_DEVICE_SAMSUNG_K9F1G08U0A);
	eval 'sub FLASH_MAXPAGESIZE () {2048;}' unless defined(&FLASH_MAXPAGESIZE);
	eval 'sub FLASH_MAXOOBSIZE () {64;}' unless defined(&FLASH_MAXOOBSIZE);
	eval 'sub FDK_LOADED () {0x1;}' unless defined(&FDK_LOADED);
	eval 'sub FDK_SAFE () {0x2;}' unless defined(&FDK_SAFE);
	eval 'sub flashsafe {
	    my($x) = @_;
    	    eval q(( &minor($x) & 0x800));
	}' unless defined(&flashsafe);
	eval 'sub flashunit {
	    my($x) = @_;
    	    eval q( &DISKUNIT( &makedev( &major($x),  &minor($x) & 0x7ff)));
	}' unless defined(&flashunit);
	eval 'sub flashpart {
	    my($x) = @_;
    	    eval q( &DISKPART( &makedev( &major($x),  &minor($x) & 0x7ff)));
	}' unless defined(&flashpart);
	eval 'sub flashlabeldev {
	    my($x) = @_;
    	    eval q(( &MAKEDISKDEV( &major($x),  &flashunit($x),  &RAW_PART) | &flashsafe($x)));
	}' unless defined(&flashlabeldev);
    }
}
1;
