PAN1080 Peripheral API
Functions
Clktrim Interface

Clktrim Interface. More...

Functions

__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. More...
 
__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. More...
 
__STATIC_INLINE uint32_t TRIM_GetRealCnt (TRIM_T *trim)
 This function used to get a real count value. More...
 
__STATIC_INLINE bool TRIM_IsIntStatusOccured (TRIM_T *trim, uint32_t msk)
 Adjust which clktrim interrupt occured. More...
 
__STATIC_INLINE void TRIM_ClearIntStatusMsk (TRIM_T *trim, uint32_t msk)
 Clear the specified interrupt. More...
 
__STATIC_INLINE void TRIM_EnableInt (TRIM_T *trim, FunctionalState NewState)
 This function used to enable interrupt. More...
 
__STATIC_INLINE void TRIM_SetRelationIncrease (TRIM_T *trim, FunctionalState NewState)
 This function used to set the relation ship between tuning code and frequency. More...
 
__STATIC_INLINE void TRIM_SetEarlyTerminatinEn (TRIM_T *trim, FunctionalState NewState)
 This function used to enable early termination. More...
 
__STATIC_INLINE void TRIM_SetCoarseCode (TRIM_T *trim, uint32_t code)
 This function used to set coarse code value. More...
 
__STATIC_INLINE uint32_t TRIM_GetCoarseCode (TRIM_T *trim)
 This function used to get coarse code value. More...
 
__STATIC_INLINE void TRIM_SetFineCode (TRIM_T *trim, uint32_t code)
 This function used to set fine code value. More...
 
__STATIC_INLINE uint32_t TRIM_GetFineCode (TRIM_T *trim)
 This function used to get fine code value. More...
 
__STATIC_INLINE void TRIM_SetPrecisionCode (TRIM_T *trim, uint32_t code)
 This function used to set precision code value. More...
 
__STATIC_INLINE uint32_t TRIM_GetPrecisionCode (TRIM_T *trim)
 This function used to get precision code value. More...
 
__STATIC_INLINE void TRIM_SetBitWidth (TRIM_T *trim, uint32_t width)
 This function used to set bit width,bit_width = width + 1. More...
 
__STATIC_INLINE uint32_t TRIM_GetBitWidth (TRIM_T *trim)
 This function used to get bit width. More...
 
__STATIC_INLINE void TRIM_StartTuning (TRIM_T *trim, uint32_t function)
 This function used to enable clk trim function. More...
 
void TRIM_SetCalWaitCnt (TRIM_T *trim, uint32_t cnt)
 This function used to set calibration cnt number to make sure rc32k stable. More...
 
void TRIM_SetCalCnt (TRIM_T *trim, uint32_t cnt)
 This function decide the number of calibration clock cycles you want count. More...
 
uint32_t TRIM_GetCalCnt (TRIM_T *trim)
 This function get the number of calibration clock cycles. More...
 
void TRIM_SetErrRange (TRIM_T *trim, uint32_t deviation)
 This function used to set range value. More...
 

Detailed Description

Clktrim Interface.

Function Documentation

◆ TRIM_ClearIntStatusMsk()

__STATIC_INLINE void TRIM_ClearIntStatusMsk ( TRIM_T *  trim,
uint32_t  msk 
)

Clear the specified interrupt.

Parameters
trimThe base address of i2s module
mskinterrupt status: TRIM_INT_MEASURE_STOP_Msk TRIM_INT_CTUNE_STOP_Msk TRIM_INT_FTUNE_STOP_Msk TRIM_INT_PTUNE_STOP_Msk TRIM_INT_OVERFLOW_Msk TRIM_INT_HW_TRIG_Msk TRIM_FLAG_MEASURE_STOP_Msk TRIM_FLAG_CTUNE_STOP_Msk TRIM_FLAG_FTUNE_STOP_Msk TRIM_FLAG_PTUNE_STOP_Msk TRIM_FLAG_OVERFLOW_Msk TRIM_FLAG_HW_TRIG_Msk
Returns
true or false

◆ TRIM_EnableInt()

__STATIC_INLINE void TRIM_EnableInt ( TRIM_T *  trim,
FunctionalState  NewState 
)

This function used to enable interrupt.

Parameters
[in]trimwhere trim is trim module base address
[in]NewStatenew state of the clk trim.This parameter can be: ENABLE or DISABLE.
Returns
none

◆ TRIM_GetBitWidth()

__STATIC_INLINE uint32_t TRIM_GetBitWidth ( TRIM_T *  trim)

This function used to get bit width.

Parameters
[in]trimwhere trim is trim module base address
Returns
none

◆ TRIM_GetCalCnt()

uint32_t TRIM_GetCalCnt ( TRIM_T *  trim)

This function get the number of calibration clock cycles.

Parameters
[in]trimwhere trim is trim module base address
Returns
none

◆ TRIM_GetCoarseCode()

__STATIC_INLINE uint32_t TRIM_GetCoarseCode ( TRIM_T *  trim)

This function used to get coarse code value.

Parameters
[in]trimwhere trim is trim module base address
Returns
none

◆ TRIM_GetFineCode()

__STATIC_INLINE uint32_t TRIM_GetFineCode ( TRIM_T *  trim)

This function used to get fine code value.

Parameters
[in]trimwhere trim is trim module base address
Returns
none

◆ TRIM_GetIdealCnt()

__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.

Parameters
[in]trimwhere trim is trim module base address
Returns
none

◆ TRIM_GetPrecisionCode()

__STATIC_INLINE uint32_t TRIM_GetPrecisionCode ( TRIM_T *  trim)

This function used to get precision code value.

Parameters
[in]trimwhere trim is trim module base address
Returns
none

◆ TRIM_GetRealCnt()

__STATIC_INLINE uint32_t TRIM_GetRealCnt ( TRIM_T *  trim)

This function used to get a real count value.

Parameters
[in]trimwhere trim is trim module base address
Returns
none

◆ TRIM_IsIntStatusOccured()

__STATIC_INLINE bool TRIM_IsIntStatusOccured ( TRIM_T *  trim,
uint32_t  msk 
)

Adjust which clktrim interrupt occured.

Parameters
trimThe base address of i2s module
mskinterrupt status: TRIM_INT_MEASURE_STOP_Msk TRIM_INT_CTUNE_STOP_Msk TRIM_INT_FTUNE_STOP_Msk TRIM_INT_PTUNE_STOP_Msk TRIM_INT_OVERFLOW_Msk TRIM_INT_HW_TRIG_Msk TRIM_FLAG_MEASURE_STOP_Msk TRIM_FLAG_CTUNE_STOP_Msk TRIM_FLAG_FTUNE_STOP_Msk TRIM_FLAG_PTUNE_STOP_Msk TRIM_FLAG_OVERFLOW_Msk TRIM_FLAG_HW_TRIG_Msk
Returns
true or false

◆ TRIM_SetBitWidth()

__STATIC_INLINE void TRIM_SetBitWidth ( TRIM_T *  trim,
uint32_t  width 
)

This function used to set bit width,bit_width = width + 1.

Parameters
[in]trimwhere trim is trim module base address
[in]widthbit width
Returns
none

◆ TRIM_SetCalCnt()

void TRIM_SetCalCnt ( TRIM_T *  trim,
uint32_t  cnt 
)

This function decide the number of calibration clock cycles you want count.

Parameters
[in]trimwhere trim is trim module base address
[in]cntwhere cnt is count value
Returns
none

◆ TRIM_SetCalWaitCnt()

void TRIM_SetCalWaitCnt ( TRIM_T *  trim,
uint32_t  cnt 
)

This function used to set calibration cnt number to make sure rc32k stable.

Parameters
[in]trimwhere trim is trim module base address
[in]cntwhere cnt is count value
Returns
none

◆ TRIM_SetCoarseCode()

__STATIC_INLINE void TRIM_SetCoarseCode ( TRIM_T *  trim,
uint32_t  code 
)

This function used to set coarse code value.

Parameters
[in]trimwhere trim is trim module base address
[in]codecoarse tuning code
Returns
none

◆ TRIM_SetEarlyTerminatinEn()

__STATIC_INLINE void TRIM_SetEarlyTerminatinEn ( TRIM_T *  trim,
FunctionalState  NewState 
)

This function used to enable early termination.

Parameters
[in]trimwhere trim is trim module base address
[in]NewStatenew state of the clk trim.This parameter can be: ENABLE or DISABLE.
Returns
none

◆ TRIM_SetErrRange()

void TRIM_SetErrRange ( TRIM_T *  trim,
uint32_t  deviation 
)

This function used to set range value.

Parameters
[in]trimwhere trim is trim module base address
[in]deviationfrequency deviation,units of Hz formula: deviation = 32k * clk_cnt / (HCLK / 32K) - 32k
Returns
none

◆ TRIM_SetFineCode()

__STATIC_INLINE void TRIM_SetFineCode ( TRIM_T *  trim,
uint32_t  code 
)

This function used to set fine code value.

Parameters
[in]trimwhere trim is trim module base address
[in]codefine tuning code
Returns
none

◆ TRIM_SetIdealCnt()

__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.

Parameters
[in]trimwhere trim is trim module base address
[in]cntwhere cnt is count value
Returns
none

◆ TRIM_SetPrecisionCode()

__STATIC_INLINE void TRIM_SetPrecisionCode ( TRIM_T *  trim,
uint32_t  code 
)

This function used to set precision code value.

Parameters
[in]trimwhere trim is trim module base address
[in]codeprecision tuning code
Returns
none

◆ TRIM_SetRelationIncrease()

__STATIC_INLINE void TRIM_SetRelationIncrease ( TRIM_T *  trim,
FunctionalState  NewState 
)

This function used to set the relation ship between tuning code and frequency.

Parameters
[in]trimwhere trim is trim module base address
[in]NewStatenew state of the clk trim.This parameter can be: ENABLE or DISABLE.
Returns
none

◆ TRIM_StartTuning()

__STATIC_INLINE void TRIM_StartTuning ( TRIM_T *  trim,
uint32_t  function 
)

This function used to enable clk trim function.

Parameters
[in]trimwhere trim is trim module base address
[in]functiontuning function,include: TRIM_MEASURE_TUNING_EN_Msk TRIM_COARSE_TUNING_EN_Msk TRIM_FINE_TUNING_EN_Msk TRIM_PRECISON_TUNING_EN_Msk
Returns
none