SmartSnippets DA1459x SDK
Macros | Typedefs | Enumerations | Functions

Clock Driver header file. More...

#include "sdk_defs.h"
#include "hw_sys.h"

Go to the source code of this file.

Macros

#define XTAL32M_USEC_TO_250K_CYCLES(x)   ((uint16_t)((x * (dg_configRC32M_FREQ/1000000) + 127) / 128))
 Convert settling time (in usec) to XTAL32M_READY counter cycles (250kHz). More...
 
#define XTALRDY_CYCLES_TO_LP_CLK_CYCLES(x, lp_freq)   ((((uint32_t)(x)) * lp_freq + dg_configRC32M_FREQ_MIN/(128) - 1) / (dg_configRC32M_FREQ_MIN/128))
 Convert XTAL32M_READY counter cycles (250kHz) to LP clock cycles. More...
 

Typedefs

typedef enum sys_clk_is_type sys_clk_is_t
 The type of the system clock.
 
typedef enum cal_clk_sel_type cal_clk_t
 The type of clock to be calibrated.
 
typedef enum cal_ref_clk_sel_type cal_ref_clk_t
 The reference clock used for calibration.
 
typedef enum sysclk_type sys_clk_t
 The system clock type. More...
 
typedef enum rclp_mode_type rclp_mode_t
 The RCLP mode. More...
 
typedef enum cpu_clk_type cpu_clk_t
 The CPU clock type (speed) More...
 

Enumerations

enum  sys_clk_is_type
 The type of the system clock.
 
enum  cal_clk_sel_type
 The type of clock to be calibrated.
 
enum  cal_ref_clk_sel_type
 The reference clock used for calibration.
 
enum  sysclk_type { sysclk_RC32 = 0, sysclk_XTAL32M = 2, sysclk_DBLR64 = 4, sysclk_LP = 255 }
 The system clock type. More...
 
enum  rclp_mode_type { RCLP_DEFAULT = 0, RCLP_FORCE_SLOW = REG_MSK(CRG_TOP, CLK_RCLP_REG, RCLP_LOW_SPEED_FORCE), RCLP_FORCE_FAST = REG_MSK(CRG_TOP, CLK_RCLP_REG, RCLP_HIGH_SPEED_FORCE) }
 The RCLP mode. More...
 
enum  cpu_clk_type {
  cpuclk_2M = 2, cpuclk_4M = 4, cpuclk_8M = 8, cpuclk_16M = 16,
  cpuclk_32M = 32, cpuclk_64M = 64
}
 The CPU clock type (speed) More...
 

Functions

__STATIC_INLINE bool hw_clk_check_rc32_status (void)
 Check if the RC32M is enabled. More...
 
__STATIC_INLINE void hw_clk_enable_rc32 (void)
 Activate the RC32M.
 
__STATIC_FORCEINLINE void hw_clk_disable_rc32 (void)
 Deactivate the RC32M.
 
void hw_clk_set_xtalm_settling_time (uint8_t cycles, bool high_clock)
 Set the XTAL32M settling time. More...
 
__STATIC_FORCEINLINE uint16_t hw_clk_get_xtalm_settling_time (void)
 Get the XTAL32M settling time (in 250kHz clock cycles). More...
 
__STATIC_INLINE bool hw_clk_check_xtalm_status (void)
 Check if the XTAL32M is enabled. More...
 
__STATIC_INLINE void hw_clk_enable_xtalm (void)
 Activate the XTAL32M.
 
__STATIC_INLINE void hw_clk_disable_xtalm (void)
 Deactivate the XTAL32M.
 
__STATIC_INLINE bool hw_clk_is_xtalm_started (void)
 Check if the XTAL32M has settled. More...
 
__STATIC_FORCEINLINE sys_clk_is_t hw_clk_get_sysclk (void)
 Return the clock used as the system clock. More...
 
__RETAINED_CODE sys_clk_t hw_clk_get_system_clock (void)
 Get the current system clock. More...
 
__STATIC_INLINE bool hw_clk_lp_is_xtal32k (void)
 Check whether the XTAL32K is the Low Power clock. More...
 
__STATIC_INLINE bool hw_clk_lp_is_rclp (void)
 Check whether the RCLP is the Low Power clock. More...
 
__STATIC_INLINE bool hw_clk_lp_is_rcx (void)
 Check whether the RCX is the Low Power clock. More...
 
__STATIC_INLINE bool hw_clk_lp_is_external (void)
 Check whether the RCX is the Low Power clock. More...
 
__STATIC_INLINE void hw_clk_lp_set_rcx (void)
 Set RCX as the Low Power clock. More...
 
__STATIC_INLINE void hw_clk_lp_set_xtal32k (void)
 Set XTAL32K as the Low Power clock. More...
 
__STATIC_INLINE void hw_clk_lp_set_ext32k (void)
 Set an external digital clock as the Low Power clock. More...
 
__STATIC_INLINE void hw_clk_set_rclp_mode (rclp_mode_t mode)
 Configure RCLP. More...
 
__STATIC_INLINE rclp_mode_t hw_clk_get_rclp_mode (void)
 Get RCLP mode of operation. More...
 
__STATIC_INLINE void hw_clk_enable_rclp (void)
 Enable RCLP.
 
__STATIC_INLINE void hw_clk_disable_rclp (void)
 Disable RCLP. More...
 
__STATIC_INLINE void hw_clk_lp_set_rclp (void)
 Set RCLP as the Low Power clock. More...
 
__STATIC_INLINE void hw_clk_configure_rcx (void)
 Configure RCX. This must be done only once since the register is retained.
 
__STATIC_INLINE void hw_clk_enable_rcx (void)
 Enable RCX but does not set it as the LP clock.
 
__STATIC_INLINE void hw_clk_disable_rcx (void)
 Disable RCX. More...
 
__STATIC_INLINE void hw_clk_configure_xtal32k (void)
 Configure XTAL32K. This must be done only once since the register is retained.
 
__STATIC_INLINE void hw_clk_enable_xtal32k (void)
 Enable XTAL32K but do not set it as the LP clock.
 
__STATIC_INLINE void hw_clk_disable_xtal32k (void)
 Disable XTAL32K. More...
 
__STATIC_INLINE void hw_clk_calibration_enable_irq (void)
 Enable the clock calibration interrupt. More...
 
__STATIC_INLINE void hw_clk_calibration_clear_irq (void)
 Clear the clock calibration interrupt. More...
 
__STATIC_INLINE bool hw_clk_calibration_status_irq (void)
 Read the status of the clock calibration interrupt. More...
 
__STATIC_INLINE bool hw_clk_calibration_finished (void)
 Check the status of a requested calibration. More...
 
void hw_clk_start_calibration (cal_clk_t clk_type, cal_ref_clk_t clk_ref_type, uint16_t cycles)
 Start calibration of a clock. More...
 
uint32_t hw_clk_get_calibration_data (void)
 Return the calibration results. More...
 
__STATIC_INLINE void hw_clk_set_sysclk (sys_clk_is_t mode)
 Set System clock. More...
 
__STATIC_FORCEINLINE void hw_clk_set_hclk_div (ahb_div_t div)
 Set the divider of the AMBA High Speed Bus. More...
 
__STATIC_FORCEINLINE void hw_clk_dblr_sys_on (void)
 Enable the Doubler.
 
__STATIC_FORCEINLINE void hw_clk_dblr_sys_off (void)
 Disable the Doubler. More...
 
__STATIC_INLINE bool hw_clk_check_dblr_status (void)
 Check if the Doubler is enabled. More...
 
__STATIC_INLINE bool hw_clk_is_dblr_ready (void)
 Check if the Doubler is available. More...
 
__STATIC_INLINE void hw_clk_enable_sysclk (sys_clk_is_t clk)
 Activate a System clock. More...
 
__STATIC_INLINE void hw_clk_disable_sysclk (sys_clk_is_t clk)
 Deactivate a System clock. More...
 
__STATIC_INLINE bool hw_clk_is_enabled_sysclk (sys_clk_is_t clk)
 Check if a System clock is enabled. More...
 
__STATIC_FORCEINLINE void hw_clk_configure_ext32k_pins (void)
 Configure pin to connect an external digital clock.
 
int8_t hw_clk_xtalm_configure_cur_set (void)
 Configure XTAL32M current setting. More...
 
void hw_clk_xtalm_configure_irq (void)
 Configure XTAL32M IRQ counter start value. More...
 
__STATIC_INLINE void hw_clk_xtalm_irq_enable (void)
 Enable XTAL32M interrupt generation. More...
 

Detailed Description

Clock Driver header file.

Copyright (C) 2020-2023 Renesas Electronics Corporation and/or its affiliates. All rights reserved. Confidential Information.

This software ("Software") is supplied by Renesas Electronics Corporation and/or its affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable, revocable, non-sub-licensable right and license to use the Software, solely if used in or together with Renesas products. You may make copies of this Software, provided this copyright notice and disclaimer ("Notice") is included in all such copies. Renesas reserves the right to change or discontinue the Software at any time without notice.

THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS SOFTWARE.