![]() |
PDL for FM4
Version1.2
Peripheral Driverl Library for FM4
|
the operation mode of WFG module More...
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 |
Macros | |
| #define | WFG_INSTANCE_COUNT |
| Macro to return the number of enabled MFT instances. More... | |
| #define | stc_mftn_wfg_t FM4_MFT_WFG_TypeDef |
| #define | MFT0_WFG (*((volatile stc_mftn_wfg_t *) FM4_MFT0_WFG_BASE)) |
| #define | MFT1_WFG (*((volatile stc_mftn_wfg_t *) FM4_MFT1_WFG_BASE)) |
| #define | MFT2_WFG (*((volatile stc_mftn_wfg_t *) FM4_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 |
Typedefs | |
| typedef enum en_wfg_instance_index | en_wfg_instance_index_t |
| Enumeration to define an index for each WFG instance. More... | |
| 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 |
| 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 FM4_MFT_WFG_TypeDef *pstcWfg) |
| Return the internal data for a certain WFG instance. More... | |
| void | Mft_Wfg_IrqHandler (volatile FM4_MFT_WFG_TypeDef *pstcMft, stc_mft_wfg_intern_data_t *pstcMftWfgInternData) |
| WFG interrupt handler sub function. More... | |
| static en_result_t | Mft_Wfg_InitIrq (volatile FM4_MFT_WFG_TypeDef *pstcMft) |
| Device dependent initialization of interrupts according CMSIS with level defined in l3.h. More... | |
| static en_result_t | Mft_Wfg_DeInitIrq (volatile FM4_MFT_WFG_TypeDef *pstcMft) |
| Device dependent de-initialization of interrupts according CMSIS. More... | |
| en_result_t | Mft_Wfg_ConfigMode (volatile FM4_MFT_WFG_TypeDef *pstcMft, uint8_t u8CoupleCh, en_mft_wfg_mode_t enMode) |
| configure WFG mode More... | |
| en_result_t | Mft_Wfg_ConfigCtrlBits (volatile FM4_MFT_WFG_TypeDef *pstcMft, uint8_t u8CoupleCh, stc_wfg_ctrl_bits *pstcCtrlBits) |
| configure WFG control bit More... | |
| en_result_t | Mft_Wfg_InitTimerClock (volatile FM4_MFT_WFG_TypeDef *pstcMft, uint8_t u8CoupleCh, en_wfg_timer_clock_t enClk) |
| init timer clock More... | |
| en_result_t | Mft_Wfg_EnableTimerInt (volatile FM4_MFT_WFG_TypeDef *pstcMft, uint8_t u8CoupleCh, func_ptr_t pfnCallback) |
| enable WFG timer interrupt More... | |
| en_result_t | Mft_Wfg_DisableTimerInt (volatile FM4_MFT_WFG_TypeDef *pstcMft, uint8_t u8CoupleCh) |
| disable WFG timer interrupt More... | |
| en_result_t | Mft_Wfg_StartTimer (volatile FM4_MFT_WFG_TypeDef *pstcMft, uint8_t u8CoupleCh) |
| Start WFG timer. More... | |
| en_result_t | Mft_Wfg_StopTimer (volatile FM4_MFT_WFG_TypeDef *pstcMft, uint8_t u8CoupleCh) |
| Stop WFG timer. More... | |
| en_int_flag_t | Mft_Wfg_GetTimerIntFlag (volatile FM4_MFT_WFG_TypeDef *pstcMft, uint8_t u8CoupleCh) |
| get WFG timer interrupt flag More... | |
| en_result_t | Mft_Wfg_ClrTimerIntFlag (volatile FM4_MFT_WFG_TypeDef *pstcMft, uint8_t u8CoupleCh) |
| clear WFG timer interrupt flag More... | |
| en_result_t | Mft_Wfg_WriteTimerCountCycle (volatile FM4_MFT_WFG_TypeDef *pstcMft, uint8_t u8CoupleCh, uint16_t u16CycleA, uint16_t u16CycleB) |
| write timer count cycle More... | |
| en_result_t | Mft_Wfg_SetTimerCycle (volatile FM4_MFT_WFG_TypeDef *pstcMft, uint8_t u8CoupleCh, uint16_t u16Count) |
| set wfg pulse counter More... | |
| uint16_t | Mft_Wfg_GetTimerCurCycle (volatile FM4_MFT_WFG_TypeDef *pstcMft, uint8_t u8CoupleCh) |
| get current pulse counter More... | |
| en_result_t | Mft_Wfg_ConfigNzcl (volatile FM4_MFT_WFG_TypeDef *pstcMft, stc_wfg_nzcl_config_t *pstcNzclConfig) |
| configure NZCL More... | |
| en_result_t | Mft_Wfg_EnableDtifInt (volatile FM4_MFT_WFG_TypeDef *pstcMft, stc_dtif_int_sel_t *pstcIntSel, stc_dtif_int_cb_t *pstcCallback) |
| Enable DTIF interrupt. More... | |
| en_result_t | Mft_Wfg_DisableDtifInt (volatile FM4_MFT_WFG_TypeDef *pstcMft, stc_dtif_int_sel_t *pstcIntSel) |
| Disable DTIF interrupt. More... | |
| en_result_t | Mft_Wfg_SwTiggerDtif (volatile FM4_MFT_WFG_TypeDef *pstcMft) |
| set software trigger DTIF More... | |
| en_int_flag_t | Mft_Wfg_GetDigitalFilterIntFlag (volatile FM4_MFT_WFG_TypeDef *pstcMft) |
| get Digital filter interrupt flag More... | |
| en_result_t | Mft_Wfg_ClrDigitalFilterIntFlag (volatile FM4_MFT_WFG_TypeDef *pstcMft) |
| clear Digital filter interrupt flag More... | |
| en_int_flag_t | Mft_Wfg_GetAnalogFilterIntFlag (volatile FM4_MFT_WFG_TypeDef *pstcMft) |
| get Analgo filter interrupt flag More... | |
| en_result_t | Mft_Wfg_ClrAnalogFilterIntFlag (volatile FM4_MFT_WFG_TypeDef *pstcMft) |
| clear analog filter interrupt flag More... | |
Variables | |
| stc_mft_wfg_instance_data_t | m_astcMftWfgInstanceDataLut [] |
| Look-up table for all enabled WFG instances and their internal data. More... | |
| stc_mft_wfg_instance_data_t | m_astcMftWfgInstanceDataLut [] |
| Look-up table for all enabled WFG instances and their internal data. More... | |
the operation mode of WFG module
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
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
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
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
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 singal. 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
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 funcion, 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 digital 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 *) FM4_MFT0_WFG_BASE)) |
Definition at line 276 of file mft_wfg.h.
Referenced by Mft_Wfg_ConfigNzcl(), Mft_Wfg_DeInitIrq(), and Mft_Wfg_InitIrq().
| #define MFT1_WFG (*((volatile stc_mftn_wfg_t *) FM4_MFT1_WFG_BASE)) |
Definition at line 277 of file mft_wfg.h.
Referenced by Mft_Wfg_ConfigNzcl(), Mft_Wfg_DeInitIrq(), and Mft_Wfg_InitIrq().
| #define MFT2_WFG (*((volatile stc_mftn_wfg_t *) FM4_MFT2_WFG_BASE)) |
Definition at line 278 of file mft_wfg.h.
Referenced by Mft_Wfg_ConfigNzcl(), Mft_Wfg_DeInitIrq(), and Mft_Wfg_InitIrq().
| #define MFT_WFG_CH10 0 |
Definition at line 287 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_CH32 1 |
Definition at line 288 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_CH54 2 |
Definition at line 289 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 290 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 FM4_MFT_WFG_TypeDef |
Definition at line 274 of file mft_wfg.h.
Referenced by Mft_Wfg_DeInitIrq(), and Mft_Wfg_InitIrq().
| #define WFG_INSTANCE_COUNT |
Macro to return the number of enabled MFT instances.
Definition at line 71 of file mft_wfg.c.
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 |
| 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 FM4_MFT_WFG_TypeDef * | pstcMft | ) |
clear analog filter interrupt flag
| [in] | pstcMft | MFT register definition
|
| Ok | Internal data has been setup |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 1042 of file mft_wfg.c.
References ErrorInvalidParameter, and Ok.
| en_result_t Mft_Wfg_ClrDigitalFilterIntFlag | ( | volatile FM4_MFT_WFG_TypeDef * | pstcMft | ) |
clear Digital filter interrupt flag
| [in] | pstcMft | MFT register definition
|
| Ok | Internal data has been setup |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 997 of file mft_wfg.c.
References ErrorInvalidParameter, and Ok.
| en_result_t Mft_Wfg_ClrTimerIntFlag | ( | volatile FM4_MFT_WFG_TypeDef * | pstcMft, |
| uint8_t | u8CoupleCh | ||
| ) |
clear WFG timer interrupt flag
| [in] | pstcMft | MFT register definition
|
| [in] | u8CoupleCh | channel of WFG couple
|
| Ok | Internal data has been setup |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 669 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 FM4_MFT_WFG_TypeDef * | pstcMft, |
| uint8_t | u8CoupleCh, | ||
| stc_wfg_ctrl_bits * | pstcCtrlBits | ||
| ) |
configure WFG control bit
| [in] | pstcMft | MFT register definition
|
| [in] | u8CoupleCh | channel of WFG couple
|
| [in] | pstcCtrlBits | structure of control bit
|
| Ok | Internal data has been setup |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 362 of file mft_wfg.c.
References 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 FM4_MFT_WFG_TypeDef * | pstcMft, |
| uint8_t | u8CoupleCh, | ||
| en_mft_wfg_mode_t | enMode | ||
| ) |
configure WFG mode
| [in] | pstcMft | MFT register definition
|
| [in] | u8CoupleCh | channel of WFG couple
|
| [in] | enMode | enum of WFG mode
|
| Ok | Internal data has been setup |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range Other invalid configuration |
Definition at line 313 of file mft_wfg.c.
References ErrorInvalidParameter, 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_ConfigNzcl | ( | volatile FM4_MFT_WFG_TypeDef * | pstcMft, |
| stc_wfg_nzcl_config_t * | pstcNzclConfig | ||
| ) |
configure NZCL
| [in] | pstcMft | MFT register definition
|
| [in] | pstcNzclConfig | configure of NZCL
|
| Ok | Internal data has been setup |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 810 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 |
Device dependent de-initialization of interrupts according CMSIS.
| pstcMft | Icu Pointer to WFG instance |
Definition at line 257 of file mft_wfg.c.
References MFT0_WFG, MFT1_WFG, MFT2_WFG, Ok, 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 FM4_MFT_WFG_TypeDef * | pstcMft, |
| stc_dtif_int_sel_t * | pstcIntSel | ||
| ) |
Disable DTIF interrupt.
| [in] | pstcMft | MFT register definition
|
| [in] | pstcIntSel | DTIF interrupt selection
|
| Ok | Interrupt disable normally |
| ErrorInvalidParameter | pstcMft == NULL pstcIntSel == NULL |
Definition at line 904 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 FM4_MFT_WFG_TypeDef * | pstcMft, |
| uint8_t | u8CoupleCh | ||
| ) |
disable WFG timer interrupt
| [in] | pstcMft | MFT register definition
|
| [in] | u8CoupleCh | channel of WFG couple
|
| Ok | Internal data has been setup |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 500 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 FM4_MFT_WFG_TypeDef * | pstcMft, |
| stc_dtif_int_sel_t * | pstcIntSel, | ||
| stc_dtif_int_cb_t * | pstcCallback | ||
| ) |
Enable DTIF interrupt.
| [in] | pstcMft | MFT register definition
|
| [in] | pstcIntSel | DTIF interrupt selection
|
| [in] | pstcCallback | Pointer to DTIF interrupt callback function array |
| Ok | Interrupt enable normally |
| ErrorInvalidParameter | pstcMft == NULL pstcIntSel == NULL pstcCallback == NULL |
Definition at line 858 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 FM4_MFT_WFG_TypeDef * | pstcMft, |
| uint8_t | u8CoupleCh, | ||
| func_ptr_t | pfnCallback | ||
| ) |
enable WFG timer interrupt
| [in] | pstcMft | MFT register definition
|
| [in] | u8CoupleCh | channel of WFG couple
|
| [in] | pfnCallback | callback function
|
| Ok | Internal data has been setup |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 449 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 FM4_MFT_WFG_TypeDef * | pstcMft | ) |
get Analgo filter interrupt flag
| [in] | pstcMft | MFT register definition
|
| en_int_flag_t | interrupt falg |
| PdlSet,PdlClr |
Definition at line 1021 of file mft_wfg.c.
Referenced by Mft_Wfg_IrqHandler().

| en_int_flag_t Mft_Wfg_GetDigitalFilterIntFlag | ( | volatile FM4_MFT_WFG_TypeDef * | pstcMft | ) |
get Digital filter interrupt flag
| [in] | pstcMft | MFT register definition
|
| en_int_flag_t | interrupt falg |
| PdlSet,PdlClr |
Definition at line 975 of file mft_wfg.c.
Referenced by Mft_Wfg_IrqHandler().

| uint16_t Mft_Wfg_GetTimerCurCycle | ( | volatile FM4_MFT_WFG_TypeDef * | pstcMft, |
| uint8_t | u8CoupleCh | ||
| ) |
| en_int_flag_t Mft_Wfg_GetTimerIntFlag | ( | volatile FM4_MFT_WFG_TypeDef * | pstcMft, |
| uint8_t | u8CoupleCh | ||
| ) |
get WFG timer interrupt flag
| [in] | pstcMft | MFT register definition
|
| [in] | u8CoupleCh | channel of WFG couple
|
| en_int_flag_t | interrupt falg |
| PdlSet,PdlClr |
Definition at line 634 of file mft_wfg.c.
References MFT_WFG_CH10, MFT_WFG_CH32, and MFT_WFG_CH54.
Referenced by Mft_Wfg_IrqHandler().

|
static |
Device dependent initialization of interrupts according CMSIS with level defined in l3.h.
| pstcMft | Pointer to WFG instance |
Definition at line 219 of file mft_wfg.c.
References MFT0_WFG, MFT1_WFG, MFT2_WFG, Ok, PDL_IRQ_LEVEL_MFT0_WFG, PDL_IRQ_LEVEL_MFT1_WFG, PDL_IRQ_LEVEL_MFT2_WFG, and stc_mftn_wfg_t.
Referenced by Mft_Wfg_EnableDtifInt(), and Mft_Wfg_EnableTimerInt().

| en_result_t Mft_Wfg_InitTimerClock | ( | volatile FM4_MFT_WFG_TypeDef * | pstcMft, |
| uint8_t | u8CoupleCh, | ||
| en_wfg_timer_clock_t | enClk | ||
| ) |
init timer clock
| [in] | pstcMft | MFT register definition
|
| [in] | u8CoupleCh | channel of WFG couple
|
| [in] | enClk | count clock cycle to PCLK multiplied
|
| Ok | Internal data has been setup |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 406 of file mft_wfg.c.
References ErrorInvalidParameter, MFT_WFG_MAXCH, and Ok.
| void Mft_Wfg_IrqHandler | ( | volatile FM4_MFT_WFG_TypeDef * | pstcMft, |
| stc_mft_wfg_intern_data_t * | pstcMftWfgInternData | ||
| ) |
WFG interrupt handler sub function.
| [in] | pstcMft | MFT register definition
|
| [in] | pstcMftWfgInternData | structure of WFG callback function
|
| void |
Definition at line 158 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.

| en_result_t Mft_Wfg_SetTimerCycle | ( | volatile FM4_MFT_WFG_TypeDef * | pstcMft, |
| uint8_t | u8CoupleCh, | ||
| uint16_t | u16Count | ||
| ) |
set wfg pulse counter
| [in] | pstcMft | MFT register definition
|
| [in] | u8CoupleCh | channel of WFG couple
|
| [in] | u16Count | wfg pulse counter value
|
| Ok | Internal data has been setup |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 758 of file mft_wfg.c.
References Ok.
| en_result_t Mft_Wfg_StartTimer | ( | volatile FM4_MFT_WFG_TypeDef * | pstcMft, |
| uint8_t | u8CoupleCh | ||
| ) |
Start WFG timer.
| [in] | pstcMft | MFT register definition
|
| [in] | u8CoupleCh | channel of WFG couple
|
| Ok | Start timer successfully |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 552 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 FM4_MFT_WFG_TypeDef * | pstcMft, |
| uint8_t | u8CoupleCh | ||
| ) |
Stop WFG timer.
| [in] | pstcMft | MFT register definition
|
| [in] | u8CoupleCh | channel of WFG couple
|
| Ok | Start timer successfully |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 593 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 FM4_MFT_WFG_TypeDef * | pstcMft | ) |
set software trigger DTIF
| [in] | pstcMft | MFT register definition
|
| Ok | Internal data has been setup |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 951 of file mft_wfg.c.
References ErrorInvalidParameter, and Ok.
| en_result_t Mft_Wfg_WriteTimerCountCycle | ( | volatile FM4_MFT_WFG_TypeDef * | pstcMft, |
| uint8_t | u8CoupleCh, | ||
| uint16_t | u16CycleA, | ||
| uint16_t | u16CycleB | ||
| ) |
write timer count cycle
| [in] | pstcMft | MFT register definition
|
| [in] | u8CoupleCh | channel of WFG couple
|
| [in] | u16CycleA | WFTA value
|
| [in] | u16CycleB | WFTB value
|
| Ok | Internal data has been setup |
| ErrorInvalidParameter | pstcMft == NULL u8CoupleCh out of range |
Definition at line 714 of file mft_wfg.c.
References ErrorInvalidParameter, MFT_WFG_MAXCH, and Ok.
|
static |
Return the internal data for a certain WFG instance.
| pstcWfg | Pointer to WFG instance |
Definition at line 125 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[] |
Look-up table for all enabled WFG instances and their internal data.
| stc_mft_wfg_instance_data_t m_astcMftWfgInstanceDataLut[] |