added prescaler for 16 bit pwm in LPC1347 target
Fork of mbed-dev by
targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_KL43Z/drivers/fsl_flexio_uart_dma.h@144:ef7eb2e8f9f7, 2016-09-02 (annotated)
- Committer:
- <>
- Date:
- Fri Sep 02 15:07:44 2016 +0100
- Revision:
- 144:ef7eb2e8f9f7
This updates the lib to the mbed lib v125
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 144:ef7eb2e8f9f7 | 1 | /* |
<> | 144:ef7eb2e8f9f7 | 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. |
<> | 144:ef7eb2e8f9f7 | 3 | * All rights reserved. |
<> | 144:ef7eb2e8f9f7 | 4 | * |
<> | 144:ef7eb2e8f9f7 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
<> | 144:ef7eb2e8f9f7 | 6 | * are permitted provided that the following conditions are met: |
<> | 144:ef7eb2e8f9f7 | 7 | * |
<> | 144:ef7eb2e8f9f7 | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
<> | 144:ef7eb2e8f9f7 | 9 | * of conditions and the following disclaimer. |
<> | 144:ef7eb2e8f9f7 | 10 | * |
<> | 144:ef7eb2e8f9f7 | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
<> | 144:ef7eb2e8f9f7 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
<> | 144:ef7eb2e8f9f7 | 13 | * other materials provided with the distribution. |
<> | 144:ef7eb2e8f9f7 | 14 | * |
<> | 144:ef7eb2e8f9f7 | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
<> | 144:ef7eb2e8f9f7 | 16 | * contributors may be used to endorse or promote products derived from this |
<> | 144:ef7eb2e8f9f7 | 17 | * software without specific prior written permission. |
<> | 144:ef7eb2e8f9f7 | 18 | * |
<> | 144:ef7eb2e8f9f7 | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
<> | 144:ef7eb2e8f9f7 | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
<> | 144:ef7eb2e8f9f7 | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
<> | 144:ef7eb2e8f9f7 | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
<> | 144:ef7eb2e8f9f7 | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
<> | 144:ef7eb2e8f9f7 | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
<> | 144:ef7eb2e8f9f7 | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
<> | 144:ef7eb2e8f9f7 | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
<> | 144:ef7eb2e8f9f7 | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
<> | 144:ef7eb2e8f9f7 | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
<> | 144:ef7eb2e8f9f7 | 29 | */ |
<> | 144:ef7eb2e8f9f7 | 30 | #ifndef _FSL_FLEXIO_UART_DMA_H_ |
<> | 144:ef7eb2e8f9f7 | 31 | #define _FSL_FLEXIO_UART_DMA_H_ |
<> | 144:ef7eb2e8f9f7 | 32 | |
<> | 144:ef7eb2e8f9f7 | 33 | #include "fsl_flexio_uart.h" |
<> | 144:ef7eb2e8f9f7 | 34 | #include "fsl_dmamux.h" |
<> | 144:ef7eb2e8f9f7 | 35 | #include "fsl_dma.h" |
<> | 144:ef7eb2e8f9f7 | 36 | |
<> | 144:ef7eb2e8f9f7 | 37 | /*! |
<> | 144:ef7eb2e8f9f7 | 38 | * @addtogroup flexio_dma_uart |
<> | 144:ef7eb2e8f9f7 | 39 | * @{ |
<> | 144:ef7eb2e8f9f7 | 40 | */ |
<> | 144:ef7eb2e8f9f7 | 41 | |
<> | 144:ef7eb2e8f9f7 | 42 | /*! @file*/ |
<> | 144:ef7eb2e8f9f7 | 43 | |
<> | 144:ef7eb2e8f9f7 | 44 | /******************************************************************************* |
<> | 144:ef7eb2e8f9f7 | 45 | * Definitions |
<> | 144:ef7eb2e8f9f7 | 46 | ******************************************************************************/ |
<> | 144:ef7eb2e8f9f7 | 47 | |
<> | 144:ef7eb2e8f9f7 | 48 | /* Forward declaration of the handle typedef. */ |
<> | 144:ef7eb2e8f9f7 | 49 | typedef struct _flexio_uart_dma_handle flexio_uart_dma_handle_t; |
<> | 144:ef7eb2e8f9f7 | 50 | |
<> | 144:ef7eb2e8f9f7 | 51 | /*! @brief UART transfer callback function. */ |
<> | 144:ef7eb2e8f9f7 | 52 | typedef void (*flexio_uart_dma_transfer_callback_t)(FLEXIO_UART_Type *base, |
<> | 144:ef7eb2e8f9f7 | 53 | flexio_uart_dma_handle_t *handle, |
<> | 144:ef7eb2e8f9f7 | 54 | status_t status, |
<> | 144:ef7eb2e8f9f7 | 55 | void *userData); |
<> | 144:ef7eb2e8f9f7 | 56 | |
<> | 144:ef7eb2e8f9f7 | 57 | /*! |
<> | 144:ef7eb2e8f9f7 | 58 | * @brief UART DMA handle |
<> | 144:ef7eb2e8f9f7 | 59 | */ |
<> | 144:ef7eb2e8f9f7 | 60 | struct _flexio_uart_dma_handle |
<> | 144:ef7eb2e8f9f7 | 61 | { |
<> | 144:ef7eb2e8f9f7 | 62 | flexio_uart_dma_transfer_callback_t callback; /*!< Callback function. */ |
<> | 144:ef7eb2e8f9f7 | 63 | void *userData; /*!< UART callback function parameter.*/ |
<> | 144:ef7eb2e8f9f7 | 64 | |
<> | 144:ef7eb2e8f9f7 | 65 | size_t txSize; /*!< Total bytes to be sent. */ |
<> | 144:ef7eb2e8f9f7 | 66 | size_t rxSize; /*!< Total bytes to be received. */ |
<> | 144:ef7eb2e8f9f7 | 67 | |
<> | 144:ef7eb2e8f9f7 | 68 | dma_handle_t *txDmaHandle; /*!< The DMA TX channel used. */ |
<> | 144:ef7eb2e8f9f7 | 69 | dma_handle_t *rxDmaHandle; /*!< The DMA RX channel used. */ |
<> | 144:ef7eb2e8f9f7 | 70 | |
<> | 144:ef7eb2e8f9f7 | 71 | volatile uint8_t txState; /*!< TX transfer state. */ |
<> | 144:ef7eb2e8f9f7 | 72 | volatile uint8_t rxState; /*!< RX transfer state */ |
<> | 144:ef7eb2e8f9f7 | 73 | }; |
<> | 144:ef7eb2e8f9f7 | 74 | |
<> | 144:ef7eb2e8f9f7 | 75 | /******************************************************************************* |
<> | 144:ef7eb2e8f9f7 | 76 | * API |
<> | 144:ef7eb2e8f9f7 | 77 | ******************************************************************************/ |
<> | 144:ef7eb2e8f9f7 | 78 | |
<> | 144:ef7eb2e8f9f7 | 79 | #if defined(__cplusplus) |
<> | 144:ef7eb2e8f9f7 | 80 | extern "C" { |
<> | 144:ef7eb2e8f9f7 | 81 | #endif |
<> | 144:ef7eb2e8f9f7 | 82 | |
<> | 144:ef7eb2e8f9f7 | 83 | /*! |
<> | 144:ef7eb2e8f9f7 | 84 | * @name eDMA transactional |
<> | 144:ef7eb2e8f9f7 | 85 | * @{ |
<> | 144:ef7eb2e8f9f7 | 86 | */ |
<> | 144:ef7eb2e8f9f7 | 87 | |
<> | 144:ef7eb2e8f9f7 | 88 | /*! |
<> | 144:ef7eb2e8f9f7 | 89 | * @brief Initializes the FLEXIO_UART handle which is used in transactional functions |
<> | 144:ef7eb2e8f9f7 | 90 | * |
<> | 144:ef7eb2e8f9f7 | 91 | * @param base Pointer to FLEXIO_UART_Type structure. |
<> | 144:ef7eb2e8f9f7 | 92 | * @param handle Pointer to flexio_uart_dma_handle_t structure. |
<> | 144:ef7eb2e8f9f7 | 93 | * @param callback FlexIO UART callback, NULL means no callback. |
<> | 144:ef7eb2e8f9f7 | 94 | * @param userData User callback function data. |
<> | 144:ef7eb2e8f9f7 | 95 | * @param txDmaHandle User requested DMA handle for TX DMA transfer. |
<> | 144:ef7eb2e8f9f7 | 96 | * @param rxDmaHandle User requested DMA handle for RX DMA transfer. |
<> | 144:ef7eb2e8f9f7 | 97 | * @retval kStatus_Success Successfully create the handle. |
<> | 144:ef7eb2e8f9f7 | 98 | * @retval kStatus_OutOfRange The FlexIO UART DMA type/handle table out of range. |
<> | 144:ef7eb2e8f9f7 | 99 | */ |
<> | 144:ef7eb2e8f9f7 | 100 | status_t FLEXIO_UART_TransferCreateHandleDMA(FLEXIO_UART_Type *base, |
<> | 144:ef7eb2e8f9f7 | 101 | flexio_uart_dma_handle_t *handle, |
<> | 144:ef7eb2e8f9f7 | 102 | flexio_uart_dma_transfer_callback_t callback, |
<> | 144:ef7eb2e8f9f7 | 103 | void *userData, |
<> | 144:ef7eb2e8f9f7 | 104 | dma_handle_t *txDmaHandle, |
<> | 144:ef7eb2e8f9f7 | 105 | dma_handle_t *rxDmaHandle); |
<> | 144:ef7eb2e8f9f7 | 106 | |
<> | 144:ef7eb2e8f9f7 | 107 | /*! |
<> | 144:ef7eb2e8f9f7 | 108 | * @brief Sends data using DMA. |
<> | 144:ef7eb2e8f9f7 | 109 | * |
<> | 144:ef7eb2e8f9f7 | 110 | * This function send data using DMA, this is non-blocking function, which return |
<> | 144:ef7eb2e8f9f7 | 111 | * right away. When all data have been sent out, the send callback function is called. |
<> | 144:ef7eb2e8f9f7 | 112 | * |
<> | 144:ef7eb2e8f9f7 | 113 | * @param base Pointer to FLEXIO_UART_Type structure |
<> | 144:ef7eb2e8f9f7 | 114 | * @param handle Pointer to flexio_uart_dma_handle_t structure |
<> | 144:ef7eb2e8f9f7 | 115 | * @param xfer FLEXIO_UART DMA transfer structure, refer to #flexio_uart_transfer_t. |
<> | 144:ef7eb2e8f9f7 | 116 | * @retval kStatus_Success if succeed, others failed. |
<> | 144:ef7eb2e8f9f7 | 117 | * @retval kStatus_FLEXIO_UART_TxBusy Previous transfer on going. |
<> | 144:ef7eb2e8f9f7 | 118 | */ |
<> | 144:ef7eb2e8f9f7 | 119 | status_t FLEXIO_UART_TransferSendDMA(FLEXIO_UART_Type *base, |
<> | 144:ef7eb2e8f9f7 | 120 | flexio_uart_dma_handle_t *handle, |
<> | 144:ef7eb2e8f9f7 | 121 | flexio_uart_transfer_t *xfer); |
<> | 144:ef7eb2e8f9f7 | 122 | |
<> | 144:ef7eb2e8f9f7 | 123 | /*! |
<> | 144:ef7eb2e8f9f7 | 124 | * @brief Receives data using DMA. |
<> | 144:ef7eb2e8f9f7 | 125 | * |
<> | 144:ef7eb2e8f9f7 | 126 | * This function receives data using DMA. This is non-blocking function, which returns |
<> | 144:ef7eb2e8f9f7 | 127 | * right away. When all data have been received, the receive callback function is called. |
<> | 144:ef7eb2e8f9f7 | 128 | * |
<> | 144:ef7eb2e8f9f7 | 129 | * @param base Pointer to FLEXIO_UART_Type structure |
<> | 144:ef7eb2e8f9f7 | 130 | * @param handle Pointer to flexio_uart_dma_handle_t structure |
<> | 144:ef7eb2e8f9f7 | 131 | * @param xfer FLEXIO_UART DMA transfer sturcture, refer to #flexio_uart_transfer_t. |
<> | 144:ef7eb2e8f9f7 | 132 | * @retval kStatus_Success if succeed, others failed. |
<> | 144:ef7eb2e8f9f7 | 133 | * @retval kStatus_FLEXIO_UART_RxBusy Previous transfer on going. |
<> | 144:ef7eb2e8f9f7 | 134 | */ |
<> | 144:ef7eb2e8f9f7 | 135 | status_t FLEXIO_UART_TransferReceiveDMA(FLEXIO_UART_Type *base, |
<> | 144:ef7eb2e8f9f7 | 136 | flexio_uart_dma_handle_t *handle, |
<> | 144:ef7eb2e8f9f7 | 137 | flexio_uart_transfer_t *xfer); |
<> | 144:ef7eb2e8f9f7 | 138 | |
<> | 144:ef7eb2e8f9f7 | 139 | /*! |
<> | 144:ef7eb2e8f9f7 | 140 | * @brief Aborts the sent data which using DMA. |
<> | 144:ef7eb2e8f9f7 | 141 | * |
<> | 144:ef7eb2e8f9f7 | 142 | * This function aborts the sent data which using DMA. |
<> | 144:ef7eb2e8f9f7 | 143 | * |
<> | 144:ef7eb2e8f9f7 | 144 | * @param base Pointer to FLEXIO_UART_Type structure |
<> | 144:ef7eb2e8f9f7 | 145 | * @param handle Pointer to flexio_uart_dma_handle_t structure |
<> | 144:ef7eb2e8f9f7 | 146 | */ |
<> | 144:ef7eb2e8f9f7 | 147 | void FLEXIO_UART_TransferAbortSendDMA(FLEXIO_UART_Type *base, flexio_uart_dma_handle_t *handle); |
<> | 144:ef7eb2e8f9f7 | 148 | |
<> | 144:ef7eb2e8f9f7 | 149 | /*! |
<> | 144:ef7eb2e8f9f7 | 150 | * @brief Aborts the receive data which using DMA. |
<> | 144:ef7eb2e8f9f7 | 151 | * |
<> | 144:ef7eb2e8f9f7 | 152 | * This function aborts the receive data which using DMA. |
<> | 144:ef7eb2e8f9f7 | 153 | * |
<> | 144:ef7eb2e8f9f7 | 154 | * @param base Pointer to FLEXIO_UART_Type structure |
<> | 144:ef7eb2e8f9f7 | 155 | * @param handle Pointer to flexio_uart_dma_handle_t structure |
<> | 144:ef7eb2e8f9f7 | 156 | */ |
<> | 144:ef7eb2e8f9f7 | 157 | void FLEXIO_UART_TransferAbortReceiveDMA(FLEXIO_UART_Type *base, flexio_uart_dma_handle_t *handle); |
<> | 144:ef7eb2e8f9f7 | 158 | |
<> | 144:ef7eb2e8f9f7 | 159 | /*! |
<> | 144:ef7eb2e8f9f7 | 160 | * @brief Gets the number of bytes still not sent out. |
<> | 144:ef7eb2e8f9f7 | 161 | * |
<> | 144:ef7eb2e8f9f7 | 162 | * This function gets the number of bytes still not sent out. |
<> | 144:ef7eb2e8f9f7 | 163 | * |
<> | 144:ef7eb2e8f9f7 | 164 | * @param base Pointer to FLEXIO_UART_Type structure |
<> | 144:ef7eb2e8f9f7 | 165 | * @param handle Pointer to flexio_uart_dma_handle_t structure |
<> | 144:ef7eb2e8f9f7 | 166 | * @param count Number of bytes sent so far by the non-blocking transaction. |
<> | 144:ef7eb2e8f9f7 | 167 | */ |
<> | 144:ef7eb2e8f9f7 | 168 | status_t FLEXIO_UART_TransferGetSendCountDMA(FLEXIO_UART_Type *base, flexio_uart_dma_handle_t *handle, size_t *count); |
<> | 144:ef7eb2e8f9f7 | 169 | |
<> | 144:ef7eb2e8f9f7 | 170 | /*! |
<> | 144:ef7eb2e8f9f7 | 171 | * @brief Gets the number of bytes still not received. |
<> | 144:ef7eb2e8f9f7 | 172 | * |
<> | 144:ef7eb2e8f9f7 | 173 | * This function gets the number of bytes still not received. |
<> | 144:ef7eb2e8f9f7 | 174 | * |
<> | 144:ef7eb2e8f9f7 | 175 | * @param base Pointer to FLEXIO_UART_Type structure |
<> | 144:ef7eb2e8f9f7 | 176 | * @param handle Pointer to flexio_uart_dma_handle_t structure |
<> | 144:ef7eb2e8f9f7 | 177 | * @param count Number of bytes received so far by the non-blocking transaction. |
<> | 144:ef7eb2e8f9f7 | 178 | */ |
<> | 144:ef7eb2e8f9f7 | 179 | status_t FLEXIO_UART_TransferGetReceiveCountDMA(FLEXIO_UART_Type *base, |
<> | 144:ef7eb2e8f9f7 | 180 | flexio_uart_dma_handle_t *handle, |
<> | 144:ef7eb2e8f9f7 | 181 | size_t *count); |
<> | 144:ef7eb2e8f9f7 | 182 | |
<> | 144:ef7eb2e8f9f7 | 183 | /*@}*/ |
<> | 144:ef7eb2e8f9f7 | 184 | |
<> | 144:ef7eb2e8f9f7 | 185 | #if defined(__cplusplus) |
<> | 144:ef7eb2e8f9f7 | 186 | } |
<> | 144:ef7eb2e8f9f7 | 187 | #endif |
<> | 144:ef7eb2e8f9f7 | 188 | |
<> | 144:ef7eb2e8f9f7 | 189 | /*! @}*/ |
<> | 144:ef7eb2e8f9f7 | 190 | |
<> | 144:ef7eb2e8f9f7 | 191 | #endif /* _FSL_UART_DMA_H_ */ |