Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
TARGET_KL82Z/TOOLCHAIN_ARM_STD/fsl_flexio_uart.h@171:3a7713b1edbc, 2018-11-08 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Nov 08 11:45:42 2018 +0000
- Revision:
- 171:3a7713b1edbc
- Parent:
- TARGET_USENSE/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/drivers/fsl_flexio_uart.h@145:64910690c574
mbed library. Release version 164
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| AnnaBridge | 145:64910690c574 | 1 | /* |
| AnnaBridge | 145:64910690c574 | 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. |
| AnnaBridge | 145:64910690c574 | 3 | * All rights reserved. |
| AnnaBridge | 145:64910690c574 | 4 | * |
| AnnaBridge | 145:64910690c574 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
| AnnaBridge | 145:64910690c574 | 6 | * are permitted provided that the following conditions are met: |
| AnnaBridge | 145:64910690c574 | 7 | * |
| AnnaBridge | 145:64910690c574 | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
| AnnaBridge | 145:64910690c574 | 9 | * of conditions and the following disclaimer. |
| AnnaBridge | 145:64910690c574 | 10 | * |
| AnnaBridge | 145:64910690c574 | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
| AnnaBridge | 145:64910690c574 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
| AnnaBridge | 145:64910690c574 | 13 | * other materials provided with the distribution. |
| AnnaBridge | 145:64910690c574 | 14 | * |
| AnnaBridge | 145:64910690c574 | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
| AnnaBridge | 145:64910690c574 | 16 | * contributors may be used to endorse or promote products derived from this |
| AnnaBridge | 145:64910690c574 | 17 | * software without specific prior written permission. |
| AnnaBridge | 145:64910690c574 | 18 | * |
| AnnaBridge | 145:64910690c574 | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| AnnaBridge | 145:64910690c574 | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| AnnaBridge | 145:64910690c574 | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| AnnaBridge | 145:64910690c574 | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
| AnnaBridge | 145:64910690c574 | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| AnnaBridge | 145:64910690c574 | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| AnnaBridge | 145:64910690c574 | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| AnnaBridge | 145:64910690c574 | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| AnnaBridge | 145:64910690c574 | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| AnnaBridge | 145:64910690c574 | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| AnnaBridge | 145:64910690c574 | 29 | */ |
| AnnaBridge | 145:64910690c574 | 30 | |
| AnnaBridge | 145:64910690c574 | 31 | #ifndef _FSL_FLEXIO_UART_H_ |
| AnnaBridge | 145:64910690c574 | 32 | #define _FSL_FLEXIO_UART_H_ |
| AnnaBridge | 145:64910690c574 | 33 | |
| AnnaBridge | 145:64910690c574 | 34 | #include "fsl_common.h" |
| AnnaBridge | 145:64910690c574 | 35 | #include "fsl_flexio.h" |
| AnnaBridge | 145:64910690c574 | 36 | |
| AnnaBridge | 145:64910690c574 | 37 | /*! |
| AnnaBridge | 145:64910690c574 | 38 | * @addtogroup flexio_uart |
| AnnaBridge | 145:64910690c574 | 39 | * @{ |
| AnnaBridge | 145:64910690c574 | 40 | */ |
| AnnaBridge | 145:64910690c574 | 41 | |
| AnnaBridge | 145:64910690c574 | 42 | |
| AnnaBridge | 145:64910690c574 | 43 | /******************************************************************************* |
| AnnaBridge | 145:64910690c574 | 44 | * Definitions |
| AnnaBridge | 145:64910690c574 | 45 | ******************************************************************************/ |
| AnnaBridge | 145:64910690c574 | 46 | |
| AnnaBridge | 145:64910690c574 | 47 | /*! @name Driver version */ |
| AnnaBridge | 145:64910690c574 | 48 | /*@{*/ |
| AnnaBridge | 145:64910690c574 | 49 | /*! @brief FlexIO UART driver version 2.1.1. */ |
| AnnaBridge | 145:64910690c574 | 50 | #define FSL_FLEXIO_UART_DRIVER_VERSION (MAKE_VERSION(2, 1, 1)) |
| AnnaBridge | 145:64910690c574 | 51 | /*@}*/ |
| AnnaBridge | 145:64910690c574 | 52 | |
| AnnaBridge | 145:64910690c574 | 53 | /*! @brief Error codes for the UART driver. */ |
| AnnaBridge | 145:64910690c574 | 54 | enum _flexio_uart_status |
| AnnaBridge | 145:64910690c574 | 55 | { |
| AnnaBridge | 145:64910690c574 | 56 | kStatus_FLEXIO_UART_TxBusy = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 0), /*!< Transmitter is busy. */ |
| AnnaBridge | 145:64910690c574 | 57 | kStatus_FLEXIO_UART_RxBusy = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 1), /*!< Receiver is busy. */ |
| AnnaBridge | 145:64910690c574 | 58 | kStatus_FLEXIO_UART_TxIdle = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 2), /*!< UART transmitter is idle. */ |
| AnnaBridge | 145:64910690c574 | 59 | kStatus_FLEXIO_UART_RxIdle = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 3), /*!< UART receiver is idle. */ |
| AnnaBridge | 145:64910690c574 | 60 | kStatus_FLEXIO_UART_ERROR = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 4), /*!< ERROR happens on UART. */ |
| AnnaBridge | 145:64910690c574 | 61 | kStatus_FLEXIO_UART_RxRingBufferOverrun = |
| AnnaBridge | 145:64910690c574 | 62 | MAKE_STATUS(kStatusGroup_FLEXIO_UART, 5), /*!< UART RX software ring buffer overrun. */ |
| AnnaBridge | 145:64910690c574 | 63 | kStatus_FLEXIO_UART_RxHardwareOverrun = MAKE_STATUS(kStatusGroup_FLEXIO_UART, 6) /*!< UART RX receiver overrun. */ |
| AnnaBridge | 145:64910690c574 | 64 | }; |
| AnnaBridge | 145:64910690c574 | 65 | |
| AnnaBridge | 145:64910690c574 | 66 | /*! @brief FlexIO UART bit count per char. */ |
| AnnaBridge | 145:64910690c574 | 67 | typedef enum _flexio_uart_bit_count_per_char |
| AnnaBridge | 145:64910690c574 | 68 | { |
| AnnaBridge | 145:64910690c574 | 69 | kFLEXIO_UART_7BitsPerChar = 7U, /*!< 7-bit data characters */ |
| AnnaBridge | 145:64910690c574 | 70 | kFLEXIO_UART_8BitsPerChar = 8U, /*!< 8-bit data characters */ |
| AnnaBridge | 145:64910690c574 | 71 | kFLEXIO_UART_9BitsPerChar = 9U, /*!< 9-bit data characters */ |
| AnnaBridge | 145:64910690c574 | 72 | } flexio_uart_bit_count_per_char_t; |
| AnnaBridge | 145:64910690c574 | 73 | |
| AnnaBridge | 145:64910690c574 | 74 | /*! @brief Define FlexIO UART interrupt mask. */ |
| AnnaBridge | 145:64910690c574 | 75 | enum _flexio_uart_interrupt_enable |
| AnnaBridge | 145:64910690c574 | 76 | { |
| AnnaBridge | 145:64910690c574 | 77 | kFLEXIO_UART_TxDataRegEmptyInterruptEnable = 0x1U, /*!< Transmit buffer empty interrupt enable. */ |
| AnnaBridge | 145:64910690c574 | 78 | kFLEXIO_UART_RxDataRegFullInterruptEnable = 0x2U, /*!< Receive buffer full interrupt enable. */ |
| AnnaBridge | 145:64910690c574 | 79 | }; |
| AnnaBridge | 145:64910690c574 | 80 | |
| AnnaBridge | 145:64910690c574 | 81 | /*! @brief Define FlexIO UART status mask. */ |
| AnnaBridge | 145:64910690c574 | 82 | enum _flexio_uart_status_flags |
| AnnaBridge | 145:64910690c574 | 83 | { |
| AnnaBridge | 145:64910690c574 | 84 | kFLEXIO_UART_TxDataRegEmptyFlag = 0x1U, /*!< Transmit buffer empty flag. */ |
| AnnaBridge | 145:64910690c574 | 85 | kFLEXIO_UART_RxDataRegFullFlag = 0x2U, /*!< Receive buffer full flag. */ |
| AnnaBridge | 145:64910690c574 | 86 | kFLEXIO_UART_RxOverRunFlag = 0x4U, /*!< Receive buffer over run flag. */ |
| AnnaBridge | 145:64910690c574 | 87 | }; |
| AnnaBridge | 145:64910690c574 | 88 | |
| AnnaBridge | 145:64910690c574 | 89 | /*! @brief Define FlexIO UART access structure typedef. */ |
| AnnaBridge | 145:64910690c574 | 90 | typedef struct _flexio_uart_type |
| AnnaBridge | 145:64910690c574 | 91 | { |
| AnnaBridge | 145:64910690c574 | 92 | FLEXIO_Type *flexioBase; /*!< FlexIO base pointer. */ |
| AnnaBridge | 145:64910690c574 | 93 | uint8_t TxPinIndex; /*!< Pin select for UART_Tx. */ |
| AnnaBridge | 145:64910690c574 | 94 | uint8_t RxPinIndex; /*!< Pin select for UART_Rx. */ |
| AnnaBridge | 145:64910690c574 | 95 | uint8_t shifterIndex[2]; /*!< Shifter index used in FlexIO UART. */ |
| AnnaBridge | 145:64910690c574 | 96 | uint8_t timerIndex[2]; /*!< Timer index used in FlexIO UART. */ |
| AnnaBridge | 145:64910690c574 | 97 | } FLEXIO_UART_Type; |
| AnnaBridge | 145:64910690c574 | 98 | |
| AnnaBridge | 145:64910690c574 | 99 | /*! @brief Define FlexIO UART user configuration structure. */ |
| AnnaBridge | 145:64910690c574 | 100 | typedef struct _flexio_uart_config |
| AnnaBridge | 145:64910690c574 | 101 | { |
| AnnaBridge | 145:64910690c574 | 102 | bool enableUart; /*!< Enable/disable FlexIO UART TX & RX. */ |
| AnnaBridge | 145:64910690c574 | 103 | bool enableInDoze; /*!< Enable/disable FlexIO operation in doze mode*/ |
| AnnaBridge | 145:64910690c574 | 104 | bool enableInDebug; /*!< Enable/disable FlexIO operation in debug mode*/ |
| AnnaBridge | 145:64910690c574 | 105 | bool enableFastAccess; /*!< Enable/disable fast access to FlexIO registers, |
| AnnaBridge | 145:64910690c574 | 106 | fast access requires the FlexIO clock to be at least |
| AnnaBridge | 145:64910690c574 | 107 | twice the frequency of the bus clock. */ |
| AnnaBridge | 145:64910690c574 | 108 | uint32_t baudRate_Bps; /*!< Baud rate in Bps. */ |
| AnnaBridge | 145:64910690c574 | 109 | flexio_uart_bit_count_per_char_t bitCountPerChar; /*!< number of bits, 7/8/9 -bit */ |
| AnnaBridge | 145:64910690c574 | 110 | } flexio_uart_config_t; |
| AnnaBridge | 145:64910690c574 | 111 | |
| AnnaBridge | 145:64910690c574 | 112 | /*! @brief Define FlexIO UART transfer structure. */ |
| AnnaBridge | 145:64910690c574 | 113 | typedef struct _flexio_uart_transfer |
| AnnaBridge | 145:64910690c574 | 114 | { |
| AnnaBridge | 145:64910690c574 | 115 | uint8_t *data; /*!< Transfer buffer*/ |
| AnnaBridge | 145:64910690c574 | 116 | size_t dataSize; /*!< Transfer size*/ |
| AnnaBridge | 145:64910690c574 | 117 | } flexio_uart_transfer_t; |
| AnnaBridge | 145:64910690c574 | 118 | |
| AnnaBridge | 145:64910690c574 | 119 | /* Forward declaration of the handle typedef. */ |
| AnnaBridge | 145:64910690c574 | 120 | typedef struct _flexio_uart_handle flexio_uart_handle_t; |
| AnnaBridge | 145:64910690c574 | 121 | |
| AnnaBridge | 145:64910690c574 | 122 | /*! @brief FlexIO UART transfer callback function. */ |
| AnnaBridge | 145:64910690c574 | 123 | typedef void (*flexio_uart_transfer_callback_t)(FLEXIO_UART_Type *base, |
| AnnaBridge | 145:64910690c574 | 124 | flexio_uart_handle_t *handle, |
| AnnaBridge | 145:64910690c574 | 125 | status_t status, |
| AnnaBridge | 145:64910690c574 | 126 | void *userData); |
| AnnaBridge | 145:64910690c574 | 127 | |
| AnnaBridge | 145:64910690c574 | 128 | /*! @brief Define FLEXIO UART handle structure*/ |
| AnnaBridge | 145:64910690c574 | 129 | struct _flexio_uart_handle |
| AnnaBridge | 145:64910690c574 | 130 | { |
| AnnaBridge | 145:64910690c574 | 131 | uint8_t *volatile txData; /*!< Address of remaining data to send. */ |
| AnnaBridge | 145:64910690c574 | 132 | volatile size_t txDataSize; /*!< Size of the remaining data to send. */ |
| AnnaBridge | 145:64910690c574 | 133 | uint8_t *volatile rxData; /*!< Address of remaining data to receive. */ |
| AnnaBridge | 145:64910690c574 | 134 | volatile size_t rxDataSize; /*!< Size of the remaining data to receive. */ |
| AnnaBridge | 145:64910690c574 | 135 | size_t txSize; /*!< Total bytes to be sent. */ |
| AnnaBridge | 145:64910690c574 | 136 | size_t rxSize; /*!< Total bytes to be received. */ |
| AnnaBridge | 145:64910690c574 | 137 | |
| AnnaBridge | 145:64910690c574 | 138 | uint8_t *rxRingBuffer; /*!< Start address of the receiver ring buffer. */ |
| AnnaBridge | 145:64910690c574 | 139 | size_t rxRingBufferSize; /*!< Size of the ring buffer. */ |
| AnnaBridge | 145:64910690c574 | 140 | volatile uint16_t rxRingBufferHead; /*!< Index for the driver to store received data into ring buffer. */ |
| AnnaBridge | 145:64910690c574 | 141 | volatile uint16_t rxRingBufferTail; /*!< Index for the user to get data from the ring buffer. */ |
| AnnaBridge | 145:64910690c574 | 142 | |
| AnnaBridge | 145:64910690c574 | 143 | flexio_uart_transfer_callback_t callback; /*!< Callback function. */ |
| AnnaBridge | 145:64910690c574 | 144 | void *userData; /*!< UART callback function parameter.*/ |
| AnnaBridge | 145:64910690c574 | 145 | |
| AnnaBridge | 145:64910690c574 | 146 | volatile uint8_t txState; /*!< TX transfer state. */ |
| AnnaBridge | 145:64910690c574 | 147 | volatile uint8_t rxState; /*!< RX transfer state */ |
| AnnaBridge | 145:64910690c574 | 148 | }; |
| AnnaBridge | 145:64910690c574 | 149 | |
| AnnaBridge | 145:64910690c574 | 150 | /******************************************************************************* |
| AnnaBridge | 145:64910690c574 | 151 | * API |
| AnnaBridge | 145:64910690c574 | 152 | ******************************************************************************/ |
| AnnaBridge | 145:64910690c574 | 153 | |
| AnnaBridge | 145:64910690c574 | 154 | #if defined(__cplusplus) |
| AnnaBridge | 145:64910690c574 | 155 | extern "C" { |
| AnnaBridge | 145:64910690c574 | 156 | #endif /*_cplusplus*/ |
| AnnaBridge | 145:64910690c574 | 157 | |
| AnnaBridge | 145:64910690c574 | 158 | /*! |
| AnnaBridge | 145:64910690c574 | 159 | * @name Initialization and deinitialization |
| AnnaBridge | 145:64910690c574 | 160 | * @{ |
| AnnaBridge | 145:64910690c574 | 161 | */ |
| AnnaBridge | 145:64910690c574 | 162 | |
| AnnaBridge | 145:64910690c574 | 163 | /*! |
| AnnaBridge | 145:64910690c574 | 164 | * @brief Ungates the FlexIO clock, resets the FlexIO module, configures FlexIO UART |
| AnnaBridge | 145:64910690c574 | 165 | * hardware, and configures the FlexIO UART with FlexIO UART configuration. |
| AnnaBridge | 145:64910690c574 | 166 | * The configuration structure can be filled by the user, or be set with |
| AnnaBridge | 145:64910690c574 | 167 | * default values by FLEXIO_UART_GetDefaultConfig(). |
| AnnaBridge | 145:64910690c574 | 168 | * |
| AnnaBridge | 145:64910690c574 | 169 | * Example |
| AnnaBridge | 145:64910690c574 | 170 | @code |
| AnnaBridge | 145:64910690c574 | 171 | FLEXIO_UART_Type base = { |
| AnnaBridge | 145:64910690c574 | 172 | .flexioBase = FLEXIO, |
| AnnaBridge | 145:64910690c574 | 173 | .TxPinIndex = 0, |
| AnnaBridge | 145:64910690c574 | 174 | .RxPinIndex = 1, |
| AnnaBridge | 145:64910690c574 | 175 | .shifterIndex = {0,1}, |
| AnnaBridge | 145:64910690c574 | 176 | .timerIndex = {0,1} |
| AnnaBridge | 145:64910690c574 | 177 | }; |
| AnnaBridge | 145:64910690c574 | 178 | flexio_uart_config_t config = { |
| AnnaBridge | 145:64910690c574 | 179 | .enableInDoze = false, |
| AnnaBridge | 145:64910690c574 | 180 | .enableInDebug = true, |
| AnnaBridge | 145:64910690c574 | 181 | .enableFastAccess = false, |
| AnnaBridge | 145:64910690c574 | 182 | .baudRate_Bps = 115200U, |
| AnnaBridge | 145:64910690c574 | 183 | .bitCountPerChar = 8 |
| AnnaBridge | 145:64910690c574 | 184 | }; |
| AnnaBridge | 145:64910690c574 | 185 | FLEXIO_UART_Init(base, &config, srcClock_Hz); |
| AnnaBridge | 145:64910690c574 | 186 | @endcode |
| AnnaBridge | 145:64910690c574 | 187 | * |
| AnnaBridge | 145:64910690c574 | 188 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 189 | * @param userConfig Pointer to the flexio_uart_config_t structure. |
| AnnaBridge | 145:64910690c574 | 190 | * @param srcClock_Hz FlexIO source clock in Hz. |
| AnnaBridge | 145:64910690c574 | 191 | */ |
| AnnaBridge | 145:64910690c574 | 192 | void FLEXIO_UART_Init(FLEXIO_UART_Type *base, const flexio_uart_config_t *userConfig, uint32_t srcClock_Hz); |
| AnnaBridge | 145:64910690c574 | 193 | |
| AnnaBridge | 145:64910690c574 | 194 | /*! |
| AnnaBridge | 145:64910690c574 | 195 | * @brief Disables the FlexIO UART and gates the FlexIO clock. |
| AnnaBridge | 145:64910690c574 | 196 | * |
| AnnaBridge | 145:64910690c574 | 197 | * @note After calling this API, call the FLEXO_UART_Init to use the FlexIO UART module. |
| AnnaBridge | 145:64910690c574 | 198 | * |
| AnnaBridge | 145:64910690c574 | 199 | * @param base pointer to FLEXIO_UART_Type structure |
| AnnaBridge | 145:64910690c574 | 200 | */ |
| AnnaBridge | 145:64910690c574 | 201 | void FLEXIO_UART_Deinit(FLEXIO_UART_Type *base); |
| AnnaBridge | 145:64910690c574 | 202 | |
| AnnaBridge | 145:64910690c574 | 203 | /*! |
| AnnaBridge | 145:64910690c574 | 204 | * @brief Gets the default configuration to configure the FlexIO UART. The configuration |
| AnnaBridge | 145:64910690c574 | 205 | * can be used directly for calling the FLEXIO_UART_Init(). |
| AnnaBridge | 145:64910690c574 | 206 | * Example: |
| AnnaBridge | 145:64910690c574 | 207 | @code |
| AnnaBridge | 145:64910690c574 | 208 | flexio_uart_config_t config; |
| AnnaBridge | 145:64910690c574 | 209 | FLEXIO_UART_GetDefaultConfig(&userConfig); |
| AnnaBridge | 145:64910690c574 | 210 | @endcode |
| AnnaBridge | 145:64910690c574 | 211 | * @param userConfig Pointer to the flexio_uart_config_t structure. |
| AnnaBridge | 145:64910690c574 | 212 | */ |
| AnnaBridge | 145:64910690c574 | 213 | void FLEXIO_UART_GetDefaultConfig(flexio_uart_config_t *userConfig); |
| AnnaBridge | 145:64910690c574 | 214 | |
| AnnaBridge | 145:64910690c574 | 215 | /* @} */ |
| AnnaBridge | 145:64910690c574 | 216 | |
| AnnaBridge | 145:64910690c574 | 217 | /*! |
| AnnaBridge | 145:64910690c574 | 218 | * @name Status |
| AnnaBridge | 145:64910690c574 | 219 | * @{ |
| AnnaBridge | 145:64910690c574 | 220 | */ |
| AnnaBridge | 145:64910690c574 | 221 | |
| AnnaBridge | 145:64910690c574 | 222 | /*! |
| AnnaBridge | 145:64910690c574 | 223 | * @brief Gets the FlexIO UART status flags. |
| AnnaBridge | 145:64910690c574 | 224 | * |
| AnnaBridge | 145:64910690c574 | 225 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 226 | * @return FlexIO UART status flags. |
| AnnaBridge | 145:64910690c574 | 227 | */ |
| AnnaBridge | 145:64910690c574 | 228 | |
| AnnaBridge | 145:64910690c574 | 229 | uint32_t FLEXIO_UART_GetStatusFlags(FLEXIO_UART_Type *base); |
| AnnaBridge | 145:64910690c574 | 230 | |
| AnnaBridge | 145:64910690c574 | 231 | /*! |
| AnnaBridge | 145:64910690c574 | 232 | * @brief Gets the FlexIO UART status flags. |
| AnnaBridge | 145:64910690c574 | 233 | * |
| AnnaBridge | 145:64910690c574 | 234 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 235 | * @param mask Status flag. |
| AnnaBridge | 145:64910690c574 | 236 | * The parameter can be any combination of the following values: |
| AnnaBridge | 145:64910690c574 | 237 | * @arg kFLEXIO_UART_TxDataRegEmptyFlag |
| AnnaBridge | 145:64910690c574 | 238 | * @arg kFLEXIO_UART_RxEmptyFlag |
| AnnaBridge | 145:64910690c574 | 239 | * @arg kFLEXIO_UART_RxOverRunFlag |
| AnnaBridge | 145:64910690c574 | 240 | */ |
| AnnaBridge | 145:64910690c574 | 241 | |
| AnnaBridge | 145:64910690c574 | 242 | void FLEXIO_UART_ClearStatusFlags(FLEXIO_UART_Type *base, uint32_t mask); |
| AnnaBridge | 145:64910690c574 | 243 | |
| AnnaBridge | 145:64910690c574 | 244 | /* @} */ |
| AnnaBridge | 145:64910690c574 | 245 | |
| AnnaBridge | 145:64910690c574 | 246 | /*! |
| AnnaBridge | 145:64910690c574 | 247 | * @name Interrupts |
| AnnaBridge | 145:64910690c574 | 248 | * @{ |
| AnnaBridge | 145:64910690c574 | 249 | */ |
| AnnaBridge | 145:64910690c574 | 250 | |
| AnnaBridge | 145:64910690c574 | 251 | /*! |
| AnnaBridge | 145:64910690c574 | 252 | * @brief Enables the FlexIO UART interrupt. |
| AnnaBridge | 145:64910690c574 | 253 | * |
| AnnaBridge | 145:64910690c574 | 254 | * This function enables the FlexIO UART interrupt. |
| AnnaBridge | 145:64910690c574 | 255 | * |
| AnnaBridge | 145:64910690c574 | 256 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 257 | * @param mask Interrupt source. |
| AnnaBridge | 145:64910690c574 | 258 | */ |
| AnnaBridge | 145:64910690c574 | 259 | void FLEXIO_UART_EnableInterrupts(FLEXIO_UART_Type *base, uint32_t mask); |
| AnnaBridge | 145:64910690c574 | 260 | |
| AnnaBridge | 145:64910690c574 | 261 | /*! |
| AnnaBridge | 145:64910690c574 | 262 | * @brief Disables the FlexIO UART interrupt. |
| AnnaBridge | 145:64910690c574 | 263 | * |
| AnnaBridge | 145:64910690c574 | 264 | * This function disables the FlexIO UART interrupt. |
| AnnaBridge | 145:64910690c574 | 265 | * |
| AnnaBridge | 145:64910690c574 | 266 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 267 | * @param mask Interrupt source. |
| AnnaBridge | 145:64910690c574 | 268 | */ |
| AnnaBridge | 145:64910690c574 | 269 | void FLEXIO_UART_DisableInterrupts(FLEXIO_UART_Type *base, uint32_t mask); |
| AnnaBridge | 145:64910690c574 | 270 | |
| AnnaBridge | 145:64910690c574 | 271 | /* @} */ |
| AnnaBridge | 145:64910690c574 | 272 | |
| AnnaBridge | 145:64910690c574 | 273 | /*! |
| AnnaBridge | 145:64910690c574 | 274 | * @name DMA Control |
| AnnaBridge | 145:64910690c574 | 275 | * @{ |
| AnnaBridge | 145:64910690c574 | 276 | */ |
| AnnaBridge | 145:64910690c574 | 277 | |
| AnnaBridge | 145:64910690c574 | 278 | /*! |
| AnnaBridge | 145:64910690c574 | 279 | * @brief Gets the FlexIO UARt transmit data register address. |
| AnnaBridge | 145:64910690c574 | 280 | * |
| AnnaBridge | 145:64910690c574 | 281 | * This function returns the UART data register address, which is mainly used by DMA/eDMA. |
| AnnaBridge | 145:64910690c574 | 282 | * |
| AnnaBridge | 145:64910690c574 | 283 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 284 | * @return FlexIO UART transmit data register address. |
| AnnaBridge | 145:64910690c574 | 285 | */ |
| AnnaBridge | 145:64910690c574 | 286 | static inline uint32_t FLEXIO_UART_GetTxDataRegisterAddress(FLEXIO_UART_Type *base) |
| AnnaBridge | 145:64910690c574 | 287 | { |
| AnnaBridge | 145:64910690c574 | 288 | return FLEXIO_GetShifterBufferAddress(base->flexioBase, kFLEXIO_ShifterBuffer, base->shifterIndex[0]); |
| AnnaBridge | 145:64910690c574 | 289 | } |
| AnnaBridge | 145:64910690c574 | 290 | |
| AnnaBridge | 145:64910690c574 | 291 | /*! |
| AnnaBridge | 145:64910690c574 | 292 | * @brief Gets the FlexIO UART receive data register address. |
| AnnaBridge | 145:64910690c574 | 293 | * |
| AnnaBridge | 145:64910690c574 | 294 | * This function returns the UART data register address, which is mainly used by DMA/eDMA. |
| AnnaBridge | 145:64910690c574 | 295 | * |
| AnnaBridge | 145:64910690c574 | 296 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 297 | * @return FlexIO UART receive data register address. |
| AnnaBridge | 145:64910690c574 | 298 | */ |
| AnnaBridge | 145:64910690c574 | 299 | static inline uint32_t FLEXIO_UART_GetRxDataRegisterAddress(FLEXIO_UART_Type *base) |
| AnnaBridge | 145:64910690c574 | 300 | { |
| AnnaBridge | 145:64910690c574 | 301 | return FLEXIO_GetShifterBufferAddress(base->flexioBase, kFLEXIO_ShifterBufferByteSwapped, base->shifterIndex[1]); |
| AnnaBridge | 145:64910690c574 | 302 | } |
| AnnaBridge | 145:64910690c574 | 303 | |
| AnnaBridge | 145:64910690c574 | 304 | /*! |
| AnnaBridge | 145:64910690c574 | 305 | * @brief Enables/disables the FlexIO UART transmit DMA. |
| AnnaBridge | 145:64910690c574 | 306 | * This function enables/disables the FlexIO UART Tx DMA, |
| AnnaBridge | 145:64910690c574 | 307 | * which means asserting the kFLEXIO_UART_TxDataRegEmptyFlag does/doesn't trigger the DMA request. |
| AnnaBridge | 145:64910690c574 | 308 | * |
| AnnaBridge | 145:64910690c574 | 309 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 310 | * @param enable True to enable, false to disable. |
| AnnaBridge | 145:64910690c574 | 311 | */ |
| AnnaBridge | 145:64910690c574 | 312 | static inline void FLEXIO_UART_EnableTxDMA(FLEXIO_UART_Type *base, bool enable) |
| AnnaBridge | 145:64910690c574 | 313 | { |
| AnnaBridge | 145:64910690c574 | 314 | FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1 << base->shifterIndex[0], enable); |
| AnnaBridge | 145:64910690c574 | 315 | } |
| AnnaBridge | 145:64910690c574 | 316 | |
| AnnaBridge | 145:64910690c574 | 317 | /*! |
| AnnaBridge | 145:64910690c574 | 318 | * @brief Enables/disables the FlexIO UART receive DMA. |
| AnnaBridge | 145:64910690c574 | 319 | * This function enables/disables the FlexIO UART Rx DMA, |
| AnnaBridge | 145:64910690c574 | 320 | * which means asserting kFLEXIO_UART_RxDataRegFullFlag does/doesn't trigger the DMA request. |
| AnnaBridge | 145:64910690c574 | 321 | * |
| AnnaBridge | 145:64910690c574 | 322 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 323 | * @param enable True to enable, false to disable. |
| AnnaBridge | 145:64910690c574 | 324 | */ |
| AnnaBridge | 145:64910690c574 | 325 | static inline void FLEXIO_UART_EnableRxDMA(FLEXIO_UART_Type *base, bool enable) |
| AnnaBridge | 145:64910690c574 | 326 | { |
| AnnaBridge | 145:64910690c574 | 327 | FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1 << base->shifterIndex[1], enable); |
| AnnaBridge | 145:64910690c574 | 328 | } |
| AnnaBridge | 145:64910690c574 | 329 | |
| AnnaBridge | 145:64910690c574 | 330 | /* @} */ |
| AnnaBridge | 145:64910690c574 | 331 | |
| AnnaBridge | 145:64910690c574 | 332 | /*! |
| AnnaBridge | 145:64910690c574 | 333 | * @name Bus Operations |
| AnnaBridge | 145:64910690c574 | 334 | * @{ |
| AnnaBridge | 145:64910690c574 | 335 | */ |
| AnnaBridge | 145:64910690c574 | 336 | |
| AnnaBridge | 145:64910690c574 | 337 | /*! |
| AnnaBridge | 145:64910690c574 | 338 | * @brief Enables/disables the FlexIO UART module operation. |
| AnnaBridge | 145:64910690c574 | 339 | * |
| AnnaBridge | 145:64910690c574 | 340 | * @param base Pointer to the FLEXIO_UART_Type. |
| AnnaBridge | 145:64910690c574 | 341 | * @param enable True to enable, false to disable. |
| AnnaBridge | 145:64910690c574 | 342 | */ |
| AnnaBridge | 145:64910690c574 | 343 | static inline void FLEXIO_UART_Enable(FLEXIO_UART_Type *base, bool enable) |
| AnnaBridge | 145:64910690c574 | 344 | { |
| AnnaBridge | 145:64910690c574 | 345 | if (enable) |
| AnnaBridge | 145:64910690c574 | 346 | { |
| AnnaBridge | 145:64910690c574 | 347 | base->flexioBase->CTRL |= FLEXIO_CTRL_FLEXEN_MASK; |
| AnnaBridge | 145:64910690c574 | 348 | } |
| AnnaBridge | 145:64910690c574 | 349 | else |
| AnnaBridge | 145:64910690c574 | 350 | { |
| AnnaBridge | 145:64910690c574 | 351 | base->flexioBase->CTRL &= ~FLEXIO_CTRL_FLEXEN_MASK; |
| AnnaBridge | 145:64910690c574 | 352 | } |
| AnnaBridge | 145:64910690c574 | 353 | } |
| AnnaBridge | 145:64910690c574 | 354 | |
| AnnaBridge | 145:64910690c574 | 355 | /*! |
| AnnaBridge | 145:64910690c574 | 356 | * @brief Writes one byte of data. |
| AnnaBridge | 145:64910690c574 | 357 | * |
| AnnaBridge | 145:64910690c574 | 358 | * @note This is a non-blocking API, which returns directly after the data is put into the |
| AnnaBridge | 145:64910690c574 | 359 | * data register. Ensure that the TxEmptyFlag is asserted before calling |
| AnnaBridge | 145:64910690c574 | 360 | * this API. |
| AnnaBridge | 145:64910690c574 | 361 | * |
| AnnaBridge | 145:64910690c574 | 362 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 363 | * @param buffer The data bytes to send. |
| AnnaBridge | 145:64910690c574 | 364 | */ |
| AnnaBridge | 145:64910690c574 | 365 | static inline void FLEXIO_UART_WriteByte(FLEXIO_UART_Type *base, const uint8_t *buffer) |
| AnnaBridge | 145:64910690c574 | 366 | { |
| AnnaBridge | 145:64910690c574 | 367 | base->flexioBase->SHIFTBUF[base->shifterIndex[0]] = *buffer; |
| AnnaBridge | 145:64910690c574 | 368 | } |
| AnnaBridge | 145:64910690c574 | 369 | |
| AnnaBridge | 145:64910690c574 | 370 | /*! |
| AnnaBridge | 145:64910690c574 | 371 | * @brief Reads one byte of data. |
| AnnaBridge | 145:64910690c574 | 372 | * |
| AnnaBridge | 145:64910690c574 | 373 | * @note This is a non-blocking API, which returns directly after the data is read from the |
| AnnaBridge | 145:64910690c574 | 374 | * data register. Ensure that the RxFullFlag is asserted before calling this API. |
| AnnaBridge | 145:64910690c574 | 375 | * |
| AnnaBridge | 145:64910690c574 | 376 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 377 | * @param buffer The buffer to store the received bytes. |
| AnnaBridge | 145:64910690c574 | 378 | */ |
| AnnaBridge | 145:64910690c574 | 379 | static inline void FLEXIO_UART_ReadByte(FLEXIO_UART_Type *base, uint8_t *buffer) |
| AnnaBridge | 145:64910690c574 | 380 | { |
| AnnaBridge | 145:64910690c574 | 381 | *buffer = base->flexioBase->SHIFTBUFBYS[base->shifterIndex[1]]; |
| AnnaBridge | 145:64910690c574 | 382 | } |
| AnnaBridge | 145:64910690c574 | 383 | |
| AnnaBridge | 145:64910690c574 | 384 | /*! |
| AnnaBridge | 145:64910690c574 | 385 | * @brief Sends a buffer of data bytes. |
| AnnaBridge | 145:64910690c574 | 386 | * |
| AnnaBridge | 145:64910690c574 | 387 | * @note This function blocks using the polling method until all bytes have been sent. |
| AnnaBridge | 145:64910690c574 | 388 | * |
| AnnaBridge | 145:64910690c574 | 389 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 390 | * @param txData The data bytes to send. |
| AnnaBridge | 145:64910690c574 | 391 | * @param txSize The number of data bytes to send. |
| AnnaBridge | 145:64910690c574 | 392 | */ |
| AnnaBridge | 145:64910690c574 | 393 | void FLEXIO_UART_WriteBlocking(FLEXIO_UART_Type *base, const uint8_t *txData, size_t txSize); |
| AnnaBridge | 145:64910690c574 | 394 | |
| AnnaBridge | 145:64910690c574 | 395 | /*! |
| AnnaBridge | 145:64910690c574 | 396 | * @brief Receives a buffer of bytes. |
| AnnaBridge | 145:64910690c574 | 397 | * |
| AnnaBridge | 145:64910690c574 | 398 | * @note This function blocks using the polling method until all bytes have been received. |
| AnnaBridge | 145:64910690c574 | 399 | * |
| AnnaBridge | 145:64910690c574 | 400 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 401 | * @param rxData The buffer to store the received bytes. |
| AnnaBridge | 145:64910690c574 | 402 | * @param rxSize The number of data bytes to be received. |
| AnnaBridge | 145:64910690c574 | 403 | */ |
| AnnaBridge | 145:64910690c574 | 404 | void FLEXIO_UART_ReadBlocking(FLEXIO_UART_Type *base, uint8_t *rxData, size_t rxSize); |
| AnnaBridge | 145:64910690c574 | 405 | |
| AnnaBridge | 145:64910690c574 | 406 | /* @} */ |
| AnnaBridge | 145:64910690c574 | 407 | |
| AnnaBridge | 145:64910690c574 | 408 | /*! |
| AnnaBridge | 145:64910690c574 | 409 | * @name Transactional |
| AnnaBridge | 145:64910690c574 | 410 | * @{ |
| AnnaBridge | 145:64910690c574 | 411 | */ |
| AnnaBridge | 145:64910690c574 | 412 | |
| AnnaBridge | 145:64910690c574 | 413 | /*! |
| AnnaBridge | 145:64910690c574 | 414 | * @brief Initializes the UART handle. |
| AnnaBridge | 145:64910690c574 | 415 | * |
| AnnaBridge | 145:64910690c574 | 416 | * This function initializes the FlexIO UART handle, which can be used for other FlexIO |
| AnnaBridge | 145:64910690c574 | 417 | * UART transactional APIs. Call this API once to get the |
| AnnaBridge | 145:64910690c574 | 418 | * initialized handle. |
| AnnaBridge | 145:64910690c574 | 419 | * |
| AnnaBridge | 145:64910690c574 | 420 | * The UART driver supports the "background" receiving, which means that user can set up |
| AnnaBridge | 145:64910690c574 | 421 | * a RX ring buffer optionally. Data received is stored into the ring buffer even when |
| AnnaBridge | 145:64910690c574 | 422 | * the user doesn't call the FLEXIO_UART_TransferReceiveNonBlocking() API. If there is already data |
| AnnaBridge | 145:64910690c574 | 423 | * received in the ring buffer, user can get the received data from the ring buffer |
| AnnaBridge | 145:64910690c574 | 424 | * directly. The ring buffer is disabled if passing NULL as @p ringBuffer. |
| AnnaBridge | 145:64910690c574 | 425 | * |
| AnnaBridge | 145:64910690c574 | 426 | * @param base to FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 427 | * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. |
| AnnaBridge | 145:64910690c574 | 428 | * @param callback The callback function. |
| AnnaBridge | 145:64910690c574 | 429 | * @param userData The parameter of the callback function. |
| AnnaBridge | 145:64910690c574 | 430 | * @retval kStatus_Success Successfully create the handle. |
| AnnaBridge | 145:64910690c574 | 431 | * @retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range. |
| AnnaBridge | 145:64910690c574 | 432 | */ |
| AnnaBridge | 145:64910690c574 | 433 | status_t FLEXIO_UART_TransferCreateHandle(FLEXIO_UART_Type *base, |
| AnnaBridge | 145:64910690c574 | 434 | flexio_uart_handle_t *handle, |
| AnnaBridge | 145:64910690c574 | 435 | flexio_uart_transfer_callback_t callback, |
| AnnaBridge | 145:64910690c574 | 436 | void *userData); |
| AnnaBridge | 145:64910690c574 | 437 | |
| AnnaBridge | 145:64910690c574 | 438 | /*! |
| AnnaBridge | 145:64910690c574 | 439 | * @brief Sets up the RX ring buffer. |
| AnnaBridge | 145:64910690c574 | 440 | * |
| AnnaBridge | 145:64910690c574 | 441 | * This function sets up the RX ring buffer to a specific UART handle. |
| AnnaBridge | 145:64910690c574 | 442 | * |
| AnnaBridge | 145:64910690c574 | 443 | * When the RX ring buffer is used, data received is stored into the ring buffer even when |
| AnnaBridge | 145:64910690c574 | 444 | * the user doesn't call the UART_ReceiveNonBlocking() API. If there are already data received |
| AnnaBridge | 145:64910690c574 | 445 | * in the ring buffer, user can get the received data from the ring buffer directly. |
| AnnaBridge | 145:64910690c574 | 446 | * |
| AnnaBridge | 145:64910690c574 | 447 | * @note When using the RX ring buffer, one byte is reserved for internal use. In other |
| AnnaBridge | 145:64910690c574 | 448 | * words, if @p ringBufferSize is 32, only 31 bytes are used for saving data. |
| AnnaBridge | 145:64910690c574 | 449 | * |
| AnnaBridge | 145:64910690c574 | 450 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 451 | * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. |
| AnnaBridge | 145:64910690c574 | 452 | * @param ringBuffer Start address of ring buffer for background receiving. Pass NULL to disable the ring buffer. |
| AnnaBridge | 145:64910690c574 | 453 | * @param ringBufferSize Size of the ring buffer. |
| AnnaBridge | 145:64910690c574 | 454 | */ |
| AnnaBridge | 145:64910690c574 | 455 | void FLEXIO_UART_TransferStartRingBuffer(FLEXIO_UART_Type *base, |
| AnnaBridge | 145:64910690c574 | 456 | flexio_uart_handle_t *handle, |
| AnnaBridge | 145:64910690c574 | 457 | uint8_t *ringBuffer, |
| AnnaBridge | 145:64910690c574 | 458 | size_t ringBufferSize); |
| AnnaBridge | 145:64910690c574 | 459 | |
| AnnaBridge | 145:64910690c574 | 460 | /*! |
| AnnaBridge | 145:64910690c574 | 461 | * @brief Aborts the background transfer and uninstalls the ring buffer. |
| AnnaBridge | 145:64910690c574 | 462 | * |
| AnnaBridge | 145:64910690c574 | 463 | * This function aborts the background transfer and uninstalls the ring buffer. |
| AnnaBridge | 145:64910690c574 | 464 | * |
| AnnaBridge | 145:64910690c574 | 465 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 466 | * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. |
| AnnaBridge | 145:64910690c574 | 467 | */ |
| AnnaBridge | 145:64910690c574 | 468 | void FLEXIO_UART_TransferStopRingBuffer(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle); |
| AnnaBridge | 145:64910690c574 | 469 | |
| AnnaBridge | 145:64910690c574 | 470 | /*! |
| AnnaBridge | 145:64910690c574 | 471 | * @brief Transmits a buffer of data using the interrupt method. |
| AnnaBridge | 145:64910690c574 | 472 | * |
| AnnaBridge | 145:64910690c574 | 473 | * This function sends data using an interrupt method. This is a non-blocking function, |
| AnnaBridge | 145:64910690c574 | 474 | * which returns directly without waiting for all data to be written to the TX register. When |
| AnnaBridge | 145:64910690c574 | 475 | * all data are written to TX register in ISR, the FlexIO UART driver calls the callback |
| AnnaBridge | 145:64910690c574 | 476 | * function and passes the @ref kStatus_FLEXIO_UART_TxIdle as status parameter. |
| AnnaBridge | 145:64910690c574 | 477 | * |
| AnnaBridge | 145:64910690c574 | 478 | * @note The kStatus_FLEXIO_UART_TxIdle is passed to the upper layer when all data is written |
| AnnaBridge | 145:64910690c574 | 479 | * to the TX register. However, it does not ensure that all data is sent out. |
| AnnaBridge | 145:64910690c574 | 480 | * |
| AnnaBridge | 145:64910690c574 | 481 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 482 | * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. |
| AnnaBridge | 145:64910690c574 | 483 | * @param xfer FlexIO UART transfer structure. See #flexio_uart_transfer_t. |
| AnnaBridge | 145:64910690c574 | 484 | * @retval kStatus_Success Successfully starts the data transmission. |
| AnnaBridge | 145:64910690c574 | 485 | * @retval kStatus_UART_TxBusy Previous transmission still not finished, data not written to the TX register. |
| AnnaBridge | 145:64910690c574 | 486 | */ |
| AnnaBridge | 145:64910690c574 | 487 | status_t FLEXIO_UART_TransferSendNonBlocking(FLEXIO_UART_Type *base, |
| AnnaBridge | 145:64910690c574 | 488 | flexio_uart_handle_t *handle, |
| AnnaBridge | 145:64910690c574 | 489 | flexio_uart_transfer_t *xfer); |
| AnnaBridge | 145:64910690c574 | 490 | |
| AnnaBridge | 145:64910690c574 | 491 | /*! |
| AnnaBridge | 145:64910690c574 | 492 | * @brief Aborts the interrupt-driven data transmit. |
| AnnaBridge | 145:64910690c574 | 493 | * |
| AnnaBridge | 145:64910690c574 | 494 | * This function aborts the interrupt-driven data sending. Get the remainBytes to know |
| AnnaBridge | 145:64910690c574 | 495 | * how many bytes are still not sent out. |
| AnnaBridge | 145:64910690c574 | 496 | * |
| AnnaBridge | 145:64910690c574 | 497 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 498 | * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. |
| AnnaBridge | 145:64910690c574 | 499 | */ |
| AnnaBridge | 145:64910690c574 | 500 | void FLEXIO_UART_TransferAbortSend(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle); |
| AnnaBridge | 145:64910690c574 | 501 | |
| AnnaBridge | 145:64910690c574 | 502 | /*! |
| AnnaBridge | 145:64910690c574 | 503 | * @brief Gets the number of remaining bytes not sent. |
| AnnaBridge | 145:64910690c574 | 504 | * |
| AnnaBridge | 145:64910690c574 | 505 | * This function gets the number of remaining bytes not sent driven by interrupt. |
| AnnaBridge | 145:64910690c574 | 506 | * |
| AnnaBridge | 145:64910690c574 | 507 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 508 | * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. |
| AnnaBridge | 145:64910690c574 | 509 | * @param count Number of bytes sent so far by the non-blocking transaction. |
| AnnaBridge | 145:64910690c574 | 510 | * @retval kStatus_InvalidArgument count is Invalid. |
| AnnaBridge | 145:64910690c574 | 511 | * @retval kStatus_Success Successfully return the count. |
| AnnaBridge | 145:64910690c574 | 512 | */ |
| AnnaBridge | 145:64910690c574 | 513 | status_t FLEXIO_UART_TransferGetSendCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count); |
| AnnaBridge | 145:64910690c574 | 514 | |
| AnnaBridge | 145:64910690c574 | 515 | /*! |
| AnnaBridge | 145:64910690c574 | 516 | * @brief Receives a buffer of data using the interrupt method. |
| AnnaBridge | 145:64910690c574 | 517 | * |
| AnnaBridge | 145:64910690c574 | 518 | * This function receives data using the interrupt method. This is a non-blocking function, |
| AnnaBridge | 145:64910690c574 | 519 | * which returns without waiting for all data to be received. |
| AnnaBridge | 145:64910690c574 | 520 | * If the RX ring buffer is used and not empty, the data in ring buffer is copied and |
| AnnaBridge | 145:64910690c574 | 521 | * the parameter @p receivedBytes shows how many bytes are copied from the ring buffer. |
| AnnaBridge | 145:64910690c574 | 522 | * After copying, if the data in ring buffer is not enough to read, the receive |
| AnnaBridge | 145:64910690c574 | 523 | * request is saved by the UART driver. When new data arrives, the receive request |
| AnnaBridge | 145:64910690c574 | 524 | * is serviced first. When all data is received, the UART driver notifies the upper layer |
| AnnaBridge | 145:64910690c574 | 525 | * through a callback function and passes the status parameter @ref kStatus_UART_RxIdle. |
| AnnaBridge | 145:64910690c574 | 526 | * For example, if the upper layer needs 10 bytes but there are only 5 bytes in the ring buffer, |
| AnnaBridge | 145:64910690c574 | 527 | * the 5 bytes are copied to xfer->data. This function returns with the |
| AnnaBridge | 145:64910690c574 | 528 | * parameter @p receivedBytes set to 5. For the last 5 bytes, newly arrived data is |
| AnnaBridge | 145:64910690c574 | 529 | * saved from the xfer->data[5]. When 5 bytes are received, the UART driver notifies upper layer. |
| AnnaBridge | 145:64910690c574 | 530 | * If the RX ring buffer is not enabled, this function enables the RX and RX interrupt |
| AnnaBridge | 145:64910690c574 | 531 | * to receive data to xfer->data. When all data is received, the upper layer is notified. |
| AnnaBridge | 145:64910690c574 | 532 | * |
| AnnaBridge | 145:64910690c574 | 533 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 534 | * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. |
| AnnaBridge | 145:64910690c574 | 535 | * @param xfer UART transfer structure. See #flexio_uart_transfer_t. |
| AnnaBridge | 145:64910690c574 | 536 | * @param receivedBytes Bytes received from the ring buffer directly. |
| AnnaBridge | 145:64910690c574 | 537 | * @retval kStatus_Success Successfully queue the transfer into the transmit queue. |
| AnnaBridge | 145:64910690c574 | 538 | * @retval kStatus_FLEXIO_UART_RxBusy Previous receive request is not finished. |
| AnnaBridge | 145:64910690c574 | 539 | */ |
| AnnaBridge | 145:64910690c574 | 540 | status_t FLEXIO_UART_TransferReceiveNonBlocking(FLEXIO_UART_Type *base, |
| AnnaBridge | 145:64910690c574 | 541 | flexio_uart_handle_t *handle, |
| AnnaBridge | 145:64910690c574 | 542 | flexio_uart_transfer_t *xfer, |
| AnnaBridge | 145:64910690c574 | 543 | size_t *receivedBytes); |
| AnnaBridge | 145:64910690c574 | 544 | |
| AnnaBridge | 145:64910690c574 | 545 | /*! |
| AnnaBridge | 145:64910690c574 | 546 | * @brief Aborts the receive data which was using IRQ. |
| AnnaBridge | 145:64910690c574 | 547 | * |
| AnnaBridge | 145:64910690c574 | 548 | * This function aborts the receive data which was using IRQ. |
| AnnaBridge | 145:64910690c574 | 549 | * |
| AnnaBridge | 145:64910690c574 | 550 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 551 | * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. |
| AnnaBridge | 145:64910690c574 | 552 | */ |
| AnnaBridge | 145:64910690c574 | 553 | void FLEXIO_UART_TransferAbortReceive(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle); |
| AnnaBridge | 145:64910690c574 | 554 | |
| AnnaBridge | 145:64910690c574 | 555 | /*! |
| AnnaBridge | 145:64910690c574 | 556 | * @brief Gets the number of remaining bytes not received. |
| AnnaBridge | 145:64910690c574 | 557 | * |
| AnnaBridge | 145:64910690c574 | 558 | * This function gets the number of remaining bytes not received driven by interrupt. |
| AnnaBridge | 145:64910690c574 | 559 | * |
| AnnaBridge | 145:64910690c574 | 560 | * @param base Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 561 | * @param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. |
| AnnaBridge | 145:64910690c574 | 562 | * @param count Number of bytes received so far by the non-blocking transaction. |
| AnnaBridge | 145:64910690c574 | 563 | * @retval kStatus_InvalidArgument count is Invalid. |
| AnnaBridge | 145:64910690c574 | 564 | * @retval kStatus_Success Successfully return the count. |
| AnnaBridge | 145:64910690c574 | 565 | */ |
| AnnaBridge | 145:64910690c574 | 566 | status_t FLEXIO_UART_TransferGetReceiveCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count); |
| AnnaBridge | 145:64910690c574 | 567 | |
| AnnaBridge | 145:64910690c574 | 568 | /*! |
| AnnaBridge | 145:64910690c574 | 569 | * @brief FlexIO UART IRQ handler function. |
| AnnaBridge | 145:64910690c574 | 570 | * |
| AnnaBridge | 145:64910690c574 | 571 | * This function processes the FlexIO UART transmit and receives the IRQ request. |
| AnnaBridge | 145:64910690c574 | 572 | * |
| AnnaBridge | 145:64910690c574 | 573 | * @param uartType Pointer to the FLEXIO_UART_Type structure. |
| AnnaBridge | 145:64910690c574 | 574 | * @param uartHandle Pointer to the flexio_uart_handle_t structure to store the transfer state. |
| AnnaBridge | 145:64910690c574 | 575 | */ |
| AnnaBridge | 145:64910690c574 | 576 | void FLEXIO_UART_TransferHandleIRQ(void *uartType, void *uartHandle); |
| AnnaBridge | 145:64910690c574 | 577 | |
| AnnaBridge | 145:64910690c574 | 578 | /*@}*/ |
| AnnaBridge | 145:64910690c574 | 579 | |
| AnnaBridge | 145:64910690c574 | 580 | #if defined(__cplusplus) |
| AnnaBridge | 145:64910690c574 | 581 | } |
| AnnaBridge | 145:64910690c574 | 582 | #endif /*_cplusplus*/ |
| AnnaBridge | 145:64910690c574 | 583 | /*@}*/ |
| AnnaBridge | 145:64910690c574 | 584 | |
| AnnaBridge | 145:64910690c574 | 585 | #endif /*_FSL_FLEXIO_UART_H_*/ |


