14#ifndef _PAN_CLKTRIM_H_
15#define _PAN_CLKTRIM_H_
35 trim->TRIM_IDEAL_CNT = cnt;
45 return trim->TRIM_IDEAL_CNT;
55 return trim->TRIM_REAL_CNT;
79 return (trim->TRIM_INT & msk)?(
true):(
false);
102 trim->TRIM_INT |= msk;
113 (NewState != DISABLE)?(trim->TRIM_INT |= TRIM_INT_EN_Msk):(trim->TRIM_INT &= ~TRIM_INT_EN_Msk);
124 (NewState != DISABLE)?(trim->TRIM_CTRL &= ~TRIM_CLRL_RELATION_Msk):(trim->TRIM_CTRL |= TRIM_CLRL_RELATION_Msk);
135 (NewState != ENABLE)?(trim->TRIM_CTRL &= ~TRIM_CLRL_EARLY_TERM_EN_Msk):(trim->TRIM_CTRL |= TRIM_CLRL_EARLY_TERM_EN_Msk);
148 trim->TRIM_CODE = (trim->TRIM_CODE & ~TRIM_COARSE_CODE_Msk) | (code << TRIM_COARSE_CODE_Pos);
158 return ((trim->TRIM_CODE & TRIM_COARSE_CODE_Msk) >> TRIM_COARSE_CODE_Pos);
168 trim->TRIM_CODE = (trim->TRIM_CODE & ~TRIM_FINE_CODE_Msk) | (code << TRIM_FINE_CODE_Pos);
177 return ((trim->TRIM_CODE & TRIM_FINE_CODE_Msk) >> TRIM_FINE_CODE_Pos);
187 trim->TRIM_CODE = (trim->TRIM_CODE & ~TRIM_PRECISION_CODE_Msk) | (code << TRIM_PRECISION_CODE_Pos);
196 return ((trim->TRIM_CODE & TRIM_PRECISION_CODE_Msk) >> TRIM_PRECISION_CODE_Pos);
206 trim->TRIM_CODE = (trim->TRIM_CODE & ~TRIM_BIT_WIDTH_Msk) | (width << TRIM_BIT_WIDTH_Pos);
216 return ((trim->TRIM_CODE & TRIM_BIT_WIDTH_Msk) >> TRIM_BIT_WIDTH_Pos);
230 trim->TRIM_EN = (trim->TRIM_EN & ~0XF) | (
function);
__STATIC_INLINE void TRIM_SetRelationIncrease(TRIM_T *trim, FunctionalState NewState)
This function used to set the relation ship between tuning code and frequency.
Definition: pan_clktrim.h:122
__STATIC_INLINE uint32_t TRIM_GetIdealCnt(TRIM_T *trim)
This function used to read a ideal count value,IDEA_CNT = CAL_CNT * (REF_CLK / CAL_CLK) -1.
Definition: pan_clktrim.h:43
__STATIC_INLINE uint32_t TRIM_GetPrecisionCode(TRIM_T *trim)
This function used to get precision code value.
Definition: pan_clktrim.h:194
__STATIC_INLINE void TRIM_SetCoarseCode(TRIM_T *trim, uint32_t code)
This function used to set coarse code value.
Definition: pan_clktrim.h:146
void TRIM_SetErrRange(TRIM_T *trim, uint32_t deviation)
This function used to set range value.
__STATIC_INLINE void TRIM_StartTuning(TRIM_T *trim, uint32_t function)
This function used to enable clk trim function.
Definition: pan_clktrim.h:228
void TRIM_SetCalWaitCnt(TRIM_T *trim, uint32_t cnt)
This function used to set calibration cnt number to make sure rc32k stable.
__STATIC_INLINE void TRIM_SetIdealCnt(TRIM_T *trim, uint32_t cnt)
This function used to set a ideal count value,IDEA_CNT = CAL_CNT * (REF_CLK / CAL_CLK) -1.
Definition: pan_clktrim.h:33
__STATIC_INLINE uint32_t TRIM_GetFineCode(TRIM_T *trim)
This function used to get fine code value.
Definition: pan_clktrim.h:175
__STATIC_INLINE void TRIM_SetBitWidth(TRIM_T *trim, uint32_t width)
This function used to set bit width,bit_width = width + 1.
Definition: pan_clktrim.h:204
__STATIC_INLINE uint32_t TRIM_GetCoarseCode(TRIM_T *trim)
This function used to get coarse code value.
Definition: pan_clktrim.h:156
__STATIC_INLINE bool TRIM_IsIntStatusOccured(TRIM_T *trim, uint32_t msk)
Adjust which clktrim interrupt occured.
Definition: pan_clktrim.h:77
__STATIC_INLINE void TRIM_EnableInt(TRIM_T *trim, FunctionalState NewState)
This function used to enable interrupt.
Definition: pan_clktrim.h:111
__STATIC_INLINE void TRIM_SetEarlyTerminatinEn(TRIM_T *trim, FunctionalState NewState)
This function used to enable early termination.
Definition: pan_clktrim.h:133
__STATIC_INLINE uint32_t TRIM_GetBitWidth(TRIM_T *trim)
This function used to get bit width.
Definition: pan_clktrim.h:214
uint32_t TRIM_GetCalCnt(TRIM_T *trim)
This function get the number of calibration clock cycles.
__STATIC_INLINE void TRIM_SetPrecisionCode(TRIM_T *trim, uint32_t code)
This function used to set precision code value.
Definition: pan_clktrim.h:185
void TRIM_SetCalCnt(TRIM_T *trim, uint32_t cnt)
This function decide the number of calibration clock cycles you want count.
__STATIC_INLINE void TRIM_SetFineCode(TRIM_T *trim, uint32_t code)
This function used to set fine code value.
Definition: pan_clktrim.h:166
__STATIC_INLINE uint32_t TRIM_GetRealCnt(TRIM_T *trim)
This function used to get a real count value.
Definition: pan_clktrim.h:53
__STATIC_INLINE void TRIM_ClearIntStatusMsk(TRIM_T *trim, uint32_t msk)
Clear the specified interrupt.
Definition: pan_clktrim.h:100