PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
mfs_hl.c File Reference
#include "mfs_hl.h"
Include dependency graph for mfs_hl.c:

Go to the source code of this file.

Macros

#define MFS_HL_RELOADVAL_MIN4UART   (4u)
 
#define MFS_HL_RELOADVAL_MIN4CSIO   (3u)
 
#define MFS_HL_RELOADVAL_MIN4LIN   (3u)
 
#define MFS_HL_BGR_MASK   (0x7FFFu)
 
#define MFS_HL_NUM_1   (1u)
 
#define MFS_HL_NUM_2   (2u)
 
#define MFS_HL_NUM_3   (3u)
 
#define MFS_HL_NUM_4   (4u)
 
#define MFS_HL_NUM_5   (5u)
 
#define MFS_HL_NUM_6   (6u)
 
#define MFS_HL_NUM_7   (7u)
 
#define MFS_HL_NUM_8   (8u)
 
#define MFS_HL_NUM_9   (9u)
 
#define MFS_HL_NUM_10   (10u)
 
#define MFS_HL_MASK_0   (0x01u)
 
#define MFS_HL_MASK_1   (0x02u)
 
#define MFS_HL_MASK_2   (0x04u)
 
#define MFS_HL_MASK_3   (0x08u)
 
#define MFS_HL_MASK_4   (0x10u)
 
#define MFS_HL_MASK_5   (0x20u)
 
#define MFS_HL_MASK_6   (0x40u)
 
#define MFS_HL_MASK_7   (0x80u)
 
#define MFS_HL_MASK_0_2   (0x07u)
 
#define MFS_HL_MASK_0_3   (0x0Fu)
 
#define MFS_HL_MASK_0_6   (0x7Fu)
 
#define MFS_HL_MASK_4_7   (0xF0u)
 
#define MFS_HL_MASK_0_7   (0x000000FFu)
 
#define MFS_HL_MASK_8_15   (0x0000FF00u)
 
#define MFS_HL_MASK_16_23   (0x00FF0000u)
 
#define MFS_HL_MASK_24_31   (0xFF000000u)
 
#define MFS_HL_MASK_0_15   (0x0000FFFFu)
 
#define MFS_HL_MASK_16_31   (0xFFFF0000u)
 

Functions

static stc_mfs_hl_intern_data_t * MfsHlGetInternDataPtr (volatile stc_mfsn_t *pstcMfs)
 Return the internal data for a certain MFS_HL instance. More...
 
static uint16_t MfsHlGetMin (uint16_t u16Num1, uint16_t u16Num2)
 Get minimum number. More...
 
static void MfsHlWriteBuf (volatile stc_mfsn_t *pstcMfs, stc_mfs_hl_intern_data_t *pstcMfsHlInternData)
 Write the contents of the buffer to Transmit Data Register. More...
 
static void MfsHlIrqHandlerTx (volatile stc_mfsn_t *pstcMfs, void *pvHandle)
 MFS_HL transmit interrupt service routine. More...
 
static void MfsHlReadBuf (volatile stc_mfsn_t *pstcMfs, stc_mfs_hl_intern_data_t *pstcMfsHlInternData)
 Store received data into buffer. More...
 
static void MfsHlIrqHandlerRx (volatile stc_mfsn_t *pstcMfs, void *pvHandle)
 MFS_HL receive interrupt service routine. More...
 
static void MfsHlIrqHandlerSts (volatile stc_mfsn_t *pstcMfs, void *pvHandle)
 MFS_HL status interrupt service routine. More...
 
static void MfsHlFifoUseInit (volatile stc_mfsn_t *pstcMfs, uint16_t u16BufFillLvl)
 MFS_HL Initialize FIFO to use. More...
 
static void MfsHlI2cDataTxMaster (volatile stc_mfsn_t *pstcI2c, stc_mfs_hl_intern_data_t *pstcMfsHlInternData)
 MFS_HL Operation to send data for I2C master. More...
 
static void MfsHlI2cDataRxMaster (volatile stc_mfsn_t *pstcI2c, stc_mfs_hl_intern_data_t *pstcMfsHlInternData)
 MFS_HL Operation to receive data for I2C master. More...
 
static void MfsHlI2cPreStartSlave (volatile stc_mfsn_t *pstcI2c, stc_mfs_hl_intern_data_t *pstcMfsHlInternData)
 MFS_HL Start operation for I2C slave. More...
 
static void MfsHlI2cDataRxSlave (volatile stc_mfsn_t *pstcI2c, stc_mfs_hl_intern_data_t *pstcMfsHlInternData)
 MFS_HL Operation to receive data for I2C slave. More...
 
static void MfsHlI2cDataTxSlave (volatile stc_mfsn_t *pstcI2c, stc_mfs_hl_intern_data_t *pstcMfsHlInternData)
 MFS_HL Operation to send data for I2C slave. More...
 
static void MfsHlI2cIrqHandlerTx (volatile stc_mfsn_t *pstcMfs, void *pvHandle)
 MFS_HL transmit interrupt service routine for I2C. More...
 
static void MfsHlI2cIrqHandlerRx (volatile stc_mfsn_t *pstcMfs, void *pvHandle)
 MFS_HL receive interrupt service routine for I2C. More...
 
static void MfsHlI2cIrqHandlerSts (volatile stc_mfsn_t *pstcMfs, void *pvHandle)
 MFS_HL status interrupt service routine for I2C. More...
 
static en_result_t MfsHlI2cStartSlave (volatile stc_mfsn_t *pstcI2c, stc_mfs_hl_intern_data_t *pstcMfsHlInternData)
 Start operation as I2C slave. More...
 
static en_result_t MfsHlI2cWaitIntState (volatile stc_mfs_hl_intern_data_t *pstcMfsHlInternData)
 Wait to change I2C interruption state. More...
 
static en_result_t MfsHlI2cChkTxRxComplete (stc_mfs_hl_intern_data_t *pstcMfsHlInternData, uint32_t u32MaxCnt)
 Check changing I2C interruption state. More...
 
en_result_t Mfs_Hl_Uart_Init (volatile stc_mfsn_t *pstcUart, stc_mfs_hl_uart_config_t *pstcConfig)
 Initialize an MFS_HL module as UART mode. This Function initialises the MFS according the UART setup in the passed configuration structure. Several checking are done before that and an error is returned if invalid Modes are requested. More...
 
en_result_t Mfs_Hl_Uart_DeInit (volatile stc_mfsn_t *pstcUart)
 UART deinitialisation of a MFS_HL module. More...
 
en_result_t Mfs_Hl_Csio_Init (volatile stc_mfsn_t *pstcCsio, stc_mfs_hl_csio_config_t *pstcConfig)
 Initialize an MFS_HL module as CSIO mode. More...
 
en_result_t Mfs_Hl_Csio_DeInit (volatile stc_mfsn_t *pstcCsio)
 CSIO deinitialisation of a MFS_HL module. More...
 
en_result_t Mfs_Hl_Csio_SynchronousTrans (volatile stc_mfsn_t *pstcCsio, const uint8_t *pu8TxData, uint8_t *pu8RxData, uint16_t u16TransferSize, boolean_t bCsHolding)
 Simultaneously transmit and receive data as CSIO master. More...
 
en_result_t Mfs_Hl_Lin_Init (volatile stc_mfsn_t *pstcLin, stc_mfs_hl_lin_config_t *pstcConfig)
 Initialize an MFS_HL module as LIN mode. More...
 
en_result_t Mfs_Hl_Lin_DeInit (volatile stc_mfsn_t *pstcLin)
 LIN deinitialisation of a MFS_HL module. More...
 
en_result_t Mfs_Hl_Lin_SetBreak (volatile stc_mfsn_t *pstcLin)
 Set LIN Break with an MFS_HL module in LIN Master Mode. More...
 
en_result_t Mfs_Hl_Lin_SetNewBaudDivisor (volatile stc_mfsn_t *pstcLin, uint16_t u16BaudDivisor)
 Set new baud divisor (NOT Baud Rate!) in LIN Slave Mode. More...
 
en_result_t Mfs_Hl_Lin_TransferRxBuffer (volatile stc_mfsn_t *pstcLin, uint8_t *pu8Data, uint16_t u16ReadCount)
 Transfers n bytes of recent receive buffer to user buffer. More...
 
en_result_t Mfs_Hl_Lin_DisableRxInterrupt (volatile stc_mfsn_t *pstcLin)
 Disable reception interrupt for LIN mode. More...
 
en_result_t Mfs_Hl_I2c_Init (volatile stc_mfsn_t *pstcI2c, stc_mfs_hl_i2c_config_t *pstcConfig)
 Initialize an MFS_HL module as I2C mode. This Function initialises the MFS according the I2C setup in the passed Config Struct. Several Checkings are done before that and an error is returned if invalid Modes are requested. More...
 
en_result_t Mfs_Hl_I2c_DeInit (volatile stc_mfsn_t *pstcI2c)
 I2C deinitialisation of a MFS_HL module. More...
 
en_result_t Mfs_Hl_I2c_Write (volatile stc_mfsn_t *pstcI2c, uint8_t u8SlaveAddr, uint8_t *pu8Data, uint16_t *pu16WriteCnt, boolean_t bBlocking)
 Write data to MFS_HL module for I2C. More...
 
en_result_t Mfs_Hl_I2c_Read (volatile stc_mfsn_t *pstcI2c, uint8_t u8SlaveAddr, uint8_t *pu8Data, uint16_t *pu16ReadCnt, boolean_t bBlocking)
 Read received data from I2C. More...
 
en_result_t Mfs_Hl_I2c_WaitTxComplete (volatile stc_mfsn_t *pstcI2c, uint32_t u32MaxCnt)
 Check to complete I2C transmission. More...
 
en_result_t Mfs_Hl_I2c_WaitRxComplete (volatile stc_mfsn_t *pstcI2c, uint32_t u32MaxCnt)
 Check to complete I2C reception. More...
 
en_result_t Mfs_Hl_Write (volatile stc_mfsn_t *pstcMfs, uint8_t *pu8Data, uint16_t u16WriteCnt, boolean_t bBlocking, boolean_t bCsHolding)
 Write data to MFS_HL module synchronously or asynchronously. More...
 
en_result_t Mfs_Hl_Read (volatile stc_mfsn_t *pstcMfs, uint8_t *pu8Data, uint16_t *pu16DataCnt, uint16_t u16ReadCnt, boolean_t bBlocking)
 Read received data from MFS_HL module synchronously or asynchronously. More...
 
en_result_t Mfs_Hl_GetBufferPointer (volatile stc_mfsn_t *pstcMfs, en_mfs_hl_buffer_t enBufIndex, stc_mfs_hl_buffer_t **ppstcBuffer)
 Get the internal TX or RX buffer pointer. More...
 

Variables

static stc_mfs_hl_instance_data_t m_astcMfsHlInstanceDataLut [MfsInstanceIndexMax]
 Look-up table for all enabled MFS_HL instances and their internal data. More...
 

Detailed Description

MFS High Level functions

History:

  • 2013-03-26 1.0 NT First version.
  • 2014-05-26 1.1 EZ Return Error when receiving errors occurs in Mfs_Hl_Read(). Add a function to get the pointer of TX or RX buffer.

Definition in file mfs_hl.c.