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
AnnaBridge 145:64910690c574 31 #ifndef _FSL_DMAMUX_H_
AnnaBridge 145:64910690c574 32 #define _FSL_DMAMUX_H_
AnnaBridge 145:64910690c574 33
AnnaBridge 145:64910690c574 34 #include "fsl_common.h"
AnnaBridge 145:64910690c574 35
AnnaBridge 145:64910690c574 36 /*!
AnnaBridge 145:64910690c574 37 * @addtogroup dmamux
AnnaBridge 145:64910690c574 38 * @{
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 /*! @name Driver version */
AnnaBridge 145:64910690c574 47 /*@{*/
AnnaBridge 145:64910690c574 48 /*! @brief DMAMUX driver version 2.0.2. */
AnnaBridge 145:64910690c574 49 #define FSL_DMAMUX_DRIVER_VERSION (MAKE_VERSION(2, 0, 2))
AnnaBridge 145:64910690c574 50 /*@}*/
AnnaBridge 145:64910690c574 51
AnnaBridge 145:64910690c574 52 /*******************************************************************************
AnnaBridge 145:64910690c574 53 * API
AnnaBridge 145:64910690c574 54 ******************************************************************************/
AnnaBridge 145:64910690c574 55
AnnaBridge 145:64910690c574 56 #if defined(__cplusplus)
AnnaBridge 145:64910690c574 57 extern "C" {
AnnaBridge 145:64910690c574 58 #endif /* __cplusplus */
AnnaBridge 145:64910690c574 59
AnnaBridge 145:64910690c574 60 /*!
AnnaBridge 145:64910690c574 61 * @name DMAMUX Initialization and de-initialization
AnnaBridge 145:64910690c574 62 * @{
AnnaBridge 145:64910690c574 63 */
AnnaBridge 145:64910690c574 64
AnnaBridge 145:64910690c574 65 /*!
AnnaBridge 145:64910690c574 66 * @brief Initializes the DMAMUX peripheral.
AnnaBridge 145:64910690c574 67 *
AnnaBridge 145:64910690c574 68 * This function ungates the DMAMUX clock.
AnnaBridge 145:64910690c574 69 *
AnnaBridge 145:64910690c574 70 * @param base DMAMUX peripheral base address.
AnnaBridge 145:64910690c574 71 *
AnnaBridge 145:64910690c574 72 */
AnnaBridge 145:64910690c574 73 void DMAMUX_Init(DMAMUX_Type *base);
AnnaBridge 145:64910690c574 74
AnnaBridge 145:64910690c574 75 /*!
AnnaBridge 145:64910690c574 76 * @brief Deinitializes the DMAMUX peripheral.
AnnaBridge 145:64910690c574 77 *
AnnaBridge 145:64910690c574 78 * This function gates the DMAMUX clock.
AnnaBridge 145:64910690c574 79 *
AnnaBridge 145:64910690c574 80 * @param base DMAMUX peripheral base address.
AnnaBridge 145:64910690c574 81 */
AnnaBridge 145:64910690c574 82 void DMAMUX_Deinit(DMAMUX_Type *base);
AnnaBridge 145:64910690c574 83
AnnaBridge 145:64910690c574 84 /* @} */
AnnaBridge 145:64910690c574 85 /*!
AnnaBridge 145:64910690c574 86 * @name DMAMUX Channel Operation
AnnaBridge 145:64910690c574 87 * @{
AnnaBridge 145:64910690c574 88 */
AnnaBridge 145:64910690c574 89
AnnaBridge 145:64910690c574 90 /*!
AnnaBridge 145:64910690c574 91 * @brief Enables the DMAMUX channel.
AnnaBridge 145:64910690c574 92 *
AnnaBridge 145:64910690c574 93 * This function enables the DMAMUX channel.
AnnaBridge 145:64910690c574 94 *
AnnaBridge 145:64910690c574 95 * @param base DMAMUX peripheral base address.
AnnaBridge 145:64910690c574 96 * @param channel DMAMUX channel number.
AnnaBridge 145:64910690c574 97 */
AnnaBridge 145:64910690c574 98 static inline void DMAMUX_EnableChannel(DMAMUX_Type *base, uint32_t channel)
AnnaBridge 145:64910690c574 99 {
AnnaBridge 145:64910690c574 100 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
AnnaBridge 145:64910690c574 101
AnnaBridge 145:64910690c574 102 base->CHCFG[channel] |= DMAMUX_CHCFG_ENBL_MASK;
AnnaBridge 145:64910690c574 103 }
AnnaBridge 145:64910690c574 104
AnnaBridge 145:64910690c574 105 /*!
AnnaBridge 145:64910690c574 106 * @brief Disables the DMAMUX channel.
AnnaBridge 145:64910690c574 107 *
AnnaBridge 145:64910690c574 108 * This function disables the DMAMUX channel.
AnnaBridge 145:64910690c574 109 *
AnnaBridge 145:64910690c574 110 * @note The user must disable the DMAMUX channel before configuring it.
AnnaBridge 145:64910690c574 111 * @param base DMAMUX peripheral base address.
AnnaBridge 145:64910690c574 112 * @param channel DMAMUX channel number.
AnnaBridge 145:64910690c574 113 */
AnnaBridge 145:64910690c574 114 static inline void DMAMUX_DisableChannel(DMAMUX_Type *base, uint32_t channel)
AnnaBridge 145:64910690c574 115 {
AnnaBridge 145:64910690c574 116 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
AnnaBridge 145:64910690c574 117
AnnaBridge 145:64910690c574 118 base->CHCFG[channel] &= ~DMAMUX_CHCFG_ENBL_MASK;
AnnaBridge 145:64910690c574 119 }
AnnaBridge 145:64910690c574 120
AnnaBridge 145:64910690c574 121 /*!
AnnaBridge 145:64910690c574 122 * @brief Configures the DMAMUX channel source.
AnnaBridge 145:64910690c574 123 *
AnnaBridge 145:64910690c574 124 * @param base DMAMUX peripheral base address.
AnnaBridge 145:64910690c574 125 * @param channel DMAMUX channel number.
AnnaBridge 145:64910690c574 126 * @param source Channel source, which is used to trigger the DMA transfer.
AnnaBridge 145:64910690c574 127 */
AnnaBridge 145:64910690c574 128 static inline void DMAMUX_SetSource(DMAMUX_Type *base, uint32_t channel, uint32_t source)
AnnaBridge 145:64910690c574 129 {
AnnaBridge 145:64910690c574 130 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
AnnaBridge 145:64910690c574 131
AnnaBridge 145:64910690c574 132 base->CHCFG[channel] = ((base->CHCFG[channel] & ~DMAMUX_CHCFG_SOURCE_MASK) | DMAMUX_CHCFG_SOURCE(source));
AnnaBridge 145:64910690c574 133 }
AnnaBridge 145:64910690c574 134
AnnaBridge 145:64910690c574 135 #if defined(FSL_FEATURE_DMAMUX_HAS_TRIG) && FSL_FEATURE_DMAMUX_HAS_TRIG > 0U
AnnaBridge 145:64910690c574 136 /*!
AnnaBridge 145:64910690c574 137 * @brief Enables the DMAMUX period trigger.
AnnaBridge 145:64910690c574 138 *
AnnaBridge 145:64910690c574 139 * This function enables the DMAMUX period trigger feature.
AnnaBridge 145:64910690c574 140 *
AnnaBridge 145:64910690c574 141 * @param base DMAMUX peripheral base address.
AnnaBridge 145:64910690c574 142 * @param channel DMAMUX channel number.
AnnaBridge 145:64910690c574 143 */
AnnaBridge 145:64910690c574 144 static inline void DMAMUX_EnablePeriodTrigger(DMAMUX_Type *base, uint32_t channel)
AnnaBridge 145:64910690c574 145 {
AnnaBridge 145:64910690c574 146 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
AnnaBridge 145:64910690c574 147
AnnaBridge 145:64910690c574 148 base->CHCFG[channel] |= DMAMUX_CHCFG_TRIG_MASK;
AnnaBridge 145:64910690c574 149 }
AnnaBridge 145:64910690c574 150
AnnaBridge 145:64910690c574 151 /*!
AnnaBridge 145:64910690c574 152 * @brief Disables the DMAMUX period trigger.
AnnaBridge 145:64910690c574 153 *
AnnaBridge 145:64910690c574 154 * This function disables the DMAMUX period trigger.
AnnaBridge 145:64910690c574 155 *
AnnaBridge 145:64910690c574 156 * @param base DMAMUX peripheral base address.
AnnaBridge 145:64910690c574 157 * @param channel DMAMUX channel number.
AnnaBridge 145:64910690c574 158 */
AnnaBridge 145:64910690c574 159 static inline void DMAMUX_DisablePeriodTrigger(DMAMUX_Type *base, uint32_t channel)
AnnaBridge 145:64910690c574 160 {
AnnaBridge 145:64910690c574 161 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
AnnaBridge 145:64910690c574 162
AnnaBridge 145:64910690c574 163 base->CHCFG[channel] &= ~DMAMUX_CHCFG_TRIG_MASK;
AnnaBridge 145:64910690c574 164 }
AnnaBridge 145:64910690c574 165 #endif /* FSL_FEATURE_DMAMUX_HAS_TRIG */
AnnaBridge 145:64910690c574 166
AnnaBridge 145:64910690c574 167 #if (defined(FSL_FEATURE_DMAMUX_HAS_A_ON) && FSL_FEATURE_DMAMUX_HAS_A_ON)
AnnaBridge 145:64910690c574 168 /*!
AnnaBridge 145:64910690c574 169 * @brief Enables the DMA channel to be always ON.
AnnaBridge 145:64910690c574 170 *
AnnaBridge 145:64910690c574 171 * This function enables the DMAMUX channel always ON feature.
AnnaBridge 145:64910690c574 172 *
AnnaBridge 145:64910690c574 173 * @param base DMAMUX peripheral base address.
AnnaBridge 145:64910690c574 174 * @param channel DMAMUX channel number.
AnnaBridge 145:64910690c574 175 * @param enable Switcher of the always ON feature. "true" means enabled, "false" means disabled.
AnnaBridge 145:64910690c574 176 */
AnnaBridge 145:64910690c574 177 static inline void DMAMUX_EnableAlwaysOn(DMAMUX_Type *base, uint32_t channel, bool enable)
AnnaBridge 145:64910690c574 178 {
AnnaBridge 145:64910690c574 179 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
AnnaBridge 145:64910690c574 180
AnnaBridge 145:64910690c574 181 if (enable)
AnnaBridge 145:64910690c574 182 {
AnnaBridge 145:64910690c574 183 base->CHCFG[channel] |= DMAMUX_CHCFG_A_ON_MASK;
AnnaBridge 145:64910690c574 184 }
AnnaBridge 145:64910690c574 185 else
AnnaBridge 145:64910690c574 186 {
AnnaBridge 145:64910690c574 187 base->CHCFG[channel] &= ~DMAMUX_CHCFG_A_ON_MASK;
AnnaBridge 145:64910690c574 188 }
AnnaBridge 145:64910690c574 189 }
AnnaBridge 145:64910690c574 190 #endif /* FSL_FEATURE_DMAMUX_HAS_A_ON */
AnnaBridge 145:64910690c574 191
AnnaBridge 145:64910690c574 192 /* @} */
AnnaBridge 145:64910690c574 193
AnnaBridge 145:64910690c574 194 #if defined(__cplusplus)
AnnaBridge 145:64910690c574 195 }
AnnaBridge 145:64910690c574 196 #endif /* __cplusplus */
AnnaBridge 145:64910690c574 197
AnnaBridge 145:64910690c574 198 /* @} */
AnnaBridge 145:64910690c574 199
AnnaBridge 145:64910690c574 200 #endif /* _FSL_DMAMUX_H_ */