require '_h2ph_pre.ph';

no warnings 'redefine';

if(!defined( &_DP857X_H)) {
    eval 'sub _DP857X_H () {1;}' unless defined(&_DP857X_H);
    eval 'sub BSIZE () {1;}' unless defined(&BSIZE);
    eval 'sub MAIN_STATUS () {0x;}' unless defined(&MAIN_STATUS);
    eval 'sub TIMER0_CTRL () {0x1;}' unless defined(&TIMER0_CTRL);
    eval 'sub TIMER1_CTRL () {0x2;}' unless defined(&TIMER1_CTRL);
    eval 'sub PERIODIC_FLAGS () {0x3;}' unless defined(&PERIODIC_FLAGS);
    eval 'sub INTERRUPT_ROUT () {0x4;}' unless defined(&INTERRUPT_ROUT);
    eval 'sub REAL_TIME_MODE () {0x1;}' unless defined(&REAL_TIME_MODE);
    eval 'sub OUTPUT_MODE () {0x2;}' unless defined(&OUTPUT_MODE);
    eval 'sub INTERRUPT_CTRL0 () {0x3;}' unless defined(&INTERRUPT_CTRL0);
    eval 'sub INTERRUPT_CTRL1 () {0x4;}' unless defined(&INTERRUPT_CTRL1);
    eval 'sub CLK_SUBSECONDS () {0x5;}' unless defined(&CLK_SUBSECONDS);
    eval 'sub CLK_SECONDS () {0x6;}' unless defined(&CLK_SECONDS);
    eval 'sub CLK_MINUTES () {0x7;}' unless defined(&CLK_MINUTES);
    eval 'sub CLK_HOURS () {0x8;}' unless defined(&CLK_HOURS);
    eval 'sub CLK_DAY () {0x9;}' unless defined(&CLK_DAY);
    eval 'sub CLK_MONTH () {0xa;}' unless defined(&CLK_MONTH);
    eval 'sub CLK_YEAR () {0xb;}' unless defined(&CLK_YEAR);
    eval 'sub CLK_JULIAN_L () {0xc;}' unless defined(&CLK_JULIAN_L);
    eval 'sub CLK_JULIAN_H () {0xd;}' unless defined(&CLK_JULIAN_H);
    eval 'sub CLK_WEEKDAY () {0xe;}' unless defined(&CLK_WEEKDAY);
    eval 'sub TIMER0_LSB () {0xf;}' unless defined(&TIMER0_LSB);
    eval 'sub TIMER0_MSB () {0x10;}' unless defined(&TIMER0_MSB);
    eval 'sub TIMER1_LSB () {0x11;}' unless defined(&TIMER1_LSB);
    eval 'sub TIMER1_MSB () {0x12;}' unless defined(&TIMER1_MSB);
    eval 'sub CMP_SECONDS () {0x13;}' unless defined(&CMP_SECONDS);
    eval 'sub CMP_MINUTES () {0x14;}' unless defined(&CMP_MINUTES);
    eval 'sub CMP_HOUR () {0x15;}' unless defined(&CMP_HOUR);
    eval 'sub CMP_DAY () {0x16;}' unless defined(&CMP_DAY);
    eval 'sub CMP_MONTH () {0x17;}' unless defined(&CMP_MONTH);
    eval 'sub CMP_WEEKDAY () {0x18;}' unless defined(&CMP_WEEKDAY);
    eval 'sub SAVE_SECONDS () {0x19;}' unless defined(&SAVE_SECONDS);
    eval 'sub SAVE_MINUTES () {0x1a;}' unless defined(&SAVE_MINUTES);
    eval 'sub SAVE_HOUR () {0x1b;}' unless defined(&SAVE_HOUR);
    eval 'sub SAVE_DAY () {0x1c;}' unless defined(&SAVE_DAY);
    eval 'sub SAVE_MONTH () {0x1d;}' unless defined(&SAVE_MONTH);
    eval 'sub RAM_1E () {0x1e;}' unless defined(&RAM_1E);
    eval 'sub RAM_1F () {0x1f;}' unless defined(&RAM_1F);
    eval 'sub SIZE_DP857X () {0x20;}' unless defined(&SIZE_DP857X);
    eval 'sub DP_FIRSTTODREG () { &CLK_SUBSECONDS;}' unless defined(&DP_FIRSTTODREG);
    eval 'sub DP_LASTTODREG () { &CLK_WEEKDAY;}' unless defined(&DP_LASTTODREG);
    eval 'sub DP857X_GETTOD {
        my($sc, $regs) = @_;
	    eval q( &do { \'int\'  &i;  &dp857x_write($sc,  &MAIN_STATUS, 0);  &do {  &for ( &i =  &DP_FIRSTTODREG;  &i <  &SIZE_DP857X;  &i++) (*$regs)[ &i] =  &dp857x_read($sc,  &i); }  &while( &dp857x_read($sc,  &PERIODIC_FLAGS) & 7); }  &while (0););
    }' unless defined(&DP857X_GETTOD);
    eval 'sub DP857X_PUTTOD {
        my($sc, $regs) = @_;
	    eval q( &do { \'int\'  &i;  &dp857x_write($sc,  &MAIN_STATUS, 0x40);  &dp857x_write($sc,  &REAL_TIME_MODE,  &dp857x_read($sc,  &REAL_TIME_MODE) & 0xf7);  &for ( &i =  &DP_FIRSTTODREG;  &i <=  &DP_LASTTODREG;  &i++)  &dp857x_write($sc,  &i, (*$regs)[ &i]);  &dp857x_write($sc,  &REAL_TIME_MODE,  &dp857x_read($sc,  &REAL_TIME_MODE) | 0x8); }  &while (0););
    }' unless defined(&DP857X_PUTTOD);
}
1;
