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.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew 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_FLEXIO_CAMERA_EDMA_H_
AnnaBridge 145:64910690c574 31 #define _FSL_FLEXIO_CAMERA_EDMA_H_
AnnaBridge 145:64910690c574 32
AnnaBridge 145:64910690c574 33 #include "fsl_flexio_camera.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 flexio_edma_camera
AnnaBridge 145:64910690c574 39 * @{
AnnaBridge 145:64910690c574 40 */
AnnaBridge 145:64910690c574 41
AnnaBridge 145:64910690c574 42
AnnaBridge 145:64910690c574 43 /*******************************************************************************
AnnaBridge 145:64910690c574 44 * Definitions
AnnaBridge 145:64910690c574 45 ******************************************************************************/
AnnaBridge 145:64910690c574 46
AnnaBridge 145:64910690c574 47 /*! @brief Forward declaration of the handle typedef. */
AnnaBridge 145:64910690c574 48 typedef struct _flexio_camera_edma_handle flexio_camera_edma_handle_t;
AnnaBridge 145:64910690c574 49
AnnaBridge 145:64910690c574 50 /*! @brief CAMERA transfer callback function. */
AnnaBridge 145:64910690c574 51 typedef void (*flexio_camera_edma_transfer_callback_t)(FLEXIO_CAMERA_Type *base,
AnnaBridge 145:64910690c574 52 flexio_camera_edma_handle_t *handle,
AnnaBridge 145:64910690c574 53 status_t status,
AnnaBridge 145:64910690c574 54 void *userData);
AnnaBridge 145:64910690c574 55
AnnaBridge 145:64910690c574 56 /*!
AnnaBridge 145:64910690c574 57 * @brief CAMERA eDMA handle
AnnaBridge 145:64910690c574 58 */
AnnaBridge 145:64910690c574 59 struct _flexio_camera_edma_handle
AnnaBridge 145:64910690c574 60 {
AnnaBridge 145:64910690c574 61 flexio_camera_edma_transfer_callback_t callback; /*!< Callback function. */
AnnaBridge 145:64910690c574 62 void *userData; /*!< CAMERA callback function parameter.*/
AnnaBridge 145:64910690c574 63 size_t rxSize; /*!< Total bytes to be received. */
AnnaBridge 145:64910690c574 64 edma_handle_t *rxEdmaHandle; /*!< The eDMA RX channel used. */
AnnaBridge 145:64910690c574 65 volatile uint8_t rxState; /*!< RX transfer state */
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
AnnaBridge 145:64910690c574 75
AnnaBridge 145:64910690c574 76 /*!
AnnaBridge 145:64910690c574 77 * @name eDMA transactional
AnnaBridge 145:64910690c574 78 * @{
AnnaBridge 145:64910690c574 79 */
AnnaBridge 145:64910690c574 80
AnnaBridge 145:64910690c574 81 /*!
AnnaBridge 145:64910690c574 82 * @brief Initializes the camera handle, which is used in transactional functions.
AnnaBridge 145:64910690c574 83 *
AnnaBridge 145:64910690c574 84 * @param base pointer to FLEXIO_CAMERA_Type.
AnnaBridge 145:64910690c574 85 * @param handle Pointer to flexio_camera_edma_handle_t structure.
AnnaBridge 145:64910690c574 86 * @param callback The callback function.
AnnaBridge 145:64910690c574 87 * @param userData The parameter of the callback function.
AnnaBridge 145:64910690c574 88 * @param rxEdmaHandle User requested DMA handle for RX DMA transfer.
AnnaBridge 145:64910690c574 89 * @retval kStatus_Success Successfully create the handle.
AnnaBridge 145:64910690c574 90 * @retval kStatus_OutOfRange The FlexIO camera eDMA type/handle table out of range.
AnnaBridge 145:64910690c574 91 */
AnnaBridge 145:64910690c574 92 status_t FLEXIO_CAMERA_TransferCreateHandleEDMA(FLEXIO_CAMERA_Type *base,
AnnaBridge 145:64910690c574 93 flexio_camera_edma_handle_t *handle,
AnnaBridge 145:64910690c574 94 flexio_camera_edma_transfer_callback_t callback,
AnnaBridge 145:64910690c574 95 void *userData,
AnnaBridge 145:64910690c574 96 edma_handle_t *rxEdmaHandle);
AnnaBridge 145:64910690c574 97
AnnaBridge 145:64910690c574 98 /*!
AnnaBridge 145:64910690c574 99 * @brief Receives data using eDMA.
AnnaBridge 145:64910690c574 100 *
AnnaBridge 145:64910690c574 101 * This function receives data using eDMA. This is a non-blocking function, which returns
AnnaBridge 145:64910690c574 102 * right away. When all data is received, the receive callback function is called.
AnnaBridge 145:64910690c574 103 *
AnnaBridge 145:64910690c574 104 * @param base Pointer to the FLEXIO_CAMERA_Type.
AnnaBridge 145:64910690c574 105 * @param handle Pointer to the flexio_camera_edma_handle_t structure.
AnnaBridge 145:64910690c574 106 * @param xfer CAMERA eDMA transfer structure, see #flexio_camera_transfer_t.
AnnaBridge 145:64910690c574 107 * @retval kStatus_Success if succeeded, others failed.
AnnaBridge 145:64910690c574 108 * @retval kStatus_CAMERA_RxBusy Previous transfer on going.
AnnaBridge 145:64910690c574 109 */
AnnaBridge 145:64910690c574 110 status_t FLEXIO_CAMERA_TransferReceiveEDMA(FLEXIO_CAMERA_Type *base,
AnnaBridge 145:64910690c574 111 flexio_camera_edma_handle_t *handle,
AnnaBridge 145:64910690c574 112 flexio_camera_transfer_t *xfer);
AnnaBridge 145:64910690c574 113
AnnaBridge 145:64910690c574 114 /*!
AnnaBridge 145:64910690c574 115 * @brief Aborts the receive data which used the eDMA.
AnnaBridge 145:64910690c574 116 *
AnnaBridge 145:64910690c574 117 * This function aborts the receive data which used the eDMA.
AnnaBridge 145:64910690c574 118 *
AnnaBridge 145:64910690c574 119 * @param base Pointer to the FLEXIO_CAMERA_Type.
AnnaBridge 145:64910690c574 120 * @param handle Pointer to the flexio_camera_edma_handle_t structure.
AnnaBridge 145:64910690c574 121 */
AnnaBridge 145:64910690c574 122 void FLEXIO_CAMERA_TransferAbortReceiveEDMA(FLEXIO_CAMERA_Type *base, flexio_camera_edma_handle_t *handle);
AnnaBridge 145:64910690c574 123
AnnaBridge 145:64910690c574 124 /*!
AnnaBridge 145:64910690c574 125 * @brief Gets the remaining bytes to be received.
AnnaBridge 145:64910690c574 126 *
AnnaBridge 145:64910690c574 127 * This function gets the number of bytes still not received.
AnnaBridge 145:64910690c574 128 *
AnnaBridge 145:64910690c574 129 * @param base Pointer to the FLEXIO_CAMERA_Type.
AnnaBridge 145:64910690c574 130 * @param handle Pointer to the flexio_camera_edma_handle_t structure.
AnnaBridge 145:64910690c574 131 * @param count Number of bytes sent so far by the non-blocking transaction.
AnnaBridge 145:64910690c574 132 * @retval kStatus_Success Succeed get the transfer count.
AnnaBridge 145:64910690c574 133 * @retval kStatus_InvalidArgument The count parameter is invalid.
AnnaBridge 145:64910690c574 134 */
AnnaBridge 145:64910690c574 135 status_t FLEXIO_CAMERA_TransferGetReceiveCountEDMA(FLEXIO_CAMERA_Type *base,
AnnaBridge 145:64910690c574 136 flexio_camera_edma_handle_t *handle,
AnnaBridge 145:64910690c574 137 size_t *count);
AnnaBridge 145:64910690c574 138
AnnaBridge 145:64910690c574 139 /*@}*/
AnnaBridge 145:64910690c574 140
AnnaBridge 145:64910690c574 141 #if defined(__cplusplus)
AnnaBridge 145:64910690c574 142 }
AnnaBridge 145:64910690c574 143 #endif
AnnaBridge 145:64910690c574 144
AnnaBridge 145:64910690c574 145 /*! @}*/
AnnaBridge 145:64910690c574 146
AnnaBridge 145:64910690c574 147 #endif /* _FSL_CAMERA_EDMA_H_ */