mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Thu Apr 03 11:45:06 2014 +0100
Revision:
149:1fb5f62b92bd
Parent:
targets/hal/TARGET_Freescale/TARGET_KSDK_MCUS/TARGET_KSDK_CODE/hal/uart/fsl_uart_hal_interrupts_and_dma.c@146:f64d43ff0c18
Synchronized with git revision 220c0bb39ceee40016e1e86350c058963d01ed42

Full URL: https://github.com/mbedmicro/mbed/commit/220c0bb39ceee40016e1e86350c058963d01ed42/

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 146:f64d43ff0c18 1 /*
mbed_official 146:f64d43ff0c18 2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
mbed_official 146:f64d43ff0c18 3 * All rights reserved.
mbed_official 146:f64d43ff0c18 4 *
mbed_official 146:f64d43ff0c18 5 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 146:f64d43ff0c18 6 * are permitted provided that the following conditions are met:
mbed_official 146:f64d43ff0c18 7 *
mbed_official 146:f64d43ff0c18 8 * o Redistributions of source code must retain the above copyright notice, this list
mbed_official 146:f64d43ff0c18 9 * of conditions and the following disclaimer.
mbed_official 146:f64d43ff0c18 10 *
mbed_official 146:f64d43ff0c18 11 * o Redistributions in binary form must reproduce the above copyright notice, this
mbed_official 146:f64d43ff0c18 12 * list of conditions and the following disclaimer in the documentation and/or
mbed_official 146:f64d43ff0c18 13 * other materials provided with the distribution.
mbed_official 146:f64d43ff0c18 14 *
mbed_official 146:f64d43ff0c18 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
mbed_official 146:f64d43ff0c18 16 * contributors may be used to endorse or promote products derived from this
mbed_official 146:f64d43ff0c18 17 * software without specific prior written permission.
mbed_official 146:f64d43ff0c18 18 *
mbed_official 146:f64d43ff0c18 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
mbed_official 146:f64d43ff0c18 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
mbed_official 146:f64d43ff0c18 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 146:f64d43ff0c18 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
mbed_official 146:f64d43ff0c18 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
mbed_official 146:f64d43ff0c18 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
mbed_official 146:f64d43ff0c18 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
mbed_official 146:f64d43ff0c18 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
mbed_official 146:f64d43ff0c18 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
mbed_official 146:f64d43ff0c18 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 146:f64d43ff0c18 29 */
mbed_official 146:f64d43ff0c18 30 #include "fsl_uart_hal.h"
mbed_official 146:f64d43ff0c18 31
mbed_official 146:f64d43ff0c18 32 /*******************************************************************************
mbed_official 146:f64d43ff0c18 33 * Definitions
mbed_official 146:f64d43ff0c18 34 ******************************************************************************/
mbed_official 146:f64d43ff0c18 35
mbed_official 146:f64d43ff0c18 36 /*******************************************************************************
mbed_official 146:f64d43ff0c18 37 * Code
mbed_official 146:f64d43ff0c18 38 ******************************************************************************/
mbed_official 146:f64d43ff0c18 39
mbed_official 146:f64d43ff0c18 40 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 41 *
mbed_official 146:f64d43ff0c18 42 * Function Name : uart_hal_configure_interrupts
mbed_official 146:f64d43ff0c18 43 * Description : Configure the UART module interrupts to enable/disable various interrupt sources.
mbed_official 146:f64d43ff0c18 44 * This function allows the user to configure all of the UART interrupts with one function call.
mbed_official 146:f64d43ff0c18 45 * The user will first need to initialize and pass in a structure of type uart_interrupt_config_t
mbed_official 146:f64d43ff0c18 46 * which sets the configuration of each interrupt.
mbed_official 146:f64d43ff0c18 47 *
mbed_official 146:f64d43ff0c18 48 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 49 void uart_hal_configure_interrupts(uint32_t uartInstance,
mbed_official 146:f64d43ff0c18 50 const uart_interrupt_config_t * interruptConfig)
mbed_official 146:f64d43ff0c18 51 {
mbed_official 146:f64d43ff0c18 52 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 53
mbed_official 146:f64d43ff0c18 54 uint8_t temp;
mbed_official 146:f64d43ff0c18 55
mbed_official 146:f64d43ff0c18 56 /* configure uart interrupt enables*/
mbed_official 146:f64d43ff0c18 57 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 58 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 59 {
mbed_official 146:f64d43ff0c18 60 /* 0 - disable interrupt, 1 - enable interrupt*/
mbed_official 146:f64d43ff0c18 61
mbed_official 146:f64d43ff0c18 62 /* UART BDH register */
mbed_official 146:f64d43ff0c18 63 temp = HW_UART0_BDH_RD() & ~(BM_UART0_BDH_LBKDIE|BM_UART0_BDH_RXEDGIE);
mbed_official 146:f64d43ff0c18 64 temp |= BF_UART0_BDH_LBKDIE(interruptConfig->linBreakDetect)
mbed_official 146:f64d43ff0c18 65 |BF_UART0_BDH_RXEDGIE(interruptConfig->rxActiveEdge);
mbed_official 146:f64d43ff0c18 66 HW_UART0_BDH_WR(temp);
mbed_official 146:f64d43ff0c18 67
mbed_official 146:f64d43ff0c18 68 /* UART C2 register */
mbed_official 146:f64d43ff0c18 69 temp = HW_UART0_C2_RD() & ~(BM_UART0_C2_TIE|BM_UART0_C2_TCIE|BM_UART0_C2_RIE|
mbed_official 146:f64d43ff0c18 70 BM_UART0_C2_ILIE);
mbed_official 146:f64d43ff0c18 71 temp |= BF_UART0_C2_TIE(interruptConfig->transmitDataRegisterEmpty)
mbed_official 146:f64d43ff0c18 72 |BF_UART0_C2_TCIE(interruptConfig->transmitComplete)
mbed_official 146:f64d43ff0c18 73 |BF_UART0_C2_RIE(interruptConfig->receiverDataRegisterFull)
mbed_official 146:f64d43ff0c18 74 |BF_UART0_C2_ILIE(interruptConfig->idleLine);
mbed_official 146:f64d43ff0c18 75 HW_UART0_C2_WR(temp);
mbed_official 146:f64d43ff0c18 76
mbed_official 146:f64d43ff0c18 77 /* UART C3 register */
mbed_official 146:f64d43ff0c18 78 temp = HW_UART0_C3_RD() & ~(BM_UART0_C3_ORIE|BM_UART0_C3_NEIE|BM_UART0_C3_FEIE|
mbed_official 146:f64d43ff0c18 79 BM_UART0_C3_PEIE);
mbed_official 146:f64d43ff0c18 80 temp |= BF_UART0_C3_ORIE(interruptConfig->receiverOverrun)
mbed_official 146:f64d43ff0c18 81 |BF_UART0_C3_NEIE(interruptConfig->noiseErrorFlag)
mbed_official 146:f64d43ff0c18 82 |BF_UART0_C3_FEIE(interruptConfig->frameErrorFlag)
mbed_official 146:f64d43ff0c18 83 |BF_UART0_C3_PEIE(interruptConfig->parityErrorFlag);
mbed_official 146:f64d43ff0c18 84 HW_UART0_C3_WR(temp);
mbed_official 146:f64d43ff0c18 85
mbed_official 146:f64d43ff0c18 86 }
mbed_official 146:f64d43ff0c18 87 else
mbed_official 146:f64d43ff0c18 88 #endif
mbed_official 146:f64d43ff0c18 89 {
mbed_official 146:f64d43ff0c18 90 /* 0 - disable interrupt, 1 - enable interrupt*/
mbed_official 146:f64d43ff0c18 91
mbed_official 146:f64d43ff0c18 92 /* UART BDH register */
mbed_official 146:f64d43ff0c18 93 temp = HW_UART_BDH_RD(uartInstance) & ~(BM_UART_BDH_LBKDIE|BM_UART_BDH_RXEDGIE);
mbed_official 146:f64d43ff0c18 94 temp |= BF_UART_BDH_LBKDIE(interruptConfig->linBreakDetect)
mbed_official 146:f64d43ff0c18 95 |BF_UART_BDH_RXEDGIE(interruptConfig->rxActiveEdge);
mbed_official 146:f64d43ff0c18 96 HW_UART_BDH_WR(uartInstance, temp);
mbed_official 146:f64d43ff0c18 97
mbed_official 146:f64d43ff0c18 98 /* UART C2 register */
mbed_official 146:f64d43ff0c18 99 temp = HW_UART_C2_RD(uartInstance) & ~(BM_UART_C2_TIE|BM_UART_C2_TCIE|BM_UART_C2_RIE|
mbed_official 146:f64d43ff0c18 100 BM_UART_C2_ILIE);
mbed_official 146:f64d43ff0c18 101 temp |= BF_UART_C2_TIE(interruptConfig->transmitDataRegisterEmpty)
mbed_official 146:f64d43ff0c18 102 |BF_UART_C2_TCIE(interruptConfig->transmitComplete)
mbed_official 146:f64d43ff0c18 103 |BF_UART_C2_RIE(interruptConfig->receiverDataRegisterFull)
mbed_official 146:f64d43ff0c18 104 |BF_UART_C2_ILIE(interruptConfig->idleLine);
mbed_official 146:f64d43ff0c18 105 HW_UART_C2_WR(uartInstance, temp);
mbed_official 146:f64d43ff0c18 106
mbed_official 146:f64d43ff0c18 107 /* UART C3 register */
mbed_official 146:f64d43ff0c18 108 temp = HW_UART_C3_RD(uartInstance) & ~(BM_UART_C3_ORIE|BM_UART_C3_NEIE|BM_UART_C3_FEIE|
mbed_official 146:f64d43ff0c18 109 BM_UART_C3_PEIE);
mbed_official 146:f64d43ff0c18 110 temp |= BF_UART_C3_ORIE(interruptConfig->receiverOverrun)
mbed_official 146:f64d43ff0c18 111 |BF_UART_C3_NEIE(interruptConfig->noiseErrorFlag)
mbed_official 146:f64d43ff0c18 112 |BF_UART_C3_FEIE(interruptConfig->frameErrorFlag)
mbed_official 146:f64d43ff0c18 113 |BF_UART_C3_PEIE(interruptConfig->parityErrorFlag);
mbed_official 146:f64d43ff0c18 114 HW_UART_C3_WR(uartInstance, temp);
mbed_official 146:f64d43ff0c18 115 #if FSL_FEATURE_UART_HAS_FIFO
mbed_official 146:f64d43ff0c18 116 /* UART CFIFO register */
mbed_official 146:f64d43ff0c18 117 temp = HW_UART_CFIFO_RD(uartInstance) & ~(BM_UART_CFIFO_TXOFE|BM_UART_CFIFO_RXUFE);
mbed_official 146:f64d43ff0c18 118 temp |= BF_UART_CFIFO_TXOFE(interruptConfig->txFifoOverflow)
mbed_official 146:f64d43ff0c18 119 |BF_UART_CFIFO_RXUFE(interruptConfig->rxFifoUnderflow);
mbed_official 146:f64d43ff0c18 120 HW_UART_CFIFO_WR(uartInstance, temp);
mbed_official 146:f64d43ff0c18 121 #endif
mbed_official 146:f64d43ff0c18 122 }
mbed_official 146:f64d43ff0c18 123 }
mbed_official 146:f64d43ff0c18 124
mbed_official 146:f64d43ff0c18 125 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 126 *
mbed_official 146:f64d43ff0c18 127 * Function Name : uart_hal_enable_break_detect_interrupt
mbed_official 146:f64d43ff0c18 128 * Description : Enable the break_detect_interrupt.
mbed_official 146:f64d43ff0c18 129 *
mbed_official 146:f64d43ff0c18 130 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 131 void uart_hal_enable_break_detect_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 132 {
mbed_official 146:f64d43ff0c18 133 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 134
mbed_official 146:f64d43ff0c18 135 /* Enable break detect interrupt LBKDIE*/
mbed_official 146:f64d43ff0c18 136 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 137 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 138 {
mbed_official 146:f64d43ff0c18 139 HW_UART0_BDH_SET(BM_UART0_BDH_LBKDIE);
mbed_official 146:f64d43ff0c18 140 }
mbed_official 146:f64d43ff0c18 141 else
mbed_official 146:f64d43ff0c18 142 #endif
mbed_official 146:f64d43ff0c18 143 {
mbed_official 146:f64d43ff0c18 144 HW_UART_BDH_SET(uartInstance, BM_UART_BDH_LBKDIE);
mbed_official 146:f64d43ff0c18 145 }
mbed_official 146:f64d43ff0c18 146 }
mbed_official 146:f64d43ff0c18 147
mbed_official 146:f64d43ff0c18 148 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 149 *
mbed_official 146:f64d43ff0c18 150 * Function Name : uart_hal_disable_break_detect_interrupt
mbed_official 146:f64d43ff0c18 151 * Description : Disable the break_detect_interrupt.
mbed_official 146:f64d43ff0c18 152 *
mbed_official 146:f64d43ff0c18 153 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 154 void uart_hal_disable_break_detect_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 155 {
mbed_official 146:f64d43ff0c18 156 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 157
mbed_official 146:f64d43ff0c18 158 /* Disable break detect interrupt LBKDIE*/
mbed_official 146:f64d43ff0c18 159 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 160 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 161 {
mbed_official 146:f64d43ff0c18 162 HW_UART0_BDH_CLR(BM_UART0_BDH_LBKDIE);
mbed_official 146:f64d43ff0c18 163 }
mbed_official 146:f64d43ff0c18 164 else
mbed_official 146:f64d43ff0c18 165 #endif
mbed_official 146:f64d43ff0c18 166 {
mbed_official 146:f64d43ff0c18 167 HW_UART_BDH_CLR(uartInstance, BM_UART_BDH_LBKDIE);
mbed_official 146:f64d43ff0c18 168 }
mbed_official 146:f64d43ff0c18 169 }
mbed_official 146:f64d43ff0c18 170
mbed_official 146:f64d43ff0c18 171 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 172 *
mbed_official 146:f64d43ff0c18 173 * Function Name : uart_hal_is_break_detect_interrupt_enabled
mbed_official 146:f64d43ff0c18 174 * Description : Get the configuration of the break_detect_interrupt enable setting.
mbed_official 146:f64d43ff0c18 175 *
mbed_official 146:f64d43ff0c18 176 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 177 bool uart_hal_is_break_detect_interrupt_enabled(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 178 {
mbed_official 146:f64d43ff0c18 179 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 180
mbed_official 146:f64d43ff0c18 181 /* return interrupt enable condition of LBKDIE*/
mbed_official 146:f64d43ff0c18 182 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 183 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 184 {
mbed_official 146:f64d43ff0c18 185 return HW_UART0_BDH.B.LBKDIE;
mbed_official 146:f64d43ff0c18 186 }
mbed_official 146:f64d43ff0c18 187 else
mbed_official 146:f64d43ff0c18 188 #endif
mbed_official 146:f64d43ff0c18 189 {
mbed_official 146:f64d43ff0c18 190 return HW_UART_BDH(uartInstance).B.LBKDIE;
mbed_official 146:f64d43ff0c18 191 }
mbed_official 146:f64d43ff0c18 192 }
mbed_official 146:f64d43ff0c18 193
mbed_official 146:f64d43ff0c18 194 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 195 *
mbed_official 146:f64d43ff0c18 196 * Function Name : uart_hal_enable_rx_active_edge_interrupt
mbed_official 146:f64d43ff0c18 197 * Description : Enable the rx_active_edge_interrupt.
mbed_official 146:f64d43ff0c18 198 *
mbed_official 146:f64d43ff0c18 199 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 200 void uart_hal_enable_rx_active_edge_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 201 {
mbed_official 146:f64d43ff0c18 202 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 203
mbed_official 146:f64d43ff0c18 204 /* Receiver Active Edge interrupt enable*/
mbed_official 146:f64d43ff0c18 205 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 206 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 207 {
mbed_official 146:f64d43ff0c18 208 HW_UART0_BDH_SET(BM_UART0_BDH_RXEDGIE);
mbed_official 146:f64d43ff0c18 209 }
mbed_official 146:f64d43ff0c18 210 else
mbed_official 146:f64d43ff0c18 211 #endif
mbed_official 146:f64d43ff0c18 212 {
mbed_official 146:f64d43ff0c18 213 HW_UART_BDH_SET(uartInstance, BM_UART_BDH_RXEDGIE);
mbed_official 146:f64d43ff0c18 214 }
mbed_official 146:f64d43ff0c18 215 }
mbed_official 146:f64d43ff0c18 216
mbed_official 146:f64d43ff0c18 217 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 218 *
mbed_official 146:f64d43ff0c18 219 * Function Name : uart_hal_disable_rx_active_edge_interrupt
mbed_official 146:f64d43ff0c18 220 * Description : Disable the rx_active_edge_interrupt.
mbed_official 146:f64d43ff0c18 221 *
mbed_official 146:f64d43ff0c18 222 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 223 void uart_hal_disable_rx_active_edge_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 224 {
mbed_official 146:f64d43ff0c18 225 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 226
mbed_official 146:f64d43ff0c18 227 /* Receiver Active Edge interrupt disable*/
mbed_official 146:f64d43ff0c18 228 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 229 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 230 {
mbed_official 146:f64d43ff0c18 231 HW_UART0_BDH_CLR(BM_UART0_BDH_RXEDGIE);
mbed_official 146:f64d43ff0c18 232 }
mbed_official 146:f64d43ff0c18 233 else
mbed_official 146:f64d43ff0c18 234 #endif
mbed_official 146:f64d43ff0c18 235 {
mbed_official 146:f64d43ff0c18 236 HW_UART_BDH_CLR(uartInstance, BM_UART_BDH_RXEDGIE);
mbed_official 146:f64d43ff0c18 237 }
mbed_official 146:f64d43ff0c18 238 }
mbed_official 146:f64d43ff0c18 239
mbed_official 146:f64d43ff0c18 240 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 241 *
mbed_official 146:f64d43ff0c18 242 * Function Name : uart_hal_is_rx_active_edge_interrupt_enabled
mbed_official 146:f64d43ff0c18 243 * Description : Get the configuration of the rx_active_edge_interrupt enable setting.
mbed_official 146:f64d43ff0c18 244 *
mbed_official 146:f64d43ff0c18 245 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 246 bool uart_hal_is_rx_active_edge_interrupt_enabled(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 247 {
mbed_official 146:f64d43ff0c18 248 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 249
mbed_official 146:f64d43ff0c18 250 /* return interrupt enable condition of RXEDGIE*/
mbed_official 146:f64d43ff0c18 251 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 252 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 253 {
mbed_official 146:f64d43ff0c18 254 return HW_UART0_BDH.B.RXEDGIE;
mbed_official 146:f64d43ff0c18 255 }
mbed_official 146:f64d43ff0c18 256 else
mbed_official 146:f64d43ff0c18 257 #endif
mbed_official 146:f64d43ff0c18 258 {
mbed_official 146:f64d43ff0c18 259 return HW_UART_BDH(uartInstance).B.RXEDGIE;
mbed_official 146:f64d43ff0c18 260 }
mbed_official 146:f64d43ff0c18 261 }
mbed_official 146:f64d43ff0c18 262
mbed_official 146:f64d43ff0c18 263 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 264 *
mbed_official 146:f64d43ff0c18 265 * Function Name : uart_hal_enable_tx_data_register_empty_interrupt
mbed_official 146:f64d43ff0c18 266 * Description : Enable the tx_data_register_empty_interrupt.
mbed_official 146:f64d43ff0c18 267 *
mbed_official 146:f64d43ff0c18 268 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 269 void uart_hal_enable_tx_data_register_empty_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 270 {
mbed_official 146:f64d43ff0c18 271 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 272
mbed_official 146:f64d43ff0c18 273 /* transmit interrupt enable for TDRE (transmit data register empty)*/
mbed_official 146:f64d43ff0c18 274 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 275 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 276 {
mbed_official 146:f64d43ff0c18 277 HW_UART0_C2_SET(BM_UART0_C2_TIE);
mbed_official 146:f64d43ff0c18 278 }
mbed_official 146:f64d43ff0c18 279 else
mbed_official 146:f64d43ff0c18 280 #endif
mbed_official 146:f64d43ff0c18 281 {
mbed_official 146:f64d43ff0c18 282 HW_UART_C2_SET(uartInstance, BM_UART_C2_TIE);
mbed_official 146:f64d43ff0c18 283 }
mbed_official 146:f64d43ff0c18 284 }
mbed_official 146:f64d43ff0c18 285
mbed_official 146:f64d43ff0c18 286 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 287 *
mbed_official 146:f64d43ff0c18 288 * Function Name : uart_hal_disable_tx_data_register_empty_interrupt
mbed_official 146:f64d43ff0c18 289 * Description : Disable the tx_data_register_empty_interrupt.
mbed_official 146:f64d43ff0c18 290 *
mbed_official 146:f64d43ff0c18 291 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 292 void uart_hal_disable_tx_data_register_empty_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 293 {
mbed_official 146:f64d43ff0c18 294 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 295
mbed_official 146:f64d43ff0c18 296 /* transmit interrupt disable for TDRE (transmit data register empty)*/
mbed_official 146:f64d43ff0c18 297 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 298 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 299 {
mbed_official 146:f64d43ff0c18 300 HW_UART0_C2_CLR(BM_UART0_C2_TIE);
mbed_official 146:f64d43ff0c18 301 }
mbed_official 146:f64d43ff0c18 302 else
mbed_official 146:f64d43ff0c18 303 #endif
mbed_official 146:f64d43ff0c18 304 {
mbed_official 146:f64d43ff0c18 305 HW_UART_C2_CLR(uartInstance, BM_UART_C2_TIE);
mbed_official 146:f64d43ff0c18 306 }
mbed_official 146:f64d43ff0c18 307 }
mbed_official 146:f64d43ff0c18 308
mbed_official 146:f64d43ff0c18 309 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 310 *
mbed_official 146:f64d43ff0c18 311 * Function Name : uart_hal_is_tx_data_register_empty_interrupt_enabled
mbed_official 146:f64d43ff0c18 312 * Description : Get the configuration of the tx_data_register_empty_interrupt enable stting.
mbed_official 146:f64d43ff0c18 313 *
mbed_official 146:f64d43ff0c18 314 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 315 bool uart_hal_is_tx_data_register_empty_interrupt_enabled(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 316 {
mbed_official 146:f64d43ff0c18 317 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 318
mbed_official 146:f64d43ff0c18 319 /* return interrupt enable condition of TIE */
mbed_official 146:f64d43ff0c18 320 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 321 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 322 {
mbed_official 146:f64d43ff0c18 323 return HW_UART0_C2.B.TIE;
mbed_official 146:f64d43ff0c18 324 }
mbed_official 146:f64d43ff0c18 325 else
mbed_official 146:f64d43ff0c18 326 #endif
mbed_official 146:f64d43ff0c18 327 {
mbed_official 146:f64d43ff0c18 328 return HW_UART_C2(uartInstance).B.TIE;
mbed_official 146:f64d43ff0c18 329 }
mbed_official 146:f64d43ff0c18 330 }
mbed_official 146:f64d43ff0c18 331
mbed_official 146:f64d43ff0c18 332 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 333 *
mbed_official 146:f64d43ff0c18 334 * Function Name : uart_hal_enable_transmission_complete_interrupt
mbed_official 146:f64d43ff0c18 335 * Description : Enable the transmission_complete_interrupt.
mbed_official 146:f64d43ff0c18 336 *
mbed_official 146:f64d43ff0c18 337 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 338 void uart_hal_enable_transmission_complete_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 339 {
mbed_official 146:f64d43ff0c18 340 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 341
mbed_official 146:f64d43ff0c18 342 /* transmission complete interrupt enable */
mbed_official 146:f64d43ff0c18 343 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 344 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 345 {
mbed_official 146:f64d43ff0c18 346 HW_UART0_C2_SET(BM_UART0_C2_TCIE);
mbed_official 146:f64d43ff0c18 347 }
mbed_official 146:f64d43ff0c18 348 else
mbed_official 146:f64d43ff0c18 349 #endif
mbed_official 146:f64d43ff0c18 350 {
mbed_official 146:f64d43ff0c18 351 HW_UART_C2_SET(uartInstance, BM_UART_C2_TCIE);
mbed_official 146:f64d43ff0c18 352 }
mbed_official 146:f64d43ff0c18 353 }
mbed_official 146:f64d43ff0c18 354
mbed_official 146:f64d43ff0c18 355 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 356 *
mbed_official 146:f64d43ff0c18 357 * Function Name : uart_hal_disable_transmission_complete_interrupt
mbed_official 146:f64d43ff0c18 358 * Description : Disable the transmission_complete_interrupt.
mbed_official 146:f64d43ff0c18 359 *
mbed_official 146:f64d43ff0c18 360 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 361 void uart_hal_disable_transmission_complete_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 362 {
mbed_official 146:f64d43ff0c18 363 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 364
mbed_official 146:f64d43ff0c18 365 /* transmission complete interrupt disable */
mbed_official 146:f64d43ff0c18 366 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 367 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 368 {
mbed_official 146:f64d43ff0c18 369 HW_UART0_C2_CLR(BM_UART0_C2_TCIE);
mbed_official 146:f64d43ff0c18 370 }
mbed_official 146:f64d43ff0c18 371 else
mbed_official 146:f64d43ff0c18 372 #endif
mbed_official 146:f64d43ff0c18 373 {
mbed_official 146:f64d43ff0c18 374 HW_UART_C2_CLR(uartInstance, BM_UART_C2_TCIE);
mbed_official 146:f64d43ff0c18 375 }
mbed_official 146:f64d43ff0c18 376 }
mbed_official 146:f64d43ff0c18 377
mbed_official 146:f64d43ff0c18 378 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 379 *
mbed_official 146:f64d43ff0c18 380 * Function Name : uart_hal_is_transmission_complete_interrupt_enabled
mbed_official 146:f64d43ff0c18 381 * Description : Get the configuration of the transmission_complete_interrupt enable setting.
mbed_official 146:f64d43ff0c18 382 *
mbed_official 146:f64d43ff0c18 383 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 384 bool uart_hal_is_transmission_complete_interrupt_enabled(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 385 {
mbed_official 146:f64d43ff0c18 386 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 387
mbed_official 146:f64d43ff0c18 388 /* return interrupt enable condition of TCIE */
mbed_official 146:f64d43ff0c18 389 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 390 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 391 {
mbed_official 146:f64d43ff0c18 392 return HW_UART0_C2.B.TCIE;
mbed_official 146:f64d43ff0c18 393 }
mbed_official 146:f64d43ff0c18 394 else
mbed_official 146:f64d43ff0c18 395 #endif
mbed_official 146:f64d43ff0c18 396 {
mbed_official 146:f64d43ff0c18 397 return HW_UART_C2(uartInstance).B.TCIE;
mbed_official 146:f64d43ff0c18 398 }
mbed_official 146:f64d43ff0c18 399 }
mbed_official 146:f64d43ff0c18 400
mbed_official 146:f64d43ff0c18 401 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 402 *
mbed_official 146:f64d43ff0c18 403 * Function Name : uart_hal_enable_rx_data_register_full_interrupt
mbed_official 146:f64d43ff0c18 404 * Description : Enable the rx_data_register_full_interrupt.
mbed_official 146:f64d43ff0c18 405 *
mbed_official 146:f64d43ff0c18 406 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 407 void uart_hal_enable_rx_data_register_full_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 408 {
mbed_official 146:f64d43ff0c18 409 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 410
mbed_official 146:f64d43ff0c18 411 /* receiver interrupt enable for receiver data register full (RDRF)*/
mbed_official 146:f64d43ff0c18 412 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 413 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 414 {
mbed_official 146:f64d43ff0c18 415 HW_UART0_C2_SET(BM_UART0_C2_RIE);
mbed_official 146:f64d43ff0c18 416 }
mbed_official 146:f64d43ff0c18 417 else
mbed_official 146:f64d43ff0c18 418 #endif
mbed_official 146:f64d43ff0c18 419 {
mbed_official 146:f64d43ff0c18 420 HW_UART_C2_SET(uartInstance, BM_UART_C2_RIE);
mbed_official 146:f64d43ff0c18 421 }
mbed_official 146:f64d43ff0c18 422 }
mbed_official 146:f64d43ff0c18 423
mbed_official 146:f64d43ff0c18 424 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 425 *
mbed_official 146:f64d43ff0c18 426 * Function Name : uart_hal_disable_rx_data_register_full_interrupt
mbed_official 146:f64d43ff0c18 427 * Description : Disable the rx_data_register_full_interrupt.
mbed_official 146:f64d43ff0c18 428 *
mbed_official 146:f64d43ff0c18 429 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 430 void uart_hal_disable_rx_data_register_full_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 431 {
mbed_official 146:f64d43ff0c18 432 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 433
mbed_official 146:f64d43ff0c18 434 /* receiver interrupt disable for receiver data register full (RDRF)*/
mbed_official 146:f64d43ff0c18 435 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 436 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 437 {
mbed_official 146:f64d43ff0c18 438 HW_UART0_C2_CLR(BM_UART0_C2_RIE);
mbed_official 146:f64d43ff0c18 439 }
mbed_official 146:f64d43ff0c18 440 else
mbed_official 146:f64d43ff0c18 441 #endif
mbed_official 146:f64d43ff0c18 442 {
mbed_official 146:f64d43ff0c18 443 HW_UART_C2_CLR(uartInstance, BM_UART_C2_RIE);
mbed_official 146:f64d43ff0c18 444 }
mbed_official 146:f64d43ff0c18 445 }
mbed_official 146:f64d43ff0c18 446
mbed_official 146:f64d43ff0c18 447 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 448 *
mbed_official 146:f64d43ff0c18 449 * Function Name : uart_hal_is_receive_data_full_interrupt_enabled
mbed_official 146:f64d43ff0c18 450 * Description : Get the configuration of the rx_data_register_full_interrupt enable setting.
mbed_official 146:f64d43ff0c18 451 *
mbed_official 146:f64d43ff0c18 452 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 453 bool uart_hal_is_receive_data_full_interrupt_enabled(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 454 {
mbed_official 146:f64d43ff0c18 455 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 456
mbed_official 146:f64d43ff0c18 457 /* return interrupt enable condition of RIE */
mbed_official 146:f64d43ff0c18 458 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 459 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 460 {
mbed_official 146:f64d43ff0c18 461 return HW_UART0_C2.B.RIE;
mbed_official 146:f64d43ff0c18 462 }
mbed_official 146:f64d43ff0c18 463 else
mbed_official 146:f64d43ff0c18 464 #endif
mbed_official 146:f64d43ff0c18 465 {
mbed_official 146:f64d43ff0c18 466 return HW_UART_C2(uartInstance).B.RIE;
mbed_official 146:f64d43ff0c18 467 }
mbed_official 146:f64d43ff0c18 468 }
mbed_official 146:f64d43ff0c18 469
mbed_official 146:f64d43ff0c18 470 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 471 *
mbed_official 146:f64d43ff0c18 472 * Function Name : uart_hal_enable_idle_line_interrupt
mbed_official 146:f64d43ff0c18 473 * Description : Enable the idle_line_interrupt.
mbed_official 146:f64d43ff0c18 474 *
mbed_official 146:f64d43ff0c18 475 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 476 void uart_hal_enable_idle_line_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 477 {
mbed_official 146:f64d43ff0c18 478 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 479
mbed_official 146:f64d43ff0c18 480 /*idle line interrupt enable */
mbed_official 146:f64d43ff0c18 481 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 482 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 483 {
mbed_official 146:f64d43ff0c18 484 HW_UART0_C2_SET(BM_UART0_C2_ILIE);
mbed_official 146:f64d43ff0c18 485 }
mbed_official 146:f64d43ff0c18 486 else
mbed_official 146:f64d43ff0c18 487 #endif
mbed_official 146:f64d43ff0c18 488 {
mbed_official 146:f64d43ff0c18 489 HW_UART_C2_SET(uartInstance, BM_UART_C2_ILIE);
mbed_official 146:f64d43ff0c18 490 }
mbed_official 146:f64d43ff0c18 491 }
mbed_official 146:f64d43ff0c18 492
mbed_official 146:f64d43ff0c18 493 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 494 *
mbed_official 146:f64d43ff0c18 495 * Function Name : uart_hal_disable_idle_line_interrupt
mbed_official 146:f64d43ff0c18 496 * Description : Disable the idle_line_interrupt.
mbed_official 146:f64d43ff0c18 497 *
mbed_official 146:f64d43ff0c18 498 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 499 void uart_hal_disable_idle_line_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 500 {
mbed_official 146:f64d43ff0c18 501 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 502
mbed_official 146:f64d43ff0c18 503 /* idle line interrupt disable */
mbed_official 146:f64d43ff0c18 504 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 505 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 506 {
mbed_official 146:f64d43ff0c18 507 HW_UART0_C2_CLR(BM_UART0_C2_ILIE);
mbed_official 146:f64d43ff0c18 508 }
mbed_official 146:f64d43ff0c18 509 else
mbed_official 146:f64d43ff0c18 510 #endif
mbed_official 146:f64d43ff0c18 511 {
mbed_official 146:f64d43ff0c18 512 HW_UART_C2_CLR(uartInstance, BM_UART_C2_ILIE);
mbed_official 146:f64d43ff0c18 513 }
mbed_official 146:f64d43ff0c18 514 }
mbed_official 146:f64d43ff0c18 515
mbed_official 146:f64d43ff0c18 516 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 517 *
mbed_official 146:f64d43ff0c18 518 * Function Name : uart_hal_is_idle_line_interrupt_enabled
mbed_official 146:f64d43ff0c18 519 * Description : Get the configuration of the idle_line_interrupt enable setting.
mbed_official 146:f64d43ff0c18 520 *
mbed_official 146:f64d43ff0c18 521 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 522 bool uart_hal_is_idle_line_interrupt_enabled(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 523 {
mbed_official 146:f64d43ff0c18 524 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 525
mbed_official 146:f64d43ff0c18 526 /* return interrupt enable condition of ILIE */
mbed_official 146:f64d43ff0c18 527 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 528 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 529 {
mbed_official 146:f64d43ff0c18 530 return HW_UART0_C2.B.ILIE;
mbed_official 146:f64d43ff0c18 531 }
mbed_official 146:f64d43ff0c18 532 else
mbed_official 146:f64d43ff0c18 533 #endif
mbed_official 146:f64d43ff0c18 534 {
mbed_official 146:f64d43ff0c18 535 return HW_UART_C2(uartInstance).B.ILIE;
mbed_official 146:f64d43ff0c18 536 }
mbed_official 146:f64d43ff0c18 537 }
mbed_official 146:f64d43ff0c18 538
mbed_official 146:f64d43ff0c18 539 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 540 *
mbed_official 146:f64d43ff0c18 541 * Function Name : uart_hal_enable_rx_overrun_interrupt
mbed_official 146:f64d43ff0c18 542 * Description : Enable the rx_overrun_interrupt.
mbed_official 146:f64d43ff0c18 543 *
mbed_official 146:f64d43ff0c18 544 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 545 void uart_hal_enable_rx_overrun_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 546 {
mbed_official 146:f64d43ff0c18 547 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 548
mbed_official 146:f64d43ff0c18 549 /*receiver overrun interrupt enable */
mbed_official 146:f64d43ff0c18 550 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 551 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 552 {
mbed_official 146:f64d43ff0c18 553 HW_UART0_C3_SET(BM_UART0_C3_ORIE);
mbed_official 146:f64d43ff0c18 554 }
mbed_official 146:f64d43ff0c18 555 else
mbed_official 146:f64d43ff0c18 556 #endif
mbed_official 146:f64d43ff0c18 557 {
mbed_official 146:f64d43ff0c18 558 HW_UART_C3_SET(uartInstance, BM_UART_C3_ORIE);
mbed_official 146:f64d43ff0c18 559 }
mbed_official 146:f64d43ff0c18 560 }
mbed_official 146:f64d43ff0c18 561
mbed_official 146:f64d43ff0c18 562 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 563 *
mbed_official 146:f64d43ff0c18 564 * Function Name : uart_hal_disable_rx_overrun_interrupt
mbed_official 146:f64d43ff0c18 565 * Description : Disable the rx_overrun_interrupt.
mbed_official 146:f64d43ff0c18 566 *
mbed_official 146:f64d43ff0c18 567 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 568 void uart_hal_disable_rx_overrun_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 569 {
mbed_official 146:f64d43ff0c18 570 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 571
mbed_official 146:f64d43ff0c18 572 /* receiver overrun interrupt disable */
mbed_official 146:f64d43ff0c18 573 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 574 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 575 {
mbed_official 146:f64d43ff0c18 576 HW_UART0_C3_CLR(BM_UART0_C3_ORIE);
mbed_official 146:f64d43ff0c18 577 }
mbed_official 146:f64d43ff0c18 578 else
mbed_official 146:f64d43ff0c18 579 #endif
mbed_official 146:f64d43ff0c18 580 {
mbed_official 146:f64d43ff0c18 581 HW_UART_C3_CLR(uartInstance, BM_UART_C3_ORIE);
mbed_official 146:f64d43ff0c18 582 }
mbed_official 146:f64d43ff0c18 583 }
mbed_official 146:f64d43ff0c18 584
mbed_official 146:f64d43ff0c18 585 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 586 *
mbed_official 146:f64d43ff0c18 587 * Function Name : uart_hal_is_rx_overrun_interrupt_enabled
mbed_official 146:f64d43ff0c18 588 * Description : Get the configuration of the rx_overrun_interrupt enable setting.
mbed_official 146:f64d43ff0c18 589 *
mbed_official 146:f64d43ff0c18 590 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 591 bool uart_hal_is_rx_overrun_interrupt_enabled(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 592 {
mbed_official 146:f64d43ff0c18 593 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 594
mbed_official 146:f64d43ff0c18 595 /* return interrupt enable condition of OR */
mbed_official 146:f64d43ff0c18 596 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 597 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 598 {
mbed_official 146:f64d43ff0c18 599 return HW_UART0_C3.B.ORIE;
mbed_official 146:f64d43ff0c18 600 }
mbed_official 146:f64d43ff0c18 601 else
mbed_official 146:f64d43ff0c18 602 #endif
mbed_official 146:f64d43ff0c18 603 {
mbed_official 146:f64d43ff0c18 604 return HW_UART_C3(uartInstance).B.ORIE;
mbed_official 146:f64d43ff0c18 605 }
mbed_official 146:f64d43ff0c18 606 }
mbed_official 146:f64d43ff0c18 607
mbed_official 146:f64d43ff0c18 608 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 609 *
mbed_official 146:f64d43ff0c18 610 * Function Name : uart_hal_enable_noise_error_interrupt
mbed_official 146:f64d43ff0c18 611 * Description : Enable the noise_error_interrupt.
mbed_official 146:f64d43ff0c18 612 *
mbed_official 146:f64d43ff0c18 613 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 614 void uart_hal_enable_noise_error_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 615 {
mbed_official 146:f64d43ff0c18 616 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 617
mbed_official 146:f64d43ff0c18 618 /*noise error interrupt enable */
mbed_official 146:f64d43ff0c18 619 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 620 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 621 {
mbed_official 146:f64d43ff0c18 622 HW_UART0_C3_SET(BM_UART0_C3_NEIE);
mbed_official 146:f64d43ff0c18 623 }
mbed_official 146:f64d43ff0c18 624 else
mbed_official 146:f64d43ff0c18 625 #endif
mbed_official 146:f64d43ff0c18 626 {
mbed_official 146:f64d43ff0c18 627 HW_UART_C3_SET(uartInstance, BM_UART_C3_NEIE);
mbed_official 146:f64d43ff0c18 628 }
mbed_official 146:f64d43ff0c18 629 }
mbed_official 146:f64d43ff0c18 630
mbed_official 146:f64d43ff0c18 631 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 632 *
mbed_official 146:f64d43ff0c18 633 * Function Name : uart_hal_disable_noise_error_interrupt
mbed_official 146:f64d43ff0c18 634 * Description : Disable the noise_error_interrupt.
mbed_official 146:f64d43ff0c18 635 *
mbed_official 146:f64d43ff0c18 636 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 637 void uart_hal_disable_noise_error_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 638 {
mbed_official 146:f64d43ff0c18 639 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 640
mbed_official 146:f64d43ff0c18 641 /* noise error interrupt disable */
mbed_official 146:f64d43ff0c18 642 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 643 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 644 {
mbed_official 146:f64d43ff0c18 645 HW_UART0_C3_CLR(BM_UART0_C3_NEIE);
mbed_official 146:f64d43ff0c18 646 }
mbed_official 146:f64d43ff0c18 647 else
mbed_official 146:f64d43ff0c18 648 #endif
mbed_official 146:f64d43ff0c18 649 {
mbed_official 146:f64d43ff0c18 650 HW_UART_C3_CLR(uartInstance, BM_UART_C3_NEIE);
mbed_official 146:f64d43ff0c18 651 }
mbed_official 146:f64d43ff0c18 652 }
mbed_official 146:f64d43ff0c18 653
mbed_official 146:f64d43ff0c18 654 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 655 *
mbed_official 146:f64d43ff0c18 656 * Function Name : uart_hal_is_noise_error_interrupt_enabled
mbed_official 146:f64d43ff0c18 657 * Description : Get the configuration of the noise_error_interrupt enable setting.
mbed_official 146:f64d43ff0c18 658 *
mbed_official 146:f64d43ff0c18 659 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 660 bool uart_hal_is_noise_error_interrupt_enabled(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 661 {
mbed_official 146:f64d43ff0c18 662 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 663
mbed_official 146:f64d43ff0c18 664 /* return interrupt enable condition of NF */
mbed_official 146:f64d43ff0c18 665 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 666 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 667 {
mbed_official 146:f64d43ff0c18 668 return HW_UART0_C3.B.NEIE;
mbed_official 146:f64d43ff0c18 669 }
mbed_official 146:f64d43ff0c18 670 else
mbed_official 146:f64d43ff0c18 671 #endif
mbed_official 146:f64d43ff0c18 672 {
mbed_official 146:f64d43ff0c18 673 return HW_UART_C3(uartInstance).B.NEIE;
mbed_official 146:f64d43ff0c18 674 }
mbed_official 146:f64d43ff0c18 675 }
mbed_official 146:f64d43ff0c18 676
mbed_official 146:f64d43ff0c18 677 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 678 *
mbed_official 146:f64d43ff0c18 679 * Function Name : uart_hal_enable_framing_error_interrupt
mbed_official 146:f64d43ff0c18 680 * Description : Enable the framing_error_interrupt.
mbed_official 146:f64d43ff0c18 681 *
mbed_official 146:f64d43ff0c18 682 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 683 void uart_hal_enable_framing_error_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 684 {
mbed_official 146:f64d43ff0c18 685 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 686
mbed_official 146:f64d43ff0c18 687 /*framing error interrupt enable */
mbed_official 146:f64d43ff0c18 688 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 689 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 690 {
mbed_official 146:f64d43ff0c18 691 HW_UART0_C3_SET(BM_UART0_C3_FEIE);
mbed_official 146:f64d43ff0c18 692 }
mbed_official 146:f64d43ff0c18 693 else
mbed_official 146:f64d43ff0c18 694 #endif
mbed_official 146:f64d43ff0c18 695 {
mbed_official 146:f64d43ff0c18 696 HW_UART_C3_SET(uartInstance, BM_UART_C3_FEIE);
mbed_official 146:f64d43ff0c18 697 }
mbed_official 146:f64d43ff0c18 698 }
mbed_official 146:f64d43ff0c18 699
mbed_official 146:f64d43ff0c18 700 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 701 *
mbed_official 146:f64d43ff0c18 702 * Function Name : uart_hal_disable_framing_error_interrupt
mbed_official 146:f64d43ff0c18 703 * Description : Disable the framing_error_interrupt.
mbed_official 146:f64d43ff0c18 704 *
mbed_official 146:f64d43ff0c18 705 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 706 void uart_hal_disable_framing_error_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 707 {
mbed_official 146:f64d43ff0c18 708 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 709
mbed_official 146:f64d43ff0c18 710 /* framing error interrupt disable */
mbed_official 146:f64d43ff0c18 711 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 712 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 713 {
mbed_official 146:f64d43ff0c18 714 HW_UART0_C3_CLR(BM_UART0_C3_FEIE);
mbed_official 146:f64d43ff0c18 715 }
mbed_official 146:f64d43ff0c18 716 else
mbed_official 146:f64d43ff0c18 717 #endif
mbed_official 146:f64d43ff0c18 718 {
mbed_official 146:f64d43ff0c18 719 HW_UART_C3_CLR(uartInstance, BM_UART_C3_FEIE);
mbed_official 146:f64d43ff0c18 720 }
mbed_official 146:f64d43ff0c18 721 }
mbed_official 146:f64d43ff0c18 722
mbed_official 146:f64d43ff0c18 723 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 724 *
mbed_official 146:f64d43ff0c18 725 * Function Name : uart_hal_is_framing_error_interrupt_enabled
mbed_official 146:f64d43ff0c18 726 * Description : Get the configuration of the framing_error_interrupt enable setting.
mbed_official 146:f64d43ff0c18 727 *
mbed_official 146:f64d43ff0c18 728 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 729 bool uart_hal_is_framing_error_interrupt_enabled(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 730 {
mbed_official 146:f64d43ff0c18 731 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 732
mbed_official 146:f64d43ff0c18 733 /* return interrupt enable condition of FE */
mbed_official 146:f64d43ff0c18 734 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 735 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 736 {
mbed_official 146:f64d43ff0c18 737 return HW_UART0_C3.B.FEIE;
mbed_official 146:f64d43ff0c18 738 }
mbed_official 146:f64d43ff0c18 739 else
mbed_official 146:f64d43ff0c18 740 #endif
mbed_official 146:f64d43ff0c18 741 {
mbed_official 146:f64d43ff0c18 742 return HW_UART_C3(uartInstance).B.FEIE;
mbed_official 146:f64d43ff0c18 743 }
mbed_official 146:f64d43ff0c18 744 }
mbed_official 146:f64d43ff0c18 745
mbed_official 146:f64d43ff0c18 746 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 747 *
mbed_official 146:f64d43ff0c18 748 * Function Name : uart_hal_enable_parity_error_interrupt
mbed_official 146:f64d43ff0c18 749 * Description : Enable the parity_error_interrupt.
mbed_official 146:f64d43ff0c18 750 *
mbed_official 146:f64d43ff0c18 751 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 752 void uart_hal_enable_parity_error_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 753 {
mbed_official 146:f64d43ff0c18 754 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 755
mbed_official 146:f64d43ff0c18 756 /* parity error interrupt enable */
mbed_official 146:f64d43ff0c18 757 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 758 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 759 {
mbed_official 146:f64d43ff0c18 760 HW_UART0_C3_SET(BM_UART0_C3_PEIE);
mbed_official 146:f64d43ff0c18 761 }
mbed_official 146:f64d43ff0c18 762 else
mbed_official 146:f64d43ff0c18 763 #endif
mbed_official 146:f64d43ff0c18 764 {
mbed_official 146:f64d43ff0c18 765 HW_UART_C3_SET(uartInstance, BM_UART_C3_PEIE);
mbed_official 146:f64d43ff0c18 766 }
mbed_official 146:f64d43ff0c18 767 }
mbed_official 146:f64d43ff0c18 768
mbed_official 146:f64d43ff0c18 769 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 770 *
mbed_official 146:f64d43ff0c18 771 * Function Name : uart_hal_disable_parity_error_interrupt
mbed_official 146:f64d43ff0c18 772 * Description : Disable the parity_error_interrupt.
mbed_official 146:f64d43ff0c18 773 *
mbed_official 146:f64d43ff0c18 774 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 775 void uart_hal_disable_parity_error_interrupt(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 776 {
mbed_official 146:f64d43ff0c18 777 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 778
mbed_official 146:f64d43ff0c18 779 /* parity error interrupt disable */
mbed_official 146:f64d43ff0c18 780 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 781 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 782 {
mbed_official 146:f64d43ff0c18 783 HW_UART0_C3_CLR(BM_UART0_C3_PEIE);
mbed_official 146:f64d43ff0c18 784 }
mbed_official 146:f64d43ff0c18 785 else
mbed_official 146:f64d43ff0c18 786 #endif
mbed_official 146:f64d43ff0c18 787 {
mbed_official 146:f64d43ff0c18 788 HW_UART_C3_CLR(uartInstance, BM_UART_C3_PEIE);
mbed_official 146:f64d43ff0c18 789 }
mbed_official 146:f64d43ff0c18 790 }
mbed_official 146:f64d43ff0c18 791
mbed_official 146:f64d43ff0c18 792 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 793 *
mbed_official 146:f64d43ff0c18 794 * Function Name : uart_hal_is_parity_error_interrupt_enabled
mbed_official 146:f64d43ff0c18 795 * Description : Get the configuration of the parity_error_interrupt enable setting.
mbed_official 146:f64d43ff0c18 796 *
mbed_official 146:f64d43ff0c18 797 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 798 bool uart_hal_is_parity_error_interrupt_enabled(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 799 {
mbed_official 146:f64d43ff0c18 800 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 801
mbed_official 146:f64d43ff0c18 802 /* return interrupt enable condition of PF */
mbed_official 146:f64d43ff0c18 803 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 804 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 805 {
mbed_official 146:f64d43ff0c18 806 return HW_UART0_C3.B.PEIE;
mbed_official 146:f64d43ff0c18 807 }
mbed_official 146:f64d43ff0c18 808 else
mbed_official 146:f64d43ff0c18 809 #endif
mbed_official 146:f64d43ff0c18 810 {
mbed_official 146:f64d43ff0c18 811 return HW_UART_C3(uartInstance).B.PEIE;
mbed_official 146:f64d43ff0c18 812 }
mbed_official 146:f64d43ff0c18 813 }
mbed_official 146:f64d43ff0c18 814
mbed_official 146:f64d43ff0c18 815 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 816 *
mbed_official 146:f64d43ff0c18 817 * Function Name : uart_hal_configure_dma
mbed_official 146:f64d43ff0c18 818 * Description : Configure the UART DMA requests for the Transmitter and Receiver.
mbed_official 146:f64d43ff0c18 819 * This function allows the user to configure the transmit data register empty flag to
mbed_official 146:f64d43ff0c18 820 * generate an interrupt request (default) or a DMA request. Similarly, this function
mbed_official 146:f64d43ff0c18 821 * allows the user to conigure the receive data register full flag to generate an interrupt
mbed_official 146:f64d43ff0c18 822 * request (default) or a DMA request.
mbed_official 146:f64d43ff0c18 823 *
mbed_official 146:f64d43ff0c18 824 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 825 void uart_hal_configure_dma(uint32_t uartInstance, bool txDmaConfig, bool rxDmaConfig)
mbed_official 146:f64d43ff0c18 826 {
mbed_official 146:f64d43ff0c18 827 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 828
mbed_official 146:f64d43ff0c18 829 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 830 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 831 {
mbed_official 146:f64d43ff0c18 832 /* TDMAE configures the transmit data register empty flag, S1[TDRE],
mbed_official 146:f64d43ff0c18 833 * to generate a DMA request.
mbed_official 146:f64d43ff0c18 834 */
mbed_official 146:f64d43ff0c18 835 BW_UART0_C5_TDMAE(txDmaConfig); /* set TDMAE to enable, clear to disable */
mbed_official 146:f64d43ff0c18 836 /* RDMAE configures the receive data register full flag, S1[RDRF],
mbed_official 146:f64d43ff0c18 837 * to generate a DMA request.
mbed_official 146:f64d43ff0c18 838 */
mbed_official 146:f64d43ff0c18 839 BW_UART0_C5_RDMAE(rxDmaConfig); /* set RDMAE to enable, clear to disable*/
mbed_official 146:f64d43ff0c18 840 }
mbed_official 146:f64d43ff0c18 841 else
mbed_official 146:f64d43ff0c18 842 #endif
mbed_official 146:f64d43ff0c18 843 {
mbed_official 146:f64d43ff0c18 844 /* TDMAS configures the transmit data register empty flag, TDRE, to generate interrupt
mbed_official 146:f64d43ff0c18 845 * or DMA requests if TIE is set.
mbed_official 146:f64d43ff0c18 846 * NOTE: If UART_C2[TIE] is cleared, TDRE DMA and TDRE interrupt request signals are
mbed_official 146:f64d43ff0c18 847 * not asserted when the TDRE flag is set, regardless of the state of TDMAS.
mbed_official 146:f64d43ff0c18 848 * If UART_C2[TIE] and TDMAS are both set, then UART_C2[TCIE] must be cleared, and UART_D
mbed_official 146:f64d43ff0c18 849 * must not be written outside of servicing of a DMA request.
mbed_official 146:f64d43ff0c18 850 * 0 If TIE is set and the TDRE flag is set, the TDRE interrupt request signal is asserted
mbed_official 146:f64d43ff0c18 851 * to request interrupt service.
mbed_official 146:f64d43ff0c18 852 * 1 If TIE is set and the TDRE flag is set, the TDRE DMA request signal is asserted
mbed_official 146:f64d43ff0c18 853 * to request a DMA transfer.
mbed_official 146:f64d43ff0c18 854 */
mbed_official 146:f64d43ff0c18 855 if (txDmaConfig == 1)
mbed_official 146:f64d43ff0c18 856 {
mbed_official 146:f64d43ff0c18 857 /* enable uart to generate transmit DMA request*/
mbed_official 146:f64d43ff0c18 858 HW_UART_C2_SET(uartInstance, BM_UART_C2_TIE); /* set TIE */
mbed_official 146:f64d43ff0c18 859 HW_UART_C2_CLR(uartInstance, BM_UART_C2_TCIE); /* clear TCIE */
mbed_official 146:f64d43ff0c18 860 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 861 HW_UART_C4_SET(uartInstance, BM_UART_C4_TDMAS); /* set TDMAS */
mbed_official 146:f64d43ff0c18 862 #else
mbed_official 146:f64d43ff0c18 863 HW_UART_C5_SET(uartInstance, BM_UART_C5_TDMAS); /* set TDMAS */
mbed_official 146:f64d43ff0c18 864 #endif
mbed_official 146:f64d43ff0c18 865 }
mbed_official 146:f64d43ff0c18 866 else
mbed_official 146:f64d43ff0c18 867 {
mbed_official 146:f64d43ff0c18 868 /* disable uart transmit DMA request*/
mbed_official 146:f64d43ff0c18 869 HW_UART_C2_CLR(uartInstance, BM_UART_C2_TIE); /* clear TIE to disable */
mbed_official 146:f64d43ff0c18 870 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 871 HW_UART_C4_CLR(uartInstance, BM_UART_C4_TDMAS); /* clear TDMAS to disable */
mbed_official 146:f64d43ff0c18 872 #else
mbed_official 146:f64d43ff0c18 873 HW_UART_C5_CLR(uartInstance, BM_UART_C5_TDMAS); /* clear TDMAS to disable */
mbed_official 146:f64d43ff0c18 874 #endif
mbed_official 146:f64d43ff0c18 875 }
mbed_official 146:f64d43ff0c18 876
mbed_official 146:f64d43ff0c18 877 /* RDMAS configures the receiver data register full flag, RDRF, to generate interrupt or
mbed_official 146:f64d43ff0c18 878 * DMA requests if RIEis set.
mbed_official 146:f64d43ff0c18 879 * NOTE: If RIE is cleared, the RDRF DMA and RDRF interrupt request signals are not
mbed_official 146:f64d43ff0c18 880 * asserted when the RDRF flag is set, regardless of the state of RDMAS.
mbed_official 146:f64d43ff0c18 881 * 0 If RIE is set and the RDRF flag is set, the RDRF interrupt request signal is
mbed_official 146:f64d43ff0c18 882 * asserted to request interrupt service.
mbed_official 146:f64d43ff0c18 883 * 1 If RIE is set and the RDRF flag is set, the RDRF DMA request signal is asserted
mbed_official 146:f64d43ff0c18 884 * to request a DMA transfer.
mbed_official 146:f64d43ff0c18 885 */
mbed_official 146:f64d43ff0c18 886 if (rxDmaConfig == 1)
mbed_official 146:f64d43ff0c18 887 {
mbed_official 146:f64d43ff0c18 888 /* enable uart to generate receive DMA request*/
mbed_official 146:f64d43ff0c18 889 HW_UART_C2_SET(uartInstance, BM_UART_C2_RIE); /* set RIE */
mbed_official 146:f64d43ff0c18 890 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 891 HW_UART_C4_SET(uartInstance, BM_UART_C4_RDMAS); /* set RDMAS */
mbed_official 146:f64d43ff0c18 892 #else
mbed_official 146:f64d43ff0c18 893 HW_UART_C5_SET(uartInstance, BM_UART_C5_RDMAS); /* set RDMAS */
mbed_official 146:f64d43ff0c18 894 #endif
mbed_official 146:f64d43ff0c18 895 }
mbed_official 146:f64d43ff0c18 896 else
mbed_official 146:f64d43ff0c18 897 {
mbed_official 146:f64d43ff0c18 898 /* disable uart receive DMA request*/
mbed_official 146:f64d43ff0c18 899 HW_UART_C2_CLR(uartInstance, BM_UART_C2_RIE); /* clear RIE to disable */
mbed_official 146:f64d43ff0c18 900 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 901 HW_UART_C4_CLR(uartInstance, BM_UART_C4_RDMAS); /* clear RDMAS to disable */
mbed_official 146:f64d43ff0c18 902 #else
mbed_official 146:f64d43ff0c18 903 HW_UART_C5_CLR(uartInstance, BM_UART_C5_RDMAS); /* clear RDMAS to disable */
mbed_official 146:f64d43ff0c18 904 #endif
mbed_official 146:f64d43ff0c18 905 }
mbed_official 146:f64d43ff0c18 906 }
mbed_official 146:f64d43ff0c18 907 }
mbed_official 146:f64d43ff0c18 908
mbed_official 146:f64d43ff0c18 909 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 910 *
mbed_official 146:f64d43ff0c18 911 * Function Name : uart_hal_is_txdma_enabled
mbed_official 146:f64d43ff0c18 912 * Description : Get the UART Transmit DMA request configuration setting.
mbed_official 146:f64d43ff0c18 913 * This function returns to the user the configuration setting of the Transmit DMA request.
mbed_official 146:f64d43ff0c18 914 *
mbed_official 146:f64d43ff0c18 915 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 916 bool uart_hal_is_txdma_enabled(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 917 {
mbed_official 146:f64d43ff0c18 918 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 919
mbed_official 146:f64d43ff0c18 920 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 921 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 922 {
mbed_official 146:f64d43ff0c18 923 /* TDMAE configures the transmit data register empty flag, S1[TDRE], to
mbed_official 146:f64d43ff0c18 924 * generate a DMA request.
mbed_official 146:f64d43ff0c18 925 */
mbed_official 146:f64d43ff0c18 926 return HW_UART0_C5.B.TDMAE; /* return TDMAE, set: enable, clear: disable */
mbed_official 146:f64d43ff0c18 927 }
mbed_official 146:f64d43ff0c18 928 else
mbed_official 146:f64d43ff0c18 929 #endif
mbed_official 146:f64d43ff0c18 930 {
mbed_official 146:f64d43ff0c18 931 /* create variable for this to work around MISRA rule 12.4 since this is a volatile value*/
mbed_official 146:f64d43ff0c18 932 uint32_t tcieBitStatus;
mbed_official 146:f64d43ff0c18 933 tcieBitStatus = HW_UART_C2(uartInstance).B.TCIE;
mbed_official 146:f64d43ff0c18 934
mbed_official 146:f64d43ff0c18 935 /* TDMAS configures the transmit data register empty flag, TDRE, to generate interrupt or
mbed_official 146:f64d43ff0c18 936 * DMA requests if TIE is set.
mbed_official 146:f64d43ff0c18 937 * NOTE: If UART_C2[TIE] is cleared, TDRE DMA and TDRE interrupt request signals are
mbed_official 146:f64d43ff0c18 938 * not asserted when the TDRE flag is set, regardless of the state of TDMAS.
mbed_official 146:f64d43ff0c18 939 * If UART_C2[TIE] and TDMAS are both set, then UART_C2[TCIE] must be cleared, and UART_D
mbed_official 146:f64d43ff0c18 940 * must not be written outside of servicing of a DMA request.
mbed_official 146:f64d43ff0c18 941 * 0 If TIE is set and the TDRE flag is set, the TDRE interrupt request signal is asserted
mbed_official 146:f64d43ff0c18 942 * to request interrupt service.
mbed_official 146:f64d43ff0c18 943 * 1 If TIE is set and the TDRE flag is set, the TDRE DMA request signal is asserted to
mbed_official 146:f64d43ff0c18 944 * request a DMA transfer.
mbed_official 146:f64d43ff0c18 945 */
mbed_official 146:f64d43ff0c18 946 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 947 if (HW_UART_C4(uartInstance).B.TDMAS == 1)
mbed_official 146:f64d43ff0c18 948 #else
mbed_official 146:f64d43ff0c18 949 if (HW_UART_C5(uartInstance).B.TDMAS == 1)
mbed_official 146:f64d43ff0c18 950 #endif
mbed_official 146:f64d43ff0c18 951 {
mbed_official 146:f64d43ff0c18 952 /* in order to enable transmit DMA request, TIE must be set and TCIE must be cleared*/
mbed_official 146:f64d43ff0c18 953 if ((HW_UART_C2(uartInstance).B.TIE == 1) &&
mbed_official 146:f64d43ff0c18 954 (tcieBitStatus == 0))
mbed_official 146:f64d43ff0c18 955 {
mbed_official 146:f64d43ff0c18 956 /* UART module is configured to generate TxDMA request*/
mbed_official 146:f64d43ff0c18 957 return 1;
mbed_official 146:f64d43ff0c18 958 }
mbed_official 146:f64d43ff0c18 959 else
mbed_official 146:f64d43ff0c18 960 {
mbed_official 146:f64d43ff0c18 961 /* UART module is NOT configured to generate TxDMA request*/
mbed_official 146:f64d43ff0c18 962 return 0;
mbed_official 146:f64d43ff0c18 963 }
mbed_official 146:f64d43ff0c18 964 }
mbed_official 146:f64d43ff0c18 965 else
mbed_official 146:f64d43ff0c18 966 {
mbed_official 146:f64d43ff0c18 967 /* UART module is NOT configured to generate TxDMA request*/
mbed_official 146:f64d43ff0c18 968 return 0;
mbed_official 146:f64d43ff0c18 969 }
mbed_official 146:f64d43ff0c18 970 }
mbed_official 146:f64d43ff0c18 971 }
mbed_official 146:f64d43ff0c18 972
mbed_official 146:f64d43ff0c18 973 /*FUNCTION**********************************************************************
mbed_official 146:f64d43ff0c18 974 *
mbed_official 146:f64d43ff0c18 975 * Function Name : uart_hal_is_rxdma_enabled
mbed_official 146:f64d43ff0c18 976 * Description : Get the UART Receive DMA request configuration setting.
mbed_official 146:f64d43ff0c18 977 * This function returns to the user the configuration setting of the Receive DMA request.
mbed_official 146:f64d43ff0c18 978 *
mbed_official 146:f64d43ff0c18 979 *END**************************************************************************/
mbed_official 146:f64d43ff0c18 980 bool uart_hal_is_rxdma_enabled(uint32_t uartInstance)
mbed_official 146:f64d43ff0c18 981 {
mbed_official 146:f64d43ff0c18 982 assert(uartInstance < UART_INSTANCE_COUNT);
mbed_official 146:f64d43ff0c18 983
mbed_official 146:f64d43ff0c18 984 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 985 if (uartInstance == 0)
mbed_official 146:f64d43ff0c18 986 {
mbed_official 146:f64d43ff0c18 987 /* RDMAE configures the receive data register fell flag, S1[RDRF], to
mbed_official 146:f64d43ff0c18 988 * generate a DMA request.
mbed_official 146:f64d43ff0c18 989 */
mbed_official 146:f64d43ff0c18 990 return HW_UART0_C5.B.RDMAE; /* return RDMAE, set: enable, clear: disable*/
mbed_official 146:f64d43ff0c18 991 }
mbed_official 146:f64d43ff0c18 992 else
mbed_official 146:f64d43ff0c18 993 #endif
mbed_official 146:f64d43ff0c18 994 {
mbed_official 146:f64d43ff0c18 995 /* RDMAS configures the receiver data register full flag, RDRF, to generate interrupt or
mbed_official 146:f64d43ff0c18 996 * DMA requests if RIE is set.
mbed_official 146:f64d43ff0c18 997 * NOTE: If RIE is cleared, the RDRF DMA and RDRF interrupt request signals are not
mbed_official 146:f64d43ff0c18 998 * asserted when the RDRF flag is set, regardless of the state of RDMAS.
mbed_official 146:f64d43ff0c18 999 * 0 If RIE is set and the RDRF flag is set, the RDRF interrupt request signal is asserted
mbed_official 146:f64d43ff0c18 1000 * to requestinterrupt service.
mbed_official 146:f64d43ff0c18 1001 * 1 If RIE is set and the RDRF flag is set, the RDRF DMA request signal is asserted to
mbed_official 146:f64d43ff0c18 1002 * request a DMA transfer.
mbed_official 146:f64d43ff0c18 1003 */
mbed_official 146:f64d43ff0c18 1004 #if FSL_FEATURE_UART_HAS_LOW_POWER_UART_SUPPORT
mbed_official 146:f64d43ff0c18 1005 if (HW_UART_C4(uartInstance).B.RDMAS == 1)
mbed_official 146:f64d43ff0c18 1006 #else
mbed_official 146:f64d43ff0c18 1007 if (HW_UART_C5(uartInstance).B.RDMAS == 1)
mbed_official 146:f64d43ff0c18 1008 #endif
mbed_official 146:f64d43ff0c18 1009 {
mbed_official 146:f64d43ff0c18 1010 /* enable uart to generate receive DMA request*/
mbed_official 146:f64d43ff0c18 1011 if (HW_UART_C2(uartInstance).B.RIE == 1)
mbed_official 146:f64d43ff0c18 1012 {
mbed_official 146:f64d43ff0c18 1013 /* UART module is configured to generate RxDMA request*/
mbed_official 146:f64d43ff0c18 1014 return 1;
mbed_official 146:f64d43ff0c18 1015 }
mbed_official 146:f64d43ff0c18 1016 else
mbed_official 146:f64d43ff0c18 1017 {
mbed_official 146:f64d43ff0c18 1018 /* UART module is NOT configured to generate RxDMA request*/
mbed_official 146:f64d43ff0c18 1019 return 0;
mbed_official 146:f64d43ff0c18 1020 }
mbed_official 146:f64d43ff0c18 1021 }
mbed_official 146:f64d43ff0c18 1022 else
mbed_official 146:f64d43ff0c18 1023 {
mbed_official 146:f64d43ff0c18 1024 /* UART module is NOT configured to generate RxDMA request*/
mbed_official 146:f64d43ff0c18 1025 return 0;
mbed_official 146:f64d43ff0c18 1026 }
mbed_official 146:f64d43ff0c18 1027 }
mbed_official 146:f64d43ff0c18 1028 }
mbed_official 146:f64d43ff0c18 1029
mbed_official 146:f64d43ff0c18 1030 /*******************************************************************************
mbed_official 146:f64d43ff0c18 1031 * EOF
mbed_official 146:f64d43ff0c18 1032 ******************************************************************************/
mbed_official 146:f64d43ff0c18 1033