| PDL for FM0+ Version1.0 Peripheral Driverl Library for FM0+

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Defines | Typedefs | Enumerations | Functions | Variables
Free-Run Timer (FRT)

## 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...
## Defines
#define | stc_mftn_frt_t FM0P_MFT_FRT_TypeDef
#define | MFT0_FRT (*((volatile stc_mftn_frt_t *) FM0P_MFT0_FRT_BASE))
#define | MFT1_FRT (*((volatile stc_mftn_frt_t *) FM0P_MFT1_FRT_BASE))
#define | MFT2_FRT (*((volatile stc_mftn_frt_t *) FM0P_MFT2_FRT_BASE))
#define | FRT_INSTANCE_COUNT
#define | MFT_FRT_CH0 0
#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.
typedef enum en_mft_frt_clock | en_mft_frt_clock_t
| Mft Clock Setting.
typedef enum en_mft_frt_mode | en_mft_frt_mode_t
| FRT count mode.
typedef struct stc_mft_frt_config | stc_mft_frt_config_t
| FRT configure.
typedef struct stc_frt_int_sel | stc_frt_int_sel_t
| Enumeration of FRT interrupt selection.
typedef enum en_mft_frt_int | en_mft_frt_int_t
| Enumeration of FRT interrupt index.
typedef struct stc_frt_int_cb | stc_frt_int_cb_t
| FRT interrupt callback function.
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.
typedef struct stc_mft_frt_instance_data | stc_mft_frt_instance_data_t
| FRT instance data type.
## Enumerations
enum | en_frt_instance_index { FrtInstanceIndexFrt0, 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 FM0P_MFT_FRT_TypeDef *pstcFrt)
| Return the internal data for a certain FRT instance.
void | Mft_Frt_IrqHandler (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, stc_mft_frt_intern_data_t *pstcMftFrtInternData)
| FRT interrupt handler sub function.
static void | Mft_Frt_InitIrq (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, stc_frt_int_sel_t *pstcIntSel)
| Device dependent initialization of interrupts according CMSIS with level defined in pdl.h.
static void | Mft_Frt_DeInitIrq (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, stc_frt_int_sel_t *pstcIntSel)
| Device dependent initialization of interrupts according CMSIS with level defined in pdl.h.
en_result_t | Mft_Frt_Init (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch, stc_mft_frt_config_t *pstcFrtConfig)
| Init FRT module.
en_result_t | Mft_Frt_SetMaskZeroTimes (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch, uint8_t u8Times)
| set mask zero times
uint8_t | Mft_Frt_GetMaskZeroTimes (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch)
| get mask zero times
en_result_t | Mft_Frt_SetMaskPeakTimes (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch, uint8_t u8Times)
| set mask peak times
uint8_t | Mft_Frt_GetMaskPeakTimes (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch)
| get mask peak times
en_result_t | Mft_Frt_Start (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch)
| Start FRT.
en_result_t | Mft_Frt_Stop (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch)
| set frt stop
en_result_t | Mft_Frt_EnableInt (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch, stc_frt_int_sel_t *pstcIntSel, stc_frt_int_cb_t *pstcFrtIntCallback)
| enable frt interrupt
en_result_t | Mft_Frt_DisableInt (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch, stc_frt_int_sel_t *pstcIntSel)
| disable frt interrupt
en_int_flag_t | Mft_Frt_GetIntFlag (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch, en_mft_frt_int_t enIntType)
| get frt interrupt flag
en_result_t | Mft_Frt_ClrIntFlag (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch, en_mft_frt_int_t enIntType)
| clear frt interrupt flag
en_result_t | Mft_Frt_SetCountCycle (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch, uint16_t u16Cycle)
| set frt cycle value
en_result_t | Mft_Frt_SetCountVal (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch, uint16_t u16Count)
| set frt count value
uint16_t | Mft_Frt_GetCurCount (volatile FM0P_MFT_FRT_TypeDef *pstcFrt, uint8_t u8Ch)
| get frt current count
## Variables
stc_mft_frt_instance_data_t | m_astcMftFrtInstanceDataLut []
| Look-up table for all enabled FRT of MFT instances and their internal data.
stc_mft_frt_instance_data_t | m_astcMftFrtInstanceDataLut [(PDL_PERIPHERAL_ENABLE_MFT0_FRT==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT1_FRT==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT2_FRT==PDL_ON?1:0)]
| Look-up table for all enabled FRT of MFT instances and their internal data.

## Detailed Description

Provided functions of FRT module:

- Mft_Frt_Init()
- Mft_Frt_SetMaskZeroTimes()
- Mft_Frt_GetMaskZeroTimes()
- Mft_Frt_SetMaskPeakTimes()
- Mft_Frt_GetMaskPeakTimes()
- Mft_Frt_Start()
- Mft_Frt_Stop()
- Mft_Frt_EnableInt()
- Mft_Frt_DisableInt()
- Mft_Frt_GetIntFlag()
- Mft_Frt_ClrIntFlag()
- Mft_Frt_SetCountCycle()
- Mft_Frt_SetCountVal()
- Mft_Frt_GetCurCount()

How to use 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.

## Define Documentation

#define FRT_INSTANCE_COUNT

Value:

    (PDL_PERIPHERAL_ENABLE_MFT0_FRT == PDL_ON ? 1 : 0) + \
                               (PDL_PERIPHERAL_ENABLE_MFT1_FRT == PDL_ON ? 1 : 0) + \
                               (PDL_PERIPHERAL_ENABLE_MFT2_FRT == PDL_ON ? 1 : 0)

Definition at line 128 of file mft_frt.h.

Referenced by MftGetInternDataPtr().

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

Definition at line 124 of file mft_frt.h.

Referenced by Mft_Frt_DeInitIrq(), Mft_Frt_InitIrq(), and MFT_FRT_IRQHandler().

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

Definition at line 125 of file mft_frt.h.

Referenced by Mft_Frt_DeInitIrq(), Mft_Frt_InitIrq(), and MFT_FRT_IRQHandler().

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

Definition at line 126 of file mft_frt.h.

Referenced by Mft_Frt_DeInitIrq(), Mft_Frt_InitIrq(), and MFT_FRT_IRQHandler().

#define MFT_FRT_CH0 0

Definition at line 132 of file mft_frt.h.

Referenced by Mft_Frt_EnableInt().

#define MFT_FRT_CH1 1

Definition at line 133 of file mft_frt.h.

Referenced by Mft_Frt_EnableInt().

#define MFT_FRT_CH2 2

Definition at line 134 of file mft_frt.h.

Referenced by Mft_Frt_EnableInt().

#define MFT_FRT_MAX_CH 3

Definition at line 136 of file mft_frt.h.

Referenced by Mft_Frt_ClrIntFlag(), Mft_Frt_DisableInt(), Mft_Frt_EnableInt(), Mft_Frt_GetCurCount(), Mft_Frt_GetMaskPeakTimes(), Mft_Frt_GetMaskZeroTimes(), Mft_Frt_Init(), Mft_Frt_SetCountCycle(), Mft_Frt_SetCountVal(), Mft_Frt_SetMaskPeakTimes(), Mft_Frt_SetMaskZeroTimes(), Mft_Frt_Start(), and Mft_Frt_Stop().

#define stc_mftn_frt_t FM0P_MFT_FRT_TypeDef

Definition at line 123 of file mft_frt.h.

Referenced by Mft_Frt_DeInitIrq(), Mft_Frt_InitIrq(), and MFT_FRT_IRQHandler().

## Typedef Documentation

typedef enum en_frt_instance_index en_frt_instance_index_t

Enumeration to define an index for each FRT instance.

typedef enum en_mft_frt_clock en_mft_frt_clock_t

Mft Clock Setting.

typedef enum en_mft_frt_int en_mft_frt_int_t

Enumeration of FRT interrupt index.

typedef enum en_mft_frt_mode en_mft_frt_mode_t

FRT count mode.

typedef struct stc_frt_int_cb stc_frt_int_cb_t

FRT interrupt callback function.

typedef struct stc_frt_int_sel stc_frt_int_sel_t

Enumeration of FRT interrupt selection.

typedef struct stc_mft_frt_config stc_mft_frt_config_t

FRT configure.

typedef struct stc_mft_frt_instance_data stc_mft_frt_instance_data_t

FRT instance data type.

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.

## Enumeration Type Documentation

enum en_frt_instance_index

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 141 of file mft_frt.h.

enum en_mft_frt_clock

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 158 of file mft_frt.h.

enum en_mft_frt_int

Enumeration of FRT interrupt index.

Enumerator:

  enFrtZeroMatchInt | zero match interrupt index
  enFrtPeakMatchInt | peak match interrupt index

Definition at line 211 of file mft_frt.h.

enum en_mft_frt_mode

FRT count mode.

Enumerator:

  FrtUpCount | FRT up-count mode.
  FrtUpDownCount | FRT up-/down-count mode.

Definition at line 177 of file mft_frt.h.

## Function Documentation

en_result_t Mft_Frt_ClrIntFlag | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch,
|  | en_mft_frt_int_t | enIntType
| ) |  |

clear frt interrupt flag

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2
  [in] | enIntType | the type of interrupt enFrtZeroMatchInt and enFrtPeakMatchInt

Return values:

  Ok | frt interrupt flag is clear
  ErrorInvalidParameter | If one of following conditions are met: pstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 766 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 void Mft_Frt_DeInitIrq | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | stc_frt_int_sel_t * | pstcIntSel
| ) |  | `[static]`

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

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | pstcIntSel | Pointer to interrupt selection structure

Definition at line 228 of file mft_frt.c.

References stc_frt_int_sel::bFrtPeakMatchInt, stc_frt_int_sel::bFrtZeroMatchInt, MFT0_FRT, MFT1_FRT, MFT2_FRT, 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 FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch,
|  | stc_frt_int_sel_t * | pstcIntSel
| ) |  |

disable frt interrupt

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2
  [in] | pstcIntSel | Pointer to interrupt selection structure

Return values:

  Ok | FRT interrupt disabled
  ErrorInvalidParameter | if one of following conditions are met: pstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 674 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 FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch,
|  | stc_frt_int_sel_t * | pstcIntSel,
|  | stc_frt_int_cb_t * | pstcFrtIntCallback
| ) |  |

enable frt interrupt

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2
  [in] | pstcIntSel | Pointer to interrupt selection structure
  [in] | pstcFrtIntCallback | Pointer to FRT interrupt callback function

Return values:

  Ok | FRT interrupt enabled
  ErrorInvalidParameter | If one of following conditions are met: pstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 582 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 FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch
| ) |  |

get frt current count

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2

Return values:

  current | count of frt

Definition at line 882 of file mft_frt.c.

References ErrorInvalidParameter, and MFT_FRT_MAX_CH.

en_int_flag_t Mft_Frt_GetIntFlag | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch,
|  | en_mft_frt_int_t | enIntType
| ) |  |

get frt interrupt flag

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2
  [in] | enIntType | the type of interrupt enFrtZeroMatchInt and enFrtPeakMatchInt

Return values:

  FALSE | If one of following condition are met: FRT zero match don't occur FRT peak match don't occur
  TRUE | If one of following condition are met: FRT zero match occurs FRT peak match occurs

Definition at line 725 of file mft_frt.c.

References enFrtZeroMatchInt, PdlClr, and PdlSet.

Referenced by Mft_Frt_IrqHandler().

Here is the caller graph for this function:

uint8_t Mft_Frt_GetMaskPeakTimes | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch
| ) |  |

get mask peak times

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2

Returns:
  mask peak times

Definition at line 470 of file mft_frt.c.

References MFT_FRT_MAX_CH.

uint8_t Mft_Frt_GetMaskZeroTimes | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch
| ) |  |

get mask zero times

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2

Returns:
  mask zero times

Definition at line 399 of file mft_frt.c.

References MFT_FRT_MAX_CH.

en_result_t Mft_Frt_Init | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch,
|  | stc_mft_frt_config_t * | pstcFrtConfig
| ) |  |

Init FRT module.

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2
  [in] | pstcFrtConfig | configuration of FRT

Return values:

  Ok | Internal data has been setup
  ErrorInvalidParameter | If one of following cases match: pstcMft == NULL pstcFrtConfig == NULL Other invalid configuration

Definition at line 298 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, 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, and stc_mft_frt_intern_data::pfnFrt2ZeroCallback.

Here is the call graph for this function:

static void Mft_Frt_InitIrq | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | stc_frt_int_sel_t * | pstcIntSel
| ) |  | `[static]`

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

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | pstcIntSel | Pointer to interrupt selection structure

Definition at line 200 of file mft_frt.c.

References stc_frt_int_sel::bFrtPeakMatchInt, stc_frt_int_sel::bFrtZeroMatchInt, MFT0_FRT, MFT1_FRT, MFT2_FRT, PDL_IRQ_LEVEL_MFT_FRT, and stc_mftn_frt_t.

Referenced by Mft_Frt_EnableInt().

Here is the caller graph for this function:

void Mft_Frt_IrqHandler | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | stc_mft_frt_intern_data_t * | pstcMftFrtInternData
| ) |  |

FRT interrupt handler sub function.

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | pstcMftFrtInternData | structure of frt callback function structure of stc_mft_intern_data

Definition at line 145 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.

Referenced by MFT_FRT_IRQHandler().

Here is the call graph for this function:

Here is the caller graph for this function:

en_result_t Mft_Frt_SetCountCycle | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch,
|  | uint16_t | u16Cycle
| ) |  |

set frt cycle value

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2
  [in] | u16Cycle | the cycle value

Return values:

  Ok | FRT cycle value is set
  ErrorInvalidParameter | If one of following conditions are met: pstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 812 of file mft_frt.c.

References ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

en_result_t Mft_Frt_SetCountVal | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch,
|  | uint16_t | u16Count
| ) |  |

set frt count value

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2
  [in] | u16Count | the count value number of 16bit

Return values:

  Ok | FRT count value is set
  ErrorInvalidParameter | If one of following conditions are met: pstcMft == NULL Other invalid configuration

Definition at line 850 of file mft_frt.c.

References ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

en_result_t Mft_Frt_SetMaskPeakTimes | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch,
|  | uint8_t | u8Times
| ) |  |

set mask peak times

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2
  [in] | u8Times | mask times value of 0~15

Return values:

  Ok | mask peak times is set
  ErrorInvalidParameter | If one of following conditions are met: pstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 436 of file mft_frt.c.

References ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

en_result_t Mft_Frt_SetMaskZeroTimes | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch,
|  | uint8_t | u8Times
| ) |  |

set mask zero times

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2
  [in] | u8Times | mask times value of 0~15

Return values:

  Ok | Internal data has been setup
  ErrorInvalidParameter | If one of following conditions are met: pstcFrt == NULL u8Ch out of range Other invalid configuration

Definition at line 365 of file mft_frt.c.

References ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

en_result_t Mft_Frt_Start | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch
| ) |  |

Start FRT.

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2

Return values:

  Ok | FRT is started
  ErrorInvalidParameter | If one of following conditions are met: pstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 506 of file mft_frt.c.

References ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

en_result_t Mft_Frt_Stop | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt,
|  | uint8_t | u8Ch
| ) |  |

set frt stop

Parameters:

  [in] | pstcFrt | Pointer to FRT instance
  [in] | u8Ch | channel of Free run timer MFT_FRT_CH0 ~ MFT_FRT_CH2

Return values:

  Ok | FRT is stopped
  ErrorInvalidParameter | If one of following conditions are met: pstcMft == NULL u8Ch out of range Other invalid configuration

Definition at line 540 of file mft_frt.c.

References ErrorInvalidParameter, MFT_FRT_MAX_CH, and Ok.

static stc_mft_frt_intern_data_t* MftGetInternDataPtr | ( | volatile FM0P_MFT_FRT_TypeDef * | pstcFrt | ) | `[static]`

Return the internal data for a certain FRT instance.

Parameters:

  pstcFrt | Pointer to FRT instance

Returns:
  Pointer to internal data or NULL if instance is not enabled (or not known)

Definition at line 118 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  FM0P_MFT_FRT_TypeDef  *) FM0P_MFT0_FRT_BASE)) ,
            {NULL,NULL,NULL,NULL,NULL,NULL}
        },

        {
            & (*((volatile  FM0P_MFT_FRT_TypeDef  *) FM0P_MFT1_FRT_BASE)) ,
            {NULL,NULL,NULL,NULL,NULL,NULL}
        },

        {
            & (*((volatile  FM0P_MFT_FRT_TypeDef  *) FM0P_MFT2_FRT_BASE)) ,
            {NULL,NULL,NULL,NULL,NULL,NULL}
        },

    }

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

Definition at line 74 of file mft_frt.c.

Referenced by MFT_FRT_IRQHandler().

stc_mft_frt_instance_data_t m_astcMftFrtInstanceDataLut[(PDL_PERIPHERAL_ENABLE_MFT0_FRT==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT1_FRT==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT2_FRT==PDL_ON?1:0)]

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

Definition at line 74 of file mft_frt.c.

Referenced by MFT_FRT_IRQHandler().