The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_SDT64B/TOOLCHAIN_GCC_ARM/fsl_i2c_edma.h@171:3a7713b1edbc, 2018-11-08 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Nov 08 11:45:42 2018 +0000
- Revision:
- 171:3a7713b1edbc
- Parent:
- TARGET_UBRIDGE/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/drivers/fsl_i2c_edma.h@145:64910690c574
mbed library. Release version 164
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 145:64910690c574 | 1 | /* |
AnnaBridge | 145:64910690c574 | 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. |
AnnaBridge | 145:64910690c574 | 3 | * All rights reserved. |
AnnaBridge | 145:64910690c574 | 4 | * |
AnnaBridge | 145:64910690c574 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
AnnaBridge | 145:64910690c574 | 6 | * are permitted provided that the following conditions are met: |
AnnaBridge | 145:64910690c574 | 7 | * |
AnnaBridge | 145:64910690c574 | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
AnnaBridge | 145:64910690c574 | 9 | * of conditions and the following disclaimer. |
AnnaBridge | 145:64910690c574 | 10 | * |
AnnaBridge | 145:64910690c574 | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
AnnaBridge | 145:64910690c574 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
AnnaBridge | 145:64910690c574 | 13 | * other materials provided with the distribution. |
AnnaBridge | 145:64910690c574 | 14 | * |
AnnaBridge | 145:64910690c574 | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
AnnaBridge | 145:64910690c574 | 16 | * contributors may be used to endorse or promote products derived from this |
AnnaBridge | 145:64910690c574 | 17 | * software without specific prior written permission. |
AnnaBridge | 145:64910690c574 | 18 | * |
AnnaBridge | 145:64910690c574 | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
AnnaBridge | 145:64910690c574 | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
AnnaBridge | 145:64910690c574 | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
AnnaBridge | 145:64910690c574 | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
AnnaBridge | 145:64910690c574 | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
AnnaBridge | 145:64910690c574 | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
AnnaBridge | 145:64910690c574 | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
AnnaBridge | 145:64910690c574 | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
AnnaBridge | 145:64910690c574 | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
AnnaBridge | 145:64910690c574 | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
AnnaBridge | 145:64910690c574 | 29 | */ |
AnnaBridge | 145:64910690c574 | 30 | #ifndef _FSL_I2C_DMA_H_ |
AnnaBridge | 145:64910690c574 | 31 | #define _FSL_I2C_DMA_H_ |
AnnaBridge | 145:64910690c574 | 32 | |
AnnaBridge | 145:64910690c574 | 33 | #include "fsl_i2c.h" |
AnnaBridge | 145:64910690c574 | 34 | #include "fsl_dmamux.h" |
AnnaBridge | 145:64910690c574 | 35 | #include "fsl_edma.h" |
AnnaBridge | 145:64910690c574 | 36 | |
AnnaBridge | 145:64910690c574 | 37 | /*! |
AnnaBridge | 145:64910690c574 | 38 | * @addtogroup i2c_edma_driver |
AnnaBridge | 145:64910690c574 | 39 | * @{ |
AnnaBridge | 145:64910690c574 | 40 | */ |
AnnaBridge | 145:64910690c574 | 41 | |
AnnaBridge | 145:64910690c574 | 42 | /******************************************************************************* |
AnnaBridge | 145:64910690c574 | 43 | * Definitions |
AnnaBridge | 145:64910690c574 | 44 | ******************************************************************************/ |
AnnaBridge | 145:64910690c574 | 45 | |
AnnaBridge | 145:64910690c574 | 46 | /*! @brief I2C master eDMA handle typedef. */ |
AnnaBridge | 145:64910690c574 | 47 | typedef struct _i2c_master_edma_handle i2c_master_edma_handle_t; |
AnnaBridge | 145:64910690c574 | 48 | |
AnnaBridge | 145:64910690c574 | 49 | /*! @brief I2C master eDMA transfer callback typedef. */ |
AnnaBridge | 145:64910690c574 | 50 | typedef void (*i2c_master_edma_transfer_callback_t)(I2C_Type *base, |
AnnaBridge | 145:64910690c574 | 51 | i2c_master_edma_handle_t *handle, |
AnnaBridge | 145:64910690c574 | 52 | status_t status, |
AnnaBridge | 145:64910690c574 | 53 | void *userData); |
AnnaBridge | 145:64910690c574 | 54 | |
AnnaBridge | 145:64910690c574 | 55 | /*! @brief I2C master eDMA transfer structure. */ |
AnnaBridge | 145:64910690c574 | 56 | struct _i2c_master_edma_handle |
AnnaBridge | 145:64910690c574 | 57 | { |
AnnaBridge | 145:64910690c574 | 58 | i2c_master_transfer_t transfer; /*!< I2C master transfer structure. */ |
AnnaBridge | 145:64910690c574 | 59 | size_t transferSize; /*!< Total bytes to be transferred. */ |
AnnaBridge | 145:64910690c574 | 60 | uint8_t nbytes; /*!< eDMA minor byte transfer count initially configured. */ |
AnnaBridge | 145:64910690c574 | 61 | uint8_t state; /*!< I2C master transfer status. */ |
AnnaBridge | 145:64910690c574 | 62 | edma_handle_t *dmaHandle; /*!< The eDMA handler used. */ |
AnnaBridge | 145:64910690c574 | 63 | i2c_master_edma_transfer_callback_t |
AnnaBridge | 145:64910690c574 | 64 | completionCallback; /*!< A callback function called after the eDMA transfer is finished. */ |
AnnaBridge | 145:64910690c574 | 65 | void *userData; /*!< A callback parameter passed to the callback function. */ |
AnnaBridge | 145:64910690c574 | 66 | }; |
AnnaBridge | 145:64910690c574 | 67 | |
AnnaBridge | 145:64910690c574 | 68 | /******************************************************************************* |
AnnaBridge | 145:64910690c574 | 69 | * API |
AnnaBridge | 145:64910690c574 | 70 | ******************************************************************************/ |
AnnaBridge | 145:64910690c574 | 71 | |
AnnaBridge | 145:64910690c574 | 72 | #if defined(__cplusplus) |
AnnaBridge | 145:64910690c574 | 73 | extern "C" { |
AnnaBridge | 145:64910690c574 | 74 | #endif /*_cplusplus. */ |
AnnaBridge | 145:64910690c574 | 75 | |
AnnaBridge | 145:64910690c574 | 76 | /*! |
AnnaBridge | 145:64910690c574 | 77 | * @name I2C Block eDMA Transfer Operation |
AnnaBridge | 145:64910690c574 | 78 | * @{ |
AnnaBridge | 145:64910690c574 | 79 | */ |
AnnaBridge | 145:64910690c574 | 80 | |
AnnaBridge | 145:64910690c574 | 81 | /*! |
AnnaBridge | 145:64910690c574 | 82 | * @brief Initializes the I2C handle which is used in transcational functions. |
AnnaBridge | 145:64910690c574 | 83 | * |
AnnaBridge | 145:64910690c574 | 84 | * @param base I2C peripheral base address. |
AnnaBridge | 145:64910690c574 | 85 | * @param handle A pointer to the i2c_master_edma_handle_t structure. |
AnnaBridge | 145:64910690c574 | 86 | * @param callback A pointer to the user callback function. |
AnnaBridge | 145:64910690c574 | 87 | * @param userData A user parameter passed to the callback function. |
AnnaBridge | 145:64910690c574 | 88 | * @param edmaHandle eDMA handle pointer. |
AnnaBridge | 145:64910690c574 | 89 | */ |
AnnaBridge | 145:64910690c574 | 90 | void I2C_MasterCreateEDMAHandle(I2C_Type *base, |
AnnaBridge | 145:64910690c574 | 91 | i2c_master_edma_handle_t *handle, |
AnnaBridge | 145:64910690c574 | 92 | i2c_master_edma_transfer_callback_t callback, |
AnnaBridge | 145:64910690c574 | 93 | void *userData, |
AnnaBridge | 145:64910690c574 | 94 | edma_handle_t *edmaHandle); |
AnnaBridge | 145:64910690c574 | 95 | |
AnnaBridge | 145:64910690c574 | 96 | /*! |
AnnaBridge | 145:64910690c574 | 97 | * @brief Performs a master eDMA non-blocking transfer on the I2C bus. |
AnnaBridge | 145:64910690c574 | 98 | * |
AnnaBridge | 145:64910690c574 | 99 | * @param base I2C peripheral base address. |
AnnaBridge | 145:64910690c574 | 100 | * @param handle A pointer to the i2c_master_edma_handle_t structure. |
AnnaBridge | 145:64910690c574 | 101 | * @param xfer A pointer to the transfer structure of i2c_master_transfer_t. |
AnnaBridge | 145:64910690c574 | 102 | * @retval kStatus_Success Sucessfully completed the data transmission. |
AnnaBridge | 145:64910690c574 | 103 | * @retval kStatus_I2C_Busy A previous transmission is still not finished. |
AnnaBridge | 145:64910690c574 | 104 | * @retval kStatus_I2C_Timeout Transfer error, waits for a signal timeout. |
AnnaBridge | 145:64910690c574 | 105 | * @retval kStatus_I2C_ArbitrationLost Transfer error, arbitration lost. |
AnnaBridge | 145:64910690c574 | 106 | * @retval kStataus_I2C_Nak Transfer error, receive NAK during transfer. |
AnnaBridge | 145:64910690c574 | 107 | */ |
AnnaBridge | 145:64910690c574 | 108 | status_t I2C_MasterTransferEDMA(I2C_Type *base, i2c_master_edma_handle_t *handle, i2c_master_transfer_t *xfer); |
AnnaBridge | 145:64910690c574 | 109 | |
AnnaBridge | 145:64910690c574 | 110 | /*! |
AnnaBridge | 145:64910690c574 | 111 | * @brief Gets a master transfer status during the eDMA non-blocking transfer. |
AnnaBridge | 145:64910690c574 | 112 | * |
AnnaBridge | 145:64910690c574 | 113 | * @param base I2C peripheral base address. |
AnnaBridge | 145:64910690c574 | 114 | * @param handle A pointer to the i2c_master_edma_handle_t structure. |
AnnaBridge | 145:64910690c574 | 115 | * @param count A number of bytes transferred by the non-blocking transaction. |
AnnaBridge | 145:64910690c574 | 116 | */ |
AnnaBridge | 145:64910690c574 | 117 | status_t I2C_MasterTransferGetCountEDMA(I2C_Type *base, i2c_master_edma_handle_t *handle, size_t *count); |
AnnaBridge | 145:64910690c574 | 118 | |
AnnaBridge | 145:64910690c574 | 119 | /*! |
AnnaBridge | 145:64910690c574 | 120 | * @brief Aborts a master eDMA non-blocking transfer early. |
AnnaBridge | 145:64910690c574 | 121 | * |
AnnaBridge | 145:64910690c574 | 122 | * @param base I2C peripheral base address. |
AnnaBridge | 145:64910690c574 | 123 | * @param handle A pointer to the i2c_master_edma_handle_t structure. |
AnnaBridge | 145:64910690c574 | 124 | */ |
AnnaBridge | 145:64910690c574 | 125 | void I2C_MasterTransferAbortEDMA(I2C_Type *base, i2c_master_edma_handle_t *handle); |
AnnaBridge | 145:64910690c574 | 126 | |
AnnaBridge | 145:64910690c574 | 127 | /* @} */ |
AnnaBridge | 145:64910690c574 | 128 | #if defined(__cplusplus) |
AnnaBridge | 145:64910690c574 | 129 | } |
AnnaBridge | 145:64910690c574 | 130 | #endif /*_cplusplus. */ |
AnnaBridge | 145:64910690c574 | 131 | /*@}*/ |
AnnaBridge | 145:64910690c574 | 132 | #endif /*_FSL_I2C_DMA_H_*/ |