PDL for FM0+  Version1.0
Peripheral Driverl Library for FM0+
Output Compare Unit (OCU)

Data Structures

struct  stc_mft_ocu_config
 OCU configure. More...
struct  stc_even_compare_config
 The compare configuration of even OCU channel. More...
struct  stc_odd_compare_config
 The compare configuration of odd OCU channel. More...
struct  stc_mft_ocu_intern_data
 Structure of OCU internal data. More...
struct  stc_mft_ocu_instance_data
 OCU instance data type. More...

Defines

#define stc_mftn_ocu_t   FM0P_MFT_OCU_TypeDef
#define MFT0_OCU   (*((volatile stc_mftn_ocu_t *) FM0P_MFT0_OCU_BASE))
#define MFT1_OCU   (*((volatile stc_mftn_ocu_t *) FM0P_MFT1_OCU_BASE))
#define MFT2_OCU   (*((volatile stc_mftn_ocu_t *) FM0P_MFT1_OCU_BASE))
#define MFT_OCU_CH0   0
#define MFT_OCU_CH1   1
#define MFT_OCU_CH2   2
#define MFT_OCU_CH3   3
#define MFT_OCU_CH4   4
#define MFT_OCU_CH5   5
#define MFT_OCU_MAXCH   6
#define MFT_OCU_CH10   0
#define MFT_OCU_CH32   1
#define MFT_OCU_CH54   2
#define OCU_INSTANCE_COUNT

Typedefs

typedef enum en_ocu_instance_index en_ocu_instance_index_t
 Enumeration to define an index for each OCU instance.
typedef enum en_mft_ocu_frt en_mft_ocu_frt_t
 select the FRT to be connected to OCU
typedef enum en_ocu_rt_out_state en_ocu_rt_out_state_t
 output level of the RT pin state
typedef enum en_ocu_occp_buf en_ocu_occp_buf_t
 buffer register function of OCCP
typedef enum en_ocu_ocse_buf en_ocu_ocse_buf_t
 buffer register function of OCSE
typedef struct stc_mft_ocu_config stc_mft_ocu_config_t
 OCU configure.
typedef enum en_rt_status en_rt_even_status_t
 RT output status.
typedef enum en_rt_status en_rt_odd_status_t
typedef enum
en_iop_flag_set_condition 
en_iop_flag_even_t
 The condition for IOP flag set.
typedef enum
en_iop_flag_set_condition 
en_iop_flag_odd_t
typedef struct
stc_even_compare_config 
stc_even_compare_config_t
 The compare configuration of even OCU channel.
typedef struct
stc_odd_compare_config 
stc_odd_compare_config_t
 The compare configuration of odd OCU channel.
typedef struct
stc_mft_ocu_intern_data 
stc_mft_ocu_intern_data_t
 Structure of OCU internal data.
typedef struct
stc_mft_ocu_instance_data 
stc_mft_ocu_instance_data_t
 OCU instance data type.

Enumerations

enum  en_ocu_instance_index { OcuInstanceIndexOcu0 = 0, OcuInstanceIndexOcu1, OcuInstanceIndexOcu2 }
 Enumeration to define an index for each OCU instance. More...
enum  en_mft_ocu_frt { Frt0ToOcu = 0u, Frt1ToOcu, Frt2ToOcu, OcuFrtToExt }
 select the FRT to be connected to OCU More...
enum  en_ocu_rt_out_state { RtLowLevel = 0, RtHighLevel }
 output level of the RT pin state More...
enum  en_ocu_occp_buf { OccpBufDisable = 0, OccpBufTrsfByFrtZero, OccpBufTrsfByFrtPeak, OccpBufTrsfByFrtZeroPeak }
 buffer register function of OCCP More...
enum  en_ocu_ocse_buf { OcseBufDisable = 0, OcseBufTrsfByFrtZero, OcseBufTrsfByFrtPeak, OcseBufTrsfByFrtZeroPeak }
 buffer register function of OCSE More...
enum  en_rt_status { RtOutputHold = 0, RtOutputHigh, RtOutputLow, RtOutputReverse }
 RT output status. More...
enum  en_iop_flag_set_condition { IopFlagHold = 0, IopFlagSet }
 The condition for IOP flag set. More...

Functions

static stc_mft_ocu_intern_data_tMftGetInternDataPtr (volatile FM0P_MFT_OCU_TypeDef *pstcOcu)
 Return the internal data for a certain OCU instance.
void Mft_Ocu_IrqHandler (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, stc_mft_ocu_intern_data_t *pstcMftOcuInternData)
 OCU module interrupt handler.
static void Mft_Ocu_InitIrq (volatile FM0P_MFT_OCU_TypeDef *pstcOcu)
 Device dependent initialization of interrupts according CMSIS with level defined in pdl.h.
static void Mft_Ocu_DeInitIrq (volatile FM0P_MFT_OCU_TypeDef *pstcOcu)
 Device dependent de-initialization of interrupts according CMSIS.
en_result_t Mft_Ocu_Init (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, uint8_t u8Ch, stc_mft_ocu_config_t *pstcOcuConfig)
 Init OCU module.
en_result_t Mft_Ocu_SetEvenChCompareMode (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, uint8_t EvenCh, stc_even_compare_config_t *pstcConfig)
 Compare congifuration of even OCU channel.
en_result_t Mft_Ocu_SetOddChCompareMode (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, uint8_t OddCh, stc_odd_compare_config_t *pstcConfig)
 Compare congifuration of odd OCU channel.
en_result_t Mft_Ocu_EnableOperation (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, uint8_t u8Ch)
 enable ocu operation
en_result_t Mft_Ocu_DisableOperation (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, uint8_t u8Ch)
 Disable ocu operation.
en_result_t Mft_Ocu_EnableInt (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, uint8_t u8Ch, func_ptr_t pfnCallback)
 enable ocu interrupt
en_result_t Mft_Ocu_DisableInt (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, uint8_t u8Ch)
 Disable ocu interrupt.
en_int_flag_t Mft_Ocu_GetIntFlag (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, uint8_t u8Ch)
 get ocu interrupt flag
en_result_t Mft_Ocu_ClrIntFlag (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, uint8_t u8Ch)
 clear ocu interrupt flag
en_ocu_rt_out_state_t Mft_Ocu_GetRtPinLevel (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, uint8_t u8Ch)
 Get RT pin level of OCU.
en_result_t Mft_Ocu_WriteOccp (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, uint8_t u8Ch, uint16_t u16Occp)
 writ occp register
uint16_t Mft_Ocu_ReadOccp (volatile FM0P_MFT_OCU_TypeDef *pstcOcu, uint8_t u8Ch)
 get occp register value

Variables

stc_mft_ocu_instance_data_t m_astcMftOcuInstanceDataLut [(PDL_PERIPHERAL_ENABLE_MFT0_OCU==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT1_OCU==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT2_OCU==PDL_ON?1:0)]
 Look-up table for all enabled FRT of MFT instances and their internal data.
stc_mft_ocu_instance_data_t m_astcMftOcuInstanceDataLut [(PDL_PERIPHERAL_ENABLE_MFT0_OCU==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT1_OCU==PDL_ON?1:0)+(PDL_PERIPHERAL_ENABLE_MFT2_OCU==PDL_ON?1:0)]
 Look-up table for all enabled OCU instances and their internal data.

Detailed Description

Provided functions of OCU module:

How to use OCU module?

Before using OCU, a FRT used to connect with applying OCU must be initialed. For how to configure FRT, see the description in the mft_frt.h

Mft_Ocu_Init() must be used for configuration of an Output Compare Unit (OCU) channel with a structure of the type stc_mft_ocu_config_t. A FRT should be connected with applying OCU with this function.

Mft_Ocu_SetEvenChCompareMode() is used to set the compare function/mode of even channel with the structure type stc_even_compare_config_t. Mft_Ocu_SetOddChCompareMode() is used to set the compare function/mode of odd channel with the structure type stc_odd_compare_config_t.

With Mft_Ocu_WriteOccp() the OCU compare value is set to the value given in the parameter Mft_Ocu_WriteOccp::u16Cycle. Whether the compare value is modified directly depends on buffer function.

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

After above setting, calling Mft_Ocu_EnableOperation() will start OCU.

With interrupt mode, the interrupt occurs when FRT count match OCU compare value, the interrupt flag will be cleared and run into user interrupt callback function.

With polling mode, user can use Mft_Ocu_GetIntFlag() to check if the interrupt occurs, and clear the interrupt flag by Mft_Ocu_ClrIntFlag().

When stopping the OCU, use Mft_Ocu_DisableOperation() to disable OCU and Mft_Ocu_DisableInt() to disable OCU interrupt.


Define Documentation

#define MFT0_OCU   (*((volatile stc_mftn_ocu_t *) FM0P_MFT0_OCU_BASE))

Definition at line 121 of file mft_ocu.h.

Referenced by Mft_Ocu_DeInitIrq(), Mft_Ocu_InitIrq(), and MFT_OPC_IRQHandler().

#define MFT1_OCU   (*((volatile stc_mftn_ocu_t *) FM0P_MFT1_OCU_BASE))

Definition at line 122 of file mft_ocu.h.

Referenced by Mft_Ocu_DeInitIrq(), Mft_Ocu_InitIrq(), and MFT_OPC_IRQHandler().

#define MFT2_OCU   (*((volatile stc_mftn_ocu_t *) FM0P_MFT1_OCU_BASE))

Definition at line 123 of file mft_ocu.h.

Referenced by Mft_Ocu_DeInitIrq(), Mft_Ocu_InitIrq(), and MFT_OPC_IRQHandler().

#define MFT_OCU_CH0   0

Definition at line 125 of file mft_ocu.h.

#define MFT_OCU_CH1   1

Definition at line 126 of file mft_ocu.h.

#define MFT_OCU_CH10   0

Definition at line 133 of file mft_ocu.h.

#define MFT_OCU_CH2   2

Definition at line 127 of file mft_ocu.h.

#define MFT_OCU_CH3   3

Definition at line 128 of file mft_ocu.h.

#define MFT_OCU_CH32   1

Definition at line 134 of file mft_ocu.h.

#define MFT_OCU_CH4   4

Definition at line 129 of file mft_ocu.h.

#define MFT_OCU_CH5   5

Definition at line 130 of file mft_ocu.h.

#define MFT_OCU_CH54   2

Definition at line 135 of file mft_ocu.h.

Value:

Definition at line 137 of file mft_ocu.h.

Referenced by MftGetInternDataPtr().

#define stc_mftn_ocu_t   FM0P_MFT_OCU_TypeDef

Definition at line 119 of file mft_ocu.h.

Referenced by Mft_Ocu_DeInitIrq(), Mft_Ocu_InitIrq(), and MFT_OPC_IRQHandler().


Typedef Documentation

The condition for IOP flag set.

select the FRT to be connected to OCU

Enumeration to define an index for each OCU instance.

buffer register function of OCCP

buffer register function of OCSE

output level of the RT pin state

RT output status.

The compare configuration of even OCU channel.

OCU configure.

OCU instance data type.

Structure of OCU internal data.

The compare configuration of odd OCU channel.


Enumeration Type Documentation

The condition for IOP flag set.

Enumerator:
IopFlagHold 

IOP flag hold.

IopFlagSet 

IOP flag set.

Definition at line 239 of file mft_ocu.h.

select the FRT to be connected to OCU

Enumerator:
Frt0ToOcu 

connect FRT0 to OCU

Frt1ToOcu 

connect FRT1 to OCU

Frt2ToOcu 

connect FRT2 to OCU

OcuFrtToExt 

connect FRT of an external MFT

Definition at line 163 of file mft_ocu.h.

Enumeration to define an index for each OCU instance.

Enumerator:
OcuInstanceIndexOcu0 

Instance index of OCU0.

OcuInstanceIndexOcu1 

Instance index of OCU1.

OcuInstanceIndexOcu2 

Instance index of OCU2.

Definition at line 145 of file mft_ocu.h.

buffer register function of OCCP

Enumerator:
OccpBufDisable 

disable the buffer function

OccpBufTrsfByFrtZero 

buffer transfer when counter value is 0x0000

OccpBufTrsfByFrtPeak 

buffer transfer when counter value is TCCP

OccpBufTrsfByFrtZeroPeak 

buffer transfer when the value is both 0 and TCCP

Definition at line 185 of file mft_ocu.h.

buffer register function of OCSE

Enumerator:
OcseBufDisable 

disable the buffer function

OcseBufTrsfByFrtZero 

buffer transfer when counter value is 0x0000

OcseBufTrsfByFrtPeak 

buffer transfer when counter value is TCCP

OcseBufTrsfByFrtZeroPeak 

buffer transfer when the value is both 0 and TCCP

Definition at line 198 of file mft_ocu.h.

output level of the RT pin state

Enumerator:
RtLowLevel 

output low level to RT pin

RtHighLevel 

output high level to RT pin

Definition at line 175 of file mft_ocu.h.

RT output status.

Enumerator:
RtOutputHold 

RT output hold.

RtOutputHigh 

RT output high.

RtOutputLow 

RT output low.

RtOutputReverse 

RT output reverse.

Definition at line 226 of file mft_ocu.h.


Function Documentation

en_result_t Mft_Ocu_ClrIntFlag ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
uint8_t  u8Ch 
)

clear ocu interrupt flag

Parameters:
[in]pstcOcuPointer to OCU instance
[in]u8Chchannel of OCU
  • MFT_OCU_CH0 ~ MFT_OCU_CH5
Return values:
OkOCU interrupt flag is clear
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMft == NULL
  • u8Ch out of range
  • Other invalid configuration

Definition at line 715 of file mft_ocu.c.

References ErrorInvalidParameter, MFT_OCU_MAXCH, and Ok.

Referenced by Mft_Ocu_IrqHandler().

Here is the caller graph for this function:

static void Mft_Ocu_DeInitIrq ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu) [static]

Device dependent de-initialization of interrupts according CMSIS.

Parameters:
[in]pstcOcuPointer to OCU instance
Return values:
OkSuccessful initialization

Definition at line 207 of file mft_ocu.c.

References MFT0_OCU, MFT1_OCU, MFT2_OCU, PDL_DEFAULT_INTERRUPT_LEVEL, and stc_mftn_ocu_t.

Referenced by Mft_Ocu_DisableInt().

Here is the caller graph for this function:

en_result_t Mft_Ocu_DisableInt ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
uint8_t  u8Ch 
)

Disable ocu interrupt.

Parameters:
[in]pstcOcuPointer to OCU instance
[in]u8Chchannel of OCU
  • MFT_OCU_CH0 ~ MFT_OCU_CH5
Return values:
OkOCU interrupt disabled
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMft == NULL
  • u8Ch out of range
  • Other invalid configuration

Definition at line 626 of file mft_ocu.c.

References ErrorInvalidParameter, Mft_Ocu_DeInitIrq(), MFT_OCU_MAXCH, MftGetInternDataPtr(), and Ok.

Here is the call graph for this function:

en_result_t Mft_Ocu_DisableOperation ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
uint8_t  u8Ch 
)

Disable ocu operation.

Parameters:
[in]pstcOcuPointer to OCU instance
[in]u8Chchannel of OCU
  • MFT_OCU_CH0 ~ MFT_OCU_CH5
Return values:
OkOCU operation disabled
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMft == NULL
  • u8Ch out of range
  • Other invalid configuration

Definition at line 524 of file mft_ocu.c.

References ErrorInvalidParameter, MFT_OCU_MAXCH, and Ok.

en_result_t Mft_Ocu_EnableInt ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
uint8_t  u8Ch,
func_ptr_t  pfnCallback 
)

enable ocu interrupt

Parameters:
[in]pstcOcuPointer to OCU instance
[in]u8Chchannel of OCU
  • MFT_OCU_CH0 ~ MFT_OCU_CH5
[in]pfnCallbackcallback function
Return values:
OkOCU interrupt enabled
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMft == NULL
  • u8Ch out of range
  • Other invalid configuration

Definition at line 571 of file mft_ocu.c.

References ErrorInvalidParameter, Mft_Ocu_InitIrq(), MFT_OCU_MAXCH, MftGetInternDataPtr(), Ok, and stc_mft_ocu_intern_data::pfnOcu0Callback.

Here is the call graph for this function:

en_result_t Mft_Ocu_EnableOperation ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
uint8_t  u8Ch 
)

enable ocu operation

Parameters:
[in]pstcOcuPointer to OCU instance
[in]u8Chchannel of OCU
  • MFT_OCU_CH0 ~ MFT_OCU_CH5
Return values:
OkOCU operation enabled
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMft == NULL
  • u8Ch out of range
  • Other invalid configuration

Definition at line 481 of file mft_ocu.c.

References ErrorInvalidParameter, MFT_OCU_MAXCH, and Ok.

en_int_flag_t Mft_Ocu_GetIntFlag ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
uint8_t  u8Ch 
)

get ocu interrupt flag

Parameters:
[in]pstcOcuPointer to OCU instance
[in]u8Chchannel of OCU
  • MFT_OCU_CH0 ~ MFT_OCU_CH5
Return values:
PdlClrOCU interrupt flag is clear
PdlSetOCU interrupt flag is set

Definition at line 678 of file mft_ocu.c.

References PdlClr, and PdlSet.

Referenced by Mft_Ocu_IrqHandler().

Here is the caller graph for this function:

en_ocu_rt_out_state_t Mft_Ocu_GetRtPinLevel ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
uint8_t  u8Ch 
)

Get RT pin level of OCU.

Parameters:
[in]pstcOcuPointer to OCU instance
[in]u8Chchannel of OCU
  • MFT_OCU_CH0 ~ MFT_OCU_CH5
Return values:
RtLowlevelRT pin is low level
RtHighlevelRT pin is high level

Definition at line 755 of file mft_ocu.c.

References RtHighLevel, and RtLowLevel.

en_result_t Mft_Ocu_Init ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
uint8_t  u8Ch,
stc_mft_ocu_config_t pstcOcuConfig 
)

Init OCU module.

Parameters:
[in]pstcOcuPointer to OCU instance
[in]u8Chchannel of OCU
  • MFT_OCU_CH0 ~ MFT_OCU_CH5
[in]pstcOcuConfigconfigure of OCU
  • structure of OCU cofnigure
Return values:
OkOCU module initialized
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMft == NULL
  • pstcOcuConfig == NULL
  • Other invalid configuration

Definition at line 270 of file mft_ocu.c.

References stc_mft_ocu_config::bCmod, stc_mft_ocu_config::bFm4, stc_mft_ocu_config::enFrtConnect, stc_mft_ocu_config::enOccpBufMode, stc_mft_ocu_config::enOcseBufMode, stc_mft_ocu_config::enStatePin, ErrorInvalidParameter, MFT_OCU_MAXCH, MftGetInternDataPtr(), OccpBufTrsfByFrtZeroPeak, OcseBufTrsfByFrtZeroPeak, OcuFrtToExt, Ok, stc_mft_ocu_intern_data::pfnOcu0Callback, stc_mft_ocu_intern_data::pfnOcu1Callback, stc_mft_ocu_intern_data::pfnOcu2Callback, stc_mft_ocu_intern_data::pfnOcu3Callback, stc_mft_ocu_intern_data::pfnOcu4Callback, stc_mft_ocu_intern_data::pfnOcu5Callback, and stc_mft_ocu_config::u8Mod.

Here is the call graph for this function:

static void Mft_Ocu_InitIrq ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu) [static]

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

Parameters:
[in]pstcOcuPointer to OCU instance
Return values:
OkSuccessful initialization

Definition at line 184 of file mft_ocu.c.

References MFT0_OCU, MFT1_OCU, MFT2_OCU, PDL_IRQ_LEVEL_MFT_OCU, and stc_mftn_ocu_t.

Referenced by Mft_Ocu_EnableInt().

Here is the caller graph for this function:

void Mft_Ocu_IrqHandler ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
stc_mft_ocu_intern_data_t pstcMftOcuInternData 
)

OCU module interrupt handler.

Parameters:
[in]pstcOcuPointer to OCU instance
[in]pstcMftOcuInternDatacallback function of OCU

Definition at line 147 of file mft_ocu.c.

References Mft_Ocu_ClrIntFlag(), Mft_Ocu_GetIntFlag(), MFT_OCU_MAXCH, PdlSet, and stc_mft_ocu_intern_data::pfnOcu0Callback.

Referenced by MFT_OPC_IRQHandler().

Here is the call graph for this function:

Here is the caller graph for this function:

uint16_t Mft_Ocu_ReadOccp ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
uint8_t  u8Ch 
)

get occp register value

Parameters:
[in]pstcOcuPointer to OCU instance
[in]u8Chchannel of OCU
  • MFT_OCU_CH0 ~ MFT_OCU_CH5
Return values:
16bitoccp value

Definition at line 825 of file mft_ocu.c.

References MFT_OCU_MAXCH.

en_result_t Mft_Ocu_SetEvenChCompareMode ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
uint8_t  EvenCh,
stc_even_compare_config_t pstcConfig 
)

Compare congifuration of even OCU channel.

Parameters:
[in]pstcOcuPointer to OCU instance
[in]EvenCheven channel of OCU
  • MFT_OCU_CH0, MFT_OCU_CH2, MFT_OCU_CH4
[in]pstcConfigpointer to structure of compare mode
Return values:
OkEven OCU channel compare mode is set
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMft == NULL
  • EvenCh out of range
  • Other invalid configuration

Definition at line 354 of file mft_ocu.c.

References stc_even_compare_config::enFrtDownCntEvenMatchEvenChRtStatus, stc_even_compare_config::enFrtPeakEvenMatchEvenChRtStatus, stc_even_compare_config::enFrtPeakEvenNotMatchEvenChStatus, stc_even_compare_config::enFrtUpCntEvenMatchEvenChRtStatus, stc_even_compare_config::enFrtZeroEvenMatchEvenChRtStatus, stc_even_compare_config::enFrtZeroEvenNotMatchEvenChRtStatus, stc_even_compare_config::enIopFlagWhenFrtDownCntEvenMatch, stc_even_compare_config::enIopFlagWhenFrtPeakEvenMatch, stc_even_compare_config::enIopFlagWhenFrtUpCntEvenMatch, stc_even_compare_config::enIopFlagWhenFrtZeroEvenMatch, ErrorInvalidParameter, IopFlagSet, Ok, and RtOutputReverse.

en_result_t Mft_Ocu_SetOddChCompareMode ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
uint8_t  OddCh,
stc_odd_compare_config_t pstcConfig 
)

Compare congifuration of odd OCU channel.

Parameters:
[in]pstcOcuPointer to OCU instance
[in]OddChodd channel of OCU
  • MFT_OCU_CH1, MFT_OCU_CH3, MFT_OCU_CH5
[in]pstcConfigpointer to structure of compare mode
Return values:
OkOdd OCU channel compare mode is set
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMft == NULL
  • OddCh out of range
  • Other invalid configuration

Definition at line 410 of file mft_ocu.c.

References stc_odd_compare_config::enFrtDownOddMatchEvenMatchOddChRtStatus, stc_odd_compare_config::enFrtDownOddMatchEvenNotMatchOddChRtStatus, stc_odd_compare_config::enFrtDownOddNotMatchEvenMatchOddChRtStatus, stc_odd_compare_config::enFrtPeakOddMatchEvenMatchOddChRtStatus, stc_odd_compare_config::enFrtPeakOddMatchEvenNotMatchOddChRtStatus, stc_odd_compare_config::enFrtPeakOddNotMatchEvenMatchOddChRtStatus, stc_odd_compare_config::enFrtPeakOddNotMatchEvenNotMatchOddChRtStatus, stc_odd_compare_config::enFrtUpCntOddMatchEvenMatchOddChRtStatus, stc_odd_compare_config::enFrtUpCntOddMatchEvenNotMatchOddChRtStatus, stc_odd_compare_config::enFrtUpCntOddNotMatchEvenMatchOddChRtStatus, stc_odd_compare_config::enFrtZeroOddMatchEvenMatchOddChRtStatus, stc_odd_compare_config::enFrtZeroOddMatchEvenNotMatchOddChRtStatus, stc_odd_compare_config::enFrtZeroOddNotMatchEvenMatchOddChRtStatus, stc_odd_compare_config::enFrtZeroOddNotMatchEvenNotMatchOddChRtStatus, stc_odd_compare_config::enIopFlagWhenFrtDownCntOddMatch, stc_odd_compare_config::enIopFlagWhenFrtPeakOddMatch, stc_odd_compare_config::enIopFlagWhenFrtUpCntOddMatch, stc_odd_compare_config::enIopFlagWhenFrtZeroOddMatch, ErrorInvalidParameter, IopFlagSet, Ok, and RtOutputReverse.

en_result_t Mft_Ocu_WriteOccp ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu,
uint8_t  u8Ch,
uint16_t  u16Occp 
)

writ occp register

Parameters:
[in]pstcOcuPointer to OCU instance
[in]u8Chchannel of OCU
  • MFT_OCU_CH0 ~ MFT_OCU_CH5
[in]u16Occpthe value of occp
  • 16bit value
Return values:
OkOCCP written
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMft == NULL
  • u8Ch out of range
  • Other invalid configuration

Definition at line 793 of file mft_ocu.c.

References ErrorInvalidParameter, MFT_OCU_MAXCH, and Ok.

static stc_mft_ocu_intern_data_t* MftGetInternDataPtr ( volatile FM0P_MFT_OCU_TypeDef *  pstcOcu) [static]

Return the internal data for a certain OCU instance.

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

Definition at line 121 of file mft_ocu.c.

References OCU_INSTANCE_COUNT, and stc_mft_ocu_instance_data::stcInternData.

Referenced by Mft_Ocu_DisableInt(), Mft_Ocu_EnableInt(), and Mft_Ocu_Init().

Here is the caller graph for this function:


Variable Documentation

Initial value:
{

    {
        & (*((volatile  FM0P_MFT_OCU_TypeDef  *) FM0P_MFT0_OCU_BASE)) ,  
        {NULL, NULL, NULL, NULL, NULL, NULL}    
    },


    {
        & (*((volatile  FM0P_MFT_OCU_TypeDef  *) FM0P_MFT1_OCU_BASE)) ,  
        {NULL, NULL, NULL, NULL, NULL, NULL}    
    },


    {
        & (*((volatile  FM0P_MFT_OCU_TypeDef  *) FM0P_MFT1_OCU_BASE)) ,  
        {NULL, NULL, NULL, NULL, NULL, NULL}    
    },

}

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

Look-up table for all enabled OCU instances and their internal data.

Definition at line 74 of file mft_ocu.c.

Referenced by MFT_OPC_IRQHandler().

Look-up table for all enabled OCU instances and their internal data.

Definition at line 74 of file mft_ocu.c.

Referenced by MFT_OPC_IRQHandler().