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

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Defines | Functions | Variables
C:/pdl_v10/library/driver/mfs/mfs.c File Reference
`#include "mfs.h"`
Include dependency graph for mfs.c:

Go to the source code of this file.

## Defines
#define | UartInstanceToIndex(Instance) ((uint32_t)Instance - (uint32_t)&UART0)/0x100u
#define | CsioInstanceToIndex(Instance) ((uint32_t)Instance - (uint32_t)&CSIO0)/0x100u
#define | I2cInstanceToIndex(Instance) ((uint32_t)Instance - (uint32_t)&I2C0)/0x100u
#define | LinInstanceToIndex(Instance) ((uint32_t)Instance - (uint32_t)&LIN0)/0x100u
## Functions
static stc_mfs_intern_data_t * | MfsUartGetInternDataPtr (volatile FM0P_MFS_UART_TypeDef *pstcUart)
| Return the internal data for a certain UART instance.
static stc_mfs_intern_data_t * | MfsCsioGetInternDataPtr (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio)
| Return the internal data for a certain CSIO instance.
static stc_mfs_intern_data_t * | MfsI2cGetInternDataPtr (volatile FM0P_MFS_I2C_TypeDef *pstcI2c)
| Return the internal data for a certain I2C instance.
static stc_mfs_intern_data_t * | MfsLinGetInternDataPtr (volatile FM0P_MFS_LIN_TypeDef *pstcLin)
| Return the internal data for a certain MFS instance.
static void | Mfs_InitIrq (en_mfs_instance_index_t enIndex, boolean_t bRxTx)
| Device dependent initialization of transmit interrupts according CMSIS with level defined in pdl.h.
static void | Mfs_DeInitIrq (en_mfs_instance_index_t enIndex, boolean_t bRxTx)
| Device dependent de-initialization of interrupts according CMSIS.
static en_mfs_instance_index_t | MfsUartGetInstanceIndex (volatile FM0P_MFS_UART_TypeDef *pstcUart)
| Return instance index for a certain UART instance.
void | MfsUartIrqHandlerRx (volatile FM0P_MFS_UART_TypeDef *pstcUart, stc_mfs_intern_data_t *pstcMfsInternData)
| UART receive interrupt service routine.
void | MfsUartIrqHandlerTx (volatile FM0P_MFS_UART_TypeDef *pstcUart, stc_mfs_intern_data_t *pstcMfsInternData)
| MFS transmit interrupt service routine.
en_result_t | Mfs_Uart_EnableInt (volatile FM0P_MFS_UART_TypeDef *pstcUart, stc_uart_int_sel_t *pstcInt, stc_uart_int_cb_t *pstcIntCb)
| Enable UART interrupts.
en_result_t | Mfs_Uart_DisableInt (volatile FM0P_MFS_UART_TypeDef *pstcUart, stc_uart_int_sel_t *pstcInt)
| Disable UART interrupts.
en_result_t | Mfs_Uart_Init (volatile FM0P_MFS_UART_TypeDef *pstcUart, const stc_mfs_uart_config_t *pstcConfig)
| Initialization of a MFS module to activate as UART.
en_result_t | Mfs_Uart_DeInit (volatile FM0P_MFS_UART_TypeDef *pstcUart)
| Deinitialisation of a MFS module activating as UART.
en_result_t | Mfs_Uart_SetBaudRate (volatile FM0P_MFS_UART_TypeDef *pstcUart, uint32_t u32BaudRate)
| Set the baudrate of UART.
en_result_t | Mfs_Uart_EnableFunc (volatile FM0P_MFS_UART_TypeDef *pstcUart, en_uart_func_t enFunc)
| Enable UART functions.
en_result_t | Mfs_Uart_DisableFunc (volatile FM0P_MFS_UART_TypeDef *pstcUart, en_uart_func_t enFunc)
| Disable UART functions.
boolean_t | Mfs_Uart_GetStatus (volatile FM0P_MFS_UART_TypeDef *pstcUart, en_uart_status_t enStatus)
| Get status of UART according to status type.
en_result_t | Mfs_Uart_ClrStatus (volatile FM0P_MFS_UART_TypeDef *pstcUart, en_uart_status_t enStatus)
| Clear status of UART according to status type.
en_result_t | Mfs_Uart_SendData (volatile FM0P_MFS_UART_TypeDef *pstcUart, uint16_t u16Data)
| Write UART data buffer.
uint16_t | Mfs_Uart_ReceiveData (volatile FM0P_MFS_UART_TypeDef *pstcUart)
| Read UART data buffer.
en_result_t | Mfs_Uart_ResetFifo (volatile FM0P_MFS_UART_TypeDef *pstcUart, en_mfs_fifo_t enFifo)
| Reset UART FIFO.
en_result_t | Mfs_Uart_SetFifoCount (volatile FM0P_MFS_UART_TypeDef *pstcUart, en_mfs_fifo_t enFifo, uint8_t u8Count)
| Set UART FIFO count.
uint8_t | Mfs_Uart_GetFifoCount (volatile FM0P_MFS_UART_TypeDef *pstcUart, en_mfs_fifo_t enFifo)
| Get UART FIFO count.
static en_mfs_instance_index_t | MfsCsioGetInstanceIndex (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio)
| Return instance index for a certain CSIO instance.
void | MfsCsioIrqHandlerRx (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, stc_mfs_intern_data_t *pstcMfsInternData)
| CSIO receive interrupt service routine.
void | MfsCsioIrqHandlerTx (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, stc_mfs_intern_data_t *pstcMfsInternData)
| CSIO transfer interrupt service routine.
void | MfsCsioIrqHandlerStatus (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, stc_mfs_intern_data_t *pstcMfsInternData)
| CSIO status interrupt service routine.
en_result_t | Mfs_Csio_EnableInt (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, stc_csio_int_sel_t *pstcInt, stc_csio_int_cb_t *pstcIntCb)
| Enable CSIO interrupts.
en_result_t | Mfs_Csio_DisableInt (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, stc_csio_int_sel_t *pstcInt)
| Disable CSIO interrupts.
en_result_t | Mfs_Csio_Init (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, const stc_mfs_csio_config_t *pstcConfig)
| Initialization of a MFS module to activate as CSIO.
en_result_t | Mfs_Csio_DeInit (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio)
| Deinitialisation of a MFS module activating as CSIO.
en_result_t | Mfs_Csio_SetBaudRate (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, uint32_t u32BaudRate)
| Set the baudrate of CSIO.
en_result_t | Mfs_Csio_SetTimerCompareValue (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, uint16_t u16CompareValue)
| Set the compare value of CSIO serial timer.
en_result_t | Mfs_Csio_SetCsTransferByteCount (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, en_cs_pin_sel_t enCsPin, uint8_t u8ByteCnt)
| Set the transfer byte count of a selected chip selection pin.
en_result_t | Mfs_Csio_SetCsHoldStatus (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, boolean_t bHold)
| Set the hold status of chip selection pin.
en_result_t | Mfs_Csio_SetTimerTransferByteCount (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, uint8_t u8ByteCnt)
| Set the transfer byte count of CSIO serial timer.
en_result_t | Mfs_Csio_EnableFunc (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, en_csio_func_t enFunc)
| Enable CSIO functions.
en_result_t | Mfs_Csio_DisableFunc (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, en_csio_func_t enFunc)
| Disable CSIO functions.
boolean_t | Mfs_Csio_GetStatus (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, en_csio_status_t enStatus)
| Get status of CSIO according to status type.
en_result_t | Mfs_Csio_ClrStatus (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, en_csio_status_t enStatus)
| Clear status of CSIO according to status type.
en_result_t | Mfs_Csio_SendData (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, uint16_t u16Data, boolean_t bSotEn)
| Write CSIO data buffer.
uint16_t | Mfs_Csio_ReceiveData (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio)
| Read CSIO data buffer.
en_result_t | Mfs_Csio_ResetFifo (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, en_mfs_fifo_t enFifo)
| Reset CSIO FIFO.
en_result_t | Mfs_Csio_SetFifoCount (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, en_mfs_fifo_t enFifo, uint8_t u8Count)
| Set CSIO FIFO count.
uint8_t | Mfs_Csio_GetFifoCount (volatile FM0P_MFS_CSIO_TypeDef *pstcCsio, en_mfs_fifo_t enFifo)
| Get CSIO FIFO count.
static en_mfs_instance_index_t | MfsI2cGetInstanceIndex (volatile FM0P_MFS_I2C_TypeDef *pstcI2c)
| Return instance index for a certain I2C instance.
void | MfsI2cIrqHandlerRx (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, stc_mfs_intern_data_t *pstcMfsInternData)
| I2C receive interrupt service routine.
void | MfsI2cIrqHandlerTx (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, stc_mfs_intern_data_t *pstcMfsInternData)
| I2C transfer interrupt service routine.
void | MfsI2cIrqHandlerStatus (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, stc_mfs_intern_data_t *pstcMfsInternData)
| I2C status interrupt service routine.
en_result_t | Mfs_I2c_EnableInt (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, stc_i2c_int_sel_t *pstcInt, stc_i2c_int_cb_t *pstcIntCb)
| Enable I2C interrupts.
en_result_t | Mfs_I2c_DisableInt (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, stc_i2c_int_sel_t *pstcInt)
| Disable I2C interrupts.
en_result_t | Mfs_I2c_Init (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, const stc_mfs_i2c_config_t *pstcConfig)
| Initialization of a MFS module to activate as I2C.
en_result_t | Mfs_I2c_DeInit (volatile FM0P_MFS_I2C_TypeDef *pstcI2c)
| Deinitialisation of a MFS module activating as I2C.
en_result_t | Mfs_I2c_SetBaudRate (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, uint32_t u32BaudRate)
| Set the baudrate of I2C.
en_result_t | Mfs_I2c_GenerateStart (volatile FM0P_MFS_I2C_TypeDef *pstcI2c)
| Generate start signal of I2C.
en_result_t | Mfs_I2c_GenerateRestart (volatile FM0P_MFS_I2C_TypeDef *pstcI2c)
| Generate restart signal of I2C.
en_result_t | Mfs_I2c_GenerateStop (volatile FM0P_MFS_I2C_TypeDef *pstcI2c)
| Generate stop signal of I2C.
en_result_t | Mfs_I2c_SendData (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, uint8_t u8Data)
| Write I2C data buffer.
uint8_t | Mfs_I2c_ReceiveData (volatile FM0P_MFS_I2C_TypeDef *pstcI2c)
| Read I2C data buffer.
en_result_t | Mfs_I2c_ConfigAck (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, en_i2c_ack_t enAck)
| Configure ACK signal sent to master.
en_i2c_ack_t | Mfs_I2c_GetAck (volatile FM0P_MFS_I2C_TypeDef *pstcI2c)
| Get the ACK signal from slave.
boolean_t | Mfs_I2c_GetStatus (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, en_i2c_status_t enStatus)
| Get status of I2C according to status type.
en_result_t | Mfs_I2c_ClrStatus (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, en_i2c_status_t enStatus)
| Clear status of I2C according to status type.
en_i2c_data_dir_t | Mfs_I2c_GetDataDir (volatile FM0P_MFS_I2C_TypeDef *pstcI2c)
| Get direction of I2C data in slave mode.
en_result_t | Mfs_I2c_ResetFifo (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, en_mfs_fifo_t enFifo)
| Reset I2C FIFO.
en_result_t | Mfs_I2c_SetFifoCount (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, en_mfs_fifo_t enFifo, uint8_t u8Count)
| Set I2C FIFO count.
uint8_t | Mfs_I2c_GetFifoCount (volatile FM0P_MFS_I2C_TypeDef *pstcI2c, en_mfs_fifo_t enFifo)
| Get I2C FIFO count.
static en_mfs_instance_index_t | MfsLinGetInstanceIndex (volatile FM0P_MFS_LIN_TypeDef *pstcLin)
| Return instance index for a certain LIN instance.
void | MfsLinIrqHandlerRx (volatile FM0P_MFS_LIN_TypeDef *pstcLin, stc_mfs_intern_data_t *pstcMfsInternData)
| LIN receive interrupt service routine.
void | MfsLinIrqHandlerTx (volatile FM0P_MFS_LIN_TypeDef *pstcLin, stc_mfs_intern_data_t *pstcMfsInternData)
| LIN transmit interrupt service routine.
void | MfsLinIrqHandlerStatus (volatile FM0P_MFS_LIN_TypeDef *pstcLin, stc_mfs_intern_data_t *pstcMfsInternData)
| LIN status interrupt service routine.
en_result_t | Mfs_Lin_EnableInt (volatile FM0P_MFS_LIN_TypeDef *pstcLin, stc_lin_int_sel_t *pstcInt, stc_lin_int_cb_t *pstcIntCb)
| Enable LIN interrupts.
en_result_t | Mfs_Lin_DisableInt (volatile FM0P_MFS_LIN_TypeDef *pstcLin, stc_lin_int_sel_t *pstcInt)
| Disable LIN interrupts.
en_result_t | Mfs_Lin_Init (volatile FM0P_MFS_LIN_TypeDef *pstcLin, const stc_mfs_lin_config_t *pstcConfig)
| Initialization of a MFS module to activate as LIN.
en_result_t | Mfs_Lin_DeInit (volatile FM0P_MFS_LIN_TypeDef *pstcLin)
| Deinitialisation of a MFS module activating as LIN.
en_result_t | Mfs_Lin_SetBaudRate (volatile FM0P_MFS_LIN_TypeDef *pstcLin, uint32_t u32BaudRate)
| Set the baudrate of LIN.
en_result_t | Mfs_Lin_GenerateBreakField (volatile FM0P_MFS_LIN_TypeDef *pstcLin)
| Generate LIN break filed.
en_result_t | Mfs_Lin_EnableFunc (volatile FM0P_MFS_LIN_TypeDef *pstcLin, en_lin_func_t enFunc)
| Enable LIN functions.
en_result_t | Mfs_Lin_DisableFunc (volatile FM0P_MFS_LIN_TypeDef *pstcLin, en_lin_func_t enFunc)
| Disable LIN functions.
boolean_t | Mfs_Lin_GetStatus (volatile FM0P_MFS_LIN_TypeDef *pstcLin, en_lin_status_t enStatus)
| Get status of LIN according to status type.
en_result_t | Mfs_Lin_ClrStatus (volatile FM0P_MFS_LIN_TypeDef *pstcLin, en_lin_status_t enStatus)
| Clear status of LIN according to status type.
en_result_t | Mfs_Lin_SendData (volatile FM0P_MFS_LIN_TypeDef *pstcLin, uint8_t Data)
| Write LIN data buffer.
uint8_t | Mfs_Lin_ReceiveData (volatile FM0P_MFS_LIN_TypeDef *pstcLin)
| Read LIN data buffer.
en_result_t | Mfs_Lin_ResetFifo (volatile FM0P_MFS_LIN_TypeDef *pstcLin, en_mfs_fifo_t enFifo)
| Reset LIN FIFO.
en_result_t | Mfs_Lin_SetFifoCount (volatile FM0P_MFS_LIN_TypeDef *pstcLin, en_mfs_fifo_t enFifo, uint8_t u8Count)
| Set LIN FIFO count.
uint8_t | Mfs_Lin_GetFifoCount (volatile FM0P_MFS_LIN_TypeDef *pstcLin, en_mfs_fifo_t enFifo)
| Get LIN FIFO count.
## Variables
stc_mfs_instance_data_t | m_astcMfsInstanceDataLut [(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS0==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS1==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS2==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS3==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS4==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS5==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS6==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS7==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS8==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS9==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS10==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS11==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS12==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS13==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS14==PDL_ON)+(uint8_t)(PDL_PERIPHERAL_ENABLE_MFS15==PDL_ON)]
| Look-up table for all enabled MFS instances and their internal data.

## Detailed Description

A detailed description is available at MFS Module description

History:

- 2014-02-13 1.0 Edison Zhang First version.
- 2014-03-11 1.1 Edison Zhang Add instance index variable in the internal data structure.
- 2014-05-14 1.2 Edison Zhang Update some comments.

Definition in file mfs.c.