![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/drivers/fsl_flexio_uart_edma.h@3:f3764f852aa8, 2018-10-11 (annotated)
- Committer:
- kadonotakashi
- Date:
- Thu Oct 11 02:27:46 2018 +0000
- Revision:
- 3:f3764f852aa8
- Parent:
- 0:8fdf9a60065b
Nucreo 446 + SSD1331 test version;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | /* |
kadonotakashi | 0:8fdf9a60065b | 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. |
kadonotakashi | 0:8fdf9a60065b | 3 | * All rights reserved. |
kadonotakashi | 0:8fdf9a60065b | 4 | * |
kadonotakashi | 0:8fdf9a60065b | 5 | * Redistribution and use in source and binary forms, with or without modification, |
kadonotakashi | 0:8fdf9a60065b | 6 | * are permitted provided that the following conditions are met: |
kadonotakashi | 0:8fdf9a60065b | 7 | * |
kadonotakashi | 0:8fdf9a60065b | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
kadonotakashi | 0:8fdf9a60065b | 9 | * of conditions and the following disclaimer. |
kadonotakashi | 0:8fdf9a60065b | 10 | * |
kadonotakashi | 0:8fdf9a60065b | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
kadonotakashi | 0:8fdf9a60065b | 12 | * list of conditions and the following disclaimer in the documentation and/or |
kadonotakashi | 0:8fdf9a60065b | 13 | * other materials provided with the distribution. |
kadonotakashi | 0:8fdf9a60065b | 14 | * |
kadonotakashi | 0:8fdf9a60065b | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
kadonotakashi | 0:8fdf9a60065b | 16 | * contributors may be used to endorse or promote products derived from this |
kadonotakashi | 0:8fdf9a60065b | 17 | * software without specific prior written permission. |
kadonotakashi | 0:8fdf9a60065b | 18 | * |
kadonotakashi | 0:8fdf9a60065b | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
kadonotakashi | 0:8fdf9a60065b | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
kadonotakashi | 0:8fdf9a60065b | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
kadonotakashi | 0:8fdf9a60065b | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
kadonotakashi | 0:8fdf9a60065b | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
kadonotakashi | 0:8fdf9a60065b | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
kadonotakashi | 0:8fdf9a60065b | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
kadonotakashi | 0:8fdf9a60065b | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
kadonotakashi | 0:8fdf9a60065b | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
kadonotakashi | 0:8fdf9a60065b | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
kadonotakashi | 0:8fdf9a60065b | 29 | */ |
kadonotakashi | 0:8fdf9a60065b | 30 | #ifndef _FSL_FLEXIO_UART_EDMA_H_ |
kadonotakashi | 0:8fdf9a60065b | 31 | #define _FSL_FLEXIO_UART_EDMA_H_ |
kadonotakashi | 0:8fdf9a60065b | 32 | |
kadonotakashi | 0:8fdf9a60065b | 33 | #include "fsl_flexio_uart.h" |
kadonotakashi | 0:8fdf9a60065b | 34 | #include "fsl_dmamux.h" |
kadonotakashi | 0:8fdf9a60065b | 35 | #include "fsl_edma.h" |
kadonotakashi | 0:8fdf9a60065b | 36 | |
kadonotakashi | 0:8fdf9a60065b | 37 | /*! |
kadonotakashi | 0:8fdf9a60065b | 38 | * @addtogroup flexio_edma_uart |
kadonotakashi | 0:8fdf9a60065b | 39 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 40 | */ |
kadonotakashi | 0:8fdf9a60065b | 41 | |
kadonotakashi | 0:8fdf9a60065b | 42 | /******************************************************************************* |
kadonotakashi | 0:8fdf9a60065b | 43 | * Definitions |
kadonotakashi | 0:8fdf9a60065b | 44 | ******************************************************************************/ |
kadonotakashi | 0:8fdf9a60065b | 45 | |
kadonotakashi | 0:8fdf9a60065b | 46 | /* Forward declaration of the handle typedef. */ |
kadonotakashi | 0:8fdf9a60065b | 47 | typedef struct _flexio_uart_edma_handle flexio_uart_edma_handle_t; |
kadonotakashi | 0:8fdf9a60065b | 48 | |
kadonotakashi | 0:8fdf9a60065b | 49 | /*! @brief UART transfer callback function. */ |
kadonotakashi | 0:8fdf9a60065b | 50 | typedef void (*flexio_uart_edma_transfer_callback_t)(FLEXIO_UART_Type *base, |
kadonotakashi | 0:8fdf9a60065b | 51 | flexio_uart_edma_handle_t *handle, |
kadonotakashi | 0:8fdf9a60065b | 52 | status_t status, |
kadonotakashi | 0:8fdf9a60065b | 53 | void *userData); |
kadonotakashi | 0:8fdf9a60065b | 54 | |
kadonotakashi | 0:8fdf9a60065b | 55 | /*! |
kadonotakashi | 0:8fdf9a60065b | 56 | * @brief UART eDMA handle |
kadonotakashi | 0:8fdf9a60065b | 57 | */ |
kadonotakashi | 0:8fdf9a60065b | 58 | struct _flexio_uart_edma_handle |
kadonotakashi | 0:8fdf9a60065b | 59 | { |
kadonotakashi | 0:8fdf9a60065b | 60 | flexio_uart_edma_transfer_callback_t callback; /*!< Callback function. */ |
kadonotakashi | 0:8fdf9a60065b | 61 | void *userData; /*!< UART callback function parameter.*/ |
kadonotakashi | 0:8fdf9a60065b | 62 | |
kadonotakashi | 0:8fdf9a60065b | 63 | size_t txDataSizeAll; /*!< Total bytes to be sent. */ |
kadonotakashi | 0:8fdf9a60065b | 64 | size_t rxDataSizeAll; /*!< Total bytes to be received. */ |
kadonotakashi | 0:8fdf9a60065b | 65 | |
kadonotakashi | 0:8fdf9a60065b | 66 | edma_handle_t *txEdmaHandle; /*!< The eDMA TX channel used. */ |
kadonotakashi | 0:8fdf9a60065b | 67 | edma_handle_t *rxEdmaHandle; /*!< The eDMA RX channel used. */ |
kadonotakashi | 0:8fdf9a60065b | 68 | |
kadonotakashi | 0:8fdf9a60065b | 69 | uint8_t nbytes; /*!< eDMA minor byte transfer count initially configured. */ |
kadonotakashi | 0:8fdf9a60065b | 70 | |
kadonotakashi | 0:8fdf9a60065b | 71 | volatile uint8_t txState; /*!< TX transfer state. */ |
kadonotakashi | 0:8fdf9a60065b | 72 | volatile uint8_t rxState; /*!< RX transfer state */ |
kadonotakashi | 0:8fdf9a60065b | 73 | }; |
kadonotakashi | 0:8fdf9a60065b | 74 | |
kadonotakashi | 0:8fdf9a60065b | 75 | /******************************************************************************* |
kadonotakashi | 0:8fdf9a60065b | 76 | * API |
kadonotakashi | 0:8fdf9a60065b | 77 | ******************************************************************************/ |
kadonotakashi | 0:8fdf9a60065b | 78 | |
kadonotakashi | 0:8fdf9a60065b | 79 | #if defined(__cplusplus) |
kadonotakashi | 0:8fdf9a60065b | 80 | extern "C" { |
kadonotakashi | 0:8fdf9a60065b | 81 | #endif |
kadonotakashi | 0:8fdf9a60065b | 82 | |
kadonotakashi | 0:8fdf9a60065b | 83 | /*! |
kadonotakashi | 0:8fdf9a60065b | 84 | * @name eDMA transactional |
kadonotakashi | 0:8fdf9a60065b | 85 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 86 | */ |
kadonotakashi | 0:8fdf9a60065b | 87 | |
kadonotakashi | 0:8fdf9a60065b | 88 | /*! |
kadonotakashi | 0:8fdf9a60065b | 89 | * @brief Initializes the UART handle which is used in transactional functions. |
kadonotakashi | 0:8fdf9a60065b | 90 | * |
kadonotakashi | 0:8fdf9a60065b | 91 | * @param base Pointer to FLEXIO_UART_Type. |
kadonotakashi | 0:8fdf9a60065b | 92 | * @param handle Pointer to flexio_uart_edma_handle_t structure. |
kadonotakashi | 0:8fdf9a60065b | 93 | * @param callback The callback function. |
kadonotakashi | 0:8fdf9a60065b | 94 | * @param userData The parameter of the callback function. |
kadonotakashi | 0:8fdf9a60065b | 95 | * @param rxEdmaHandle User requested DMA handle for RX DMA transfer. |
kadonotakashi | 0:8fdf9a60065b | 96 | * @param txEdmaHandle User requested DMA handle for TX DMA transfer. |
kadonotakashi | 0:8fdf9a60065b | 97 | * @retval kStatus_Success Successfully create the handle. |
kadonotakashi | 0:8fdf9a60065b | 98 | * @retval kStatus_OutOfRange The FlexIO SPI eDMA type/handle table out of range. |
kadonotakashi | 0:8fdf9a60065b | 99 | */ |
kadonotakashi | 0:8fdf9a60065b | 100 | status_t FLEXIO_UART_TransferCreateHandleEDMA(FLEXIO_UART_Type *base, |
kadonotakashi | 0:8fdf9a60065b | 101 | flexio_uart_edma_handle_t *handle, |
kadonotakashi | 0:8fdf9a60065b | 102 | flexio_uart_edma_transfer_callback_t callback, |
kadonotakashi | 0:8fdf9a60065b | 103 | void *userData, |
kadonotakashi | 0:8fdf9a60065b | 104 | edma_handle_t *txEdmaHandle, |
kadonotakashi | 0:8fdf9a60065b | 105 | edma_handle_t *rxEdmaHandle); |
kadonotakashi | 0:8fdf9a60065b | 106 | |
kadonotakashi | 0:8fdf9a60065b | 107 | /*! |
kadonotakashi | 0:8fdf9a60065b | 108 | * @brief Sends data using eDMA. |
kadonotakashi | 0:8fdf9a60065b | 109 | * |
kadonotakashi | 0:8fdf9a60065b | 110 | * This function sends data using eDMA. This is a non-blocking function, which returns |
kadonotakashi | 0:8fdf9a60065b | 111 | * right away. When all data is sent out, the send callback function is called. |
kadonotakashi | 0:8fdf9a60065b | 112 | * |
kadonotakashi | 0:8fdf9a60065b | 113 | * @param base Pointer to FLEXIO_UART_Type |
kadonotakashi | 0:8fdf9a60065b | 114 | * @param handle UART handle pointer. |
kadonotakashi | 0:8fdf9a60065b | 115 | * @param xfer UART eDMA transfer structure, see #flexio_uart_transfer_t. |
kadonotakashi | 0:8fdf9a60065b | 116 | * @retval kStatus_Success if succeed, others failed. |
kadonotakashi | 0:8fdf9a60065b | 117 | * @retval kStatus_FLEXIO_UART_TxBusy Previous transfer on going. |
kadonotakashi | 0:8fdf9a60065b | 118 | */ |
kadonotakashi | 0:8fdf9a60065b | 119 | status_t FLEXIO_UART_TransferSendEDMA(FLEXIO_UART_Type *base, |
kadonotakashi | 0:8fdf9a60065b | 120 | flexio_uart_edma_handle_t *handle, |
kadonotakashi | 0:8fdf9a60065b | 121 | flexio_uart_transfer_t *xfer); |
kadonotakashi | 0:8fdf9a60065b | 122 | |
kadonotakashi | 0:8fdf9a60065b | 123 | /*! |
kadonotakashi | 0:8fdf9a60065b | 124 | * @brief Receives data using eDMA. |
kadonotakashi | 0:8fdf9a60065b | 125 | * |
kadonotakashi | 0:8fdf9a60065b | 126 | * This function receives data using eDMA. This is a non-blocking function, which returns |
kadonotakashi | 0:8fdf9a60065b | 127 | * right away. When all data is received, the receive callback function is called. |
kadonotakashi | 0:8fdf9a60065b | 128 | * |
kadonotakashi | 0:8fdf9a60065b | 129 | * @param base Pointer to FLEXIO_UART_Type |
kadonotakashi | 0:8fdf9a60065b | 130 | * @param handle Pointer to flexio_uart_edma_handle_t structure |
kadonotakashi | 0:8fdf9a60065b | 131 | * @param xfer UART eDMA transfer structure, see #flexio_uart_transfer_t. |
kadonotakashi | 0:8fdf9a60065b | 132 | * @retval kStatus_Success if succeed, others failed. |
kadonotakashi | 0:8fdf9a60065b | 133 | * @retval kStatus_UART_RxBusy Previous transfer on going. |
kadonotakashi | 0:8fdf9a60065b | 134 | */ |
kadonotakashi | 0:8fdf9a60065b | 135 | status_t FLEXIO_UART_TransferReceiveEDMA(FLEXIO_UART_Type *base, |
kadonotakashi | 0:8fdf9a60065b | 136 | flexio_uart_edma_handle_t *handle, |
kadonotakashi | 0:8fdf9a60065b | 137 | flexio_uart_transfer_t *xfer); |
kadonotakashi | 0:8fdf9a60065b | 138 | |
kadonotakashi | 0:8fdf9a60065b | 139 | /*! |
kadonotakashi | 0:8fdf9a60065b | 140 | * @brief Aborts the sent data which using eDMA. |
kadonotakashi | 0:8fdf9a60065b | 141 | * |
kadonotakashi | 0:8fdf9a60065b | 142 | * This function aborts sent data which using eDMA. |
kadonotakashi | 0:8fdf9a60065b | 143 | * |
kadonotakashi | 0:8fdf9a60065b | 144 | * @param base Pointer to FLEXIO_UART_Type |
kadonotakashi | 0:8fdf9a60065b | 145 | * @param handle Pointer to flexio_uart_edma_handle_t structure |
kadonotakashi | 0:8fdf9a60065b | 146 | */ |
kadonotakashi | 0:8fdf9a60065b | 147 | void FLEXIO_UART_TransferAbortSendEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle); |
kadonotakashi | 0:8fdf9a60065b | 148 | |
kadonotakashi | 0:8fdf9a60065b | 149 | /*! |
kadonotakashi | 0:8fdf9a60065b | 150 | * @brief Aborts the receive data which using eDMA. |
kadonotakashi | 0:8fdf9a60065b | 151 | * |
kadonotakashi | 0:8fdf9a60065b | 152 | * This function aborts the receive data which using eDMA. |
kadonotakashi | 0:8fdf9a60065b | 153 | * |
kadonotakashi | 0:8fdf9a60065b | 154 | * @param base Pointer to FLEXIO_UART_Type |
kadonotakashi | 0:8fdf9a60065b | 155 | * @param handle Pointer to flexio_uart_edma_handle_t structure |
kadonotakashi | 0:8fdf9a60065b | 156 | */ |
kadonotakashi | 0:8fdf9a60065b | 157 | void FLEXIO_UART_TransferAbortReceiveEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle); |
kadonotakashi | 0:8fdf9a60065b | 158 | |
kadonotakashi | 0:8fdf9a60065b | 159 | /*! |
kadonotakashi | 0:8fdf9a60065b | 160 | * @brief Gets the number of bytes sent out. |
kadonotakashi | 0:8fdf9a60065b | 161 | * |
kadonotakashi | 0:8fdf9a60065b | 162 | * This function gets the number of bytes sent out. |
kadonotakashi | 0:8fdf9a60065b | 163 | * |
kadonotakashi | 0:8fdf9a60065b | 164 | * @param base Pointer to FLEXIO_UART_Type |
kadonotakashi | 0:8fdf9a60065b | 165 | * @param handle Pointer to flexio_uart_edma_handle_t structure |
kadonotakashi | 0:8fdf9a60065b | 166 | * @param count Number of bytes sent so far by the non-blocking transaction. |
kadonotakashi | 0:8fdf9a60065b | 167 | * @retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. |
kadonotakashi | 0:8fdf9a60065b | 168 | * @retval kStatus_Success Successfully return the count. |
kadonotakashi | 0:8fdf9a60065b | 169 | */ |
kadonotakashi | 0:8fdf9a60065b | 170 | status_t FLEXIO_UART_TransferGetSendCountEDMA(FLEXIO_UART_Type *base, flexio_uart_edma_handle_t *handle, size_t *count); |
kadonotakashi | 0:8fdf9a60065b | 171 | |
kadonotakashi | 0:8fdf9a60065b | 172 | /*! |
kadonotakashi | 0:8fdf9a60065b | 173 | * @brief Gets the number of bytes received. |
kadonotakashi | 0:8fdf9a60065b | 174 | * |
kadonotakashi | 0:8fdf9a60065b | 175 | * This function gets the number of bytes received. |
kadonotakashi | 0:8fdf9a60065b | 176 | * |
kadonotakashi | 0:8fdf9a60065b | 177 | * @param base Pointer to FLEXIO_UART_Type |
kadonotakashi | 0:8fdf9a60065b | 178 | * @param handle Pointer to flexio_uart_edma_handle_t structure |
kadonotakashi | 0:8fdf9a60065b | 179 | * @param count Number of bytes received so far by the non-blocking transaction. |
kadonotakashi | 0:8fdf9a60065b | 180 | * @retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. |
kadonotakashi | 0:8fdf9a60065b | 181 | * @retval kStatus_Success Successfully return the count. |
kadonotakashi | 0:8fdf9a60065b | 182 | */ |
kadonotakashi | 0:8fdf9a60065b | 183 | status_t FLEXIO_UART_TransferGetReceiveCountEDMA(FLEXIO_UART_Type *base, |
kadonotakashi | 0:8fdf9a60065b | 184 | flexio_uart_edma_handle_t *handle, |
kadonotakashi | 0:8fdf9a60065b | 185 | size_t *count); |
kadonotakashi | 0:8fdf9a60065b | 186 | |
kadonotakashi | 0:8fdf9a60065b | 187 | /*@}*/ |
kadonotakashi | 0:8fdf9a60065b | 188 | |
kadonotakashi | 0:8fdf9a60065b | 189 | #if defined(__cplusplus) |
kadonotakashi | 0:8fdf9a60065b | 190 | } |
kadonotakashi | 0:8fdf9a60065b | 191 | #endif |
kadonotakashi | 0:8fdf9a60065b | 192 | |
kadonotakashi | 0:8fdf9a60065b | 193 | /*! @}*/ |
kadonotakashi | 0:8fdf9a60065b | 194 | |
kadonotakashi | 0:8fdf9a60065b | 195 | #endif /* _FSL_UART_EDMA_H_ */ |