![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/drivers/fsl_dmamux.h@0:8fdf9a60065b, 2018-10-10 (annotated)
- Committer:
- kadonotakashi
- Date:
- Wed Oct 10 00:33:53 2018 +0000
- Revision:
- 0:8fdf9a60065b
how to make mbed librry
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | /* |
kadonotakashi | 0:8fdf9a60065b | 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. |
kadonotakashi | 0:8fdf9a60065b | 3 | * All rights reserved. |
kadonotakashi | 0:8fdf9a60065b | 4 | * |
kadonotakashi | 0:8fdf9a60065b | 5 | * Redistribution and use in source and binary forms, with or without modification, |
kadonotakashi | 0:8fdf9a60065b | 6 | * are permitted provided that the following conditions are met: |
kadonotakashi | 0:8fdf9a60065b | 7 | * |
kadonotakashi | 0:8fdf9a60065b | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
kadonotakashi | 0:8fdf9a60065b | 9 | * of conditions and the following disclaimer. |
kadonotakashi | 0:8fdf9a60065b | 10 | * |
kadonotakashi | 0:8fdf9a60065b | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
kadonotakashi | 0:8fdf9a60065b | 12 | * list of conditions and the following disclaimer in the documentation and/or |
kadonotakashi | 0:8fdf9a60065b | 13 | * other materials provided with the distribution. |
kadonotakashi | 0:8fdf9a60065b | 14 | * |
kadonotakashi | 0:8fdf9a60065b | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
kadonotakashi | 0:8fdf9a60065b | 16 | * contributors may be used to endorse or promote products derived from this |
kadonotakashi | 0:8fdf9a60065b | 17 | * software without specific prior written permission. |
kadonotakashi | 0:8fdf9a60065b | 18 | * |
kadonotakashi | 0:8fdf9a60065b | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
kadonotakashi | 0:8fdf9a60065b | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
kadonotakashi | 0:8fdf9a60065b | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
kadonotakashi | 0:8fdf9a60065b | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
kadonotakashi | 0:8fdf9a60065b | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
kadonotakashi | 0:8fdf9a60065b | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
kadonotakashi | 0:8fdf9a60065b | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
kadonotakashi | 0:8fdf9a60065b | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
kadonotakashi | 0:8fdf9a60065b | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
kadonotakashi | 0:8fdf9a60065b | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
kadonotakashi | 0:8fdf9a60065b | 29 | */ |
kadonotakashi | 0:8fdf9a60065b | 30 | |
kadonotakashi | 0:8fdf9a60065b | 31 | #ifndef _FSL_DMAMUX_H_ |
kadonotakashi | 0:8fdf9a60065b | 32 | #define _FSL_DMAMUX_H_ |
kadonotakashi | 0:8fdf9a60065b | 33 | |
kadonotakashi | 0:8fdf9a60065b | 34 | #include "fsl_common.h" |
kadonotakashi | 0:8fdf9a60065b | 35 | |
kadonotakashi | 0:8fdf9a60065b | 36 | /*! |
kadonotakashi | 0:8fdf9a60065b | 37 | * @addtogroup dmamux |
kadonotakashi | 0:8fdf9a60065b | 38 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 39 | */ |
kadonotakashi | 0:8fdf9a60065b | 40 | |
kadonotakashi | 0:8fdf9a60065b | 41 | |
kadonotakashi | 0:8fdf9a60065b | 42 | /******************************************************************************* |
kadonotakashi | 0:8fdf9a60065b | 43 | * Definitions |
kadonotakashi | 0:8fdf9a60065b | 44 | ******************************************************************************/ |
kadonotakashi | 0:8fdf9a60065b | 45 | |
kadonotakashi | 0:8fdf9a60065b | 46 | /*! @name Driver version */ |
kadonotakashi | 0:8fdf9a60065b | 47 | /*@{*/ |
kadonotakashi | 0:8fdf9a60065b | 48 | /*! @brief DMAMUX driver version 2.0.2. */ |
kadonotakashi | 0:8fdf9a60065b | 49 | #define FSL_DMAMUX_DRIVER_VERSION (MAKE_VERSION(2, 0, 2)) |
kadonotakashi | 0:8fdf9a60065b | 50 | /*@}*/ |
kadonotakashi | 0:8fdf9a60065b | 51 | |
kadonotakashi | 0:8fdf9a60065b | 52 | /******************************************************************************* |
kadonotakashi | 0:8fdf9a60065b | 53 | * API |
kadonotakashi | 0:8fdf9a60065b | 54 | ******************************************************************************/ |
kadonotakashi | 0:8fdf9a60065b | 55 | |
kadonotakashi | 0:8fdf9a60065b | 56 | #if defined(__cplusplus) |
kadonotakashi | 0:8fdf9a60065b | 57 | extern "C" { |
kadonotakashi | 0:8fdf9a60065b | 58 | #endif /* __cplusplus */ |
kadonotakashi | 0:8fdf9a60065b | 59 | |
kadonotakashi | 0:8fdf9a60065b | 60 | /*! |
kadonotakashi | 0:8fdf9a60065b | 61 | * @name DMAMUX Initialization and de-initialization |
kadonotakashi | 0:8fdf9a60065b | 62 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 63 | */ |
kadonotakashi | 0:8fdf9a60065b | 64 | |
kadonotakashi | 0:8fdf9a60065b | 65 | /*! |
kadonotakashi | 0:8fdf9a60065b | 66 | * @brief Initializes the DMAMUX peripheral. |
kadonotakashi | 0:8fdf9a60065b | 67 | * |
kadonotakashi | 0:8fdf9a60065b | 68 | * This function ungates the DMAMUX clock. |
kadonotakashi | 0:8fdf9a60065b | 69 | * |
kadonotakashi | 0:8fdf9a60065b | 70 | * @param base DMAMUX peripheral base address. |
kadonotakashi | 0:8fdf9a60065b | 71 | * |
kadonotakashi | 0:8fdf9a60065b | 72 | */ |
kadonotakashi | 0:8fdf9a60065b | 73 | void DMAMUX_Init(DMAMUX_Type *base); |
kadonotakashi | 0:8fdf9a60065b | 74 | |
kadonotakashi | 0:8fdf9a60065b | 75 | /*! |
kadonotakashi | 0:8fdf9a60065b | 76 | * @brief Deinitializes the DMAMUX peripheral. |
kadonotakashi | 0:8fdf9a60065b | 77 | * |
kadonotakashi | 0:8fdf9a60065b | 78 | * This function gates the DMAMUX clock. |
kadonotakashi | 0:8fdf9a60065b | 79 | * |
kadonotakashi | 0:8fdf9a60065b | 80 | * @param base DMAMUX peripheral base address. |
kadonotakashi | 0:8fdf9a60065b | 81 | */ |
kadonotakashi | 0:8fdf9a60065b | 82 | void DMAMUX_Deinit(DMAMUX_Type *base); |
kadonotakashi | 0:8fdf9a60065b | 83 | |
kadonotakashi | 0:8fdf9a60065b | 84 | /* @} */ |
kadonotakashi | 0:8fdf9a60065b | 85 | /*! |
kadonotakashi | 0:8fdf9a60065b | 86 | * @name DMAMUX Channel Operation |
kadonotakashi | 0:8fdf9a60065b | 87 | * @{ |
kadonotakashi | 0:8fdf9a60065b | 88 | */ |
kadonotakashi | 0:8fdf9a60065b | 89 | |
kadonotakashi | 0:8fdf9a60065b | 90 | /*! |
kadonotakashi | 0:8fdf9a60065b | 91 | * @brief Enables the DMAMUX channel. |
kadonotakashi | 0:8fdf9a60065b | 92 | * |
kadonotakashi | 0:8fdf9a60065b | 93 | * This function enables the DMAMUX channel. |
kadonotakashi | 0:8fdf9a60065b | 94 | * |
kadonotakashi | 0:8fdf9a60065b | 95 | * @param base DMAMUX peripheral base address. |
kadonotakashi | 0:8fdf9a60065b | 96 | * @param channel DMAMUX channel number. |
kadonotakashi | 0:8fdf9a60065b | 97 | */ |
kadonotakashi | 0:8fdf9a60065b | 98 | static inline void DMAMUX_EnableChannel(DMAMUX_Type *base, uint32_t channel) |
kadonotakashi | 0:8fdf9a60065b | 99 | { |
kadonotakashi | 0:8fdf9a60065b | 100 | assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL); |
kadonotakashi | 0:8fdf9a60065b | 101 | |
kadonotakashi | 0:8fdf9a60065b | 102 | base->CHCFG[channel] |= DMAMUX_CHCFG_ENBL_MASK; |
kadonotakashi | 0:8fdf9a60065b | 103 | } |
kadonotakashi | 0:8fdf9a60065b | 104 | |
kadonotakashi | 0:8fdf9a60065b | 105 | /*! |
kadonotakashi | 0:8fdf9a60065b | 106 | * @brief Disables the DMAMUX channel. |
kadonotakashi | 0:8fdf9a60065b | 107 | * |
kadonotakashi | 0:8fdf9a60065b | 108 | * This function disables the DMAMUX channel. |
kadonotakashi | 0:8fdf9a60065b | 109 | * |
kadonotakashi | 0:8fdf9a60065b | 110 | * @note The user must disable the DMAMUX channel before configuring it. |
kadonotakashi | 0:8fdf9a60065b | 111 | * @param base DMAMUX peripheral base address. |
kadonotakashi | 0:8fdf9a60065b | 112 | * @param channel DMAMUX channel number. |
kadonotakashi | 0:8fdf9a60065b | 113 | */ |
kadonotakashi | 0:8fdf9a60065b | 114 | static inline void DMAMUX_DisableChannel(DMAMUX_Type *base, uint32_t channel) |
kadonotakashi | 0:8fdf9a60065b | 115 | { |
kadonotakashi | 0:8fdf9a60065b | 116 | assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL); |
kadonotakashi | 0:8fdf9a60065b | 117 | |
kadonotakashi | 0:8fdf9a60065b | 118 | base->CHCFG[channel] &= ~DMAMUX_CHCFG_ENBL_MASK; |
kadonotakashi | 0:8fdf9a60065b | 119 | } |
kadonotakashi | 0:8fdf9a60065b | 120 | |
kadonotakashi | 0:8fdf9a60065b | 121 | /*! |
kadonotakashi | 0:8fdf9a60065b | 122 | * @brief Configures the DMAMUX channel source. |
kadonotakashi | 0:8fdf9a60065b | 123 | * |
kadonotakashi | 0:8fdf9a60065b | 124 | * @param base DMAMUX peripheral base address. |
kadonotakashi | 0:8fdf9a60065b | 125 | * @param channel DMAMUX channel number. |
kadonotakashi | 0:8fdf9a60065b | 126 | * @param source Channel source, which is used to trigger the DMA transfer. |
kadonotakashi | 0:8fdf9a60065b | 127 | */ |
kadonotakashi | 0:8fdf9a60065b | 128 | static inline void DMAMUX_SetSource(DMAMUX_Type *base, uint32_t channel, uint32_t source) |
kadonotakashi | 0:8fdf9a60065b | 129 | { |
kadonotakashi | 0:8fdf9a60065b | 130 | assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL); |
kadonotakashi | 0:8fdf9a60065b | 131 | |
kadonotakashi | 0:8fdf9a60065b | 132 | base->CHCFG[channel] = ((base->CHCFG[channel] & ~DMAMUX_CHCFG_SOURCE_MASK) | DMAMUX_CHCFG_SOURCE(source)); |
kadonotakashi | 0:8fdf9a60065b | 133 | } |
kadonotakashi | 0:8fdf9a60065b | 134 | |
kadonotakashi | 0:8fdf9a60065b | 135 | #if defined(FSL_FEATURE_DMAMUX_HAS_TRIG) && FSL_FEATURE_DMAMUX_HAS_TRIG > 0U |
kadonotakashi | 0:8fdf9a60065b | 136 | /*! |
kadonotakashi | 0:8fdf9a60065b | 137 | * @brief Enables the DMAMUX period trigger. |
kadonotakashi | 0:8fdf9a60065b | 138 | * |
kadonotakashi | 0:8fdf9a60065b | 139 | * This function enables the DMAMUX period trigger feature. |
kadonotakashi | 0:8fdf9a60065b | 140 | * |
kadonotakashi | 0:8fdf9a60065b | 141 | * @param base DMAMUX peripheral base address. |
kadonotakashi | 0:8fdf9a60065b | 142 | * @param channel DMAMUX channel number. |
kadonotakashi | 0:8fdf9a60065b | 143 | */ |
kadonotakashi | 0:8fdf9a60065b | 144 | static inline void DMAMUX_EnablePeriodTrigger(DMAMUX_Type *base, uint32_t channel) |
kadonotakashi | 0:8fdf9a60065b | 145 | { |
kadonotakashi | 0:8fdf9a60065b | 146 | assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL); |
kadonotakashi | 0:8fdf9a60065b | 147 | |
kadonotakashi | 0:8fdf9a60065b | 148 | base->CHCFG[channel] |= DMAMUX_CHCFG_TRIG_MASK; |
kadonotakashi | 0:8fdf9a60065b | 149 | } |
kadonotakashi | 0:8fdf9a60065b | 150 | |
kadonotakashi | 0:8fdf9a60065b | 151 | /*! |
kadonotakashi | 0:8fdf9a60065b | 152 | * @brief Disables the DMAMUX period trigger. |
kadonotakashi | 0:8fdf9a60065b | 153 | * |
kadonotakashi | 0:8fdf9a60065b | 154 | * This function disables the DMAMUX period trigger. |
kadonotakashi | 0:8fdf9a60065b | 155 | * |
kadonotakashi | 0:8fdf9a60065b | 156 | * @param base DMAMUX peripheral base address. |
kadonotakashi | 0:8fdf9a60065b | 157 | * @param channel DMAMUX channel number. |
kadonotakashi | 0:8fdf9a60065b | 158 | */ |
kadonotakashi | 0:8fdf9a60065b | 159 | static inline void DMAMUX_DisablePeriodTrigger(DMAMUX_Type *base, uint32_t channel) |
kadonotakashi | 0:8fdf9a60065b | 160 | { |
kadonotakashi | 0:8fdf9a60065b | 161 | assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL); |
kadonotakashi | 0:8fdf9a60065b | 162 | |
kadonotakashi | 0:8fdf9a60065b | 163 | base->CHCFG[channel] &= ~DMAMUX_CHCFG_TRIG_MASK; |
kadonotakashi | 0:8fdf9a60065b | 164 | } |
kadonotakashi | 0:8fdf9a60065b | 165 | #endif /* FSL_FEATURE_DMAMUX_HAS_TRIG */ |
kadonotakashi | 0:8fdf9a60065b | 166 | |
kadonotakashi | 0:8fdf9a60065b | 167 | #if (defined(FSL_FEATURE_DMAMUX_HAS_A_ON) && FSL_FEATURE_DMAMUX_HAS_A_ON) |
kadonotakashi | 0:8fdf9a60065b | 168 | /*! |
kadonotakashi | 0:8fdf9a60065b | 169 | * @brief Enables the DMA channel to be always ON. |
kadonotakashi | 0:8fdf9a60065b | 170 | * |
kadonotakashi | 0:8fdf9a60065b | 171 | * This function enables the DMAMUX channel always ON feature. |
kadonotakashi | 0:8fdf9a60065b | 172 | * |
kadonotakashi | 0:8fdf9a60065b | 173 | * @param base DMAMUX peripheral base address. |
kadonotakashi | 0:8fdf9a60065b | 174 | * @param channel DMAMUX channel number. |
kadonotakashi | 0:8fdf9a60065b | 175 | * @param enable Switcher of the always ON feature. "true" means enabled, "false" means disabled. |
kadonotakashi | 0:8fdf9a60065b | 176 | */ |
kadonotakashi | 0:8fdf9a60065b | 177 | static inline void DMAMUX_EnableAlwaysOn(DMAMUX_Type *base, uint32_t channel, bool enable) |
kadonotakashi | 0:8fdf9a60065b | 178 | { |
kadonotakashi | 0:8fdf9a60065b | 179 | assert(channel < FSL_FEATURE_DMAMUX_MODULE_CHANNEL); |
kadonotakashi | 0:8fdf9a60065b | 180 | |
kadonotakashi | 0:8fdf9a60065b | 181 | if (enable) |
kadonotakashi | 0:8fdf9a60065b | 182 | { |
kadonotakashi | 0:8fdf9a60065b | 183 | base->CHCFG[channel] |= DMAMUX_CHCFG_A_ON_MASK; |
kadonotakashi | 0:8fdf9a60065b | 184 | } |
kadonotakashi | 0:8fdf9a60065b | 185 | else |
kadonotakashi | 0:8fdf9a60065b | 186 | { |
kadonotakashi | 0:8fdf9a60065b | 187 | base->CHCFG[channel] &= ~DMAMUX_CHCFG_A_ON_MASK; |
kadonotakashi | 0:8fdf9a60065b | 188 | } |
kadonotakashi | 0:8fdf9a60065b | 189 | } |
kadonotakashi | 0:8fdf9a60065b | 190 | #endif /* FSL_FEATURE_DMAMUX_HAS_A_ON */ |
kadonotakashi | 0:8fdf9a60065b | 191 | |
kadonotakashi | 0:8fdf9a60065b | 192 | /* @} */ |
kadonotakashi | 0:8fdf9a60065b | 193 | |
kadonotakashi | 0:8fdf9a60065b | 194 | #if defined(__cplusplus) |
kadonotakashi | 0:8fdf9a60065b | 195 | } |
kadonotakashi | 0:8fdf9a60065b | 196 | #endif /* __cplusplus */ |
kadonotakashi | 0:8fdf9a60065b | 197 | |
kadonotakashi | 0:8fdf9a60065b | 198 | /* @} */ |
kadonotakashi | 0:8fdf9a60065b | 199 | |
kadonotakashi | 0:8fdf9a60065b | 200 | #endif /* _FSL_DMAMUX_H_ */ |