![]() |
|
|||
File indexing completed on 2025-05-11 08:22:59
0001 /* 0002 * Copyright (c) 2015, Freescale Semiconductor, Inc. 0003 * Copyright 2016-2020 NXP 0004 * All rights reserved. 0005 * 0006 * SPDX-License-Identifier: BSD-3-Clause 0007 */ 0008 #ifndef _FSL_FLEXIO_UART_EDMA_H_ 0009 #define _FSL_FLEXIO_UART_EDMA_H_ 0010 0011 #include "fsl_flexio_uart.h" 0012 #include "fsl_edma.h" 0013 0014 /*! 0015 * @addtogroup flexio_edma_uart 0016 * @{ 0017 */ 0018 0019 /******************************************************************************* 0020 * Definitions 0021 ******************************************************************************/ 0022 0023 /*! @name Driver version */ 0024 /*@{*/ 0025 /*! @brief FlexIO UART EDMA driver version. */ 0026 #define FSL_FLEXIO_UART_EDMA_DRIVER_VERSION (MAKE_VERSION(2, 4, 1)) 0027 /*@}*/ 0028 0029 /* Forward declaration of the handle typedef. */ 0030 typedef struct _flexio_uart_edma_handle flexio_uart_edma_handle_t; 0031 0032 /*! @brief UART transfer callback function. */ 0033 typedef void (*flexio_uart_edma_transfer_callback_t)(FLEXIO_UART_Type *base, 0034 flexio_uart_edma_handle_t *handle, 0035 status_t status, 0036 void *userData); 0037 0038 /*! 0039 * @brief UART eDMA handle 0040 */ 0041 struct _flexio_uart_edma_handle 0042 { 0043 flexio_uart_edma_transfer_callback_t callback; /*!< Callback function. */ 0044 void *userData; /*!< UART callback function parameter.*/ 0045 0046 size_t txDataSizeAll; /*!< Total bytes to be sent. */ 0047 size_t rxDataSizeAll; /*!< Total bytes to be received. */ 0048 0049 edma_handle_t *txEdmaHandle; /*!< The eDMA TX channel used. */ 0050 edma_handle_t *rxEdmaHandle; /*!< The eDMA RX channel used. */ 0051 0052 uint8_t nbytes; /*!< eDMA minor byte transfer count initially configured. */ 0053 0054 volatile uint8_t txState; /*!< TX transfer state. */ 0055 volatile uint8_t rxState; /*!< RX transfer state */ 0056 }; 0057 0058 /******************************************************************************* 0059 * API 0060 ******************************************************************************/ 0061 0062 #if defined(__cplusplus) 0063 extern "C" { 0064 #endif 0065 0066 /*! 0067 * @name eDMA transactional 0068 * @{ 0069 */ 0070 0071 /*! 0072 * @brief Initializes the UART handle which is used in transactional functions. 0073 * 0074 * @param base Pointer to FLEXIO_UART_Type. 0075 * @param handle Pointer to flexio_uart_edma_handle_t structure. 0076 * @param callback The callback function. 0077 * @param userData The parameter of the callback function. 0078 * @param rxEdmaHandle User requested DMA handle for RX DMA transfer. 0079 * @param txEdmaHandle User requested DMA handle for TX DMA transfer. 0080 * @retval kStatus_Success Successfully create the handle. 0081 * @retval kStatus_OutOfRange The FlexIO SPI eDMA type/handle table out of range. 0082 */ 0083 status_t FLEXIO_UART_TransferCreateHandleEDMA(FLEXIO_UART_Type *base, 0084 flexio_uart_edma_handle_t *handle, 0085 flexio_uart_edma_transfer_callback_t callback, 0086 void *userData, 0087 edma_handle_t *txEdmaHandle, 0088 edma_handle_t *rxEdmaHandle); 0089 0090 /*! 0091 * @brief Sends data using eDMA. 0092 * 0093 * This function sends data using eDMA. This is a non-blocking function, which returns 0094 * right away. When all data is sent out, the send callback function is called. 0095 * 0096 * @param base Pointer to FLEXIO_UART_Type 0097 * @param handle UART handle pointer. 0098 * @param xfer UART eDMA transfer structure, see #flexio_uart_transfer_t. 0099 * @retval kStatus_Success if succeed, others failed. 0100 * @retval kStatus_FLEXIO_UART_TxBusy Previous transfer on going. 0101 */ 0102 status_t FLEXIO_UART_TransferSendEDMA(FLEXIO_UART_Type *base, 0103 flexio_uart_edma_handle_t *handle, 0104 flexio_uart_transfer_t *xfer); 0105 0106 /*! 0107 * @brief Receives data using eDMA. 0108 * 0109 * This function receives data using eDMA. This is a non-blocking function, which returns 0110 * right away. When all data is received, the receive callback function is called. 0111 * 0112 * @param base Pointer to FLEXIO_UART_Type 0113 * @param handle Pointer to flexio_uart_edma_handle_t structure 0114 * @param xfer UART eDMA transfer structure, see #flexio_uart_transfer_t. 0115 * @retval kStatus_Success if succeed, others failed. 0116 * @retval kStatus_UART_RxBusy Previous transfer on going. 0117 */ 0118 status_t FLEXIO_UART_TransferReceiveEDMA(FLEXIO_UART_Type *base, 0119 flexio_uart_edma_handle_t *handle, 0120 flexio_uart_transfer_t *xfer); 0121 0122 /*! 0123 * @brief Aborts the sent data which using eDMA. 0124 * 0125 * This function aborts sent data which using eDMA. 0126 * 0127 * @param base Pointer to FLEXIO_UART_Type 0128 * @param handle Pointer to flexio_uart_edma_handle_t structure 0129 */ 0130 void FLEXIO_UART_TransferAbortSendEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle); 0131 0132 /*! 0133 * @brief Aborts the receive data which using eDMA. 0134 * 0135 * This function aborts the receive data which using eDMA. 0136 * 0137 * @param base Pointer to FLEXIO_UART_Type 0138 * @param handle Pointer to flexio_uart_edma_handle_t structure 0139 */ 0140 void FLEXIO_UART_TransferAbortReceiveEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle); 0141 0142 /*! 0143 * @brief Gets the number of bytes sent out. 0144 * 0145 * This function gets the number of bytes sent out. 0146 * 0147 * @param base Pointer to FLEXIO_UART_Type 0148 * @param handle Pointer to flexio_uart_edma_handle_t structure 0149 * @param count Number of bytes sent so far by the non-blocking transaction. 0150 * @retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. 0151 * @retval kStatus_Success Successfully return the count. 0152 */ 0153 status_t FLEXIO_UART_TransferGetSendCountEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle, size_t *count); 0154 0155 /*! 0156 * @brief Gets the number of bytes received. 0157 * 0158 * This function gets the number of bytes received. 0159 * 0160 * @param base Pointer to FLEXIO_UART_Type 0161 * @param handle Pointer to flexio_uart_edma_handle_t structure 0162 * @param count Number of bytes received so far by the non-blocking transaction. 0163 * @retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. 0164 * @retval kStatus_Success Successfully return the count. 0165 */ 0166 status_t FLEXIO_UART_TransferGetReceiveCountEDMA(FLEXIO_UART_Type *base, 0167 flexio_uart_edma_handle_t *handle, 0168 size_t *count); 0169 0170 /*@}*/ 0171 0172 #if defined(__cplusplus) 0173 } 0174 #endif 0175 0176 /*! @}*/ 0177 0178 #endif /* _FSL_UART_EDMA_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |