![]() |
PDL for FM0+
Version1.0
Peripheral Driverl Library for FM0+
|
Data Structures | |
struct | stc_wfg_ctrl_bits |
struct | stc_mft_wfg_intern_data |
struct | stc_wfg_nzcl_config |
struct | stc_dtif_int_sel |
struct | stc_dtif_int_cb |
struct | stc_mft_wfg_instance_data |
Defines | |
#define | stc_mftn_wfg_t FM0P_MFT_WFG_TypeDef |
#define | MFT0_WFG (*((volatile stc_mftn_wfg_t *) FM0P_MFT0_WFG_BASE)) |
#define | MFT1_WFG (*((volatile stc_mftn_wfg_t *) FM0P_MFT1_WFG_BASE)) |
#define | MFT2_WFG (*((volatile stc_mftn_wfg_t *) FM0P_MFT2_WFG_BASE)) |
#define | MFT_WFG_CH0 0 |
#define | MFT_WFG_CH1 1 |
#define | MFT_WFG_CH2 2 |
#define | MFT_WFG_CH3 3 |
#define | MFT_WFG_CH4 4 |
#define | MFT_WFG_CH5 5 |
#define | MFT_WFG_CH10 0 |
#define | MFT_WFG_CH32 1 |
#define | MFT_WFG_CH54 2 |
#define | MFT_WFG_MAXCH 3 |
#define | WFG_INSTANCE_COUNT |
Typedefs | |
typedef enum en_wfg_instance_index | en_wfg_instance_index_t |
Enumeration to define an index for each WFG instance. | |
typedef enum en_mft_wfg_mode | en_mft_wfg_mode_t |
typedef enum en_gten_bits | en_gten_bits_t |
typedef enum en_psel_bits | en_psel_bits_t |
typedef enum en_pgen_bits | en_pgen_bits_t |
typedef enum en_dmod_bit | en_dmod_bit_t |
typedef struct stc_wfg_ctrl_bits | stc_wfg_ctrl_bits_t |
typedef enum en_wfg_timer_clock | en_wfg_timer_clock_t |
typedef struct stc_mft_wfg_intern_data | stc_mft_wfg_intern_data_t |
typedef enum en_nzcl_filter_width | en_nzcl_filter_width_t |
typedef struct stc_wfg_nzcl_config | stc_wfg_nzcl_config_t |
typedef struct stc_dtif_int_sel | stc_dtif_int_sel_t |
typedef struct stc_dtif_int_cb | stc_dtif_int_cb_t |
typedef struct stc_mft_wfg_instance_data | stc_mft_wfg_instance_data_t |
Enumerations | |
enum | en_wfg_instance_index { WfgInstanceIndexWfg0 = 0, WfgInstanceIndexWfg1, WfgInstanceIndexWfg2 } |
Enumeration to define an index for each WFG instance. More... | |
enum | en_mft_wfg_mode { WfgThroughMode = 0, WfgRtPpgMode = 1, WfgTimerPpgMode = 2, WfgRtDeadTimerMode = 4, WfgRtDeadTimerFilterMode = 5, WfgPpgDeadTimerFilterMode = 6, WfgPpgDeadTimerMode = 7 } |
enum | en_gten_bits { GtenBits00B = 0, GtenBits01B, GtenBits10B, GtenBits11B } |
enum | en_psel_bits { PselBits00B = 0, PselBits01B, PselBits10B, PselBits11B } |
enum | en_pgen_bits { PgenBits00B = 0, PgenBits01B, PgenBits10B, PgenBits11B } |
enum | en_dmod_bit { DmodBit0B = 0, DmodBit1B } |
enum | en_wfg_timer_clock { WfgPlckDiv1 = 0, WfgPlckDiv2, WfgPlckDiv4, WfgPlckDiv8, WfgPlckDiv16, WfgPlckDiv32, WfgPlckDiv64, WfgPlckDiv128 } |
enum | en_nzcl_filter_width { NzlcNoFilter, NzlcWidth4Cycle, NzlcWidth8Cycle, NzlcWidth16Cycle, NzlcWidth32Cycle, NzlcWidth64Cycle, NzlcWidth128Cycle } |
Functions | |
static stc_mft_wfg_intern_data_t * | MftGetInternDataPtr (volatile FM0P_MFT_WFG_TypeDef *pstcWfg) |
Return the internal data for a certain WFG instance. | |
void | Mft_Wfg_IrqHandler (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, stc_mft_wfg_intern_data_t *pstcMftWfgInternData) |
WFG interrupt handler sub function. | |
static void | Mft_Wfg_InitIrq (volatile FM0P_MFT_WFG_TypeDef *pstcWfg) |
Device dependent initialization of interrupts according CMSIS with level defined in pdl.h. | |
static void | Mft_Wfg_DeInitIrq (volatile FM0P_MFT_WFG_TypeDef *pstcWfg) |
Device dependent de-initialization of interrupts according CMSIS. | |
en_result_t | Mft_Wfg_ConfigMode (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh, en_mft_wfg_mode_t enMode) |
configure WFG mode | |
en_result_t | Mft_Wfg_ConfigCtrlBits (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh, stc_wfg_ctrl_bits_t *pstcCtrlBits) |
configure WFG control bit | |
en_result_t | Mft_Wfg_InitTimerClock (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh, en_wfg_timer_clock_t enClk) |
init timer clock | |
en_result_t | Mft_Wfg_EnableTimerInt (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh, func_ptr_t pfnCallback) |
enable WFG timer interrupt | |
en_result_t | Mft_Wfg_DisableTimerInt (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh) |
disable WFG timer interrupt | |
en_result_t | Mft_Wfg_StartTimer (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh) |
Start WFG timer. | |
en_result_t | Mft_Wfg_StopTimer (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh) |
Stop WFG timer. | |
en_int_flag_t | Mft_Wfg_GetTimerIntFlag (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh) |
get WFG timer interrupt flag | |
en_result_t | Mft_Wfg_ClrTimerIntFlag (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh) |
clear WFG timer interrupt flag | |
en_result_t | Mft_Wfg_WriteTimerCountCycle (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh, uint16_t u16CycleA, uint16_t u16CycleB) |
write timer count cycle | |
en_result_t | Mft_Wfg_SetTimerCycle (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh, uint16_t u16Count) |
set cycle of WFG timer | |
uint16_t | Mft_Wfg_GetTimerCurCycle (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, uint8_t u8CoupleCh) |
get cycle of WFG timer | |
en_result_t | Mft_Wfg_ConfigNzcl (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, stc_wfg_nzcl_config_t *pstcNzclConfig) |
configure NZCL | |
en_result_t | Mft_Wfg_EnableDtifInt (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, stc_dtif_int_sel_t *pstcIntSel, stc_dtif_int_cb_t *pstcCallback) |
Enable DTIF interrupt. | |
en_result_t | Mft_Wfg_DisableDtifInt (volatile FM0P_MFT_WFG_TypeDef *pstcWfg, stc_dtif_int_sel_t *pstcIntSel) |
Disable DTIF interrupt. | |
en_result_t | Mft_Wfg_SwTiggerDtif (volatile FM0P_MFT_WFG_TypeDef *pstcWfg) |
set software trigger DTIF | |
en_int_flag_t | Mft_Wfg_GetDigitalFilterIntFlag (volatile FM0P_MFT_WFG_TypeDef *pstcWfg) |
get Digital filter interrupt flag | |
en_result_t | Mft_Wfg_ClrDigitalFilterIntFlag (volatile FM0P_MFT_WFG_TypeDef *pstcWfg) |
clear Digital filter interrupt flag | |
en_int_flag_t | Mft_Wfg_GetAnalogFilterIntFlag (volatile FM0P_MFT_WFG_TypeDef *pstcWfg) |
get Analog Filter interrupt flag | |
en_result_t | Mft_Wfg_ClrAnalogFilterIntFlag (volatile FM0P_MFT_WFG_TypeDef *pstcWfg) |
clear Analog Filter interrupt flag | |
Variables | |
stc_mft_wfg_instance_data_t | m_astcMftWfgInstanceDataLut [(PDL_PERIPHERAL_ENABLE_MFT0_WFG==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT1_WFG==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT2_WFG==PDL_ON?1:0)] |
Look-up table for all enabled WFG instances and their internal data. | |
stc_mft_wfg_instance_data_t | m_astcMftWfgInstanceDataLut [(PDL_PERIPHERAL_ENABLE_MFT0_WFG==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT1_WFG==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT2_WFG==PDL_ON?1:0)] |
Look-up table for all enabled WFG instances and their internal data. |
Provided functions of WFG module:
The WFG can be configured to following mode:
how to operate WFG with Through mode (one of usages)?
Before using WFG, the FRT used to connect with applying OCU must be initialed first and OCU must be initialed then.
For how to configure FRT, see the description in the mft_frt.h
For how to configure OCU, see the description in the mft_ocu.h
Set the control bits with Mft_Wfg_ConfigCtrlBits() with a structure of the type stc_wfg_ctrl_bits_t
Configure WFG to Through mode with Mft_Wfg_ConfigMode()
Enable OCU operation and RT signal will output to RTO pin directly. Changing the value of control bits will influence RTO output.
how to operate WFG with RT-PPG mode (one of usages)?
Before using WFG, the FRT used to connect with applying OCU must be initialized first and OCU must be initialed then, PPG should be initialized at the following.
For how to configure FRT, see the description in the mft_frt.h
For how to configure OCU, see the description in the mft_ocu.h
For how to configure PPG, see the description in the ppg.h
Set the control bits with Mft_Wfg_ConfigCtrlBits() with a structure of the type stc_wfg_ctrl_bits_t
Configure WFG to RT-PPG mode with Mft_Wfg_ConfigMode()
Start PPG0 and enable OCU operation.
In this case RTO0 will outputs the logic AND signal of RT0 signal and PPG0, RTO1 will outputs the logic AND signal of RT1 signal and PPG0. Changing the value of control bits will influence RTO output.
how to operate WFG with Timer-PPG mode (one of usages)?
Before using WFG, the FRT used to connect with applying OCU must be initialized first and OCU must be initialed then, PPG and WFG timer should be initialized at the following.
For how to configure FRT, see the description in the mft_frt.h
For how to configure OCU, see the description in the mft_ocu.h
For how to configure PPG, see the description in the ppg.h
For how to initialize WFG timer, see the description at the following.
Set the control bits with Mft_Wfg_ConfigCtrlBits() with a structure of the type stc_wfg_ctrl_bits_t
Configure WFG to Timer-PPG mode with Mft_Wfg_ConfigMode()
Start PPG0, enable OCU operation and start WFG timer.
In this case RTO0 will outputs the logic AND signal of WFG timer flag 0 and PPG0, RTO1 will outputs the logic AND signal of WFG timer flag 1 and PPG0. Changing the value of control bits will influence RTO output.
how to operate WFG with RT-dead timer mode (one of usages)?
Before using WFG, the FRT used to connect with applying OCU must be initialized first and OCU must be initialed then, WFG timer should be initialized at the following.
For how to configure FRT, see the description in the mft_frt.h
For how to configure OCU, see the description in the mft_ocu.h
For how to initialize WFG timer, see the description at the following.
Configure WFG to RT-dead timer mode with Mft_Wfg_ConfigMode()
Set the control bits with Mft_Wfg_ConfigCtrlBits() with a structure of the type stc_wfg_ctrl_bits_t
Enable OCU operation and start WFG timer.
In this case, RT(1) will trigger the WFG timer to start, WFG will output the generated non-overlap signal. Changing the value of control bits will influence RTO output.
how to operate WFG with PPG-dead timer mode (one of usages)?
Before using WFG, WFG timer should be initialized at the following. For how to initialize WFG timer, see the description at the following.
Configure WFG to PPG-dead timer mode with Mft_Wfg_ConfigMode()
Set the control bits with Mft_Wfg_ConfigCtrlBits() with a structure of the type stc_wfg_ctrl_bits_t
Start WFG timer.
In this case, PPG0 will trigger the WFG timer to start, WFG will output the generated non-overlap singal. Changing the value of control bits will influence RTO output.
How to use the WFG timer?
Mft_Wfg_InitTimerClock() must be used for configuration of a Free-Run timer (FRT) channel with a structure of the type en_wfg_timer_clock_t.
A WFG timer interrupt can be enabled by the function Mft_Wfg_EnableTimerInt(). This function can set callback function for each channel too.
With Mft_Wfg_WriteTimerCountCycle() the WFG timer cycle is set to the value given in the parameter Mft_Wfg_WriteTimerCountCycle::u16CycleA and Mft_Wfg_WriteTimerCountCycle::u16CycleB.
After above setting, calling Mft_Wfg_SetTimerCycle() will start WFG timer.
With Mft_Wfg_GetTimerCurCycle() the current WFG timer count can be read when WFG timer is running.
With interrupt mode, when the interrupt occurs, the interrupt flag will be cleared and run into user interrupt callback function.
With polling mode, user can use Mft_Wfg_GetTimerIntFlag() to check if the interrupt occurs, and clear the interrupt flag by Mft_Wfg_ClrTimerIntFlag().
When stopping the WFG, use Mft_Wfg_DisableTimerInt() to disable WFG timer and Mft_Wfg_DisableTimerInt() to disable WFG timer interrupt.
How to use the NZCL (used for motor emergency shutdown) ?
Mft_Wfg_ConfigNzcl() must be used for configuration of the WFG NZCL with a structure of the type stc_wfg_nzcl_config_t.
Both analog noise filter and digital noise filter can be used to filter the signal input from DTTIX pin. WFG NTCL interrupt with filter user mode can be enabled by the function Mft_Wfg_EnableDtifInt(). This function can set callback function for each channel too. With this function, the operation of WFG NZCL is also enabled.
With interrupt mode, when the interrupt occurs, the interrupt flag will be cleared and run into user interrupt callback function.
With polling mode, user can use Mft_Wfg_GetDigitalFilterIntFlag() to check if the interrupt of digital noise filter occurs, and clear the interrupt flag by Mft_Wfg_ClrDigitalFilterIntFlag(). user can use Mft_Wfg_GetAnalogFilterIntFlag() to check if the interrupt of analog noise filter occurs, and clear the interrupt flag by Mft_Wfg_ClrAnalogFilterIntFlag().
Mft_Wfg_SwTiggerDtif() is used to trigger the DTIF interrupt by software, regardless of DTTIX pin input status.
When stopping the WFG NZCL, use Mft_Wfg_DisableDtifInt() to disable WFG NZCL operation as well as WFG NZCL interrupt.
#define MFT0_WFG (*((volatile stc_mftn_wfg_t *) FM0P_MFT0_WFG_BASE)) |
Definition at line 286 of file mft_wfg.h.
Referenced by Mft_Wfg_ConfigNzcl(), Mft_Wfg_DeInitIrq(), Mft_Wfg_InitIrq(), and MFT_WFG_IRQHandler().
#define MFT1_WFG (*((volatile stc_mftn_wfg_t *) FM0P_MFT1_WFG_BASE)) |
Definition at line 287 of file mft_wfg.h.
Referenced by Mft_Wfg_ConfigNzcl(), Mft_Wfg_DeInitIrq(), Mft_Wfg_InitIrq(), and MFT_WFG_IRQHandler().
#define MFT2_WFG (*((volatile stc_mftn_wfg_t *) FM0P_MFT2_WFG_BASE)) |
Definition at line 288 of file mft_wfg.h.
Referenced by Mft_Wfg_ConfigNzcl(), Mft_Wfg_DeInitIrq(), Mft_Wfg_InitIrq(), and MFT_WFG_IRQHandler().
#define MFT_WFG_CH0 0 |
#define MFT_WFG_CH1 1 |
#define MFT_WFG_CH10 0 |
Definition at line 297 of file mft_wfg.h.
Referenced by Mft_Wfg_ClrTimerIntFlag(), Mft_Wfg_DisableTimerInt(), Mft_Wfg_EnableTimerInt(), Mft_Wfg_GetTimerIntFlag(), Mft_Wfg_StartTimer(), and Mft_Wfg_StopTimer().
#define MFT_WFG_CH2 2 |
#define MFT_WFG_CH3 3 |
#define MFT_WFG_CH32 1 |
Definition at line 298 of file mft_wfg.h.
Referenced by Mft_Wfg_ClrTimerIntFlag(), Mft_Wfg_DisableTimerInt(), Mft_Wfg_EnableTimerInt(), Mft_Wfg_GetTimerIntFlag(), Mft_Wfg_StartTimer(), and Mft_Wfg_StopTimer().
#define MFT_WFG_CH4 4 |
#define MFT_WFG_CH5 5 |
#define MFT_WFG_CH54 2 |
Definition at line 299 of file mft_wfg.h.
Referenced by Mft_Wfg_ClrTimerIntFlag(), Mft_Wfg_DisableTimerInt(), Mft_Wfg_EnableTimerInt(), Mft_Wfg_GetTimerIntFlag(), Mft_Wfg_StartTimer(), and Mft_Wfg_StopTimer().
#define MFT_WFG_MAXCH 3 |
Definition at line 300 of file mft_wfg.h.
Referenced by Mft_Wfg_ClrTimerIntFlag(), Mft_Wfg_ConfigCtrlBits(), Mft_Wfg_ConfigMode(), Mft_Wfg_DisableTimerInt(), Mft_Wfg_EnableTimerInt(), Mft_Wfg_InitTimerClock(), Mft_Wfg_StartTimer(), Mft_Wfg_StopTimer(), and Mft_Wfg_WriteTimerCountCycle().
#define stc_mftn_wfg_t FM0P_MFT_WFG_TypeDef |
Definition at line 284 of file mft_wfg.h.
Referenced by Mft_Wfg_DeInitIrq(), Mft_Wfg_InitIrq(), and MFT_WFG_IRQHandler().
#define WFG_INSTANCE_COUNT |
(PDL_PERIPHERAL_ENABLE_MFT0_WFG == PDL_ON ? 1 : 0) + \ (PDL_PERIPHERAL_ENABLE_MFT1_WFG == PDL_ON ? 1 : 0) + \ (PDL_PERIPHERAL_ENABLE_MFT2_WFG == PDL_ON ? 1 : 0)
Definition at line 302 of file mft_wfg.h.
Referenced by MftGetInternDataPtr().
typedef enum en_dmod_bit en_dmod_bit_t |
typedef enum en_gten_bits en_gten_bits_t |
typedef enum en_mft_wfg_mode en_mft_wfg_mode_t |
typedef enum en_nzcl_filter_width en_nzcl_filter_width_t |
typedef enum en_pgen_bits en_pgen_bits_t |
typedef enum en_psel_bits en_psel_bits_t |
typedef enum en_wfg_instance_index en_wfg_instance_index_t |
Enumeration to define an index for each WFG instance.
typedef enum en_wfg_timer_clock en_wfg_timer_clock_t |
typedef struct stc_dtif_int_cb stc_dtif_int_cb_t |
typedef struct stc_dtif_int_sel stc_dtif_int_sel_t |
typedef struct stc_mft_wfg_instance_data stc_mft_wfg_instance_data_t |
typedef struct stc_mft_wfg_intern_data stc_mft_wfg_intern_data_t |
typedef struct stc_wfg_ctrl_bits stc_wfg_ctrl_bits_t |
typedef struct stc_wfg_nzcl_config stc_wfg_nzcl_config_t |
enum en_dmod_bit |
enum en_gten_bits |
enum en_mft_wfg_mode |
enum en_nzcl_filter_width |
enum en_pgen_bits |
enum en_psel_bits |
enum en_wfg_timer_clock |
en_result_t Mft_Wfg_ClrAnalogFilterIntFlag | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg | ) |
clear Analog Filter interrupt flag
[in] | pstcWfg | Pointer to WFG instance |
Ok | Analog Filter interrupt flag is clear |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 1036 of file mft_wfg.c.
References ErrorInvalidParameter, and Ok.
en_result_t Mft_Wfg_ClrDigitalFilterIntFlag | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg | ) |
clear Digital filter interrupt flag
[in] | pstcWfg | Pointer to WFG instance |
Ok | Digital filter interrupt flag is clear |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 991 of file mft_wfg.c.
References ErrorInvalidParameter, and Ok.
en_result_t Mft_Wfg_ClrTimerIntFlag | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
uint8_t | u8CoupleCh | ||
) |
clear WFG timer interrupt flag
[in] | pstcWfg | Pointer to WFG instance |
[in] | u8CoupleCh | channel of WFG couple
|
Ok | WFG timer interrupt flag is clear |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 661 of file mft_wfg.c.
References ErrorInvalidParameter, MFT_WFG_CH10, MFT_WFG_CH32, MFT_WFG_CH54, MFT_WFG_MAXCH, and Ok.
Referenced by Mft_Wfg_IrqHandler().
en_result_t Mft_Wfg_ConfigCtrlBits | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
uint8_t | u8CoupleCh, | ||
stc_wfg_ctrl_bits_t * | pstcCtrlBits | ||
) |
configure WFG control bit
[in] | pstcWfg | Pointer to WFG instance |
[in] | u8CoupleCh | channel of WFG couple
|
[in] | pstcCtrlBits | structure of control bit
|
Ok | Control bits are set |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 345 of file mft_wfg.c.
References DmodBit0B, stc_wfg_ctrl_bits::enDmodBit, stc_wfg_ctrl_bits::enGtenBits, stc_wfg_ctrl_bits::enPgenBits, stc_wfg_ctrl_bits::enPselBits, ErrorInvalidParameter, MFT_WFG_MAXCH, and Ok.
en_result_t Mft_Wfg_ConfigMode | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
uint8_t | u8CoupleCh, | ||
en_mft_wfg_mode_t | enMode | ||
) |
configure WFG mode
[in] | pstcWfg | Pointer to WFG instance |
[in] | u8CoupleCh | channel of WFG couple
|
[in] | enMode | enum of WFG mode
|
Ok | WFG mode is configured |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 272 of file mft_wfg.c.
References ErrorInvalidParameter, MFT_WFG_MAXCH, MftGetInternDataPtr(), Ok, stc_mft_wfg_intern_data::pfnWfg10TimerCallback, stc_mft_wfg_intern_data::pfnWfg32TimerCallback, stc_mft_wfg_intern_data::pfnWfg54TimerCallback, WfgPpgDeadTimerFilterMode, WfgPpgDeadTimerMode, WfgRtDeadTimerFilterMode, WfgRtDeadTimerMode, WfgRtPpgMode, WfgThroughMode, and WfgTimerPpgMode.
en_result_t Mft_Wfg_ConfigNzcl | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
stc_wfg_nzcl_config_t * | pstcNzclConfig | ||
) |
configure NZCL
[in] | pstcWfg | Pointer to WFG instance |
[in] | pstcNzclConfig | configure of NZCL |
Ok | NZCL is configured |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 801 of file mft_wfg.c.
References stc_wfg_nzcl_config::bEnAnalogFilter, stc_wfg_nzcl_config::bEnDigitalFilter, stc_wfg_nzcl_config::bSwitchToGpio, stc_wfg_nzcl_config::enDigitalFilterWidth, ErrorInvalidParameter, MFT0_WFG, MFT1_WFG, MFT2_WFG, and Ok.
static void Mft_Wfg_DeInitIrq | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg | ) | [static] |
Device dependent de-initialization of interrupts according CMSIS.
[in] | pstcWfg | Pointer to WFG instance |
Ok | Successful initialization |
Definition at line 232 of file mft_wfg.c.
References MFT0_WFG, MFT1_WFG, MFT2_WFG, PDL_DEFAULT_INTERRUPT_LEVEL, and stc_mftn_wfg_t.
Referenced by Mft_Wfg_DisableDtifInt(), and Mft_Wfg_DisableTimerInt().
en_result_t Mft_Wfg_DisableDtifInt | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
stc_dtif_int_sel_t * | pstcIntSel | ||
) |
Disable DTIF interrupt.
[in] | pstcWfg | Pointer to WFG instance |
[in] | pstcIntSel | DTIF interrupt selection
|
Ok | Interrupt disable normally |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 897 of file mft_wfg.c.
References stc_dtif_int_sel::bDtifAnalogFilterInt, stc_dtif_int_sel::bDtifDigitalFilterInt, ErrorInvalidParameter, Mft_Wfg_DeInitIrq(), MftGetInternDataPtr(), Ok, stc_mft_wfg_intern_data::pfnWfgAnalogFilterCallback, stc_mft_wfg_intern_data::pfnWfgDigtalFilterCallback, and TRUE.
en_result_t Mft_Wfg_DisableTimerInt | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
uint8_t | u8CoupleCh | ||
) |
disable WFG timer interrupt
[in] | pstcWfg | Pointer to WFG instance |
[in] | u8CoupleCh | channel of WFG couple
|
Ok | WFG timer interrupt is disabled |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 488 of file mft_wfg.c.
References ErrorInvalidParameter, MFT_WFG_CH10, MFT_WFG_CH32, MFT_WFG_CH54, Mft_Wfg_DeInitIrq(), MFT_WFG_MAXCH, MftGetInternDataPtr(), Ok, stc_mft_wfg_intern_data::pfnWfg10TimerCallback, stc_mft_wfg_intern_data::pfnWfg32TimerCallback, and stc_mft_wfg_intern_data::pfnWfg54TimerCallback.
en_result_t Mft_Wfg_EnableDtifInt | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
stc_dtif_int_sel_t * | pstcIntSel, | ||
stc_dtif_int_cb_t * | pstcCallback | ||
) |
Enable DTIF interrupt.
[in] | pstcWfg | Pointer to WFG instance |
[in] | pstcIntSel | DTIF interrupt selection
|
[in] | pstcCallback | Pointer to DTIF interrupt callback function array
|
Ok | DTIF interrupt is enabled |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 850 of file mft_wfg.c.
References stc_dtif_int_sel::bDtifAnalogFilterInt, stc_dtif_int_sel::bDtifDigitalFilterInt, ErrorInvalidParameter, Mft_Wfg_InitIrq(), MftGetInternDataPtr(), Ok, stc_mft_wfg_intern_data::pfnWfgAnalogFilterCallback, stc_dtif_int_cb::pfnWfgAnalogFilterCallback, stc_mft_wfg_intern_data::pfnWfgDigtalFilterCallback, stc_dtif_int_cb::pfnWfgDigtalFilterCallback, and TRUE.
en_result_t Mft_Wfg_EnableTimerInt | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
uint8_t | u8CoupleCh, | ||
func_ptr_t | pfnCallback | ||
) |
enable WFG timer interrupt
[in] | pstcWfg | Pointer to WFG instance |
[in] | u8CoupleCh | channel of WFG couple
|
[in] | pfnCallback | callback function
|
Ok | WFG timer interrupt is enabled |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 435 of file mft_wfg.c.
References ErrorInvalidParameter, MFT_WFG_CH10, MFT_WFG_CH32, MFT_WFG_CH54, Mft_Wfg_InitIrq(), MFT_WFG_MAXCH, MftGetInternDataPtr(), Ok, stc_mft_wfg_intern_data::pfnWfg10TimerCallback, stc_mft_wfg_intern_data::pfnWfg32TimerCallback, and stc_mft_wfg_intern_data::pfnWfg54TimerCallback.
en_int_flag_t Mft_Wfg_GetAnalogFilterIntFlag | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg | ) |
get Analog Filter interrupt flag
[in] | pstcWfg | Pointer to WFG instance |
PdlClr | Analog Filter interrupt flag is clear |
PdlSet | Analog Filter interrupt flag is set |
Definition at line 1014 of file mft_wfg.c.
References PdlClr, and PdlSet.
Referenced by Mft_Wfg_IrqHandler().
en_int_flag_t Mft_Wfg_GetDigitalFilterIntFlag | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg | ) |
get Digital filter interrupt flag
[in] | pstcWfg | Pointer to WFG instance |
PdlClr | Digital Filter interrupt flag is clear |
PdlSet | Digital Filter interrupt flag is set |
Definition at line 968 of file mft_wfg.c.
References PdlClr, and PdlSet.
Referenced by Mft_Wfg_IrqHandler().
uint16_t Mft_Wfg_GetTimerCurCycle | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
uint8_t | u8CoupleCh | ||
) |
en_int_flag_t Mft_Wfg_GetTimerIntFlag | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
uint8_t | u8CoupleCh | ||
) |
get WFG timer interrupt flag
[in] | pstcWfg | Pointer to WFG instance |
[in] | u8CoupleCh | channel of WFG couple
|
PdlSet | WFG Interrupt flag is set |
PdlClr | WFG Interrupt flag is clear |
Definition at line 623 of file mft_wfg.c.
References MFT_WFG_CH10, MFT_WFG_CH32, MFT_WFG_CH54, PdlClr, and PdlSet.
Referenced by Mft_Wfg_IrqHandler().
static void Mft_Wfg_InitIrq | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg | ) | [static] |
Device dependent initialization of interrupts according CMSIS with level defined in pdl.h.
[in] | pstcWfg | Pointer to WFG instance |
Ok | Successful initialization |
Definition at line 209 of file mft_wfg.c.
References MFT0_WFG, MFT1_WFG, MFT2_WFG, PDL_IRQ_LEVEL_MFT_WFG, and stc_mftn_wfg_t.
Referenced by Mft_Wfg_EnableDtifInt(), and Mft_Wfg_EnableTimerInt().
en_result_t Mft_Wfg_InitTimerClock | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
uint8_t | u8CoupleCh, | ||
en_wfg_timer_clock_t | enClk | ||
) |
init timer clock
[in] | pstcWfg | Pointer to WFG instance |
[in] | u8CoupleCh | channel of WFG couple
|
[in] | enClk | count clock cycle to PCLK multiplied
|
Ok | WFG timer is initialized |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 394 of file mft_wfg.c.
References ErrorInvalidParameter, MFT_WFG_MAXCH, and Ok.
void Mft_Wfg_IrqHandler | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
stc_mft_wfg_intern_data_t * | pstcMftWfgInternData | ||
) |
WFG interrupt handler sub function.
[in] | pstcWfg | Pointer to WFG instance |
[in] | pstcMftWfgInternData | structure of WFG callback function
|
Definition at line 149 of file mft_wfg.c.
References Mft_Wfg_ClrTimerIntFlag(), Mft_Wfg_GetAnalogFilterIntFlag(), Mft_Wfg_GetDigitalFilterIntFlag(), Mft_Wfg_GetTimerIntFlag(), PdlSet, stc_mft_wfg_intern_data::pfnWfg10TimerCallback, stc_mft_wfg_intern_data::pfnWfgAnalogFilterCallback, and stc_mft_wfg_intern_data::pfnWfgDigtalFilterCallback.
Referenced by MFT_WFG_IRQHandler().
en_result_t Mft_Wfg_SetTimerCycle | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
uint8_t | u8CoupleCh, | ||
uint16_t | u16Count | ||
) |
set cycle of WFG timer
[in] | pstcWfg | Pointer to WFG instance |
[in] | u8CoupleCh | channel of WFG couple
|
[in] | u16Count | wfg pulse counter value
|
Ok | cycle of WFG timer is set |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 752 of file mft_wfg.c.
References Ok.
en_result_t Mft_Wfg_StartTimer | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
uint8_t | u8CoupleCh | ||
) |
Start WFG timer.
[in] | pstcWfg | Pointer to WFG instance |
[in] | u8CoupleCh | channel of WFG couple
|
Ok | Start timer successfully |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 542 of file mft_wfg.c.
References ErrorInvalidParameter, MFT_WFG_CH10, MFT_WFG_CH32, MFT_WFG_CH54, MFT_WFG_MAXCH, and Ok.
en_result_t Mft_Wfg_StopTimer | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
uint8_t | u8CoupleCh | ||
) |
Stop WFG timer.
[in] | pstcWfg | Pointer to WFG instance |
[in] | u8CoupleCh | channel of WFG couple
|
Ok | Stop timer successfully |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 583 of file mft_wfg.c.
References ErrorInvalidParameter, MFT_WFG_CH10, MFT_WFG_CH32, MFT_WFG_CH54, MFT_WFG_MAXCH, and Ok.
en_result_t Mft_Wfg_SwTiggerDtif | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg | ) |
set software trigger DTIF
[in] | pstcWfg | Pointer to WFG instance |
Ok | DTIF is triggered by software |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 945 of file mft_wfg.c.
References ErrorInvalidParameter, and Ok.
en_result_t Mft_Wfg_WriteTimerCountCycle | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg, |
uint8_t | u8CoupleCh, | ||
uint16_t | u16CycleA, | ||
uint16_t | u16CycleB | ||
) |
write timer count cycle
[in] | pstcWfg | Pointer to WFG instance |
[in] | u8CoupleCh | channel of WFG couple
|
[in] | u16CycleA | WFTA value
|
[in] | u16CycleB | WFTB value
|
Ok | Timer count cycle is written |
ErrorInvalidParameter | If one of following conditions are met:
|
Definition at line 708 of file mft_wfg.c.
References ErrorInvalidParameter, MFT_WFG_MAXCH, and Ok.
static stc_mft_wfg_intern_data_t* MftGetInternDataPtr | ( | volatile FM0P_MFT_WFG_TypeDef * | pstcWfg | ) | [static] |
Return the internal data for a certain WFG instance.
pstcWfg | Pointer to WFG instance |
Definition at line 121 of file mft_wfg.c.
References stc_mft_wfg_instance_data::stcInternData, and WFG_INSTANCE_COUNT.
Referenced by Mft_Wfg_ConfigMode(), Mft_Wfg_DisableDtifInt(), Mft_Wfg_DisableTimerInt(), Mft_Wfg_EnableDtifInt(), and Mft_Wfg_EnableTimerInt().
stc_mft_wfg_instance_data_t m_astcMftWfgInstanceDataLut[(PDL_PERIPHERAL_ENABLE_MFT0_WFG==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT1_WFG==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT2_WFG==PDL_ON?1:0)] |
{ { & (*((volatile FM0P_MFT_WFG_TypeDef *) FM0P_MFT0_WFG_BASE)) , {NULL,NULL,NULL,NULL,NULL} }, { & (*((volatile FM0P_MFT_WFG_TypeDef *) FM0P_MFT1_WFG_BASE)) , {NULL,NULL,NULL,NULL,NULL} }, { & (*((volatile FM0P_MFT_WFG_TypeDef *) FM0P_MFT2_WFG_BASE)) , {NULL,NULL,NULL,NULL,NULL} }, }
Look-up table for all enabled WFG instances and their internal data.
Definition at line 74 of file mft_wfg.c.
Referenced by MFT_WFG_IRQHandler().
stc_mft_wfg_instance_data_t m_astcMftWfgInstanceDataLut[(PDL_PERIPHERAL_ENABLE_MFT0_WFG==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT1_WFG==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT2_WFG==PDL_ON?1:0)] |
Look-up table for all enabled WFG instances and their internal data.
Definition at line 74 of file mft_wfg.c.
Referenced by MFT_WFG_IRQHandler().