Ben Katz / mbed-dev-f303

Dependents:   Hobbyking_Cheetah_Compact Hobbyking_Cheetah_Compact_DRV8323_14bit Hobbyking_Cheetah_Compact_DRV8323_V51_201907 HKC_MiniCheetah ... more

Fork of mbed-dev by mbed official

Committer:
benkatz
Date:
Mon Jul 30 20:31:44 2018 +0000
Revision:
181:36facd806e4a
Parent:
154:37f96f9d4de2
going on the robot.  fixed a dumb bug in float_to_uint

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 154:37f96f9d4de2 1 /*
<> 154:37f96f9d4de2 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
<> 154:37f96f9d4de2 3 * All rights reserved.
<> 154:37f96f9d4de2 4 *
<> 154:37f96f9d4de2 5 * Redistribution and use in source and binary forms, with or without modification,
<> 154:37f96f9d4de2 6 * are permitted provided that the following conditions are met:
<> 154:37f96f9d4de2 7 *
<> 154:37f96f9d4de2 8 * o Redistributions of source code must retain the above copyright notice, this list
<> 154:37f96f9d4de2 9 * of conditions and the following disclaimer.
<> 154:37f96f9d4de2 10 *
<> 154:37f96f9d4de2 11 * o Redistributions in binary form must reproduce the above copyright notice, this
<> 154:37f96f9d4de2 12 * list of conditions and the following disclaimer in the documentation and/or
<> 154:37f96f9d4de2 13 * other materials provided with the distribution.
<> 154:37f96f9d4de2 14 *
<> 154:37f96f9d4de2 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
<> 154:37f96f9d4de2 16 * contributors may be used to endorse or promote products derived from this
<> 154:37f96f9d4de2 17 * software without specific prior written permission.
<> 154:37f96f9d4de2 18 *
<> 154:37f96f9d4de2 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
<> 154:37f96f9d4de2 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
<> 154:37f96f9d4de2 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 154:37f96f9d4de2 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
<> 154:37f96f9d4de2 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
<> 154:37f96f9d4de2 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
<> 154:37f96f9d4de2 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
<> 154:37f96f9d4de2 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
<> 154:37f96f9d4de2 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
<> 154:37f96f9d4de2 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 154:37f96f9d4de2 29 */
<> 154:37f96f9d4de2 30 #ifndef _FSL_LPUART_EDMA_H_
<> 154:37f96f9d4de2 31 #define _FSL_LPUART_EDMA_H_
<> 154:37f96f9d4de2 32
<> 154:37f96f9d4de2 33 #include "fsl_lpuart.h"
<> 154:37f96f9d4de2 34 #include "fsl_dmamux.h"
<> 154:37f96f9d4de2 35 #include "fsl_edma.h"
<> 154:37f96f9d4de2 36
<> 154:37f96f9d4de2 37 /*!
<> 154:37f96f9d4de2 38 * @addtogroup lpuart_edma_driver
<> 154:37f96f9d4de2 39 * @{
<> 154:37f96f9d4de2 40 */
<> 154:37f96f9d4de2 41
<> 154:37f96f9d4de2 42 /*******************************************************************************
<> 154:37f96f9d4de2 43 * Definitions
<> 154:37f96f9d4de2 44 ******************************************************************************/
<> 154:37f96f9d4de2 45
<> 154:37f96f9d4de2 46 /* Forward declaration of the handle typedef. */
<> 154:37f96f9d4de2 47 typedef struct _lpuart_edma_handle lpuart_edma_handle_t;
<> 154:37f96f9d4de2 48
<> 154:37f96f9d4de2 49 /*! @brief LPUART transfer callback function. */
<> 154:37f96f9d4de2 50 typedef void (*lpuart_edma_transfer_callback_t)(LPUART_Type *base,
<> 154:37f96f9d4de2 51 lpuart_edma_handle_t *handle,
<> 154:37f96f9d4de2 52 status_t status,
<> 154:37f96f9d4de2 53 void *userData);
<> 154:37f96f9d4de2 54
<> 154:37f96f9d4de2 55 /*!
<> 154:37f96f9d4de2 56 * @brief LPUART eDMA handle
<> 154:37f96f9d4de2 57 */
<> 154:37f96f9d4de2 58 struct _lpuart_edma_handle
<> 154:37f96f9d4de2 59 {
<> 154:37f96f9d4de2 60 lpuart_edma_transfer_callback_t callback; /*!< Callback function. */
<> 154:37f96f9d4de2 61 void *userData; /*!< LPUART callback function parameter.*/
<> 154:37f96f9d4de2 62 size_t rxDataSizeAll; /*!< Size of the data to receive. */
<> 154:37f96f9d4de2 63 size_t txDataSizeAll; /*!< Size of the data to send out. */
<> 154:37f96f9d4de2 64
<> 154:37f96f9d4de2 65 edma_handle_t *txEdmaHandle; /*!< The eDMA TX channel used. */
<> 154:37f96f9d4de2 66 edma_handle_t *rxEdmaHandle; /*!< The eDMA RX channel used. */
<> 154:37f96f9d4de2 67
<> 154:37f96f9d4de2 68 uint8_t nbytes; /*!< eDMA minor byte transfer count initially configured. */
<> 154:37f96f9d4de2 69
<> 154:37f96f9d4de2 70 volatile uint8_t txState; /*!< TX transfer state. */
<> 154:37f96f9d4de2 71 volatile uint8_t rxState; /*!< RX transfer state */
<> 154:37f96f9d4de2 72 };
<> 154:37f96f9d4de2 73
<> 154:37f96f9d4de2 74 /*******************************************************************************
<> 154:37f96f9d4de2 75 * API
<> 154:37f96f9d4de2 76 ******************************************************************************/
<> 154:37f96f9d4de2 77
<> 154:37f96f9d4de2 78 #if defined(__cplusplus)
<> 154:37f96f9d4de2 79 extern "C" {
<> 154:37f96f9d4de2 80 #endif
<> 154:37f96f9d4de2 81
<> 154:37f96f9d4de2 82 /*!
<> 154:37f96f9d4de2 83 * @name eDMA transactional
<> 154:37f96f9d4de2 84 * @{
<> 154:37f96f9d4de2 85 */
<> 154:37f96f9d4de2 86
<> 154:37f96f9d4de2 87 /*!
<> 154:37f96f9d4de2 88 * @brief Initializes the LPUART handle which is used in transactional functions.
<> 154:37f96f9d4de2 89 * @param base LPUART peripheral base address.
<> 154:37f96f9d4de2 90 * @param handle Pointer to lpuart_edma_handle_t structure.
<> 154:37f96f9d4de2 91 * @param callback Callback function.
<> 154:37f96f9d4de2 92 * @param userData User data.
<> 154:37f96f9d4de2 93 * @param txEdmaHandle User requested DMA handle for TX DMA transfer.
<> 154:37f96f9d4de2 94 * @param rxEdmaHandle User requested DMA handle for RX DMA transfer.
<> 154:37f96f9d4de2 95 */
<> 154:37f96f9d4de2 96 void LPUART_TransferCreateHandleEDMA(LPUART_Type *base,
<> 154:37f96f9d4de2 97 lpuart_edma_handle_t *handle,
<> 154:37f96f9d4de2 98 lpuart_edma_transfer_callback_t callback,
<> 154:37f96f9d4de2 99 void *userData,
<> 154:37f96f9d4de2 100 edma_handle_t *txEdmaHandle,
<> 154:37f96f9d4de2 101 edma_handle_t *rxEdmaHandle);
<> 154:37f96f9d4de2 102
<> 154:37f96f9d4de2 103 /*!
<> 154:37f96f9d4de2 104 * @brief Sends data using eDMA.
<> 154:37f96f9d4de2 105 *
<> 154:37f96f9d4de2 106 * This function sends data using eDMA. This is a non-blocking function, which returns
<> 154:37f96f9d4de2 107 * right away. When all data is sent, the send callback function is called.
<> 154:37f96f9d4de2 108 *
<> 154:37f96f9d4de2 109 * @param base LPUART peripheral base address.
<> 154:37f96f9d4de2 110 * @param handle LPUART handle pointer.
<> 154:37f96f9d4de2 111 * @param xfer LPUART eDMA transfer structure. See #lpuart_transfer_t.
<> 154:37f96f9d4de2 112 * @retval kStatus_Success if succeed, others failed.
<> 154:37f96f9d4de2 113 * @retval kStatus_LPUART_TxBusy Previous transfer on going.
<> 154:37f96f9d4de2 114 * @retval kStatus_InvalidArgument Invalid argument.
<> 154:37f96f9d4de2 115 */
<> 154:37f96f9d4de2 116 status_t LPUART_SendEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, lpuart_transfer_t *xfer);
<> 154:37f96f9d4de2 117
<> 154:37f96f9d4de2 118 /*!
<> 154:37f96f9d4de2 119 * @brief Receives data using eDMA.
<> 154:37f96f9d4de2 120 *
<> 154:37f96f9d4de2 121 * This function receives data using eDMA. This is non-blocking function, which returns
<> 154:37f96f9d4de2 122 * right away. When all data is received, the receive callback function is called.
<> 154:37f96f9d4de2 123 *
<> 154:37f96f9d4de2 124 * @param base LPUART peripheral base address.
<> 154:37f96f9d4de2 125 * @param handle Pointer to lpuart_edma_handle_t structure.
<> 154:37f96f9d4de2 126 * @param xfer LPUART eDMA transfer structure, see #lpuart_transfer_t.
<> 154:37f96f9d4de2 127 * @retval kStatus_Success if succeed, others fail.
<> 154:37f96f9d4de2 128 * @retval kStatus_LPUART_RxBusy Previous transfer ongoing.
<> 154:37f96f9d4de2 129 * @retval kStatus_InvalidArgument Invalid argument.
<> 154:37f96f9d4de2 130 */
<> 154:37f96f9d4de2 131 status_t LPUART_ReceiveEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, lpuart_transfer_t *xfer);
<> 154:37f96f9d4de2 132
<> 154:37f96f9d4de2 133 /*!
<> 154:37f96f9d4de2 134 * @brief Aborts the sent data using eDMA.
<> 154:37f96f9d4de2 135 *
<> 154:37f96f9d4de2 136 * This function aborts the sent data using eDMA.
<> 154:37f96f9d4de2 137 *
<> 154:37f96f9d4de2 138 * @param base LPUART peripheral base address.
<> 154:37f96f9d4de2 139 * @param handle Pointer to lpuart_edma_handle_t structure.
<> 154:37f96f9d4de2 140 */
<> 154:37f96f9d4de2 141 void LPUART_TransferAbortSendEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle);
<> 154:37f96f9d4de2 142
<> 154:37f96f9d4de2 143 /*!
<> 154:37f96f9d4de2 144 * @brief Aborts the received data using eDMA.
<> 154:37f96f9d4de2 145 *
<> 154:37f96f9d4de2 146 * This function aborts the received data using eDMA.
<> 154:37f96f9d4de2 147 *
<> 154:37f96f9d4de2 148 * @param base LPUART peripheral base address.
<> 154:37f96f9d4de2 149 * @param handle Pointer to lpuart_edma_handle_t structure.
<> 154:37f96f9d4de2 150 */
<> 154:37f96f9d4de2 151 void LPUART_TransferAbortReceiveEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle);
<> 154:37f96f9d4de2 152
<> 154:37f96f9d4de2 153 /*!
<> 154:37f96f9d4de2 154 * @brief Gets the number of bytes written to the LPUART TX register.
<> 154:37f96f9d4de2 155 *
<> 154:37f96f9d4de2 156 * This function gets the number of bytes written to the LPUART TX
<> 154:37f96f9d4de2 157 * register by DMA.
<> 154:37f96f9d4de2 158 *
<> 154:37f96f9d4de2 159 * @param base LPUART peripheral base address.
<> 154:37f96f9d4de2 160 * @param handle LPUART handle pointer.
<> 154:37f96f9d4de2 161 * @param count Send bytes count.
<> 154:37f96f9d4de2 162 * @retval kStatus_NoTransferInProgress No send in progress.
<> 154:37f96f9d4de2 163 * @retval kStatus_InvalidArgument Parameter is invalid.
<> 154:37f96f9d4de2 164 * @retval kStatus_Success Get successfully through the parameter \p count;
<> 154:37f96f9d4de2 165 */
<> 154:37f96f9d4de2 166 status_t LPUART_TransferGetSendCountEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, uint32_t *count);
<> 154:37f96f9d4de2 167
<> 154:37f96f9d4de2 168 /*!
<> 154:37f96f9d4de2 169 * @brief Gets the number of received bytes.
<> 154:37f96f9d4de2 170 *
<> 154:37f96f9d4de2 171 * This function gets the number of received bytes.
<> 154:37f96f9d4de2 172 *
<> 154:37f96f9d4de2 173 * @param base LPUART peripheral base address.
<> 154:37f96f9d4de2 174 * @param handle LPUART handle pointer.
<> 154:37f96f9d4de2 175 * @param count Receive bytes count.
<> 154:37f96f9d4de2 176 * @retval kStatus_NoTransferInProgress No receive in progress.
<> 154:37f96f9d4de2 177 * @retval kStatus_InvalidArgument Parameter is invalid.
<> 154:37f96f9d4de2 178 * @retval kStatus_Success Get successfully through the parameter \p count;
<> 154:37f96f9d4de2 179 */
<> 154:37f96f9d4de2 180 status_t LPUART_TransferGetReceiveCountEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, uint32_t *count);
<> 154:37f96f9d4de2 181
<> 154:37f96f9d4de2 182 /*@}*/
<> 154:37f96f9d4de2 183
<> 154:37f96f9d4de2 184 #if defined(__cplusplus)
<> 154:37f96f9d4de2 185 }
<> 154:37f96f9d4de2 186 #endif
<> 154:37f96f9d4de2 187
<> 154:37f96f9d4de2 188 /*! @}*/
<> 154:37f96f9d4de2 189
<> 154:37f96f9d4de2 190 #endif /* _FSL_LPUART_EDMA_H_ */