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_KL82Z/TOOLCHAIN_IAR/fsl_dmamux.h@171:3a7713b1edbc, 2018-11-08 (annotated)
- Committer:
- AnnaBridge
- Date:
- Thu Nov 08 11:45:42 2018 +0000
- Revision:
- 171:3a7713b1edbc
- Parent:
- TARGET_USENSE/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL82Z/drivers/fsl_dmamux.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 | |
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.1. */ |
AnnaBridge | 145:64910690c574 | 49 | #define FSL_DMAMUX_DRIVER_VERSION (MAKE_VERSION(2, 0, 1)) |
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 Initialize and De-initialize |
AnnaBridge | 145:64910690c574 | 62 | * @{ |
AnnaBridge | 145:64910690c574 | 63 | */ |
AnnaBridge | 145:64910690c574 | 64 | |
AnnaBridge | 145:64910690c574 | 65 | /*! |
AnnaBridge | 145:64910690c574 | 66 | * @brief Initializes DMAMUX peripheral. |
AnnaBridge | 145:64910690c574 | 67 | * |
AnnaBridge | 145:64910690c574 | 68 | * This function ungate 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 DMAMUX peripheral. |
AnnaBridge | 145:64910690c574 | 77 | * |
AnnaBridge | 145:64910690c574 | 78 | * This function gate 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 Enable DMAMUX channel. |
AnnaBridge | 145:64910690c574 | 92 | * |
AnnaBridge | 145:64910690c574 | 93 | * This function enable DMAMUX channel to work. |
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 Disable DMAMUX channel. |
AnnaBridge | 145:64910690c574 | 107 | * |
AnnaBridge | 145:64910690c574 | 108 | * This function disable DMAMUX channel. |
AnnaBridge | 145:64910690c574 | 109 | * |
AnnaBridge | 145:64910690c574 | 110 | * @note User must disable 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 Configure 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 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 Enable DMAMUX period trigger. |
AnnaBridge | 145:64910690c574 | 138 | * |
AnnaBridge | 145:64910690c574 | 139 | * This function enable 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 Disable DMAMUX period trigger. |
AnnaBridge | 145:64910690c574 | 153 | * |
AnnaBridge | 145:64910690c574 | 154 | * This function disable 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 | /* @} */ |
AnnaBridge | 145:64910690c574 | 168 | |
AnnaBridge | 145:64910690c574 | 169 | #if defined(__cplusplus) |
AnnaBridge | 145:64910690c574 | 170 | } |
AnnaBridge | 145:64910690c574 | 171 | #endif /* __cplusplus */ |
AnnaBridge | 145:64910690c574 | 172 | |
AnnaBridge | 145:64910690c574 | 173 | /* @} */ |
AnnaBridge | 145:64910690c574 | 174 | |
AnnaBridge | 145:64910690c574 | 175 | #endif /* _FSL_DMAMUX_H_ */ |