drivers: clock_control: nrf: reimplementation including API updates

Reimplementation of clock control driver for nrf platform. It includes
latest API changes: asynchronous starting and getting clock status.

Additionally, it implements calibration algorithm which optionally
skips calibration based on no temperature change. Internal temperature
sensor is used for that.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2019-06-26 13:27:31 +02:00 committed by Carles Cufí
commit 6700f2f194
8 changed files with 771 additions and 428 deletions

View file

@ -7,9 +7,7 @@
#ifndef ZEPHYR_INCLUDE_DRIVERS_CLOCK_CONTROL_NRF_CLOCK_CONTROL_H_
#define ZEPHYR_INCLUDE_DRIVERS_CLOCK_CONTROL_NRF_CLOCK_CONTROL_H_
#if defined(CONFIG_USB) && defined(CONFIG_SOC_NRF52840)
#include <device.h>
#endif
#include <hal/nrf_clock.h>
/* TODO: move all these to clock_control.h ? */
@ -57,8 +55,25 @@
#define CLOCK_CONTROL_NRF_K32SRC_ACCURACY 7
#endif
#if defined(CONFIG_USB) && defined(CONFIG_SOC_NRF52840)
void nrf5_power_usb_power_int_enable(bool enable);
#endif
/** @brief Force LF clock calibration. */
void z_nrf_clock_calibration_force_start(void);
/** @brief Return number of calibrations performed.
*
* Valid when @ref CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_DEBUG is set.
*
* @return Number of calibrations or -1 if feature is disabled.
*/
int z_nrf_clock_calibration_count(void);
/** @brief Return number of attempts when calibration was skipped.
*
* Valid when @ref CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_DEBUG is set.
*
* @return Number of calibrations or -1 if feature is disabled.
*/
int z_nrf_clock_calibration_skips_count(void);
#endif /* ZEPHYR_INCLUDE_DRIVERS_CLOCK_CONTROL_NRF_CLOCK_CONTROL_H_ */