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 171:3a7713b1edbc 1 /*
AnnaBridge 171:3a7713b1edbc 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
AnnaBridge 171:3a7713b1edbc 3 * All rights reserved.
AnnaBridge 171:3a7713b1edbc 4 *
AnnaBridge 171:3a7713b1edbc 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 171:3a7713b1edbc 6 * are permitted provided that the following conditions are met:
AnnaBridge 171:3a7713b1edbc 7 *
AnnaBridge 171:3a7713b1edbc 8 * o Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 171:3a7713b1edbc 9 * of conditions and the following disclaimer.
AnnaBridge 171:3a7713b1edbc 10 *
AnnaBridge 171:3a7713b1edbc 11 * o Redistributions in binary form must reproduce the above copyright notice, this
AnnaBridge 171:3a7713b1edbc 12 * list of conditions and the following disclaimer in the documentation and/or
AnnaBridge 171:3a7713b1edbc 13 * other materials provided with the distribution.
AnnaBridge 171:3a7713b1edbc 14 *
AnnaBridge 171:3a7713b1edbc 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
AnnaBridge 171:3a7713b1edbc 16 * contributors may be used to endorse or promote products derived from this
AnnaBridge 171:3a7713b1edbc 17 * software without specific prior written permission.
AnnaBridge 171:3a7713b1edbc 18 *
AnnaBridge 171:3a7713b1edbc 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 171:3a7713b1edbc 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 171:3a7713b1edbc 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 171:3a7713b1edbc 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 171:3a7713b1edbc 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 171:3a7713b1edbc 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 171:3a7713b1edbc 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 171:3a7713b1edbc 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 171:3a7713b1edbc 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 171:3a7713b1edbc 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 171:3a7713b1edbc 29 */
AnnaBridge 171:3a7713b1edbc 30
AnnaBridge 171:3a7713b1edbc 31 #ifndef _FSL_DMAMUX_H_
AnnaBridge 171:3a7713b1edbc 32 #define _FSL_DMAMUX_H_
AnnaBridge 171:3a7713b1edbc 33
AnnaBridge 171:3a7713b1edbc 34 #include "fsl_common.h"
AnnaBridge 171:3a7713b1edbc 35
AnnaBridge 171:3a7713b1edbc 36 /*!
AnnaBridge 171:3a7713b1edbc 37 * @addtogroup dmamux
AnnaBridge 171:3a7713b1edbc 38 * @{
AnnaBridge 171:3a7713b1edbc 39 */
AnnaBridge 171:3a7713b1edbc 40
AnnaBridge 171:3a7713b1edbc 41 /*! @file */
AnnaBridge 171:3a7713b1edbc 42
AnnaBridge 171:3a7713b1edbc 43 /*******************************************************************************
AnnaBridge 171:3a7713b1edbc 44 * Definitions
AnnaBridge 171:3a7713b1edbc 45 ******************************************************************************/
AnnaBridge 171:3a7713b1edbc 46
AnnaBridge 171:3a7713b1edbc 47 /*! @name Driver version */
AnnaBridge 171:3a7713b1edbc 48 /*@{*/
AnnaBridge 171:3a7713b1edbc 49 /*! @brief DMAMUX driver version 2.0.0. */
AnnaBridge 171:3a7713b1edbc 50 #define FSL_DMAMUX_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))
AnnaBridge 171:3a7713b1edbc 51 /*@}*/
AnnaBridge 171:3a7713b1edbc 52
AnnaBridge 171:3a7713b1edbc 53 /*******************************************************************************
AnnaBridge 171:3a7713b1edbc 54 * API
AnnaBridge 171:3a7713b1edbc 55 ******************************************************************************/
AnnaBridge 171:3a7713b1edbc 56
AnnaBridge 171:3a7713b1edbc 57 #if defined(__cplusplus)
AnnaBridge 171:3a7713b1edbc 58 extern "C" {
AnnaBridge 171:3a7713b1edbc 59 #endif /* __cplusplus */
AnnaBridge 171:3a7713b1edbc 60
AnnaBridge 171:3a7713b1edbc 61 /*!
AnnaBridge 171:3a7713b1edbc 62 * @name DMAMUX Initialize and De-initialize
AnnaBridge 171:3a7713b1edbc 63 * @{
AnnaBridge 171:3a7713b1edbc 64 */
AnnaBridge 171:3a7713b1edbc 65
AnnaBridge 171:3a7713b1edbc 66 /*!
AnnaBridge 171:3a7713b1edbc 67 * @brief Initializes DMAMUX peripheral.
AnnaBridge 171:3a7713b1edbc 68 *
AnnaBridge 171:3a7713b1edbc 69 * This function ungate the DMAMUX clock.
AnnaBridge 171:3a7713b1edbc 70 *
AnnaBridge 171:3a7713b1edbc 71 * @param base DMAMUX peripheral base address.
AnnaBridge 171:3a7713b1edbc 72 *
AnnaBridge 171:3a7713b1edbc 73 */
AnnaBridge 171:3a7713b1edbc 74 void DMAMUX_Init(DMAMUX_Type *base);
AnnaBridge 171:3a7713b1edbc 75
AnnaBridge 171:3a7713b1edbc 76 /*!
AnnaBridge 171:3a7713b1edbc 77 * @brief Deinitializes DMAMUX peripheral.
AnnaBridge 171:3a7713b1edbc 78 *
AnnaBridge 171:3a7713b1edbc 79 * This function gate the DMAMUX clock.
AnnaBridge 171:3a7713b1edbc 80 *
AnnaBridge 171:3a7713b1edbc 81 * @param base DMAMUX peripheral base address.
AnnaBridge 171:3a7713b1edbc 82 */
AnnaBridge 171:3a7713b1edbc 83 void DMAMUX_Deinit(DMAMUX_Type *base);
AnnaBridge 171:3a7713b1edbc 84
AnnaBridge 171:3a7713b1edbc 85 /* @} */
AnnaBridge 171:3a7713b1edbc 86 /*!
AnnaBridge 171:3a7713b1edbc 87 * @name DMAMUX Channel Operation
AnnaBridge 171:3a7713b1edbc 88 * @{
AnnaBridge 171:3a7713b1edbc 89 */
AnnaBridge 171:3a7713b1edbc 90
AnnaBridge 171:3a7713b1edbc 91 /*!
AnnaBridge 171:3a7713b1edbc 92 * @brief Enable DMAMUX channel.
AnnaBridge 171:3a7713b1edbc 93 *
AnnaBridge 171:3a7713b1edbc 94 * This function enable DMAMUX channel to work.
AnnaBridge 171:3a7713b1edbc 95 *
AnnaBridge 171:3a7713b1edbc 96 * @param base DMAMUX peripheral base address.
AnnaBridge 171:3a7713b1edbc 97 * @param channel DMAMUX channel number.
AnnaBridge 171:3a7713b1edbc 98 */
AnnaBridge 171:3a7713b1edbc 99 static inline void DMAMUX_EnableChannel(DMAMUX_Type *base, uint32_t channel)
AnnaBridge 171:3a7713b1edbc 100 {
AnnaBridge 171:3a7713b1edbc 101 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
AnnaBridge 171:3a7713b1edbc 102
AnnaBridge 171:3a7713b1edbc 103 base->CHCFG[channel] |= DMAMUX_CHCFG_ENBL_MASK;
AnnaBridge 171:3a7713b1edbc 104 }
AnnaBridge 171:3a7713b1edbc 105
AnnaBridge 171:3a7713b1edbc 106 /*!
AnnaBridge 171:3a7713b1edbc 107 * @brief Disable DMAMUX channel.
AnnaBridge 171:3a7713b1edbc 108 *
AnnaBridge 171:3a7713b1edbc 109 * This function disable DMAMUX channel.
AnnaBridge 171:3a7713b1edbc 110 *
AnnaBridge 171:3a7713b1edbc 111 * @note User must disable DMAMUX channel before configure it.
AnnaBridge 171:3a7713b1edbc 112 * @param base DMAMUX peripheral base address.
AnnaBridge 171:3a7713b1edbc 113 * @param channel DMAMUX channel number.
AnnaBridge 171:3a7713b1edbc 114 */
AnnaBridge 171:3a7713b1edbc 115 static inline void DMAMUX_DisableChannel(DMAMUX_Type *base, uint32_t channel)
AnnaBridge 171:3a7713b1edbc 116 {
AnnaBridge 171:3a7713b1edbc 117 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
AnnaBridge 171:3a7713b1edbc 118
AnnaBridge 171:3a7713b1edbc 119 base->CHCFG[channel] &= ~DMAMUX_CHCFG_ENBL_MASK;
AnnaBridge 171:3a7713b1edbc 120 }
AnnaBridge 171:3a7713b1edbc 121
AnnaBridge 171:3a7713b1edbc 122 /*!
AnnaBridge 171:3a7713b1edbc 123 * @brief Configure DMAMUX channel source.
AnnaBridge 171:3a7713b1edbc 124 *
AnnaBridge 171:3a7713b1edbc 125 * @param base DMAMUX peripheral base address.
AnnaBridge 171:3a7713b1edbc 126 * @param channel DMAMUX channel number.
AnnaBridge 171:3a7713b1edbc 127 * @param source Channel source which is used to trigger DMA transfer.
AnnaBridge 171:3a7713b1edbc 128 */
AnnaBridge 171:3a7713b1edbc 129 static inline void DMAMUX_SetSource(DMAMUX_Type *base, uint32_t channel, uint8_t source)
AnnaBridge 171:3a7713b1edbc 130 {
AnnaBridge 171:3a7713b1edbc 131 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
AnnaBridge 171:3a7713b1edbc 132
AnnaBridge 171:3a7713b1edbc 133 base->CHCFG[channel] = ((base->CHCFG[channel] & ~DMAMUX_CHCFG_SOURCE_MASK) | DMAMUX_CHCFG_SOURCE(source));
AnnaBridge 171:3a7713b1edbc 134 }
AnnaBridge 171:3a7713b1edbc 135
AnnaBridge 171:3a7713b1edbc 136 #if defined(FSL_FEATURE_DMAMUX_HAS_TRIG) && FSL_FEATURE_DMAMUX_HAS_TRIG > 0U
AnnaBridge 171:3a7713b1edbc 137 /*!
AnnaBridge 171:3a7713b1edbc 138 * @brief Enable DMAMUX period trigger.
AnnaBridge 171:3a7713b1edbc 139 *
AnnaBridge 171:3a7713b1edbc 140 * This function enable DMAMUX period trigger feature.
AnnaBridge 171:3a7713b1edbc 141 *
AnnaBridge 171:3a7713b1edbc 142 * @param base DMAMUX peripheral base address.
AnnaBridge 171:3a7713b1edbc 143 * @param channel DMAMUX channel number.
AnnaBridge 171:3a7713b1edbc 144 */
AnnaBridge 171:3a7713b1edbc 145 static inline void DMAMUX_EnablePeriodTrigger(DMAMUX_Type *base, uint32_t channel)
AnnaBridge 171:3a7713b1edbc 146 {
AnnaBridge 171:3a7713b1edbc 147 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
AnnaBridge 171:3a7713b1edbc 148
AnnaBridge 171:3a7713b1edbc 149 base->CHCFG[channel] |= DMAMUX_CHCFG_TRIG_MASK;
AnnaBridge 171:3a7713b1edbc 150 }
AnnaBridge 171:3a7713b1edbc 151
AnnaBridge 171:3a7713b1edbc 152 /*!
AnnaBridge 171:3a7713b1edbc 153 * @brief Disable DMAMUX period trigger.
AnnaBridge 171:3a7713b1edbc 154 *
AnnaBridge 171:3a7713b1edbc 155 * This function disable DMAMUX period trigger.
AnnaBridge 171:3a7713b1edbc 156 *
AnnaBridge 171:3a7713b1edbc 157 * @param base DMAMUX peripheral base address.
AnnaBridge 171:3a7713b1edbc 158 * @param channel DMAMUX channel number.
AnnaBridge 171:3a7713b1edbc 159 */
AnnaBridge 171:3a7713b1edbc 160 static inline void DMAMUX_DisablePeriodTrigger(DMAMUX_Type *base, uint32_t channel)
AnnaBridge 171:3a7713b1edbc 161 {
AnnaBridge 171:3a7713b1edbc 162 assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL);
AnnaBridge 171:3a7713b1edbc 163
AnnaBridge 171:3a7713b1edbc 164 base->CHCFG[channel] &= ~DMAMUX_CHCFG_TRIG_MASK;
AnnaBridge 171:3a7713b1edbc 165 }
AnnaBridge 171:3a7713b1edbc 166 #endif /* FSL_FEATURE_DMAMUX_HAS_TRIG */
AnnaBridge 171:3a7713b1edbc 167
AnnaBridge 171:3a7713b1edbc 168 /* @} */
AnnaBridge 171:3a7713b1edbc 169
AnnaBridge 171:3a7713b1edbc 170 #if defined(__cplusplus)
AnnaBridge 171:3a7713b1edbc 171 }
AnnaBridge 171:3a7713b1edbc 172 #endif /* __cplusplus */
AnnaBridge 171:3a7713b1edbc 173
AnnaBridge 171:3a7713b1edbc 174 /* @} */
AnnaBridge 171:3a7713b1edbc 175
AnnaBridge 171:3a7713b1edbc 176 #endif /* _FSL_DMAMUX_H_ */