S32 SDK
FlexIO Common Driver

Detailed Description

Common services for FlexIO drivers.

The Flexio Common driver layer contains services used by all Flexio drivers. The need for this layer derives from the requirement to allow multiple Flexio drivers to run in parallel on the same device, to the extent that enough hardware resources (shifters and timers) are available.

Functionality

The Flexio Common driver layer provides functions for device initialization and reset. Before using any Flexio driver the device must first be initialized using function FLEXIO_DRV_InitDevice(). Then any number of Flexio drivers can be initialized on the same device, to the extent that enough hardware resources (shifters and timers) are available. Driver initialization functions will return STATUS_ERROR if not enough resources are available for a new driver.

Important Notes

Calling any Flexio common function will destroy any driver that is active on that device. Normally these functions should be called only when there are no active driver instances on the device.

Typedefs

typedef void(* flexio_callback_t) (void *driverState, flexio_event_t event, void *userData)
 flexio callback function More...
 

Enumerations

enum  flexio_driver_type_t { FLEXIO_DRIVER_TYPE_INTERRUPTS = 0U, FLEXIO_DRIVER_TYPE_POLLING = 1U, FLEXIO_DRIVER_TYPE_DMA = 2U }
 Driver type: interrupts/polling/DMA Implements : flexio_driver_type_t_Class. More...
 
enum  flexio_event_t { FLEXIO_EVENT_RX_FULL = 0x00U, FLEXIO_EVENT_TX_EMPTY = 0x01U, FLEXIO_EVENT_END_TRANSFER = 0x02U }
 flexio events Implements : flexio_event_t_Class More...
 

FLEXIO_I2C Driver

status_t FLEXIO_DRV_InitDevice (uint32_t instance, flexio_device_state_t *deviceState)
 Initializes the FlexIO device. More...
 
status_t FLEXIO_DRV_DeinitDevice (uint32_t instance)
 De-initializes the FlexIO device. More...
 
status_t FLEXIO_DRV_Reset (uint32_t instance)
 Resets the FlexIO device. More...
 

Typedef Documentation

typedef void(* flexio_callback_t) (void *driverState, flexio_event_t event, void *userData)

flexio callback function

Callback functions are called by flexio drivers when relevant events must be reported. See type flexio_event_t for a list of events. The callback can then react to the event, for example providing the buffers for transmission or reception, or waking a task to use the received data. Note that callback functions are called from interrupts, so the callback execution time should be as small as possible.

Definition at line 74 of file flexio.h.

Enumeration Type Documentation

Driver type: interrupts/polling/DMA Implements : flexio_driver_type_t_Class.

Enumerator
FLEXIO_DRIVER_TYPE_INTERRUPTS 

Driver uses interrupts for data transfers

FLEXIO_DRIVER_TYPE_POLLING 

Driver is based on polling

FLEXIO_DRIVER_TYPE_DMA 

Driver uses DMA for data transfers

Definition at line 42 of file flexio.h.

flexio events Implements : flexio_event_t_Class

Enumerator
FLEXIO_EVENT_RX_FULL 

Rx buffer is full

FLEXIO_EVENT_TX_EMPTY 

Tx buffer is empty

FLEXIO_EVENT_END_TRANSFER 

The current transfer is ending

Definition at line 52 of file flexio.h.

Function Documentation

status_t FLEXIO_DRV_DeinitDevice ( uint32_t  instance)

De-initializes the FlexIO device.

This function de-initializes the FlexIO device.

Parameters
instanceFLEXIO peripheral instance number
Returns
Error or success status returned by API

Definition at line 126 of file flexio_common.c.

status_t FLEXIO_DRV_InitDevice ( uint32_t  instance,
flexio_device_state_t *  deviceState 
)

Initializes the FlexIO device.

This function resets the FlexIO device, enables interrupts in interrupt manager and enables the device.

Parameters
instanceFLEXIO peripheral instance number
deviceStatePointer to the FLEXIO device context structure. The driver uses this memory area for its internal logic. The application must make no assumptions about the content of this structure, and must not free this memory until the device is de-initialized using FLEXIO_DRV_DeinitDevice().
Returns
Error or success status returned by API

Definition at line 89 of file flexio_common.c.

status_t FLEXIO_DRV_Reset ( uint32_t  instance)

Resets the FlexIO device.

This function resets the FlexIO device.

Parameters
instanceFLEXIO peripheral instance number
Returns
Error or success status returned by API

Definition at line 151 of file flexio_common.c.