PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
Free-Run Timer (FRT)

How to use FRT module. More...

Data Structures

struct  stc_mft_frt_config
 FRT configure. More...
 
struct  stc_frt_int_sel
 Enumeration of FRT interrupt selection. More...
 
struct  stc_frt_int_cb
 FRT interrupt callback function. More...
 
struct  stc_mft_frt_intern_data
 FRT instance internal data, storing internal information for each enabled FRT instance. More...
 
struct  stc_mft_frt_instance_data
 FRT instance data type. More...
 

Macros

#define FRT_INSTANCE_COUNT
 Macro to return the number of enabled MFT instances. More...
 
#define stc_mftn_frt_t   FM4_MFT_FRT_TypeDef
 
#define MFT0_FRT   (*((volatile stc_mftn_frt_t *) FM4_MFT0_FRT_BASE))
 
#define MFT1_FRT   (*((volatile stc_mftn_frt_t *) FM4_MFT1_FRT_BASE))
 
#define MFT2_FRT   (*((volatile stc_mftn_frt_t *) FM4_MFT2_FRT_BASE))
 
#define MFT_FRT_CH0   0
 MFT Frt channel definition. More...
 
#define MFT_FRT_CH1   1
 
#define MFT_FRT_CH2   2
 
#define MFT_FRT_MAX_CH   3
 

Typedefs

typedef enum en_frt_instance_index en_frt_instance_index_t
 Enumeration to define an index for each FRT instance. More...
 
typedef enum en_mft_frt_clock en_mft_frt_clock_t
 Mft Clock Setting. More...
 
typedef enum en_mft_frt_mode en_mft_frt_mode_t
 FRT count mode. More...
 
typedef struct stc_mft_frt_config stc_mft_frt_config_t
 FRT configure. More...
 
typedef struct stc_frt_int_sel stc_frt_int_sel_t
 Enumeration of FRT interrupt selection. More...
 
typedef enum en_mft_frt_int en_mft_frt_int_t
 Enumeration of FRT interrupt index. More...
 
typedef struct stc_frt_int_cb stc_frt_int_cb_t
 FRT interrupt callback function. More...
 
typedef struct
stc_mft_frt_intern_data 
stc_mft_frt_intern_data_t
 FRT instance internal data, storing internal information for each enabled FRT instance. More...
 
typedef struct
stc_mft_frt_instance_data 
stc_mft_frt_instance_data_t
 FRT instance data type. More...
 

Enumerations

enum  en_frt_instance_index {
  FrtInstanceIndexFrt0 = 0,
  FrtInstanceIndexFrt1,
  FrtInstanceIndexFrt2
}
 Enumeration to define an index for each FRT instance. More...
 
enum  en_mft_frt_clock {
  FrtPclkDiv1 = 0,
  FrtPclkDiv2 = 1,
  FrtPclkDiv4 = 2,
  FrtPclkDiv8 = 3,
  FrtPclkDiv16 = 4,
  FrtPclkDiv32 = 5,
  FrtPclkDiv64 = 6,
  FrtPclkDiv128 = 7,
  FrtPclkDiv256 = 8,
  FrtPclkDiv512 = 9,
  FrtPclkDiv1024 = 10
}
 Mft Clock Setting. More...
 
enum  en_mft_frt_mode {
  FrtUpCount = 0,
  FrtUpDownCount = 1
}
 FRT count mode. More...
 
enum  en_mft_frt_int {
  enFrtZeroMatchInt = 0,
  enFrtPeakMatchInt
}
 Enumeration of FRT interrupt index. More...
 

Functions

static stc_mft_frt_intern_data_t * MftGetInternDataPtr (volatile FM4_MFT_FRT_TypeDef *pstcFrt)
 Return the internal data for a certain FRT instance. More...
 
void Mft_Frt_IrqHandler (volatile FM4_MFT_FRT_TypeDef *pstcMft, stc_mft_frt_intern_data_t *pstcMftFrtInternData)
 FRT interrupt handler sub function. More...
 
static en_result_t Mft_Frt_InitIrq (volatile FM4_MFT_FRT_TypeDef *pstcMft, stc_frt_int_sel_t *pstcIntSel)
 Device dependent initialization of interrupts according CMSIS with level defined in l3.h. More...
 
static en_result_t Mft_Frt_DeInitIrq (volatile FM4_MFT_FRT_TypeDef *pstcMft, stc_frt_int_sel_t *pstcIntSel)
 Device dependent initialization of interrupts according CMSIS with level defined in l3.h. More...
 
en_result_t Mft_Frt_Init (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch, stc_mft_frt_config_t *pstcFrtConfig)
 Init FRT module. More...
 
en_result_t Mft_Frt_SetMaskZeroTimes (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch, uint8_t u8Times)
 set mask zero times More...
 
uint8_t Mft_Frt_GetMaskZeroTimes (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch)
 get mask zero times More...
 
en_result_t Mft_Frt_SetMaskPeakTimes (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch, uint8_t u8Times)
 set mask peak times More...
 
uint8_t Mft_Frt_GetMaskPeakTimes (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch)
 get mask peak times More...
 
en_result_t Mft_Frt_Start (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch)
 set frt start More...
 
en_result_t Mft_Frt_Stop (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch)
 set frt stop More...
 
en_result_t Mft_Frt_EnableInt (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch, stc_frt_int_sel_t *pstcIntSel, stc_frt_int_cb_t *pstcFrtIntCallback)
 enable frt interrupt More...
 
en_result_t Mft_Frt_DisableInt (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch, stc_frt_int_sel_t *pstcIntSel)
 disable frt interrupt More...
 
en_int_flag_t Mft_Frt_GetIntFlag (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch, en_mft_frt_int_t enIntType)
 get frt interrupt falg More...
 
en_result_t Mft_Frt_ClrIntFlag (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch, en_mft_frt_int_t enIntType)
 clear frt interrupt falg More...
 
en_result_t Mft_Frt_SetCountCycle (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch, uint16_t u16Cycle)
 set frt cycle value More...
 
en_result_t Mft_Frt_SetCountVal (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch, uint16_t u16Count)
 set frt count value More...
 
uint16_t Mft_Frt_GetCurCount (volatile FM4_MFT_FRT_TypeDef *pstcMft, uint8_t u8Ch)
 get frt current count More...
 

Variables

stc_mft_frt_instance_data_t m_astcMftFrtInstanceDataLut []
 Look-up table for all enabled FRT of MFT instances and their internal data. More...
 
stc_mft_frt_instance_data_t m_astcMftFrtInstanceDataLut []
 Look-up table for all enabled FRT of MFT instances and their internal data. More...
 

Detailed Description

How to use FRT module.

Provided functions of FRT module:

Mft_Frt_Init() must be used for configuration of a Free-Run timer (FRT) channel with a structure of the type stc_mft_frt_config_t.

Mft_Frt_SetMaskZeroTimes() is used to set the mask times of Zero match interrupt. Mft_Frt_GetMaskZeroTimes() is used to get the mask times of peak match interrupt.

Mft_Frt_SetMaskPeakTimes() is used to set the mask times of peak match interrupt. Mft_Frt_GetMaskPeakTimes() is used to get the mask times of peak match interrupt.

A FRT interrupt can be enabled by the function Mft_Frt_EnableInt(). This function can set callback function for each channel too.

With Mft_Frt_SetCountCycle() the FRT cycle is set to the value given in the parameter Mft_Frt_SetCountCycle::u16Cycle. And the initial count value can be modified by Mft_Frt_SetCountVal().

After above setting, calling Mft_Frt_Start() will start FRT.

With Mft_Frt_GetCurCount() the current FRT count can be read when FRT 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_Frt_GetIntFlag() to check if the interrupt occurs, and clear the interrupt flag by Mft_Frt_ClrIntFlag().

When stopping the FRT, use Mft_Frt_Stop() to disable FRT and Mft_Frt_DisableInt() to disable FRT interrupt.

Macro Definition Documentation

#define FRT_INSTANCE_COUNT
Value:
(uint32_t)(sizeof(m_astcMftFrtInstanceDataLut) \

Macro to return the number of enabled MFT instances.

Definition at line 70 of file mft_frt.c.

Referenced by MftGetInternDataPtr().

#define MFT0_FRT   (*((volatile stc_mftn_frt_t *) FM4_MFT0_FRT_BASE))

Definition at line 125 of file mft_frt.h.

Referenced by Mft_Frt_DeInitIrq(), and Mft_Frt_InitIrq().

#define MFT1_FRT   (*((volatile stc_mftn_frt_t *) FM4_MFT1_FRT_BASE))

Definition at line 126 of file mft_frt.h.

Referenced by Mft_Frt_DeInitIrq(), and Mft_Frt_InitIrq().

#define MFT2_FRT   (*((volatile stc_mftn_frt_t *) FM4_MFT2_FRT_BASE))

Definition at line 127 of file mft_frt.h.

Referenced by Mft_Frt_DeInitIrq(), and Mft_Frt_InitIrq().

#define MFT_FRT_CH0   0

MFT Frt channel definition.

Definition at line 133 of file mft_frt.h.

Referenced by Mft_Frt_EnableInt().

#define MFT_FRT_CH1   1

Definition at line 134 of file mft_frt.h.

Referenced by Mft_Frt_EnableInt().

#define MFT_FRT_CH2   2

Definition at line 135 of file mft_frt.h.

Referenced by Mft_Frt_EnableInt().

#define stc_mftn_frt_t   FM4_MFT_FRT_TypeDef

Definition at line 124 of file mft_frt.h.

Referenced by Mft_Frt_DeInitIrq(), and Mft_Frt_InitIrq().

Typedef Documentation

Enumeration to define an index for each FRT instance.

Mft Clock Setting.

Enumeration of FRT interrupt index.

FRT count mode.

FRT interrupt callback function.

Enumeration of FRT interrupt selection.

FRT configure.

FRT instance data type.

FRT instance internal data, storing internal information for each enabled FRT instance.

Enumeration Type Documentation

Enumeration to define an index for each FRT instance.

Enumerator
FrtInstanceIndexFrt0 

Instance index of FRT0.

FrtInstanceIndexFrt1 

Instance index of FRT1.

FrtInstanceIndexFrt2 

Instance index of FRT2.

Definition at line 143 of file mft_frt.h.

Mft Clock Setting.

Enumerator
FrtPclkDiv1 

FRT clock: PCLK.

FrtPclkDiv2 

FRT clock: PCLK/2.

FrtPclkDiv4 

FRT clock: PCLK/4.

FrtPclkDiv8 

FRT clock: PCLK/8.

FrtPclkDiv16 

FRT clock: PCLK/16.

FrtPclkDiv32 

FRT clock: PCLK/32.

FrtPclkDiv64 

FRT clock: PCLK/64.

FrtPclkDiv128 

FRT clock: PCLK/128.

FrtPclkDiv256 

FRT clock: PCLK/256.

FrtPclkDiv512 

FRT clock: PCLK/512.

FrtPclkDiv1024 

FRT clock: PCLK/1024.

Definition at line 155 of file mft_frt.h.

Enumeration of FRT interrupt index.

Enumerator
enFrtZeroMatchInt 

zero match interrupt index

enFrtPeakMatchInt 

peak match interrupt index

Definition at line 208 of file mft_frt.h.

FRT count mode.

Enumerator
FrtUpCount 

FRT up-count mode.

FrtUpDownCount 

FRT up-/down-count mode.

Definition at line 174 of file mft_frt.h.

Function Documentation

en_result_t Mft_Frt_ClrIntFlag ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch,
en_mft_frt_int_t  enIntType 
)

clear frt interrupt falg

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
[in]enIntTypethe type of interrupt
  • enFrtZeroMatchInt and enFrtPeakMatchInt,
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 866 of file mft_frt.c.

References enFrtZeroMatchInt, ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

Referenced by Mft_Frt_IrqHandler().

Here is the caller graph for this function:

static en_result_t Mft_Frt_DeInitIrq ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
stc_frt_int_sel_t *  pstcIntSel 
)
static

Device dependent initialization of interrupts according CMSIS with level defined in l3.h.

Parameters
[in]pstcMftPointer to FRT instance
[in]pstcIntSelInterrupt selection
Returns
Ok Successful initialization

Definition at line 284 of file mft_frt.c.

References stc_frt_int_sel::bFrtPeakMatchInt, stc_frt_int_sel::bFrtZeroMatchInt, ErrorInvalidParameter, MFT0_FRT, MFT1_FRT, MFT2_FRT, Ok, PDL_DEFAULT_INTERRUPT_LEVEL, and stc_mftn_frt_t.

Referenced by Mft_Frt_DisableInt().

Here is the caller graph for this function:

en_result_t Mft_Frt_DisableInt ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch,
stc_frt_int_sel_t *  pstcIntSel 
)

disable frt interrupt

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
[in]pstcIntSelthe type of interrupt
  • enFrtZeroMatchInt and enFrtPeakMatchInt,
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 773 of file mft_frt.c.

References stc_frt_int_sel::bFrtPeakMatchInt, stc_frt_int_sel::bFrtZeroMatchInt, ErrorInvalidParameter, Mft_Frt_DeInitIrq(), MFT_FRT_MAX_CH, and Ok.

Here is the call graph for this function:

en_result_t Mft_Frt_EnableInt ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch,
stc_frt_int_sel_t *  pstcIntSel,
stc_frt_int_cb_t *  pstcFrtIntCallback 
)

enable frt interrupt

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8ChChannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
[in]pstcIntSelTpe of interrupt
  • enFrtZeroMatchInt and enFrtPeakMatchInt,
[in]pstcFrtIntCallbackCallback function structure of frt
  • structure of func_ptr_t
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 679 of file mft_frt.c.

References stc_frt_int_sel::bFrtPeakMatchInt, stc_frt_int_sel::bFrtZeroMatchInt, ErrorInvalidParameter, MFT_FRT_CH0, MFT_FRT_CH1, MFT_FRT_CH2, Mft_Frt_InitIrq(), MFT_FRT_MAX_CH, MftGetInternDataPtr(), Ok, stc_mft_frt_intern_data::pfnFrt0PeakCallback, stc_mft_frt_intern_data::pfnFrt0ZeroCallback, stc_mft_frt_intern_data::pfnFrt1PeakCallback, stc_mft_frt_intern_data::pfnFrt1ZeroCallback, stc_mft_frt_intern_data::pfnFrt2PeakCallback, stc_mft_frt_intern_data::pfnFrt2ZeroCallback, stc_frt_int_cb::pfnFrtPeakCallback, and stc_frt_int_cb::pfnFrtZeroCallback.

Here is the call graph for this function:

uint16_t Mft_Frt_GetCurCount ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch 
)

get frt current count

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
Return values
currentcount of frt

Definition at line 987 of file mft_frt.c.

References ErrorInvalidParameter, and MFT_FRT_MAX_CH.

en_int_flag_t Mft_Frt_GetIntFlag ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch,
en_mft_frt_int_t  enIntType 
)

get frt interrupt falg

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
[in]enIntTypethe type of interrupt
  • enFrtZeroMatchInt and enFrtPeakMatchInt,
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 824 of file mft_frt.c.

References enFrtZeroMatchInt.

Referenced by Mft_Frt_IrqHandler().

Here is the caller graph for this function:

uint8_t Mft_Frt_GetMaskPeakTimes ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch 
)

get mask peak times

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 567 of file mft_frt.c.

References MFT_FRT_MAX_CH.

uint8_t Mft_Frt_GetMaskZeroTimes ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch 
)

get mask zero times

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 496 of file mft_frt.c.

References MFT_FRT_MAX_CH.

en_result_t Mft_Frt_Init ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch,
stc_mft_frt_config_t *  pstcFrtConfig 
)

Init FRT module.

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
[in]pstcFrtConfigconfigure of FRT
  • structure of FRT cofnigure
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL pstcFrtConfig == NULL Other invalid configuration

Definition at line 389 of file mft_frt.c.

References stc_mft_frt_config::bEnBuffer, stc_mft_frt_config::bEnExtClock, stc_mft_frt_config::enFrtClockDiv, stc_mft_frt_config::enFrtMode, ErrorInvalidParameter, FrtPclkDiv1024, FrtUpDownCount, MftGetInternDataPtr(), Ok, stc_mft_frt_intern_data::pfnFrt0PeakCallback, stc_mft_frt_intern_data::pfnFrt0ZeroCallback, stc_mft_frt_intern_data::pfnFrt1PeakCallback, stc_mft_frt_intern_data::pfnFrt1ZeroCallback, stc_mft_frt_intern_data::pfnFrt2PeakCallback, and stc_mft_frt_intern_data::pfnFrt2ZeroCallback.

Here is the call graph for this function:

static en_result_t Mft_Frt_InitIrq ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
stc_frt_int_sel_t *  pstcIntSel 
)
static

Device dependent initialization of interrupts according CMSIS with level defined in l3.h.

Parameters
[in]pstcMftPointer to FRT instance
[in]pstcIntSelInterrupt selection
Returns
Ok Successful initialization

Definition at line 215 of file mft_frt.c.

References stc_frt_int_sel::bFrtPeakMatchInt, stc_frt_int_sel::bFrtZeroMatchInt, MFT0_FRT, MFT1_FRT, MFT2_FRT, Ok, PDL_IRQ_LEVEL_MFT0_FRT, PDL_IRQ_LEVEL_MFT1_FRT, PDL_IRQ_LEVEL_MFT2_FRT, and stc_mftn_frt_t.

Referenced by Mft_Frt_EnableInt().

Here is the caller graph for this function:

void Mft_Frt_IrqHandler ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
stc_mft_frt_intern_data_t *  pstcMftFrtInternData 
)

FRT interrupt handler sub function.

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]pstcMftFrtInternDatastructure of frt callback function
  • structure of stc_mft_intern_data
Return values
void

Definition at line 154 of file mft_frt.c.

References enFrtPeakMatchInt, enFrtZeroMatchInt, Mft_Frt_ClrIntFlag(), Mft_Frt_GetIntFlag(), PdlSet, stc_mft_frt_intern_data::pfnFrt0PeakCallback, and stc_mft_frt_intern_data::pfnFrt0ZeroCallback.

Here is the call graph for this function:

en_result_t Mft_Frt_SetCountCycle ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch,
uint16_t  u16Cycle 
)

set frt cycle value

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
[in]u16Cyclethe cycle value
  • number of 16bit
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 914 of file mft_frt.c.

References ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

en_result_t Mft_Frt_SetCountVal ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch,
uint16_t  u16Count 
)

set frt count value

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
[in]u16Countthe count value
  • number of 16bit
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL Other invalid configuration

Definition at line 953 of file mft_frt.c.

References ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

en_result_t Mft_Frt_SetMaskPeakTimes ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch,
uint8_t  u8Times 
)

set mask peak times

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
[in]u8Timesmask times
  • value of 0~15
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 530 of file mft_frt.c.

References ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

en_result_t Mft_Frt_SetMaskZeroTimes ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch,
uint8_t  u8Times 
)

set mask zero times

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
[in]u8Timesmask times
  • value of 0~15
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 459 of file mft_frt.c.

References ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

en_result_t Mft_Frt_Start ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch 
)

set frt start

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 600 of file mft_frt.c.

References ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

en_result_t Mft_Frt_Stop ( volatile FM4_MFT_FRT_TypeDef *  pstcMft,
uint8_t  u8Ch 
)

set frt stop

Parameters
[in]pstcMftMFT register definition
  • structure of MFT register
[in]u8Chchannel of Free run timer
  • MFT_FRT_CH0 ~ MFT_FRT_CH2
Return values
OkInternal data has been setup
ErrorInvalidParameterpstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 634 of file mft_frt.c.

References ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

static stc_mft_frt_intern_data_t* MftGetInternDataPtr ( volatile FM4_MFT_FRT_TypeDef *  pstcFrt)
static

Return the internal data for a certain FRT instance.

Parameters
pstcFrtPointer to FRT instance
Returns
Pointer to internal data or NULL if instance is not enabled (or not known)

Definition at line 121 of file mft_frt.c.

References FRT_INSTANCE_COUNT, and stc_mft_frt_instance_data::stcInternData.

Referenced by Mft_Frt_EnableInt(), and Mft_Frt_Init().

Here is the caller graph for this function:

Variable Documentation

stc_mft_frt_instance_data_t m_astcMftFrtInstanceDataLut[]
Initial value:
=
{
{
& (*((volatile FM4_MFT_FRT_TypeDef *) FM4_MFT0_FRT_BASE)) ,
NULL
},
{
& (*((volatile FM4_MFT_FRT_TypeDef *) FM4_MFT1_FRT_BASE)) ,
NULL
},
{
& (*((volatile FM4_MFT_FRT_TypeDef *) FM4_MFT2_FRT_BASE)) ,
NULL
},
}

Look-up table for all enabled FRT of MFT instances and their internal data.

Definition at line 77 of file mft_frt.c.

stc_mft_frt_instance_data_t m_astcMftFrtInstanceDataLut[]

Look-up table for all enabled FRT of MFT instances and their internal data.

Definition at line 77 of file mft_frt.c.