37 #define AUTO_XTAL_TEST_DBG_EN 0 // Enable/Disable debug parameters.
40 #define XTAL_OPERATION_SUCCESS (0) // XTAL calibration success.
41 #define PULSE_OUT_OF_RANGE_ERROR (-1) // Pulse found in the pulse pin assigned GPIO was out of acceptable range
42 #define NO_PULSE_ERROR (-2) // No pulse found, or pulse > 740 ms (measure_pulse aborts)
43 #define WRITING_VAL_TO_OTP_ERROR (-3) // Failed to write value in OTP.
44 #define INVALID_GPIO_ERROR (-4) // Wrong GPIO configuration.
45 #define WRONG_XTAL_SOURCE_ERROR (-5) // Incorrect pulse detected.
46 #define XTAL_CALIBRATION_ERROR (-6) // XTAL calibration error.
50 uint16_t run_xtal32m_block_calib(
void);
52 void delay(uint32_t dd);
53 void Setting_Trim(uint32_t Trim_Value);
55 uint32_t pulse_counter(
void);
56 uint32_t MEASURE_PULSE(int32_t datareg1, int32_t shift_bit1);
58 #if AUTO_XTAL_TEST_DBG_EN
59 void TRIM_test (
int S1,
int S2);