RTEMS 6.1-rc1
Data Structures | Variables
Lpi2c_master_edma_driver

Data Structures

struct  _lpi2c_master_edma_handle
 Driver handle for master DMA APIs. More...
 

Variables

LPI2C_Type_lpi2c_master_edma_handle::base
 
bool _lpi2c_master_edma_handle::isBusy
 
uint8_t _lpi2c_master_edma_handle::nbytes
 
uint16_t _lpi2c_master_edma_handle::commandBuffer [10]
 
lpi2c_master_transfer_t _lpi2c_master_edma_handle::transfer
 
lpi2c_master_edma_transfer_callback_t _lpi2c_master_edma_handle::completionCallback
 
void * _lpi2c_master_edma_handle::userData
 
edma_handle_t_lpi2c_master_edma_handle::rx
 
edma_handle_t_lpi2c_master_edma_handle::tx
 
edma_tcd_t _lpi2c_master_edma_handle::tcds [3]
 

Driver version

typedef struct _lpi2c_master_edma_handle lpi2c_master_edma_handle_t
 
typedef void(* lpi2c_master_edma_transfer_callback_t) (LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, status_t completionStatus, void *userData)
 Master DMA completion callback function pointer type. More...
 

Master DMA

void LPI2C_MasterCreateEDMAHandle (LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, edma_handle_t *rxDmaHandle, edma_handle_t *txDmaHandle, lpi2c_master_edma_transfer_callback_t callback, void *userData)
 Create a new handle for the LPI2C master DMA APIs. More...
 
status_t LPI2C_MasterTransferEDMA (LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, lpi2c_master_transfer_t *transfer)
 Performs a non-blocking DMA-based transaction on the I2C bus. More...
 
status_t LPI2C_MasterTransferGetCountEDMA (LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, size_t *count)
 Returns number of bytes transferred so far. More...
 
status_t LPI2C_MasterTransferAbortEDMA (LPI2C_Type *base, lpi2c_master_edma_handle_t *handle)
 Terminates a non-blocking LPI2C master transmission early. More...
 

Detailed Description

Typedef Documentation

◆ lpi2c_master_edma_transfer_callback_t

typedef void(* lpi2c_master_edma_transfer_callback_t) (LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, status_t completionStatus, void *userData)

Master DMA completion callback function pointer type.

This callback is used only for the non-blocking master transfer API. Specify the callback you wish to use in the call to LPI2C_MasterCreateEDMAHandle().

Parameters
baseThe LPI2C peripheral base address.
handleHandle associated with the completed transfer.
completionStatusEither kStatus_Success or an error code describing how the transfer completed.
userDataArbitrary pointer-sized value passed from the application.

Function Documentation

◆ LPI2C_MasterCreateEDMAHandle()

void LPI2C_MasterCreateEDMAHandle ( LPI2C_Type base,
lpi2c_master_edma_handle_t handle,
edma_handle_t rxDmaHandle,
edma_handle_t txDmaHandle,
lpi2c_master_edma_transfer_callback_t  callback,
void *  userData 
)

Create a new handle for the LPI2C master DMA APIs.

The creation of a handle is for use with the DMA APIs. Once a handle is created, there is not a corresponding destroy handle. If the user wants to terminate a transfer, the LPI2C_MasterTransferAbortEDMA() API shall be called.

For devices where the LPI2C send and receive DMA requests are OR'd together, the txDmaHandle parameter is ignored and may be set to NULL.

Parameters
baseThe LPI2C peripheral base address.
[out]handlePointer to the LPI2C master driver handle.
rxDmaHandleHandle for the eDMA receive channel. Created by the user prior to calling this function.
txDmaHandleHandle for the eDMA transmit channel. Created by the user prior to calling this function.
callbackUser provided pointer to the asynchronous callback function.
userDataUser provided pointer to the application callback data.

brief Create a new handle for the LPI2C master DMA APIs.

The creation of a handle is for use with the DMA APIs. Once a handle is created, there is not a corresponding destroy handle. If the user wants to terminate a transfer, the LPI2C_MasterTransferAbortEDMA() API shall be called.

For devices where the LPI2C send and receive DMA requests are OR'd together, the a txDmaHandle parameter is ignored and may be set to NULL.

param base The LPI2C peripheral base address. param[out] handle Pointer to the LPI2C master driver handle. param rxDmaHandle Handle for the eDMA receive channel. Created by the user prior to calling this function. param txDmaHandle Handle for the eDMA transmit channel. Created by the user prior to calling this function. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data.

◆ LPI2C_MasterTransferAbortEDMA()

status_t LPI2C_MasterTransferAbortEDMA ( LPI2C_Type base,
lpi2c_master_edma_handle_t handle 
)

Terminates a non-blocking LPI2C master transmission early.

Note
It is not safe to call this function from an IRQ handler that has a higher priority than the eDMA peripheral's IRQ priority.
Parameters
baseThe LPI2C peripheral base address.
handlePointer to the LPI2C master driver handle.
Return values
kStatus_SuccessA transaction was successfully aborted.
kStatus_LPI2C_IdleThere is not a DMA transaction currently in progress.

brief Terminates a non-blocking LPI2C master transmission early.

note It is not safe to call this function from an IRQ handler that has a higher priority than the eDMA peripheral's IRQ priority.

param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. retval kStatus_Success A transaction was successfully aborted. retval kStatus_LPI2C_Idle There is not a DMA transaction currently in progress.

◆ LPI2C_MasterTransferEDMA()

status_t LPI2C_MasterTransferEDMA ( LPI2C_Type base,
lpi2c_master_edma_handle_t handle,
lpi2c_master_transfer_t transfer 
)

Performs a non-blocking DMA-based transaction on the I2C bus.

The callback specified when the handle was created is invoked when the transaction has completed.

Parameters
baseThe LPI2C peripheral base address.
handlePointer to the LPI2C master driver handle.
transferThe pointer to the transfer descriptor.
Return values
kStatus_SuccessThe transaction was started successfully.
kStatus_LPI2C_BusyEither another master is currently utilizing the bus, or another DMA transaction is already in progress.

brief Performs a non-blocking DMA-based transaction on the I2C bus.

The callback specified when the a handle was created is invoked when the transaction has completed.

param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. param transfer The pointer to the transfer descriptor. retval kStatus_Success The transaction was started successfully. retval kStatus_LPI2C_Busy Either another master is currently utilizing the bus, or another DMA transaction is already in progress.

◆ LPI2C_MasterTransferGetCountEDMA()

status_t LPI2C_MasterTransferGetCountEDMA ( LPI2C_Type base,
lpi2c_master_edma_handle_t handle,
size_t *  count 
)

Returns number of bytes transferred so far.

Parameters
baseThe LPI2C peripheral base address.
handlePointer to the LPI2C master driver handle.
[out]countNumber of bytes transferred so far by the non-blocking transaction.
Return values
kStatus_Success
kStatus_NoTransferInProgressThere is not a DMA transaction currently in progress.

brief Returns number of bytes transferred so far.

param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. param[out] count Number of bytes transferred so far by the non-blocking transaction. retval kStatus_Success retval kStatus_NoTransferInProgress There is not a DMA transaction currently in progress.

Variable Documentation

◆ base

LPI2C_Type* _lpi2c_master_edma_handle::base

LPI2C base pointer.

◆ commandBuffer

uint16_t _lpi2c_master_edma_handle::commandBuffer[10]

LPI2C command sequence. When all 10 command words are used: Start&addr&write[1 word] + subaddr[4 words] + restart&addr&read[1 word] + receive&Size[4 words]

◆ completionCallback

lpi2c_master_edma_transfer_callback_t _lpi2c_master_edma_handle::completionCallback

Callback function pointer.

◆ isBusy

bool _lpi2c_master_edma_handle::isBusy

Transfer state machine current state.

◆ nbytes

uint8_t _lpi2c_master_edma_handle::nbytes

eDMA minor byte transfer count initially configured.

◆ rx

edma_handle_t* _lpi2c_master_edma_handle::rx

Handle for receive DMA channel.

◆ tcds

edma_tcd_t _lpi2c_master_edma_handle::tcds[3]

Software TCD. Three are allocated to provide enough room to align to 32-bytes.

◆ transfer

lpi2c_master_transfer_t _lpi2c_master_edma_handle::transfer

Copy of the current transfer info.

◆ tx

edma_handle_t* _lpi2c_master_edma_handle::tx

Handle for transmit DMA channel.

◆ userData

void* _lpi2c_master_edma_handle::userData

Application data passed to callback.