PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
MFS High Level Functions (MFS_HL)

How to use MFS High Level module. More...

Data Structures

struct  stc_mfs_hl_buffer
 MFS_HL ring buffer. More...
 
struct  stc_mfs_hl_uart_config
 MFS_HL UART configuration. More...
 
struct  stc_mfs_hl_spi_config
 MFS_HL SPI configuration. More...
 
struct  stc_mfs_hl_timer_config
 MFS_HL Timer mode configuration. More...
 
struct  stc_mfs_hl_csio_config
 MFS_HL CSIO configuration. More...
 
struct  stc_mfs_hl_i2c_config
 MFS_HL I2C configuration. More...
 
struct  stc_mfs_hl_lin_config
 MFS_HL LIN configuration. More...
 
struct  stc_mfs_hl_intern_data
 MFS_HL module internal data, storing internal information for each enabled MFS instance. More...
 
struct  stc_mfs_hl_instance_data
 MFS_HL instance data type. More...
 

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)
 
#define MFS_HL_MODE_GROUP_CHK   (0xF0u)
 MFS_HL mode group. More...
 
#define MFS_HL_MODE_GROUP_UART   (0x10u)
 
#define MFS_HL_MODE_GROUP_CSIO   (0x20u)
 
#define MFS_HL_MODE_GROUP_I2C   (0x30u)
 
#define MFS_HL_MODE_GROUP_LIN   (0x40u)
 

Typedefs

typedef void(* mfs_hl_tx_cb_func_ptr_t )(uint16_t)
 MFS_HL callback function prototypes. More...
 
typedef void(* mfs_hl_rx_cb_func_ptr_t )(uint16_t)
 
typedef uint8_t(* mfs_hl_i2c_slv_cb_func_prt_t )(uint8_t)
 
typedef void(* mfs_hl_lin_brk_func_ptr_t )(void)
 
typedef enum en_mfs_hl_fifo_usage en_mfs_hl_fifo_usage_t
 MFS_HL FIFO usage. More...
 
typedef enum en_mfs_hl_exec en_mfs_hl_exec_t
 MFS_HL Execution status. More...
 
typedef enum en_mfs_hl_mfs_mode en_mfs_hl_mfs_mode_t
 MFS_HL MFS mode. More...
 
typedef enum
en_mfs_hl_i2c_wait_select 
en_mfs_hl_i2c_wait_select_t
 MFS_HL I2C wait selection. More...
 
typedef enum
en_mfs_hl_i2c_int_state 
en_mfs_hl_i2c_int_state_t
 MFS_HL I2C interrupt status. More...
 
typedef struct stc_mfs_hl_buffer stc_mfs_hl_buffer_t
 MFS_HL ring buffer. More...
 
typedef struct
stc_mfs_hl_uart_config 
stc_mfs_hl_uart_config_t
 MFS_HL UART configuration. More...
 
typedef struct
stc_mfs_hl_spi_config 
stc_mfs_hl_spi_config_t
 MFS_HL SPI configuration. More...
 
typedef struct
stc_mfs_hl_timer_config 
stc_mfs_hl_timer_config_t
 MFS_HL Timer mode configuration. More...
 
typedef struct
stc_mfs_hl_csio_config 
stc_mfs_hl_csio_config_t
 MFS_HL CSIO configuration. More...
 
typedef struct
stc_mfs_hl_i2c_config 
stc_mfs_hl_i2c_config_t
 MFS_HL I2C configuration. More...
 
typedef struct
stc_mfs_hl_lin_config 
stc_mfs_hl_lin_config_t
 MFS_HL LIN configuration. More...
 
typedef enum en_mfs_hl_buffer en_mfs_hl_buffer_t
 Get the poitner to internal RX or TX buffer. More...
 
typedef struct
stc_mfs_hl_intern_data 
stc_mfs_hl_intern_data_t
 MFS_HL module internal data, storing internal information for each enabled MFS instance. More...
 
typedef struct
stc_mfs_hl_instance_data 
stc_mfs_hl_instance_data_t
 MFS_HL instance data type. More...
 

Enumerations

enum  en_mfs_hl_fifo_usage {
  MfsHlUseNoFifo = 0,
  MfsHlUseFifo = 1
}
 MFS_HL FIFO usage. More...
 
enum  en_mfs_hl_exec {
  MfsHlExecStby = 0,
  MfsHlExecReceiving = 1,
  MfsHlExecTransmitting = 2,
  MfsHlExecWaitTxBusIdle = 3
}
 MFS_HL Execution status. More...
 
enum  en_mfs_hl_mfs_mode {
  MfsHlModeStby = 0x00,
  MfsHlModeUartNormal = 0x10,
  MfsHlModeUartMulti = 0x11,
  MfsHlModeCsioNormalMaster = 0x20,
  MfsHlModeCsioNormalMasterTimer = 0x21,
  MfsHlModeCsioNormalSlave = 0x22,
  MfsHlModeCsioNormalSlaveTimer = 0x23,
  MfsHlModeCsioSpiMaster = 0x28,
  MfsHlModeCsioSpiMasterWithCs = 0x29,
  MfsHlModeCsioSpiSlave = 0x2A,
  MfsHlModeCsioSpiSlaveWithCs = 0x2B,
  MfsHlModeI2cMaster = 0x30,
  MfsHlModeI2cSlave = 0x31,
  MfsHlModeI2cMasterFast = 0x32,
  MfsHlModeI2cSlaveFast = 0x33,
  MfsHlModeLinMaster = 0x40,
  MfsHlModeLinSlave = 0x41
}
 MFS_HL MFS mode. More...
 
enum  en_mfs_hl_i2c_wait_select {
  MfsHlI2cWaitAfterAck = 0,
  MfsHlI2cWaitAfterDataTxRx = 1
}
 MFS_HL I2C wait selection. More...
 
enum  en_mfs_hl_i2c_int_state {
  MfsHlI2cIntStateStby = 0,
  MfsHlI2cIntStateEndData = 1,
  MfsHlI2cIntStateNack = 2,
  MfsHlI2cIntStateStopCond = 3,
  MfsHlI2cIntStateErr = 0xEE
}
 MFS_HL I2C interrupt status. More...
 
enum  en_mfs_hl_buffer {
  MfsHlRxBuffer = 0u,
  MfsHlTxBuffer = 1u
}
 Get the poitner to internal RX or TX buffer. More...
 

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

How to use MFS High Level module.

Provided functions of MFS_HL module:

Mfs_Hl_Uart_Init() is used to initialize an MFS instance to UART mode with parameter pstcConfig of type stc_mfs_hl_uart_config_t. Mfs_Hl_Uart_DeInit() is used to reset all MFS UART related register. So this function is used after initialization by Mfs_Hl_Uart_Init().

Mfs_Hl_Csio_Init() is used to initialize an MFS instance to CSIO mode with parameter pstcConfig of type stc_mfs_hl_csio_config_t. This function can be able to set timer mode or SPI mode using chip select (CS) with parameter pstcConfig->pstcMfsSpiConfig of type stc_mfs_hl_spi_config_t. Mfs_Hl_Csio_DeInit() is used to reset all MFS CSIO related register. So this function is used after initialization by Mfs_Hl_Csio_Init(). Mfs_Hl_Csio_SynchronousTrans() is used to transfer and receive data simultaneously. This function is only used by blocking. So interrupt is not used for this function.

Mfs_Hl_Lin_Init() is used to initialize an MFS instance to LIN mode with its dedicated LIN configuration (stc_mfs_hl_lin_config_t). Mfs_Hl_Lin_DeInit() is used to reset all MFS LIN related register. So this function is used after initialization by Mfs_Hl_Lin_Init(). Mfs_Hl_Lin_SetBreak() set the LIN Break in LIN Master mode. The baud rate divisor (not the rate itself!) can be adjusted by Mfs_Hl_Lin_SetNewBaudDivisor() after measurement with a dedicated ICU in LIN Slave mode. Note that the LIN functionality only works properly when the MFS is connected to a LIN transceiver, which means, that the SOT line as always read-back by SIN input! Mfs_Hl_Lin_DisableRxInterrupt() is used to disable the Rx interrupt, if a LIN frame was completely read and a new frame beginning with the LIN break is awaited to avoid unnecessary reception of a '0'-Byte with a framing error. Mfs_Hl_Lin_TransferRxBuffer() transfers the reception data from the internal ring buffer to a user buffer. This function can be used for LIN Master and Slave mode, because of the external LIN transceiver, every data (transmission and/or reception) is always read completely to the reception buffer.

Mfs_Hl_I2c_Init() is used to initialize an MFS instance to I2C mode with parameter pstcConfig of type stc_mfs_hl_i2c_config_t. Mfs_Hl_I2c_DeInit() is used to reset all MFS I2C related register. So this function is used after initialization by Mfs_Hl_I2c_Init(). Mfs_Hl_I2c_Write() is used to transmit data, and Mfs_Hl_I2c_Read() is used to receive data on I2C mode. These function can use synchronously (blocking-call) or asynchronously(non-blocking-call). If user wants to use it synchronously, the parameter bBlocking of Mfs_Hl_I2c_Write() or/and Mfs_Hl_I2c_Read() should specified TRUE. Otherwise, if user wants to use it asynchronously, the parameter bBlocking of Mfs_Hl_I2c_Write() or/and Mfs_Hl_I2c_Read() should specified FALSE. These functions are used for I2C mode. But Mfs_Hl_Read() and Mfs_Hl_Write() can't use for I2C. Mfs_Hl_I2c_WaitTxComplete() and Mfs_Hl_I2c_WaitRxComplete() are used to check complete transmission or receiption. If Mfs_Hl_I2c_Write() is used by non-blocking, please call Mfs_Hl_I2c_WaitTxComplete() at the application periodically because execution status doesn't change to standby if stop condition isn't detected. If Mfs_Hl_I2c_Read() is used by non-blocking, please call Mfs_Hl_I2c_WaitRxComplete() at the application periodically because execution status doesn't change to standby if stop condition isn't detected.

For UART, CSIO or LIN, Mfs_Hl_Read() and Mfs_Hl_Write() can use for communication. See the description of these functions for detail.

Macro Definition Documentation

#define MFS_HL_BGR_MASK   (0x7FFFu)

Definition at line 76 of file mfs_hl.c.

Referenced by Mfs_Hl_Csio_Init(), Mfs_Hl_I2c_Init(), Mfs_Hl_Lin_Init(), and Mfs_Hl_Uart_Init().

#define MFS_HL_MASK_0   (0x01u)

Definition at line 91 of file mfs_hl.c.

#define MFS_HL_MASK_0_15   (0x0000FFFFu)

Definition at line 108 of file mfs_hl.c.

#define MFS_HL_MASK_0_2   (0x07u)

Definition at line 99 of file mfs_hl.c.

Referenced by Mfs_Hl_Csio_Init().

#define MFS_HL_MASK_0_3   (0x0Fu)

Definition at line 100 of file mfs_hl.c.

Referenced by Mfs_Hl_Csio_Init().

#define MFS_HL_MASK_0_6   (0x7Fu)

Definition at line 101 of file mfs_hl.c.

Referenced by Mfs_Hl_I2c_Init().

#define MFS_HL_MASK_0_7   (0x000000FFu)

Definition at line 104 of file mfs_hl.c.

Referenced by MfsHlWriteBuf().

#define MFS_HL_MASK_1   (0x02u)

Definition at line 92 of file mfs_hl.c.

#define MFS_HL_MASK_16_23   (0x00FF0000u)

Definition at line 106 of file mfs_hl.c.

#define MFS_HL_MASK_16_31   (0xFFFF0000u)

Definition at line 109 of file mfs_hl.c.

#define MFS_HL_MASK_2   (0x04u)

Definition at line 93 of file mfs_hl.c.

#define MFS_HL_MASK_24_31   (0xFF000000u)

Definition at line 107 of file mfs_hl.c.

#define MFS_HL_MASK_3   (0x08u)

Definition at line 94 of file mfs_hl.c.

#define MFS_HL_MASK_4   (0x10u)

Definition at line 95 of file mfs_hl.c.

#define MFS_HL_MASK_4_7   (0xF0u)

Definition at line 102 of file mfs_hl.c.

#define MFS_HL_MASK_5   (0x20u)

Definition at line 96 of file mfs_hl.c.

#define MFS_HL_MASK_6   (0x40u)

Definition at line 97 of file mfs_hl.c.

#define MFS_HL_MASK_7   (0x80u)

Definition at line 98 of file mfs_hl.c.

#define MFS_HL_MASK_8_15   (0x0000FF00u)

Definition at line 105 of file mfs_hl.c.

#define MFS_HL_MODE_GROUP_CHK   (0xF0u)

MFS_HL mode group.

Definition at line 179 of file mfs_hl.h.

Referenced by Mfs_Hl_Read(), and MfsHlIrqHandlerRx().

#define MFS_HL_MODE_GROUP_CSIO   (0x20u)

Definition at line 181 of file mfs_hl.h.

Referenced by Mfs_Hl_Read(), and MfsHlIrqHandlerRx().

#define MFS_HL_MODE_GROUP_I2C   (0x30u)

Definition at line 182 of file mfs_hl.h.

#define MFS_HL_MODE_GROUP_LIN   (0x40u)

Definition at line 183 of file mfs_hl.h.

Referenced by Mfs_Hl_Read(), and MfsHlIrqHandlerRx().

#define MFS_HL_MODE_GROUP_UART   (0x10u)

Definition at line 180 of file mfs_hl.h.

Referenced by Mfs_Hl_Read(), and MfsHlIrqHandlerRx().

#define MFS_HL_NUM_10   (10u)

Definition at line 88 of file mfs_hl.c.

Referenced by MfsHlI2cWaitIntState().

#define MFS_HL_NUM_2   (2u)

Definition at line 80 of file mfs_hl.c.

Referenced by MfsHlReadBuf(), and MfsHlWriteBuf().

#define MFS_HL_NUM_3   (3u)

Definition at line 81 of file mfs_hl.c.

Referenced by MfsHlReadBuf(), and MfsHlWriteBuf().

#define MFS_HL_NUM_4   (4u)

Definition at line 82 of file mfs_hl.c.

Referenced by Mfs_Hl_Uart_Init(), MfsHlReadBuf(), and MfsHlWriteBuf().

#define MFS_HL_NUM_5   (5u)

Definition at line 83 of file mfs_hl.c.

#define MFS_HL_NUM_6   (6u)

Definition at line 84 of file mfs_hl.c.

#define MFS_HL_NUM_7   (7u)

Definition at line 85 of file mfs_hl.c.

#define MFS_HL_NUM_8   (8u)

Definition at line 86 of file mfs_hl.c.

Referenced by MfsHlReadBuf(), and MfsHlWriteBuf().

#define MFS_HL_NUM_9   (9u)

Definition at line 87 of file mfs_hl.c.

#define MFS_HL_RELOADVAL_MIN4CSIO   (3u)

Definition at line 74 of file mfs_hl.c.

Referenced by Mfs_Hl_Csio_Init().

#define MFS_HL_RELOADVAL_MIN4LIN   (3u)

Definition at line 75 of file mfs_hl.c.

Referenced by Mfs_Hl_Lin_Init().

#define MFS_HL_RELOADVAL_MIN4UART   (4u)

Definition at line 73 of file mfs_hl.c.

Typedef Documentation

Get the poitner to internal RX or TX buffer.

The buffer information can be gotten with this pointer.

MFS_HL Execution status.

MFS_HL FIFO usage.

MFS_HL I2C interrupt status.

MFS_HL I2C wait selection.

MFS_HL MFS mode.

typedef uint8_t(* mfs_hl_i2c_slv_cb_func_prt_t)(uint8_t)

Definition at line 169 of file mfs_hl.h.

typedef void(* mfs_hl_lin_brk_func_ptr_t)(void)

Definition at line 170 of file mfs_hl.h.

typedef void(* mfs_hl_rx_cb_func_ptr_t)(uint16_t)

Definition at line 168 of file mfs_hl.h.

typedef void(* mfs_hl_tx_cb_func_ptr_t)(uint16_t)

MFS_HL callback function prototypes.

Definition at line 167 of file mfs_hl.h.

MFS_HL ring buffer.

Contains all parameter for ring buffer handling.

MFS_HL CSIO configuration.

Contains all parameter for configuratin a MFS channel, if set to CSIO mode.

MFS_HL I2C configuration.

Contains all parameter for configuratin a MFS channel, if set to I2C mode.

MFS_HL instance data type.

MFS_HL module internal data, storing internal information for each enabled MFS instance.

MFS_HL LIN configuration.

Contains all parameter for configuratin a MFS channel, if set to LIN mode. This configuration was rolled-out from stc_mfs_hl_lin_config_t to save RAM memory since LIN is a special mode. Only use functions with prefix 'Mfs_Hl_Lin_'!

MFS_HL SPI configuration.

Contains all parameter for configuratin a MFS channel, if set to CSIO mode.

MFS_HL Timer mode configuration.

Contains all parameter for configuratin a MFS channel, if set to CSIO mode.

MFS_HL UART configuration.

Contains all parameter for configuratin a MFS channel, if set to UART mode.

Enumeration Type Documentation

Get the poitner to internal RX or TX buffer.

The buffer information can be gotten with this pointer.

Enumerator
MfsHlRxBuffer 

MFS high level RX buffer.

MfsHlTxBuffer 

MFS high level TX buffer.

Definition at line 413 of file mfs_hl.h.

MFS_HL Execution status.

Enumerator
MfsHlExecStby 

MFS doesn't active.

MfsHlExecReceiving 

MFS is performing reception.

MfsHlExecTransmitting 

MFS is performing transmission.

MfsHlExecWaitTxBusIdle 

MFS is waiting TX bus idle.

Definition at line 203 of file mfs_hl.h.

MFS_HL FIFO usage.

Enumerator
MfsHlUseNoFifo 

Don't use MFS FIFO function.

MfsHlUseFifo 

Use MFS FIFO function.

Definition at line 193 of file mfs_hl.h.

MFS_HL I2C interrupt status.

Enumerator
MfsHlI2cIntStateStby 

Non interruption.

MfsHlI2cIntStateEndData 

End to transmit data.

MfsHlI2cIntStateNack 

Receive NACK.

MfsHlI2cIntStateStopCond 

Stop condition.

MfsHlI2cIntStateErr 

Error.

Definition at line 250 of file mfs_hl.h.

MFS_HL I2C wait selection.

Enumerator
MfsHlI2cWaitAfterAck 

Waits (9bits) after acknowledgement.

MfsHlI2cWaitAfterDataTxRx 

Waits (8bits) after data transmission or reception.

Definition at line 240 of file mfs_hl.h.

MFS_HL MFS mode.

Enumerator
MfsHlModeStby 

MFS is no active.

MfsHlModeUartNormal 

UART normal mode.

MfsHlModeUartMulti 

UART multi-processor mode.

MfsHlModeCsioNormalMaster 

CSIO normal mode/master.

MfsHlModeCsioNormalMasterTimer 

CSIO normal mode/master/use serial timer.

MfsHlModeCsioNormalSlave 

CSIO normal mode/slave.

MfsHlModeCsioNormalSlaveTimer 

CSIO normal mode/slave/use serial timer.

MfsHlModeCsioSpiMaster 

CSIO SPI mode/master.

MfsHlModeCsioSpiMasterWithCs 

CSIO SPI mode/master/use chip select.

MfsHlModeCsioSpiSlave 

CSIO SPI mode/slave.

MfsHlModeCsioSpiSlaveWithCs 

CSIO SPI mode/slave/use chip select.

MfsHlModeI2cMaster 

I2C mode/master.

MfsHlModeI2cSlave 

I2C mode/slave.

MfsHlModeI2cMasterFast 

I2C mode/master/Fast mode.

MfsHlModeI2cSlaveFast 

I2C mode/master/Fast mode.

MfsHlModeLinMaster 

LIN mode/master.

MfsHlModeLinSlave 

LIN mode/slave.

Definition at line 215 of file mfs_hl.h.

Function Documentation

en_result_t Mfs_Hl_Csio_DeInit ( volatile stc_mfsn_t *  pstcCsio)

CSIO deinitialisation of a MFS_HL module.

This function de-initializes the MFS_HL module activating as CSIO. This function uses for mode change or other changed settings.

Parameters
[in]pstcCsioPointer to CSIO (MFS) instance register area
Return values
OkDeinitialisation of MFS_HL module successfully done
ErrorInvalidParameterIf one of following conditions are met:
  • pstcCsio == NULL
  • pstcMfsInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))

Definition at line 2317 of file mfs_hl.c.

References ErrorInvalidParameter, FALSE, Mfs_DeInitIrq(), Mfs_SetRxIntCallBack(), Mfs_SetStsIntCallBack(), Mfs_SetTxIntCallBack(), Mfs_SetUpperLayerHandle(), MfsHlExecStby, MfsHlGetInternDataPtr(), MfsHlModeStby, Ok, stc_mfs_hl_intern_data::pfnLinBreakCbFunction, stc_mfs_hl_intern_data::pfnReceiveCbFunction, stc_mfs_hl_intern_data::pfnTransmitCbFunction, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcRxBuffer, stc_mfs_hl_intern_data::stcTxBuffer, TRUE, stc_mfs_hl_intern_data::u8Exec, and stc_mfs_hl_intern_data::u8MfsMode.

Here is the call graph for this function:

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.

This Function initialises the MFS according the CSIO setup in the passed configuration structure. Several checking are done before that and an error is returned if invalid Modes are requested.

Parameters
[in]pstcCsioPointer to CSIO (MFS) instance register area
[in]pstcConfigMFS CSIO configuration
Return values
OkInitializiation of MFS_HL module successfully done.
ErrorInvalidParameterIf one of following conditions are met:
  • pstcCsio == NULL
  • pstcConfig == NULL
  • pstcMfsInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
  • one or more enumerated values in pstcUart out of enumaration

Definition at line 1880 of file mfs_hl.c.

References stc_mfs_hl_csio_config::bBitDirection, stc_mfs_hl_spi_config::bCsLevel, stc_mfs_hl_buffer::bOverflow, stc_mfs_hl_csio_config::bSignalSystem, stc_mfs_hl_timer_config::bTimerSyncEnable, ErrorInvalidParameter, FALSE, MFS6, MFS7, MFS_DATA_LEN_10, MFS_DATA_LEN_11, MFS_DATA_LEN_12, MFS_DATA_LEN_13, MFS_DATA_LEN_14, MFS_DATA_LEN_15, MFS_DATA_LEN_16, MFS_DATA_LEN_20, MFS_DATA_LEN_24, MFS_DATA_LEN_32, MFS_DATA_LEN_5, MFS_DATA_LEN_6, MFS_DATA_LEN_7, MFS_DATA_LEN_8, MFS_DATA_LEN_9, Mfs_GetReloadValue(), MFS_HL_BGR_MASK, MFS_HL_MASK_0_2, MFS_HL_MASK_0_3, MFS_HL_RELOADVAL_MIN4CSIO, Mfs_InitRxIrq(), Mfs_InitTxIrq(), MFS_MD_CSIO, Mfs_SetRxIntCallBack(), Mfs_SetStsIntCallBack(), Mfs_SetTxIntCallBack(), Mfs_SetUpperLayerHandle(), MFS_WAIT_TIME_0BIT, MFS_WAIT_TIME_1BIT, MFS_WAIT_TIME_2BITS, MFS_WAIT_TIME_3BITS, MfsCsioActNormalMode, MfsCsioActSpiMode, MfsCsioMaster, MfsCsioSlave, MfsEightBits, MfsElevenBits, MfsFifteenBits, MfsFiveBits, MfsFourteenBits, MfsHlExecStby, MfsHlFifoUseInit(), MfsHlGetInternDataPtr(), MfsHlIrqHandlerRx(), MfsHlIrqHandlerSts(), MfsHlIrqHandlerTx(), MfsHlModeCsioNormalMaster, MfsHlModeCsioNormalMasterTimer, MfsHlModeCsioNormalSlave, MfsHlModeCsioSpiMaster, MfsHlModeCsioSpiMasterWithCs, MfsHlModeCsioSpiSlave, MfsHlModeCsioSpiSlaveWithCs, MfsHlUseFifo, MfsHlUseNoFifo, MfsNineBits, MfsSevenBits, MfsSixBits, MfsSixteenBits, MfsSyncWaitOne, MfsSyncWaitThree, MfsSyncWaitTwo, MfsSyncWaitZero, MfsTenBits, MfsThirteenBits, MfsThirtyTwoBits, MfsTwelveBits, MfsTwentyBits, MfsTwentyFourBits, Ok, stc_mfs_hl_intern_data::pfnReceiveCbFunction, stc_mfs_hl_csio_config::pfnRxCb, stc_mfs_hl_intern_data::pfnTransmitCbFunction, stc_mfs_hl_csio_config::pfnTxCb, stc_mfs_hl_csio_config::pstcMfsSpiCsConfig, stc_mfs_hl_csio_config::pstcMfsTimerConfig, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_csio_config::pu8RxBuf, stc_mfs_hl_csio_config::pu8TxBuf, stc_mfs_hl_intern_data::stcRxBuffer, stc_mfs_hl_intern_data::stcTxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_spi_config::u16CsDeSelect, stc_mfs_hl_buffer::u16FillCount, stc_mfs_hl_buffer::u16InIndex, stc_mfs_hl_buffer::u16OutIndex, stc_mfs_hl_csio_config::u16RxBufSize, stc_mfs_hl_intern_data::u16RxCallbackBufFillLevel, stc_mfs_hl_csio_config::u16RxCbBufFillLvl, stc_mfs_hl_timer_config::u16SerialTimer, stc_mfs_hl_csio_config::u16TxBufSize, stc_mfs_hl_buffer::u16TxCount, stc_mfs_hl_buffer::u16TxCounter, stc_mfs_hl_csio_config::u32DataRate, stc_mfs_hl_csio_config::u8CharLength, stc_mfs_hl_spi_config::u8CsDivision, stc_mfs_hl_spi_config::u8CsHoldDelay, stc_mfs_hl_csio_config::u8CsioActMode, stc_mfs_hl_csio_config::u8CsioMode, stc_mfs_hl_spi_config::u8CsSetDelay, stc_mfs_hl_intern_data::u8DataWidth, stc_mfs_hl_intern_data::u8Exec, stc_mfs_hl_csio_config::u8FifoUsage, stc_mfs_hl_intern_data::u8FifoUsage, stc_mfs_hl_intern_data::u8MfsMode, stc_mfs_hl_csio_config::u8SyncWaitTime, stc_mfs_hl_timer_config::u8TimerDivision, and stc_mfs_hl_timer_config::u8TxByte.

Here is the call graph for this function:

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.

This function will transmit and receive the same amount of data, based on the serial (shift) clock signal (MFS SCK pin) in synchronous master or slave mode. The operation mode of the MFS instance must be setup for synchronous master or slave mode.

While the data in Mfs_Hl_Csio_SynchronousTrans::pu8TxData is transmitted the input data is received and stored in Mfs_Hl_Csio_SynchronousTrans::pu8RxData. The function operates in CSIO (blocking) mode only i.e. it will wait until the amount of data defined by Mfs_Hl_Csio_SynchronousTrans::u16TransferSize is transmitted/received. No MFS internal buffers or transfer counters are used. The TX/RX callback functions will not be called. Note, that in synchronous slave mode, the transfer is controlled by the external master device, providing the serial shift clock. This may cause this function to block very long time.

Because this function uses blocking method, no interrupts are needed and therfore are not used. Also no FIFO operation is performed.

Note
Synchronous (non-blocking) TX/RX operations are provided by using the functions Mfs_Hl_Write() and Mfs_Hl_Read() for MFS CSIO master and slave modes, too. Note, that these functions do not support full-duplex operation! This function can use only if character length was set to less or equal to eight bits. Mfs_Hl_Csio_SynchronousTrans::pu8TxData and Mfs_Hl_Csio_SynchronousTrans::pu8RxData can be set NULL, but either should be set except NULL. If only Mfs_Hl_Csio_SynchronousTrans::pu8TxData is set NULL, dummy data is sent and the received data is stored in the buffer shown by Mfs_Hl_Csio_SynchronousTrans::pu8RxData. If only Mfs_Hl_Csio_SynchronousTrans::pu8RxData is set NULL, the data of the buffer shown by Mfs_Hl_Csio_SynchronousTrans::pu8TxData is transmitted and the received data is thrown away.
Parameters
[in]pstcCsioPointer to CSIO (MFS) instance register area
[in]pu8TxDataPointer to transmit data buffer, can be NULL.
[in,out]pu8RxDataPointer to receive data buffer, can be NULL.
[in]u16TransferSizeTransmit size (Must be at least 1)
[in]bCsHoldingSpecify to hold chip select
Return values
OkTransfer done successfully.
ErrorInvalidParameterIf any of following conditions are met:
  • pstcCsio == NULL
  • pu8TxData == NULL or pu8RxData == NULL
  • u16TransferSize == 0
  • pstcMfsInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
ErrorOperationInProgressA transmission is still pending or the RX buffer is not empty.
ErrorInvalidModeMFS_HL module was not initalised in MFS CSIO mode.
ErrorCharacter length is over 8 bits.

Definition at line 2450 of file mfs_hl.c.

References Error, ErrorInvalidMode, ErrorInvalidParameter, FALSE, MFS_CSIO_SSR_ERR, MFS_CSIO_TBYTE_MAX, MFS_HL_NUM_1, MFS_MD_CSIO, MFS_SSR_RDRF, MfsHlGetInternDataPtr(), MfsHlModeCsioNormalMasterTimer, MfsHlModeCsioSpiMasterWithCs, Ok, PDL_WAIT_LOOP_HOOK(), stc_mfs_hl_intern_data::pfnReceiveCbFunction, TRUE, and stc_mfs_hl_intern_data::u8MfsMode.

Here is the call graph for this function:

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.

The buffer information can be gotten with this pointer.

Parameters
[in]pstcMfsPointer to MFS instance register area.
[in]enBufIndexBuffer index
[out]ppstcBufferPointer to the pointer of RX or TX buffer
Return values
OkWrite data successfully done.
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMfs == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
  • (enBuf != MfsHlRxBuffer) && (enBuf != MfsHlTxBuffer)

Definition at line 4671 of file mfs_hl.c.

References ErrorInvalidParameter, MfsHlGetInternDataPtr(), MfsHlRxBuffer, MfsHlTxBuffer, Ok, stc_mfs_hl_intern_data::stcRxBuffer, and stc_mfs_hl_intern_data::stcTxBuffer.

Here is the call graph for this function:

en_result_t Mfs_Hl_I2c_DeInit ( volatile stc_mfsn_t *  pstcI2c)

I2C deinitialisation of a MFS_HL module.

All used mfs register are reset to their default values.

Parameters
[in]pstcI2cPointer to I2C (MFS) instance register area
Return values
OkDeinitialisation of MFS_HL module successfully done
ErrorInvalidParameterIf one of following conditions are met:
  • pstcI2c == NULL
  • pstcMfsInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))

Definition at line 3446 of file mfs_hl.c.

References ErrorInvalidParameter, FALSE, Mfs_DeInitIrq(), Mfs_SetRxIntCallBack(), Mfs_SetStsIntCallBack(), Mfs_SetTxIntCallBack(), Mfs_SetUpperLayerHandle(), MfsHlExecStby, MfsHlGetInternDataPtr(), MfsHlModeStby, Ok, stc_mfs_hl_intern_data::pfnI2cSlvStCbFunction, stc_mfs_hl_intern_data::pfnLinBreakCbFunction, stc_mfs_hl_intern_data::pfnReceiveCbFunction, stc_mfs_hl_intern_data::pfnTransmitCbFunction, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcRxBuffer, stc_mfs_hl_intern_data::stcTxBuffer, TRUE, stc_mfs_hl_intern_data::u8Exec, and stc_mfs_hl_intern_data::u8MfsMode.

Here is the call graph for this function:

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.

Parameters
[in]pstcI2cPointer to I2C (MFS) instance register area
[in]pstcConfigMFS I2C configuration
Return values
OkInitializiation of MFS_HL module successfully done.
ErrorInvalidParameterIf one of following conditions are met:
  • pstcI2c == NULL
  • pstcConfig == NULL
  • pstcMfsInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
  • one or more enumerated values in pstcUart out of enumaration
ErrorUninitializedIf bus clock is over specification, NFCR can't set properly. So this function returned this error code.

Definition at line 3147 of file mfs_hl.c.

References stc_mfs_hl_buffer::bOverflow, ErrorInvalidParameter, ErrorUninitialized, FALSE, MFS_CLOCK_100M, MFS_CLOCK_120M, MFS_CLOCK_140M, MFS_CLOCK_160M, MFS_CLOCK_180M, MFS_CLOCK_200M, MFS_CLOCK_220M, MFS_CLOCK_240M, MFS_CLOCK_260M, MFS_CLOCK_280M, MFS_CLOCK_300M, MFS_CLOCK_320M, MFS_CLOCK_340M, MFS_CLOCK_360M, MFS_CLOCK_380M, MFS_CLOCK_400M, MFS_CLOCK_40M, MFS_CLOCK_60M, MFS_CLOCK_80M, MFS_FIFO_MAX_VAL, Mfs_GetBusClock(), MFS_HL_BGR_MASK, MFS_HL_MASK_0_6, MFS_I2C_FAST_MODE_PLUS_CH_A, MFS_I2C_FAST_MODE_PLUS_CH_B, Mfs_I2c_GetReloadValue(), Mfs_InitRxIrq(), Mfs_InitTxIrq(), MFS_MD_I2C, Mfs_SetRxIntCallBack(), Mfs_SetStsIntCallBack(), Mfs_SetTxIntCallBack(), Mfs_SetUpperLayerHandle(), MfsEightBits, MfsHlExecStby, MfsHlFifoUseInit(), MfsHlGetInternDataPtr(), MfsHlI2cIrqHandlerRx(), MfsHlI2cIrqHandlerSts(), MfsHlI2cIrqHandlerTx(), MfsHlModeI2cMaster, MfsHlModeI2cSlave, MfsHlUseFifo, MfsHlUseNoFifo, MfsI2cDisableFastModePlus, MfsI2cEnableFastModePlus, MfsI2cMaster, MfsI2cNoizeFilterLess100M, MfsI2cNoizeFilterLess120M, MfsI2cNoizeFilterLess140M, MfsI2cNoizeFilterLess160M, MfsI2cNoizeFilterLess180M, MfsI2cNoizeFilterLess200M, MfsI2cNoizeFilterLess220M, MfsI2cNoizeFilterLess240M, MfsI2cNoizeFilterLess260M, MfsI2cNoizeFilterLess280M, MfsI2cNoizeFilterLess300M, MfsI2cNoizeFilterLess320M, MfsI2cNoizeFilterLess340M, MfsI2cNoizeFilterLess360M, MfsI2cNoizeFilterLess380M, MfsI2cNoizeFilterLess400M, MfsI2cNoizeFilterLess40M, MfsI2cNoizeFilterLess60M, MfsI2cNoizeFilterLess80M, MfsI2cSlave, Ok, stc_mfs_hl_i2c_config::pfnI2cSlvStCb, stc_mfs_hl_intern_data::pfnI2cSlvStCbFunction, stc_mfs_hl_intern_data::pfnReceiveCbFunction, stc_mfs_hl_i2c_config::pfnRxCb, stc_mfs_hl_intern_data::pfnTransmitCbFunction, stc_mfs_hl_i2c_config::pfnTxCb, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcRxBuffer, stc_mfs_hl_intern_data::stcTxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16FillCount, stc_mfs_hl_buffer::u16InIndex, stc_mfs_hl_buffer::u16OutIndex, stc_mfs_hl_intern_data::u16RxCallbackBufFillLevel, stc_mfs_hl_buffer::u16TxCount, stc_mfs_hl_buffer::u16TxCounter, stc_mfs_hl_i2c_config::u32DataRate, stc_mfs_hl_intern_data::u8DataWidth, stc_mfs_hl_intern_data::u8Exec, stc_mfs_hl_i2c_config::u8FastMode, stc_mfs_hl_i2c_config::u8FifoUsage, stc_mfs_hl_intern_data::u8FifoUsage, stc_mfs_hl_i2c_config::u8I2cMode, stc_mfs_hl_intern_data::u8MfsMode, and stc_mfs_hl_i2c_config::u8SlvAddr.

Here is the call graph for this function:

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.

The received data is copied from Receive Data Register into the provided data buffer Mfs_Hl_I2c_Read::pu8Data. The slave address (Mfs_Hl_I2c_Read::u8SlaveAddr) is used on master mode. The size is defined by Mfs_Hl_I2c_Read::pu16ReadCnt. If non-blocking is specified (Mfs_Hl_I2c_Read::bBlocking is FALSE), this function will return immediately after available datas from remote device are received into the provided buffer. (Mfs_Hl_I2c_Read::pu8Data)

Anyway, Receive interrupt is used in any case.

Note: Don't access to the buffer which specified by pu8Data until reception processing completes.

Parameters
[in]pstcI2cPointer to I2C (MFS) instance register area.
[in]u8SlaveAddrSlave Address.
[in,out]pu8DataBuffer to store received characters.
[in,out]pu16ReadCntPointrer to variable for number of bytes been read.
[in]bBlockingIf TRUE, synchronously wait until pu16ReadCnt bytes have been received. If FALSE, return immediately.
Return values
OkRead data successfully done or started.
ErrorInvalidParameterIf one of following conditions are met:
  • pstcI2c == NULL
  • pu8Data == NULL
  • pu16ReadCnt == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
ErrorOperationInProgressIf the following condition is met:
  • A transmission or reception is still ongoing while another I2C operation should be started.
ErrorTimeoutInterruption state didn't change within the specified period of time.

Definition at line 3856 of file mfs_hl.c.

References ErrorInvalidParameter, ErrorOperationInProgress, ErrorTimeout, FALSE, MFS_FIFO_MAX_VAL, MFS_HL_NUM_1, MfsHlExecReceiving, MfsHlExecStby, MfsHlGetInternDataPtr(), MfsHlGetMin(), MfsHlI2cStartSlave(), MfsHlI2cWaitIntState(), MfsHlModeI2cMaster, MfsHlUseFifo, MfsI2cRead, Ok, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcRxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16InIndex, stc_mfs_hl_intern_data::u32I2cProcCnt, stc_mfs_hl_intern_data::u8Exec, stc_mfs_hl_intern_data::u8FifoUsage, and stc_mfs_hl_intern_data::u8MfsMode.

Here is the call graph for this function:

en_result_t Mfs_Hl_I2c_WaitRxComplete ( volatile stc_mfsn_t *  pstcI2c,
uint32_t  u32MaxCnt 
)

Check to complete I2C reception.

If Mfs_Hl_I2c_Read() is used by non-blocking, please call this function at the application periodically because execution status doesn't change to standby if stop condition isn't detected.

Parameters
[in]pstcI2cPointer to I2C (MFS) instance register area.
[in]u32MaxCntMaximum period to check state changing
Return values
OkWrite data successfully done.
ErrorInvalidParameterIf one of following conditions are met:
  • pstcI2c == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
ErrorInvalidModeA transmission is still ongoing.
ErrorOperationInProgressA reception is still ongoing.
ErrorTimeoutA reception didn't complete within the specified period.

Definition at line 4072 of file mfs_hl.c.

References ErrorInvalidMode, ErrorInvalidParameter, ErrorOperationInProgress, ErrorTimeout, MfsHlExecReceiving, MfsHlExecStby, MfsHlGetInternDataPtr(), MfsHlI2cChkTxRxComplete(), Ok, stc_mfs_hl_intern_data::stcRxBuffer, stc_mfs_hl_buffer::u16InIndex, and stc_mfs_hl_intern_data::u8Exec.

Here is the call graph for this function:

en_result_t Mfs_Hl_I2c_WaitTxComplete ( volatile stc_mfsn_t *  pstcI2c,
uint32_t  u32MaxCnt 
)

Check to complete I2C transmission.

If Mfs_Hl_I2c_Write() is used by non-blocking, please call this function at the application periodically because execution status doesn't change to standby if stop condition isn't detected.

Parameters
[in]pstcI2cPointer to I2C (MFS) instance register area.
[in]u32MaxCntMaximum period to check state changing
Return values
OkWrite data successfully done.
ErrorInvalidParameterIf one of following conditions are met:
  • pstcI2c == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
ErrorInvalidModeA reception is still ongoing.
ErrorOperationInProgressA transmission is still ongoing.
ErrorTimeoutA transmission didn't complete within the specified period.

Definition at line 4004 of file mfs_hl.c.

References ErrorInvalidMode, ErrorInvalidParameter, ErrorOperationInProgress, ErrorTimeout, MfsHlExecStby, MfsHlExecTransmitting, MfsHlGetInternDataPtr(), MfsHlI2cChkTxRxComplete(), Ok, stc_mfs_hl_intern_data::stcTxBuffer, stc_mfs_hl_buffer::u16OutIndex, and stc_mfs_hl_intern_data::u8Exec.

Here is the call graph for this function:

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.

The data provided by Mfs_Hl_I2c_Write::pu8Data is used directly and the transmission (via TX interrupt) is started, if not ongoing already.

If Mfs_Hl_I2c_Write::bBlocking is specified FALSE, the function will return immediately after datas are transfered to the remote device.

If Mfs_Hl_I2c_Write::bBlocking is specified TRUE, the function wait until all data is transferred to the MFS hardware FIFO. If the referenced MFS does not have a FIFO single data is written.

Note: Don't access to the buffer which specified by pu8Data until transmission processing completes.

Parameters
[in]pstcI2cPointer to I2C (MFS) instance register area
[in]u8SlaveAddrSlave address for master mode
[in]pu8DataPointer to data buffer for transmission
[in,out]pu16WriteCntPointrer to variable for number of bytes to send(must be at least 1). And pointrer to variable for number of bytes been sent.
[in]bBlockingIf TRUE, synchronously wait until all data is transferred into the hardware (Fifo) buffer. If FALSE, return immediately.
Return values
OkWrite data successfully done or started.
ErrorInvalidParameterIf one of following conditions are met:
  • pstcI2c == NULL
  • pu8Data == NULL
  • pu16WriteCnt == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
ErrorOperationInProgressIf the following condition is met:
  • A transmission or reception is still ongoing while another I2C operation should be started.
ErrorTimeoutInterruption state didn't change within the specified period of time.

Definition at line 3696 of file mfs_hl.c.

References ErrorInvalidParameter, ErrorOperationInProgress, ErrorTimeout, FALSE, MFS_HL_NUM_1, MfsHlExecStby, MfsHlExecTransmitting, MfsHlGetInternDataPtr(), MfsHlI2cStartSlave(), MfsHlI2cWaitIntState(), MfsHlModeI2cMaster, MfsHlUseFifo, MfsI2cWrite, Ok, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcTxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16OutIndex, stc_mfs_hl_intern_data::u32I2cProcCnt, stc_mfs_hl_intern_data::u8Exec, stc_mfs_hl_intern_data::u8FifoUsage, and stc_mfs_hl_intern_data::u8MfsMode.

Here is the call graph for this function:

en_result_t Mfs_Hl_Lin_DeInit ( volatile stc_mfsn_t *  pstcLin)

LIN deinitialisation of a MFS_HL module.

This function de-initializes the MFS_HL module activating as LIN. This function uses for mode change or other changed settings.

Parameters
[in]pstcLinPointer to LIN (MFS) instance register area
Return values
OkLIN Deinitialisation of MFS_HL module successfully done
ErrorInvalidModeMFS not in LIN mode
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMfs == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))

Definition at line 2895 of file mfs_hl.c.

References ErrorInvalidMode, Mfs_Hl_Uart_DeInit(), MFS_SMR_LIN_MODE, and MFS_SMR_MODEBITS_MASK.

Here is the call graph for this function:

en_result_t Mfs_Hl_Lin_DisableRxInterrupt ( volatile stc_mfsn_t *  pstcLin)

Disable reception interrupt for LIN mode.

Return values
OkBaud rate was set correctly
ErrorInvalidParameterIf one of following conditions are met:
  • pstcLin == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))

Definition at line 3102 of file mfs_hl.c.

References ErrorInvalidParameter, FALSE, MfsHlGetInternDataPtr(), and Ok.

Here is the call graph for this function:

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.

This Function initialises the MFS according the LIN setup in the passed configuration structure. Several checking are done before that and an error is returned if invalid Modes are requested.

Parameters
[in]pstcLinPointer to LIN (MFS) instance register area
[in]pstcConfigMFS LIN configuration
Return values
OkInitializiation of MFS_HL module successfully done.
ErrorInvalidParameterIf one of following conditions are met:
  • pstcCsio == NULL
  • pstcConfig == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
  • one or more enumerated values in pstcUart out of enumaration

Definition at line 2637 of file mfs_hl.c.

References stc_mfs_hl_lin_config::bLinBreakIrqEnable, stc_mfs_hl_buffer::bOverflow, ErrorInvalidParameter, FALSE, Mfs_GetReloadValue(), MFS_HL_BGR_MASK, MFS_HL_RELOADVAL_MIN4LIN, Mfs_InitRxIrq(), Mfs_InitTxIrq(), MFS_LIN_BREAK_13BITS, MFS_LIN_BREAK_14BITS, MFS_LIN_BREAK_15BITS, MFS_LIN_BREAK_16BITS, MFS_LIN_DELIMITER_1BIT, MFS_LIN_DELIMITER_2BITS, MFS_LIN_DELIMITER_3BITS, MFS_LIN_DELIMITER_4BITS, MFS_MD_LIN, MFS_RX_FIFO_MIN_VAL, Mfs_SetRxIntCallBack(), Mfs_SetStsIntCallBack(), Mfs_SetTxIntCallBack(), Mfs_SetUpperLayerHandle(), MfsEightBits, MfsHlExecStby, MfsHlFifoUseInit(), MfsHlGetInternDataPtr(), MfsHlIrqHandlerRx(), MfsHlIrqHandlerSts(), MfsHlIrqHandlerTx(), MfsHlModeLinMaster, MfsHlModeLinSlave, MfsHlUseFifo, MfsHlUseNoFifo, MfsLinBreakLength13, MfsLinBreakLength14, MfsLinBreakLength15, MfsLinBreakLength16, MfsLinDelimiterLength1, MfsLinDelimiterLength2, MfsLinDelimiterLength3, MfsLinDelimiterLength4, MfsLinFourStopBits, MfsLinMaster, MfsLinOneStopBit, MfsLinSlave, MfsLinThreeStopBits, MfsLinTwoStopBits, Ok, stc_mfs_hl_intern_data::pfnLinBreakCbFunction, stc_mfs_hl_lin_config::pfnLinBrkCb, stc_mfs_hl_intern_data::pfnReceiveCbFunction, stc_mfs_hl_lin_config::pfnRxCb, stc_mfs_hl_intern_data::pfnTransmitCbFunction, stc_mfs_hl_lin_config::pfnTxCb, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_lin_config::pu8RxBuf, stc_mfs_hl_lin_config::pu8TxBuf, stc_mfs_hl_intern_data::stcRxBuffer, stc_mfs_hl_intern_data::stcTxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16FillCount, stc_mfs_hl_buffer::u16InIndex, stc_mfs_hl_buffer::u16OutIndex, stc_mfs_hl_lin_config::u16RxBufSize, stc_mfs_hl_intern_data::u16RxCallbackBufFillLevel, stc_mfs_hl_lin_config::u16TxBufSize, stc_mfs_hl_buffer::u16TxCount, stc_mfs_hl_buffer::u16TxCounter, stc_mfs_hl_lin_config::u32DataRate, stc_mfs_hl_lin_config::u8BreakLength, stc_mfs_hl_intern_data::u8DataWidth, stc_mfs_hl_lin_config::u8DelimiterLength, stc_mfs_hl_intern_data::u8Exec, stc_mfs_hl_lin_config::u8FifoUsage, stc_mfs_hl_intern_data::u8FifoUsage, stc_mfs_hl_lin_config::u8LinMode, stc_mfs_hl_intern_data::u8MfsMode, and stc_mfs_hl_lin_config::u8StopBits.

Here is the call graph for this function:

en_result_t Mfs_Hl_Lin_SetBreak ( volatile stc_mfsn_t *  pstcLin)

Set LIN Break with an MFS_HL module in LIN Master Mode.

Note
MFS_HL module must be initialized to LIN Master mode

This Function sets a LIN break and break delimiter length with the configuration by the previous initialization.

Parameters
[in]pstcLinPointer to LIN (MFS) instance register area
Return values
OkLIN Break is (being) generated
ErrorInvalidParameterIf one of following conditions are met:
  • pstcLin == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
ErrorInvalidModeMFS not in LIN master mode
ErrorOperationInProgressMFS not ready for generating break

Definition at line 2932 of file mfs_hl.c.

References ErrorInvalidMode, ErrorInvalidParameter, ErrorOperationInProgress, FALSE, MFS_SMR_LIN_MODE, MFS_SMR_MODEBITS_MASK, MfsHlGetInternDataPtr(), Ok, and TRUE.

Here is the call graph for this function:

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.

Precondition
MFS_HL module must be initialized to LIN Slave mode

This Function sets a new (calculated) baud divisor, if the MFS is in LIN Slave mode.

Note
This function should only be called:
  • After a complete LIN frame was received and before next LIN Break
  • Shortly after the second ICU interrupt within the LIN Synch Field and before the next start bit of the LIN Header byte!
Parameters
[in]pstcLinPointer to LIN (MFS) instance register area
[in]u16BaudDivisorNew (calculated) Baud Divisor
Return values
OkBaud rate was set correctly
ErrorInvalidParameterIf one of following conditions are met:
  • pstcLin == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
ErrorInvalidModeMFS not in LIN slave mode

Definition at line 2993 of file mfs_hl.c.

References ErrorInvalidMode, ErrorInvalidParameter, FALSE, MFS_SMR_LIN_MODE, MFS_SMR_MODEBITS_MASK, MfsHlGetInternDataPtr(), and Ok.

Here is the call graph for this function:

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.

Parameters
[in]pstcLinPointer to MFS instance register area
[in,out]pu8DataPointer to data buffer
[in]u16ReadCountNumber of bytes to be transfered
Return values
OkProcess is success
ErrorInvalidParameterIf one of following conditions are met:
  • pstcLin == NULL
  • pu8Data == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))

Definition at line 3041 of file mfs_hl.c.

References ErrorInvalidParameter, MfsHlGetInternDataPtr(), Ok, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcRxBuffer, stc_mfs_hl_buffer::u16BufferSize, and stc_mfs_hl_buffer::u16InIndex.

Here is the call graph for this function:

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.

This function can use for UART, CSIO or LIN.

The received data is copied from internal RX buffer (filled by RX interrupt) into the provided data buffer Mfs_Hl_Read::pu8Data. The size is defined by Mfs_Hl_Read::pu16DataCnt. Depending on the Mfs_Hl_Read::bBlocking parameter, the function behavior is different.

For an asynchronous (non-blocking) call (Mfs_Hl_Read::bBlocking = FALSE), the function will return immediately after all currently available characters (in SW ring buffer and HW FIFO) are copied into the provided buffer (Mfs_Hl_Read::pu8Data) or the maximum count (Mfs_Hl_Read::u16ReadCnt) is reached. The value returned by Mfs_Hl_Read::pu16DataCnt gives the count of characters that was read actually. If the referenced MFS does not have a FIFO single data is read.

For a synchronous (blocking) call (Mfs_Hl_Read::bBlocking == TRUE), the function will return after the requested count of characters (Mfs_Hl_Read::pu16DataCnt) is received completely. This should be used with caution as the full application can get stuck if no further data is received.

Parameters
[in]pstcMfsPointer to MFS instance register area
[in,out]pu8DataBuffer to store received data
[in,out]pu16DataCntPointer to variable for number of bytes been read
[in]u16ReadCntMaximum number of characters to read (ensure sufficient size of pu16DataCnt::pu8Data!)
[in]bBlockingIf TRUE, synchronously wait until pu16DataCnt::u16ReadCnt bytes have been received. If FALSE, read all available and return immediately.
Return values
OkRead data successfully done or started.
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMfs == NULL
  • pu8Data == NULL
  • pu16DataCnt == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
ErrorOperationInProgressIf the following condition is met:
  • An asynchronous transmission is still ongoing while another asynchronous operation should be started.

Definition at line 4419 of file mfs_hl.c.

References Error, ErrorInvalidParameter, ErrorOperationInProgress, FALSE, MFS_CSIO_SSR_ERR, MFS_FIFO_MAX_VAL, MFS_HL_MODE_GROUP_CHK, MFS_HL_MODE_GROUP_CSIO, MFS_HL_MODE_GROUP_LIN, MFS_HL_MODE_GROUP_UART, MFS_LIN_SSR_ERR, MFS_RX_FIFO_MIN_VAL, MFS_SSR_RDRF, MFS_UART_SSR_ERR, MfsHlExecStby, MfsHlGetInternDataPtr(), MfsHlGetMin(), MfsHlReadBuf(), MfsHlUseFifo, Ok, PDL_WAIT_LOOP_HOOK(), stc_mfs_hl_intern_data::pfnReceiveCbFunction, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcRxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16FillCount, stc_mfs_hl_buffer::u16OutIndex, stc_mfs_hl_intern_data::u8Exec, stc_mfs_hl_intern_data::u8FifoUsage, and stc_mfs_hl_intern_data::u8MfsMode.

Here is the call graph for this function:

en_result_t Mfs_Hl_Uart_DeInit ( volatile stc_mfsn_t *  pstcUart)

UART deinitialisation of a MFS_HL module.

This function de-initializes the MFS_HL module activating as UART. This function uses for mode change or other changed settings.

Parameters
[in]pstcUartPointer to UART (MFS) instance register area
Return values
OkDeinitialisation of MFS_HL module successfully done
ErrorInvalidParameterIf one of following conditions are met:
  • pstcUart == NULL
  • pstcMfsInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))

Definition at line 1791 of file mfs_hl.c.

References ErrorInvalidParameter, FALSE, Mfs_DeInitIrq(), Mfs_SetRxIntCallBack(), Mfs_SetStsIntCallBack(), Mfs_SetTxIntCallBack(), Mfs_SetUpperLayerHandle(), MfsHlExecStby, MfsHlGetInternDataPtr(), MfsHlModeStby, Ok, stc_mfs_hl_intern_data::pfnLinBreakCbFunction, stc_mfs_hl_intern_data::pfnReceiveCbFunction, stc_mfs_hl_intern_data::pfnTransmitCbFunction, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcRxBuffer, stc_mfs_hl_intern_data::stcTxBuffer, TRUE, stc_mfs_hl_intern_data::u8Exec, and stc_mfs_hl_intern_data::u8MfsMode.

Referenced by Mfs_Hl_Lin_DeInit().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
[in]pstcUartPointer to UART (MFS) instance register area
[in]pstcConfigMFS UART configuration
Return values
OkInitializiation of MFS_HL module successfully done.
ErrorInvalidParameterIf one of following conditions are met:
  • pstcUart == NULL
  • pstcConfig == NULL
  • pstcMfsInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
  • one or more values in pstcConfig out of range

Definition at line 1475 of file mfs_hl.c.

References stc_mfs_hl_uart_config::bBitDirection, stc_mfs_hl_uart_config::bHwFlow, stc_mfs_hl_buffer::bOverflow, stc_mfs_hl_uart_config::bSignalSystem, ErrorInvalidParameter, FALSE, MFS_DATA_LEN_5, MFS_DATA_LEN_6, MFS_DATA_LEN_7, MFS_DATA_LEN_8, MFS_DATA_LEN_9, Mfs_GetReloadValue(), MFS_HL_BGR_MASK, MFS_HL_NUM_4, Mfs_InitRxIrq(), Mfs_InitTxIrq(), MFS_MD_UART_MULTI, MFS_MD_UART_NORNAL, Mfs_SetRxIntCallBack(), Mfs_SetTxIntCallBack(), Mfs_SetUpperLayerHandle(), MfsEightBits, MfsFiveBits, MfsFourStopBits, MfsHlExecStby, MfsHlFifoUseInit(), MfsHlGetInternDataPtr(), MfsHlIrqHandlerRx(), MfsHlIrqHandlerTx(), MfsHlModeUartMulti, MfsHlModeUartNormal, MfsHlUseFifo, MfsHlUseNoFifo, MfsNineBits, MfsOneStopBit, MfsParityEven, MfsParityNone, MfsParityOdd, MfsSevenBits, MfsSixBits, MfsThreeStopBits, MfsTwoStopBits, MfsUartMulti, MfsUartNormal, Ok, stc_mfs_hl_intern_data::pfnReceiveCbFunction, stc_mfs_hl_uart_config::pfnRxCb, stc_mfs_hl_intern_data::pfnTransmitCbFunction, stc_mfs_hl_uart_config::pfnTxCb, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_uart_config::pu8RxBuf, stc_mfs_hl_uart_config::pu8TxBuf, stc_mfs_hl_intern_data::stcRxBuffer, stc_mfs_hl_intern_data::stcTxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16FillCount, stc_mfs_hl_buffer::u16InIndex, stc_mfs_hl_buffer::u16OutIndex, stc_mfs_hl_uart_config::u16RxBufSize, stc_mfs_hl_intern_data::u16RxCallbackBufFillLevel, stc_mfs_hl_uart_config::u16RxCbBufFillLvl, stc_mfs_hl_uart_config::u16TxBufSize, stc_mfs_hl_buffer::u16TxCount, stc_mfs_hl_buffer::u16TxCounter, stc_mfs_hl_uart_config::u32DataRate, stc_mfs_hl_uart_config::u8CharLength, stc_mfs_hl_intern_data::u8DataWidth, stc_mfs_hl_intern_data::u8Exec, stc_mfs_hl_uart_config::u8FifoUsage, stc_mfs_hl_intern_data::u8FifoUsage, stc_mfs_hl_intern_data::u8MfsMode, stc_mfs_hl_uart_config::u8Parity, stc_mfs_hl_uart_config::u8StopBit, and stc_mfs_hl_uart_config::u8UartMode.

Here is the call graph for this function:

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.

This function can use for UART, CSIO or LIN.

The data provided by Mfs_Hl_Write::pu8Data is copied into the internal TX buffer and the transmission (via TX interrupt) is started, if transmission is not ongoing already. Depending on the Mfs_Hl_Write::bBlocking parameter, the function return behavior is different.

For an asynchronous (non-blocking) call (Mfs_Hl_Write::bBlocking = FALSE), the free size of the internal buffer must be sufficient to take all data (Mfs_Hl_Write::pu8Data) of length Mfs_Hl_Write::u16WriteCnt, otherwise the function will return ErrorBufferFull. After all data is copied into the internal buffer, the function will return immediately. The transmission may be pending when the function returns.

For a synchronous (blocking) call (Mfs_Hl_Write::bBlocking = TRUE), the function will wait until all data is transferred to the MFS hardware FIFO. The transmission may be pending when the function returns. If the referenced MFS does not have a FIFO single data is written.

However, when call-back for transmission is not set, this function executes only by blocking.

Parameters
[in]pstcMfsPointer to MFS instance register area
[in]pu8DataTransmit data buffer holding data to transmit
[in]u16WriteCntNumber of characters to write, must be at least 1
[in]bBlockingIf TRUE, synchronously wait until all data is transferred into the hardware Fifo buffer If FALSE, put data into internal TX buffer and return immediately But this parameter isn't effective when the call-back for transmission isn't set.
[in]bCsHoldingSpecify to hold chip select This parameter is only effective when mode is CSIO/SPI master and chip select function is used.
Return values
OkTransmit data successfully done or started.
ErrorInvalidParameterIf one of following conditions are met:
  • pstcMfs == NULL
  • pu8Data == NULL
  • pstcMfsHlInternData == NULL (invalid or disabled MFS unit (PDL_PERIPHERAL_ENABLE_MFS))
ErrorOperationInProgressA transmission or reception is still ongoing
ErrorBufferFullInsufficient free size of TX buffer to take all data (in case of Mfs_Hl_Write::bBlocking = FALSE only)

Definition at line 4172 of file mfs_hl.c.

References ErrorBufferFull, ErrorInvalidParameter, ErrorOperationInProgress, FALSE, MFS_CSIO_TBYTE_MAX, MfsHlExecStby, MfsHlExecTransmitting, MfsHlGetInternDataPtr(), MfsHlGetMin(), MfsHlModeCsioNormalMasterTimer, MfsHlModeCsioSpiMasterWithCs, MfsHlUseFifo, MfsHlWriteBuf(), Ok, PDL_WAIT_LOOP_HOOK(), stc_mfs_hl_intern_data::pfnTransmitCbFunction, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcTxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16FillCount, stc_mfs_hl_buffer::u16InIndex, stc_mfs_hl_buffer::u16TxCount, stc_mfs_hl_buffer::u16TxCounter, stc_mfs_hl_intern_data::u8Exec, stc_mfs_hl_intern_data::u8FifoUsage, and stc_mfs_hl_intern_data::u8MfsMode.

Here is the call graph for this function:

static void MfsHlFifoUseInit ( volatile stc_mfsn_t *  pstcMfs,
uint16_t  u16BufFillLvl 
)
static

MFS_HL Initialize FIFO to use.

Parameters
[in]pstcMfsPointer to MFS instance register area
[in]u16BufFillLvlFilled count to interrupt

Definition at line 760 of file mfs_hl.c.

References FALSE, MFS_FIFO_MAX_VAL, MfsHlGetMin(), and TRUE.

Referenced by Mfs_Hl_Csio_Init(), Mfs_Hl_I2c_Init(), Mfs_Hl_Lin_Init(), and Mfs_Hl_Uart_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

static stc_mfs_hl_intern_data_t * MfsHlGetInternDataPtr ( volatile stc_mfsn_t *  pstcMfs)
static

Return the internal data for a certain MFS_HL instance.

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

Definition at line 311 of file mfs_hl.c.

References MfsInstanceIndexMax, and stc_mfs_hl_instance_data::stcInternData.

Referenced by Mfs_Hl_Csio_DeInit(), Mfs_Hl_Csio_Init(), Mfs_Hl_Csio_SynchronousTrans(), Mfs_Hl_GetBufferPointer(), Mfs_Hl_I2c_DeInit(), Mfs_Hl_I2c_Init(), Mfs_Hl_I2c_Read(), Mfs_Hl_I2c_WaitRxComplete(), Mfs_Hl_I2c_WaitTxComplete(), Mfs_Hl_I2c_Write(), Mfs_Hl_Lin_DisableRxInterrupt(), Mfs_Hl_Lin_Init(), Mfs_Hl_Lin_SetBreak(), Mfs_Hl_Lin_SetNewBaudDivisor(), Mfs_Hl_Lin_TransferRxBuffer(), Mfs_Hl_Read(), Mfs_Hl_Uart_DeInit(), Mfs_Hl_Uart_Init(), and Mfs_Hl_Write().

Here is the caller graph for this function:

static uint16_t MfsHlGetMin ( uint16_t  u16Num1,
uint16_t  u16Num2 
)
static

Get minimum number.

Parameters
[in]u16Num1The number to compare to u16Num2
[in]u16Num2The number to compare to u16Num1
Returns
The smaller number as the result of comparing u16Num1 with u16Num2

Definition at line 341 of file mfs_hl.c.

Referenced by Mfs_Hl_I2c_Read(), Mfs_Hl_Read(), Mfs_Hl_Write(), MfsHlFifoUseInit(), MfsHlI2cDataTxMaster(), MfsHlI2cDataTxSlave(), and MfsHlWriteBuf().

Here is the caller graph for this function:

static en_result_t MfsHlI2cChkTxRxComplete ( stc_mfs_hl_intern_data_t *  pstcMfsHlInternData,
uint32_t  u32MaxCnt 
)
static

Check changing I2C interruption state.

Parameters
[in]pstcMfsHlInternDataPointer to internal data
[in]u32MaxCntMaximum counter to check state changing
Return values
OkInterruption state changed within the specified period of count.
ErrorOperationInProgressInterruption state doesn't change and counter isn't overflow yet.
ErrorTimeoutInterruption state didn't change within the specified period of count.

Definition at line 3629 of file mfs_hl.c.

References ErrorOperationInProgress, ErrorTimeout, MfsHlExecStby, Ok, stc_mfs_hl_intern_data::u32I2cProcCnt, and stc_mfs_hl_intern_data::u8Exec.

Referenced by Mfs_Hl_I2c_WaitRxComplete(), and Mfs_Hl_I2c_WaitTxComplete().

Here is the caller graph for this function:

static void MfsHlI2cDataRxMaster ( volatile stc_mfsn_t *  pstcI2c,
stc_mfs_hl_intern_data_t *  pstcMfsHlInternData 
)
static

MFS_HL Operation to receive data for I2C master.

Parameters
[in]pstcI2cPointer to I2C (MFS) instance register area
[in]pstcMfsHlInternDataPointer to internal data

Definition at line 930 of file mfs_hl.c.

References FALSE, MFS_HL_NUM_1, MfsHlExecStby, stc_mfs_hl_intern_data::pfnReceiveCbFunction, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcRxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16InIndex, and stc_mfs_hl_intern_data::u8Exec.

Referenced by MfsHlI2cIrqHandlerRx(), and MfsHlI2cIrqHandlerSts().

Here is the caller graph for this function:

static void MfsHlI2cDataRxSlave ( volatile stc_mfsn_t *  pstcI2c,
stc_mfs_hl_intern_data_t *  pstcMfsHlInternData 
)
static

MFS_HL Operation to receive data for I2C slave.

Parameters
[in]pstcI2cPointer to I2C (MFS) instance register area
[in]pstcMfsHlInternDataPointer to internal data

Definition at line 1104 of file mfs_hl.c.

References FALSE, MFS_HL_NUM_1, MfsHlExecStby, stc_mfs_hl_intern_data::pfnReceiveCbFunction, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcRxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16InIndex, and stc_mfs_hl_intern_data::u8Exec.

Referenced by MfsHlI2cIrqHandlerRx(), and MfsHlI2cIrqHandlerSts().

Here is the caller graph for this function:

static void MfsHlI2cDataTxMaster ( volatile stc_mfsn_t *  pstcI2c,
stc_mfs_hl_intern_data_t *  pstcMfsHlInternData 
)
static

MFS_HL Operation to send data for I2C master.

Parameters
[in]pstcI2cPointer to I2C (MFS) instance register area
[in]pstcMfsHlInternDataPointer to internal data

Definition at line 806 of file mfs_hl.c.

References FALSE, MFS_FIFO_MAX_VAL, MFS_HL_NUM_1, MfsHlExecStby, MfsHlGetMin(), MfsHlUseFifo, stc_mfs_hl_intern_data::pfnTransmitCbFunction, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcTxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16OutIndex, stc_mfs_hl_intern_data::u8Exec, and stc_mfs_hl_intern_data::u8FifoUsage.

Referenced by MfsHlI2cIrqHandlerSts(), and MfsHlI2cIrqHandlerTx().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MfsHlI2cDataTxSlave ( volatile stc_mfsn_t *  pstcI2c,
stc_mfs_hl_intern_data_t *  pstcMfsHlInternData 
)
static

MFS_HL Operation to send data for I2C slave.

Parameters
[in]pstcI2cPointer to I2C (MFS) instance register area
[in]pstcMfsHlInternDataPointer to internal data

Definition at line 1209 of file mfs_hl.c.

References FALSE, MFS_FIFO_MAX_VAL, MfsHlExecStby, MfsHlGetMin(), MfsHlUseFifo, stc_mfs_hl_intern_data::pfnTransmitCbFunction, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcTxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16OutIndex, stc_mfs_hl_intern_data::u8Exec, and stc_mfs_hl_intern_data::u8FifoUsage.

Referenced by MfsHlI2cIrqHandlerSts(), and MfsHlI2cIrqHandlerTx().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MfsHlI2cIrqHandlerRx ( volatile stc_mfsn_t *  pstcMfs,
void *  pvHandle 
)
static

MFS_HL receive interrupt service routine for I2C.

This Function is called on Reception Interrupt set by the I2C.

Parameters
[in]pstcMfsPointer to I2C (MFS) instance register area
[in]pvHandlePointer to internal data

Definition at line 1374 of file mfs_hl.c.

References MfsHlExecStby, MfsHlI2cDataRxMaster(), MfsHlI2cDataRxSlave(), MfsHlI2cPreStartSlave(), MfsHlModeI2cMaster, stc_mfs_hl_intern_data::u8Exec, and stc_mfs_hl_intern_data::u8MfsMode.

Referenced by Mfs_Hl_I2c_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MfsHlI2cIrqHandlerSts ( volatile stc_mfsn_t *  pstcMfs,
void *  pvHandle 
)
static

MFS_HL status interrupt service routine for I2C.

This Function is called on Status Interrupt set by the I2C.

Parameters
[in]pstcMfsPointer to I2C (MFS) instance register area
[in]pvHandlePointer to internal data

Definition at line 1412 of file mfs_hl.c.

References MfsHlExecReceiving, MfsHlExecStby, MfsHlExecTransmitting, MfsHlI2cDataRxMaster(), MfsHlI2cDataRxSlave(), MfsHlI2cDataTxMaster(), MfsHlI2cDataTxSlave(), MfsHlI2cPreStartSlave(), MfsHlModeI2cMaster, stc_mfs_hl_intern_data::u8Exec, and stc_mfs_hl_intern_data::u8MfsMode.

Referenced by Mfs_Hl_I2c_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MfsHlI2cIrqHandlerTx ( volatile stc_mfsn_t *  pstcMfs,
void *  pvHandle 
)
static

MFS_HL transmit interrupt service routine for I2C.

This Function is called on Transmit Interrupt set by the I2C.

Parameters
[in]pstcMfsPointer to I2C (MFS) instance register area
[in]pvHandlePointer to internal data

Definition at line 1344 of file mfs_hl.c.

References MfsHlI2cDataTxMaster(), MfsHlI2cDataTxSlave(), MfsHlModeI2cMaster, and stc_mfs_hl_intern_data::u8MfsMode.

Referenced by Mfs_Hl_I2c_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MfsHlI2cPreStartSlave ( volatile stc_mfsn_t *  pstcI2c,
stc_mfs_hl_intern_data_t *  pstcMfsHlInternData 
)
static

MFS_HL Start operation for I2C slave.

Parameters
[in]pstcI2cPointer to I2C (MFS) instance register area
[in]pstcMfsHlInternDataPointer to internal data

Definition at line 1039 of file mfs_hl.c.

References FALSE, MfsI2cRead, MfsI2cWrite, stc_mfs_hl_intern_data::pfnI2cSlvStCbFunction, and TRUE.

Referenced by MfsHlI2cIrqHandlerRx(), and MfsHlI2cIrqHandlerSts().

Here is the caller graph for this function:

static en_result_t MfsHlI2cStartSlave ( volatile stc_mfsn_t *  pstcI2c,
stc_mfs_hl_intern_data_t *  pstcMfsHlInternData 
)
static

Start operation as I2C slave.

Parameters
[in]pstcI2cPointer to I2C (MFS) instance register area
[in]pstcMfsHlInternDataPointer to internal data
Return values
OkStart slave process successfully done
ErrorInvalidModeSlave isn't active

Definition at line 3519 of file mfs_hl.c.

References ErrorInvalidMode, FALSE, MfsHlExecStby, MfsHlUseFifo, Ok, TRUE, stc_mfs_hl_intern_data::u8Exec, and stc_mfs_hl_intern_data::u8FifoUsage.

Referenced by Mfs_Hl_I2c_Read(), and Mfs_Hl_I2c_Write().

Here is the caller graph for this function:

static en_result_t MfsHlI2cWaitIntState ( volatile stc_mfs_hl_intern_data_t *  pstcMfsHlInternData)
static

Wait to change I2C interruption state.

Parameters
[in]pstcMfsHlInternDataPointer to internal data
Return values
OkInterruption state changed within the specified period of time.
ErrorTimeoutInterruption state didn't change within the specified period of time.

Definition at line 3591 of file mfs_hl.c.

References ErrorTimeout, Mfs_GetBusClock(), MFS_HL_NUM_10, MfsHlExecStby, Ok, and stc_mfs_hl_intern_data::u8Exec.

Referenced by Mfs_Hl_I2c_Read(), and Mfs_Hl_I2c_Write().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MfsHlIrqHandlerRx ( volatile stc_mfsn_t *  pstcMfs,
void *  pvHandle 
)
static

MFS_HL receive interrupt service routine.

This Function is called on each Receive Interrupt set by the MFS. It stores the data from the FIFO into the internal Ring Buffer an triggers a callback function if the specific Fill Level of the internal Ring Buffer is reached. If the referenced MFS does not have a FIFO single data is read.

In LIN mode this ISR also handles the LIN Break detection.

Definition at line 662 of file mfs_hl.c.

References MFS_CSIO_SSR_ERR, MFS_HL_MODE_GROUP_CHK, MFS_HL_MODE_GROUP_CSIO, MFS_HL_MODE_GROUP_LIN, MFS_HL_MODE_GROUP_UART, MFS_LIN_SSR_ERR, MFS_UART_SSR_ERR, MfsHlReadBuf(), stc_mfs_hl_intern_data::pfnReceiveCbFunction, stc_mfs_hl_intern_data::stcRxBuffer, TRUE, stc_mfs_hl_buffer::u16FillCount, stc_mfs_hl_intern_data::u16RxCallbackBufFillLevel, and stc_mfs_hl_intern_data::u8MfsMode.

Referenced by Mfs_Hl_Csio_Init(), Mfs_Hl_Lin_Init(), and Mfs_Hl_Uart_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MfsHlIrqHandlerSts ( volatile stc_mfsn_t *  pstcMfs,
void *  pvHandle 
)
static

MFS_HL status interrupt service routine.

Definition at line 723 of file mfs_hl.c.

References FALSE, MFS_SMR_LIN_MODE, MFS_SMR_MODEBITS_MASK, stc_mfs_hl_intern_data::pfnLinBreakCbFunction, and TRUE.

Referenced by Mfs_Hl_Csio_Init(), and Mfs_Hl_Lin_Init().

Here is the caller graph for this function:

static void MfsHlIrqHandlerTx ( volatile stc_mfsn_t *  pstcMfs,
void *  pvHandle 
)
static

MFS_HL transmit interrupt service routine.

This Function is called on each Transmit Interrupt set by the MFS. This highly depends on the Configuration of the INT Sources. Interrupts might occur on TX Fifo empty, last bit has been shifted out, ... The data from the internal Ring Buffer is put into the Fifo until there's no more space left or all data has been transferred to the Fifo. If the referenced MFS does not have a FIFO single data is put.

In LIN mode this handler also checks for LIN Break detection. If it is detected, possible reception errors are cleared, the reception register (RDR) is flushed and (if not NULL) a dedicated callback function is called. Afterwards the Function is left by return w/o any further transmission action.

Definition at line 454 of file mfs_hl.c.

References FALSE, MfsHlExecStby, MfsHlExecWaitTxBusIdle, MfsHlModeCsioNormalMasterTimer, MfsHlUseFifo, MfsHlWriteBuf(), stc_mfs_hl_intern_data::pfnTransmitCbFunction, stc_mfs_hl_intern_data::stcTxBuffer, TRUE, stc_mfs_hl_buffer::u16FillCount, stc_mfs_hl_buffer::u16TxCount, stc_mfs_hl_buffer::u16TxCounter, stc_mfs_hl_intern_data::u8Exec, stc_mfs_hl_intern_data::u8FifoUsage, and stc_mfs_hl_intern_data::u8MfsMode.

Referenced by Mfs_Hl_Csio_Init(), Mfs_Hl_Lin_Init(), and Mfs_Hl_Uart_Init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MfsHlReadBuf ( volatile stc_mfsn_t *  pstcMfs,
stc_mfs_hl_intern_data_t *  pstcMfsHlInternData 
)
static

Store received data into buffer.

It stores the data from the FIFO into the internal Ring Buffer If the referenced MFS does not have a FIFO single data is read.

Parameters
[in]pstcMfsPointer to MFS instance register area
[in,out]pstcMfsHlInternDataPointer to internal data

Definition at line 543 of file mfs_hl.c.

References stc_mfs_hl_buffer::bOverflow, MFS_HL_NUM_1, MFS_HL_NUM_2, MFS_HL_NUM_3, MFS_HL_NUM_4, MFS_HL_NUM_8, MfsEightBits, MfsHlUseFifo, MfsSixteenBits, MfsTwentyFourBits, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcRxBuffer, TRUE, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16FillCount, stc_mfs_hl_buffer::u16InIndex, stc_mfs_hl_intern_data::u8DataWidth, and stc_mfs_hl_intern_data::u8FifoUsage.

Referenced by Mfs_Hl_Read(), and MfsHlIrqHandlerRx().

Here is the caller graph for this function:

static void MfsHlWriteBuf ( volatile stc_mfsn_t *  pstcMfs,
stc_mfs_hl_intern_data_t *  pstcMfsHlInternData 
)
static

Write the contents of the buffer to Transmit Data Register.

The data from the internal Ring Buffer is put into the Fifo until there's no more space left or all data has been transferred to the Fifo. If the referenced MFS does not have a FIFO single data is put.

Parameters
[in]pstcMfsPointer to MFS instance register area
[in,out]pstcMfsHlInternDataPointer to internal data

Definition at line 369 of file mfs_hl.c.

References MFS_FIFO_MAX_VAL, MFS_HL_MASK_0_7, MFS_HL_NUM_1, MFS_HL_NUM_2, MFS_HL_NUM_3, MFS_HL_NUM_4, MFS_HL_NUM_8, MfsEightBits, MfsHlGetMin(), MfsHlUseFifo, MfsSixteenBits, MfsTwentyFourBits, stc_mfs_hl_buffer::pu8Buffer, stc_mfs_hl_intern_data::stcTxBuffer, stc_mfs_hl_buffer::u16BufferSize, stc_mfs_hl_buffer::u16FillCount, stc_mfs_hl_buffer::u16OutIndex, stc_mfs_hl_buffer::u16TxCount, stc_mfs_hl_buffer::u16TxCounter, stc_mfs_hl_intern_data::u8DataWidth, and stc_mfs_hl_intern_data::u8FifoUsage.

Referenced by Mfs_Hl_Write(), and MfsHlIrqHandlerTx().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

stc_mfs_hl_instance_data_t m_astcMfsHlInstanceDataLut[MfsInstanceIndexMax]
static

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

Definition at line 116 of file mfs_hl.c.