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.
Fork of mbed-dev by
targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC54114/drivers/fsl_dmic_dma.h@178:7b4eb50f6890, 2017-11-29 (annotated)
- Committer:
- misodengaku
- Date:
- Wed Nov 29 06:30:35 2017 +0000
- Revision:
- 178:7b4eb50f6890
- Parent:
- 170:19eb464bc2be
sco-evb-01 patch
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 170:19eb464bc2be | 1 | /* |
Kojto | 170:19eb464bc2be | 2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. |
Kojto | 170:19eb464bc2be | 3 | * All rights reserved. |
Kojto | 170:19eb464bc2be | 4 | * |
Kojto | 170:19eb464bc2be | 5 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 170:19eb464bc2be | 6 | * are permitted provided that the following conditions are met: |
Kojto | 170:19eb464bc2be | 7 | * |
Kojto | 170:19eb464bc2be | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
Kojto | 170:19eb464bc2be | 9 | * of conditions and the following disclaimer. |
Kojto | 170:19eb464bc2be | 10 | * |
Kojto | 170:19eb464bc2be | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
Kojto | 170:19eb464bc2be | 12 | * list of conditions and the following disclaimer in the documentation and/or |
Kojto | 170:19eb464bc2be | 13 | * other materials provided with the distribution. |
Kojto | 170:19eb464bc2be | 14 | * |
Kojto | 170:19eb464bc2be | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
Kojto | 170:19eb464bc2be | 16 | * contributors may be used to endorse or promote products derived from this |
Kojto | 170:19eb464bc2be | 17 | * software without specific prior written permission. |
Kojto | 170:19eb464bc2be | 18 | * |
Kojto | 170:19eb464bc2be | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
Kojto | 170:19eb464bc2be | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
Kojto | 170:19eb464bc2be | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 170:19eb464bc2be | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
Kojto | 170:19eb464bc2be | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
Kojto | 170:19eb464bc2be | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
Kojto | 170:19eb464bc2be | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
Kojto | 170:19eb464bc2be | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
Kojto | 170:19eb464bc2be | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
Kojto | 170:19eb464bc2be | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 170:19eb464bc2be | 29 | */ |
Kojto | 170:19eb464bc2be | 30 | #ifndef _FSL_DMIC_DMA_H_ |
Kojto | 170:19eb464bc2be | 31 | #define _FSL_DMIC_DMA_H_ |
Kojto | 170:19eb464bc2be | 32 | |
Kojto | 170:19eb464bc2be | 33 | #include "fsl_common.h" |
Kojto | 170:19eb464bc2be | 34 | #include "fsl_dma.h" |
Kojto | 170:19eb464bc2be | 35 | |
Kojto | 170:19eb464bc2be | 36 | /*! |
Kojto | 170:19eb464bc2be | 37 | * @addtogroup dmic_dma_driver |
Kojto | 170:19eb464bc2be | 38 | * @{ |
Kojto | 170:19eb464bc2be | 39 | */ |
Kojto | 170:19eb464bc2be | 40 | |
Kojto | 170:19eb464bc2be | 41 | /*! @file */ |
Kojto | 170:19eb464bc2be | 42 | |
Kojto | 170:19eb464bc2be | 43 | /******************************************************************************* |
Kojto | 170:19eb464bc2be | 44 | * Definitions |
Kojto | 170:19eb464bc2be | 45 | ******************************************************************************/ |
Kojto | 170:19eb464bc2be | 46 | |
Kojto | 170:19eb464bc2be | 47 | /*! @brief DMIC transfer structure. */ |
Kojto | 170:19eb464bc2be | 48 | typedef struct _dmic_transfer |
Kojto | 170:19eb464bc2be | 49 | { |
Kojto | 170:19eb464bc2be | 50 | uint16_t *data; /*!< The buffer of data to be transfer.*/ |
Kojto | 170:19eb464bc2be | 51 | size_t dataSize; /*!< The byte count to be transfer. */ |
Kojto | 170:19eb464bc2be | 52 | } dmic_transfer_t; |
Kojto | 170:19eb464bc2be | 53 | |
Kojto | 170:19eb464bc2be | 54 | /* Forward declaration of the handle typedef. */ |
Kojto | 170:19eb464bc2be | 55 | typedef struct _dmic_dma_handle dmic_dma_handle_t; |
Kojto | 170:19eb464bc2be | 56 | |
Kojto | 170:19eb464bc2be | 57 | /*! @brief DMIC transfer callback function. */ |
Kojto | 170:19eb464bc2be | 58 | typedef void (*dmic_dma_transfer_callback_t)(DMIC_Type *base, |
Kojto | 170:19eb464bc2be | 59 | dmic_dma_handle_t *handle, |
Kojto | 170:19eb464bc2be | 60 | status_t status, |
Kojto | 170:19eb464bc2be | 61 | void *userData); |
Kojto | 170:19eb464bc2be | 62 | |
Kojto | 170:19eb464bc2be | 63 | /*! |
Kojto | 170:19eb464bc2be | 64 | * @brief DMIC DMA handle |
Kojto | 170:19eb464bc2be | 65 | */ |
Kojto | 170:19eb464bc2be | 66 | struct _dmic_dma_handle |
Kojto | 170:19eb464bc2be | 67 | { |
Kojto | 170:19eb464bc2be | 68 | DMIC_Type *base; /*!< DMIC peripheral base address. */ |
Kojto | 170:19eb464bc2be | 69 | dma_handle_t *rxDmaHandle; /*!< The DMA RX channel used. */ |
Kojto | 170:19eb464bc2be | 70 | dmic_dma_transfer_callback_t callback; /*!< Callback function. */ |
Kojto | 170:19eb464bc2be | 71 | void *userData; /*!< DMIC callback function parameter.*/ |
Kojto | 170:19eb464bc2be | 72 | size_t transferSize; /*!< Size of the data to receive. */ |
Kojto | 170:19eb464bc2be | 73 | volatile uint8_t state; /*!< Internal state of DMIC DMA transfer */ |
Kojto | 170:19eb464bc2be | 74 | }; |
Kojto | 170:19eb464bc2be | 75 | |
Kojto | 170:19eb464bc2be | 76 | /******************************************************************************* |
Kojto | 170:19eb464bc2be | 77 | * API |
Kojto | 170:19eb464bc2be | 78 | ******************************************************************************/ |
Kojto | 170:19eb464bc2be | 79 | |
Kojto | 170:19eb464bc2be | 80 | #ifdef __cplusplus |
Kojto | 170:19eb464bc2be | 81 | extern "C" { |
Kojto | 170:19eb464bc2be | 82 | #endif /* _cplusplus */ |
Kojto | 170:19eb464bc2be | 83 | |
Kojto | 170:19eb464bc2be | 84 | /*! |
Kojto | 170:19eb464bc2be | 85 | * @name DMA transactional |
Kojto | 170:19eb464bc2be | 86 | * @{ |
Kojto | 170:19eb464bc2be | 87 | */ |
Kojto | 170:19eb464bc2be | 88 | |
Kojto | 170:19eb464bc2be | 89 | /*! |
Kojto | 170:19eb464bc2be | 90 | * @brief Initializes the DMIC handle which is used in transactional functions. |
Kojto | 170:19eb464bc2be | 91 | * @param base DMIC peripheral base address. |
Kojto | 170:19eb464bc2be | 92 | * @param handle Pointer to dmic_dma_handle_t structure. |
Kojto | 170:19eb464bc2be | 93 | * @param callback Callback function. |
Kojto | 170:19eb464bc2be | 94 | * @param userData User data. |
Kojto | 170:19eb464bc2be | 95 | * @param rxDmaHandle User-requested DMA handle for RX DMA transfer. |
Kojto | 170:19eb464bc2be | 96 | */ |
Kojto | 170:19eb464bc2be | 97 | status_t DMIC_TransferCreateHandleDMA(DMIC_Type *base, |
Kojto | 170:19eb464bc2be | 98 | dmic_dma_handle_t *handle, |
Kojto | 170:19eb464bc2be | 99 | dmic_dma_transfer_callback_t callback, |
Kojto | 170:19eb464bc2be | 100 | void *userData, |
Kojto | 170:19eb464bc2be | 101 | dma_handle_t *rxDmaHandle); |
Kojto | 170:19eb464bc2be | 102 | |
Kojto | 170:19eb464bc2be | 103 | /*! |
Kojto | 170:19eb464bc2be | 104 | * @brief Receives data using DMA. |
Kojto | 170:19eb464bc2be | 105 | * |
Kojto | 170:19eb464bc2be | 106 | * This function receives data using DMA. This is a non-blocking function, which returns |
Kojto | 170:19eb464bc2be | 107 | * right away. When all data is received, the receive callback function is called. |
Kojto | 170:19eb464bc2be | 108 | * |
Kojto | 170:19eb464bc2be | 109 | * @param base USART peripheral base address. |
Kojto | 170:19eb464bc2be | 110 | * @param handle Pointer to usart_dma_handle_t structure. |
Kojto | 170:19eb464bc2be | 111 | * @param xfer DMIC DMA transfer structure. See #dmic_transfer_t. |
Kojto | 170:19eb464bc2be | 112 | * @param dmic_channel DMIC channel |
Kojto | 170:19eb464bc2be | 113 | * @retval kStatus_Success |
Kojto | 170:19eb464bc2be | 114 | */ |
Kojto | 170:19eb464bc2be | 115 | status_t DMIC_TransferReceiveDMA(DMIC_Type *base, |
Kojto | 170:19eb464bc2be | 116 | dmic_dma_handle_t *handle, |
Kojto | 170:19eb464bc2be | 117 | dmic_transfer_t *xfer, |
Kojto | 170:19eb464bc2be | 118 | uint32_t dmic_channel); |
Kojto | 170:19eb464bc2be | 119 | |
Kojto | 170:19eb464bc2be | 120 | /*! |
Kojto | 170:19eb464bc2be | 121 | * @brief Aborts the received data using DMA. |
Kojto | 170:19eb464bc2be | 122 | * |
Kojto | 170:19eb464bc2be | 123 | * This function aborts the received data using DMA. |
Kojto | 170:19eb464bc2be | 124 | * |
Kojto | 170:19eb464bc2be | 125 | * @param base DMIC peripheral base address |
Kojto | 170:19eb464bc2be | 126 | * @param handle Pointer to dmic_dma_handle_t structure |
Kojto | 170:19eb464bc2be | 127 | */ |
Kojto | 170:19eb464bc2be | 128 | void DMIC_TransferAbortReceiveDMA(DMIC_Type *base, dmic_dma_handle_t *handle); |
Kojto | 170:19eb464bc2be | 129 | |
Kojto | 170:19eb464bc2be | 130 | /*! |
Kojto | 170:19eb464bc2be | 131 | * @brief Get the number of bytes that have been received. |
Kojto | 170:19eb464bc2be | 132 | * |
Kojto | 170:19eb464bc2be | 133 | * This function gets the number of bytes that have been received. |
Kojto | 170:19eb464bc2be | 134 | * |
Kojto | 170:19eb464bc2be | 135 | * @param base DMIC peripheral base address. |
Kojto | 170:19eb464bc2be | 136 | * @param handle DMIC handle pointer. |
Kojto | 170:19eb464bc2be | 137 | * @param count Receive bytes count. |
Kojto | 170:19eb464bc2be | 138 | * @retval kStatus_NoTransferInProgress No receive in progress. |
Kojto | 170:19eb464bc2be | 139 | * @retval kStatus_InvalidArgument Parameter is invalid. |
Kojto | 170:19eb464bc2be | 140 | * @retval kStatus_Success Get successfully through the parameter count; |
Kojto | 170:19eb464bc2be | 141 | */ |
Kojto | 170:19eb464bc2be | 142 | status_t DMIC_TransferGetReceiveCountDMA(DMIC_Type *base, dmic_dma_handle_t *handle, uint32_t *count); |
Kojto | 170:19eb464bc2be | 143 | |
Kojto | 170:19eb464bc2be | 144 | /* @} */ |
Kojto | 170:19eb464bc2be | 145 | |
Kojto | 170:19eb464bc2be | 146 | #if defined(__cplusplus) |
Kojto | 170:19eb464bc2be | 147 | } |
Kojto | 170:19eb464bc2be | 148 | #endif |
Kojto | 170:19eb464bc2be | 149 | |
Kojto | 170:19eb464bc2be | 150 | /*! @}*/ |
Kojto | 170:19eb464bc2be | 151 | |
Kojto | 170:19eb464bc2be | 152 | #endif /* _FSL_DMIC_DMA_H_ */ |