require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_TC921X_H_)) {
    eval 'sub _TC921X_H_ () {1;}' unless defined(&_TC921X_H_);
    require 'sys/types.ph';
    require 'machine/bus.ph';
    eval 'sub TC921X_REGISTER_LENGTH () {24;}' unless defined(&TC921X_REGISTER_LENGTH);
    eval 'sub TC921X_D0_FREQ_DIVIDER () {0xffff;}' unless defined(&TC921X_D0_FREQ_DIVIDER);
    eval 'sub TC921X_D0_REF_FREQ_500_HZ () {(0x << 16);}' unless defined(&TC921X_D0_REF_FREQ_500_HZ);
    eval 'sub TC921X_D0_REF_FREQ_1_KHZ () {(0x1 << 16);}' unless defined(&TC921X_D0_REF_FREQ_1_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_2P5_KHZ () {(0x2 << 16);}' unless defined(&TC921X_D0_REF_FREQ_2P5_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_3_KHZ () {(0x3 << 16);}' unless defined(&TC921X_D0_REF_FREQ_3_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_3P125_KHZ () {(0x4 << 16);}' unless defined(&TC921X_D0_REF_FREQ_3P125_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_3PXXX_KHZ () {(0x5 << 16);}' unless defined(&TC921X_D0_REF_FREQ_3PXXX_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_5_KHZ () {(0x6 << 16);}' unless defined(&TC921X_D0_REF_FREQ_5_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_6P25_KHZ () {(0x7 << 16);}' unless defined(&TC921X_D0_REF_FREQ_6P25_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_7PXXX_KHZ () {(0x8 << 16);}' unless defined(&TC921X_D0_REF_FREQ_7PXXX_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_9_KHZ () {(0x9 << 16);}' unless defined(&TC921X_D0_REF_FREQ_9_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_10_KHZ () {(0xa << 16);}' unless defined(&TC921X_D0_REF_FREQ_10_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_12P5_KHZ () {(0xb << 16);}' unless defined(&TC921X_D0_REF_FREQ_12P5_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_25_KHZ () {(0xc << 16);}' unless defined(&TC921X_D0_REF_FREQ_25_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_50_KHZ () {(0xd << 16);}' unless defined(&TC921X_D0_REF_FREQ_50_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_100_KHZ () {(0xe << 16);}' unless defined(&TC921X_D0_REF_FREQ_100_KHZ);
    eval 'sub TC921X_D0_REF_FREQ_NOT_USED () {(0xf << 16);}' unless defined(&TC921X_D0_REF_FREQ_NOT_USED);
    eval 'sub TC921X_D0_DIRECT_DIVIDING_MODE () {(0<< 20);}' unless defined(&TC921X_D0_DIRECT_DIVIDING_MODE);
    eval 'sub TC921X_D0_PULSE_SWALLOW_HF_MODE () {(2<< 20);}' unless defined(&TC921X_D0_PULSE_SWALLOW_HF_MODE);
    eval 'sub TC921X_D0_PULSE_SWALLOW_FM_MODE () {(1<< 20);}' unless defined(&TC921X_D0_PULSE_SWALLOW_FM_MODE);
    eval 'sub TC921X_D0_HALF_PULSE_SWALLOW_MODE () {(3<< 20);}' unless defined(&TC921X_D0_HALF_PULSE_SWALLOW_MODE);
    eval 'sub TC921X_D0_OSC_7POINT2_MHZ () {(1<< 22);}' unless defined(&TC921X_D0_OSC_7POINT2_MHZ);
    eval 'sub TC921X_D0_OSC_4POINT5_MHZ () {(0<< 22);}' unless defined(&TC921X_D0_OSC_4POINT5_MHZ);
    eval 'sub TC921X_D0_OUT_CONTROL_ON () {(1<< 23);}' unless defined(&TC921X_D0_OUT_CONTROL_ON);
    eval 'sub TC921X_D0_OUT_CONTROL_OFF () {(0<< 23);}' unless defined(&TC921X_D0_OUT_CONTROL_OFF);
    eval 'sub TC921X_D2_GATE_TIME {
        my($x) = @_;
	    eval q(($x << 0));
    }' unless defined(&TC921X_D2_GATE_TIME);
    eval 'sub TC921X_D2_GATE_TIME_1MS () { &TC921X_D2_GATE_TIME(0);}' unless defined(&TC921X_D2_GATE_TIME_1MS);
    eval 'sub TC921X_D2_GATE_TIME_4MS () { &TC921X_D2_GATE_TIME(1);}' unless defined(&TC921X_D2_GATE_TIME_4MS);
    eval 'sub TC921X_D2_GATE_TIME_16MS () { &TC921X_D2_GATE_TIME(2);}' unless defined(&TC921X_D2_GATE_TIME_16MS);
    eval 'sub TC921X_D2_GATE_TIME_MANUAL () { &TC921X_D2_GATE_TIME(3);}' unless defined(&TC921X_D2_GATE_TIME_MANUAL);
    eval 'sub TC921X_D2_COUNTER_MODE {
        my($x) = @_;
	    eval q(($x << 2));
    }' unless defined(&TC921X_D2_COUNTER_MODE);
    eval 'sub TC921X_D2_COUNTER_INPUT_SC () {(1<< 5);}' unless defined(&TC921X_D2_COUNTER_INPUT_SC);
    eval 'sub TC921X_D2_COUNTER_INPUT_HFC () {(1<< 6);}' unless defined(&TC921X_D2_COUNTER_INPUT_HFC);
    eval 'sub TC921X_D2_COUNTER_INPUT_LFC () {(1<< 7);}' unless defined(&TC921X_D2_COUNTER_INPUT_LFC);
    eval 'sub TC921X_D2_START_BIT () {(1<< 8);}' unless defined(&TC921X_D2_START_BIT);
    eval 'sub TC921X_D2_TEST_BIT () {(1<< 9);}' unless defined(&TC921X_D2_TEST_BIT);
    eval 'sub TC921X_D2_IO_PORT {
        my($x) = @_;
	    eval q(($x << 10));
    }' unless defined(&TC921X_D2_IO_PORT);
    eval 'sub TC921X_D2_IO_PORT_OUTPUT {
        my($x) = @_;
	    eval q(($x << 15));
    }' unless defined(&TC921X_D2_IO_PORT_OUTPUT);
    eval 'sub TC921X_D2_IO_PORT_INPUT {
        my($x) = @_;
	    eval q(($x << 19));
    }' unless defined(&TC921X_D2_IO_PORT_INPUT);
}
1;
