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_intmux.h@172:65be27845400, 2019-02-20 (annotated)
- 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?
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_INTMUX_H_ |
AnnaBridge | 145:64910690c574 | 32 | #define _FSL_INTMUX_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 intmux |
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 | /*!< Version 2.0.0. */ |
AnnaBridge | 145:64910690c574 | 49 | #define FSL_INTMUX_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
AnnaBridge | 145:64910690c574 | 50 | /*@}*/ |
AnnaBridge | 145:64910690c574 | 51 | |
AnnaBridge | 145:64910690c574 | 52 | /*! @brief INTMUX channel logic mode. */ |
AnnaBridge | 145:64910690c574 | 53 | typedef enum _intmux_channel_logic_mode |
AnnaBridge | 145:64910690c574 | 54 | { |
AnnaBridge | 145:64910690c574 | 55 | kINTMUX_ChannelLogicOR = 0x0U, /*!< Logic OR all enabled interrupt inputs */ |
AnnaBridge | 145:64910690c574 | 56 | kINTMUX_ChannelLogicAND, /*!< Logic AND all enabled interrupt inputs */ |
AnnaBridge | 145:64910690c574 | 57 | } intmux_channel_logic_mode_t; |
AnnaBridge | 145:64910690c574 | 58 | |
AnnaBridge | 145:64910690c574 | 59 | /******************************************************************************* |
AnnaBridge | 145:64910690c574 | 60 | * API |
AnnaBridge | 145:64910690c574 | 61 | ******************************************************************************/ |
AnnaBridge | 145:64910690c574 | 62 | |
AnnaBridge | 145:64910690c574 | 63 | #if defined(__cplusplus) |
AnnaBridge | 145:64910690c574 | 64 | extern "C" { |
AnnaBridge | 145:64910690c574 | 65 | #endif |
AnnaBridge | 145:64910690c574 | 66 | |
AnnaBridge | 145:64910690c574 | 67 | /*! @name Initialization and deinitialization */ |
AnnaBridge | 145:64910690c574 | 68 | /*@{*/ |
AnnaBridge | 145:64910690c574 | 69 | |
AnnaBridge | 145:64910690c574 | 70 | /*! |
AnnaBridge | 145:64910690c574 | 71 | * @brief Initializes the INTMUX module. |
AnnaBridge | 145:64910690c574 | 72 | * |
AnnaBridge | 145:64910690c574 | 73 | * This function enables the clock gate for the specified INTMUX. It then resets all channels, so that no |
AnnaBridge | 145:64910690c574 | 74 | * interrupt sources are routed and the logic mode is set to default of #kINTMUX_ChannelLogicOR. |
AnnaBridge | 145:64910690c574 | 75 | * Finally, the NVIC vectors for all the INTMUX output channels are enabled. |
AnnaBridge | 145:64910690c574 | 76 | * |
AnnaBridge | 145:64910690c574 | 77 | * @param base INTMUX peripheral base address. |
AnnaBridge | 145:64910690c574 | 78 | */ |
AnnaBridge | 145:64910690c574 | 79 | void INTMUX_Init(INTMUX_Type *base); |
AnnaBridge | 145:64910690c574 | 80 | |
AnnaBridge | 145:64910690c574 | 81 | /*! |
AnnaBridge | 145:64910690c574 | 82 | * @brief Deinitializes an INTMUX instance for operation. |
AnnaBridge | 145:64910690c574 | 83 | * |
AnnaBridge | 145:64910690c574 | 84 | * The clock gate for the specified INTMUX is disabled and the NVIC vectors for all channels are disabled. |
AnnaBridge | 145:64910690c574 | 85 | * |
AnnaBridge | 145:64910690c574 | 86 | * @param base INTMUX peripheral base address. |
AnnaBridge | 145:64910690c574 | 87 | */ |
AnnaBridge | 145:64910690c574 | 88 | void INTMUX_Deinit(INTMUX_Type *base); |
AnnaBridge | 145:64910690c574 | 89 | |
AnnaBridge | 145:64910690c574 | 90 | /*! |
AnnaBridge | 145:64910690c574 | 91 | * @brief Resets an INTMUX channel. |
AnnaBridge | 145:64910690c574 | 92 | * |
AnnaBridge | 145:64910690c574 | 93 | * Sets all register values in the specified channel to their reset value. This function disables all interrupt |
AnnaBridge | 145:64910690c574 | 94 | * sources for the channel. |
AnnaBridge | 145:64910690c574 | 95 | * |
AnnaBridge | 145:64910690c574 | 96 | * @param base INTMUX peripheral base address. |
AnnaBridge | 145:64910690c574 | 97 | * @param channel The INTMUX channel number. |
AnnaBridge | 145:64910690c574 | 98 | */ |
AnnaBridge | 145:64910690c574 | 99 | static inline void INTMUX_ResetChannel(INTMUX_Type *base, uint32_t channel) |
AnnaBridge | 145:64910690c574 | 100 | { |
AnnaBridge | 145:64910690c574 | 101 | assert(channel < FSL_FEATURE_INTMUX_CHANNEL_COUNT); |
AnnaBridge | 145:64910690c574 | 102 | |
AnnaBridge | 145:64910690c574 | 103 | base->CHANNEL[channel].CHn_CSR |= INTMUX_CHn_CSR_RST_MASK; |
AnnaBridge | 145:64910690c574 | 104 | } |
AnnaBridge | 145:64910690c574 | 105 | |
AnnaBridge | 145:64910690c574 | 106 | /*! |
AnnaBridge | 145:64910690c574 | 107 | * @brief Sets the logic mode for an INTMUX channel. |
AnnaBridge | 145:64910690c574 | 108 | * |
AnnaBridge | 145:64910690c574 | 109 | * INTMUX channels can be configured to use one of the two logic modes that control how pending interrupt sources |
AnnaBridge | 145:64910690c574 | 110 | * on the channel trigger the output interrupt. |
AnnaBridge | 145:64910690c574 | 111 | * - #kINTMUX_ChannelLogicOR means any source pending triggers the output interrupt. |
AnnaBridge | 145:64910690c574 | 112 | * - #kINTMUX_ChannelLogicAND means all selected sources on the channel must be pending before the channel |
AnnaBridge | 145:64910690c574 | 113 | * output interrupt triggers. |
AnnaBridge | 145:64910690c574 | 114 | * |
AnnaBridge | 145:64910690c574 | 115 | * @param base INTMUX peripheral base address. |
AnnaBridge | 145:64910690c574 | 116 | * @param channel The INTMUX channel number. |
AnnaBridge | 145:64910690c574 | 117 | * @param logic The INTMUX channel logic mode. |
AnnaBridge | 145:64910690c574 | 118 | */ |
AnnaBridge | 145:64910690c574 | 119 | static inline void INTMUX_SetChannelMode(INTMUX_Type *base, uint32_t channel, intmux_channel_logic_mode_t logic) |
AnnaBridge | 145:64910690c574 | 120 | { |
AnnaBridge | 145:64910690c574 | 121 | assert(channel < FSL_FEATURE_INTMUX_CHANNEL_COUNT); |
AnnaBridge | 145:64910690c574 | 122 | |
AnnaBridge | 145:64910690c574 | 123 | base->CHANNEL[channel].CHn_CSR = INTMUX_CHn_CSR_AND(logic); |
AnnaBridge | 145:64910690c574 | 124 | } |
AnnaBridge | 145:64910690c574 | 125 | |
AnnaBridge | 145:64910690c574 | 126 | /*@}*/ |
AnnaBridge | 145:64910690c574 | 127 | /*! @name Sources */ |
AnnaBridge | 145:64910690c574 | 128 | /*@{*/ |
AnnaBridge | 145:64910690c574 | 129 | |
AnnaBridge | 145:64910690c574 | 130 | /*! |
AnnaBridge | 145:64910690c574 | 131 | * @brief Enables an interrupt source on an INTMUX channel. |
AnnaBridge | 145:64910690c574 | 132 | * |
AnnaBridge | 145:64910690c574 | 133 | * @param base INTMUX peripheral base address. |
AnnaBridge | 145:64910690c574 | 134 | * @param channel Index of the INTMUX channel on which the specified interrupt is enabled. |
AnnaBridge | 145:64910690c574 | 135 | * @param irq Interrupt to route to the specified INTMUX channel. The interrupt must be an INTMUX source. |
AnnaBridge | 145:64910690c574 | 136 | */ |
AnnaBridge | 145:64910690c574 | 137 | static inline void INTMUX_EnableInterrupt(INTMUX_Type *base, uint32_t channel, IRQn_Type irq) |
AnnaBridge | 145:64910690c574 | 138 | { |
AnnaBridge | 145:64910690c574 | 139 | assert(channel < FSL_FEATURE_INTMUX_CHANNEL_COUNT); |
AnnaBridge | 145:64910690c574 | 140 | assert(irq >= FSL_FEATURE_INTMUX_IRQ_START_INDEX); |
AnnaBridge | 145:64910690c574 | 141 | |
AnnaBridge | 145:64910690c574 | 142 | base->CHANNEL[channel].CHn_IER_31_0 |= (1U << ((uint32_t)irq - FSL_FEATURE_INTMUX_IRQ_START_INDEX)); |
AnnaBridge | 145:64910690c574 | 143 | } |
AnnaBridge | 145:64910690c574 | 144 | |
AnnaBridge | 145:64910690c574 | 145 | /*! |
AnnaBridge | 145:64910690c574 | 146 | * @brief Disables an interrupt source on an INTMUX channel. |
AnnaBridge | 145:64910690c574 | 147 | * |
AnnaBridge | 145:64910690c574 | 148 | * @param base INTMUX peripheral base address. |
AnnaBridge | 145:64910690c574 | 149 | * @param channel Index of the INTMUX channel on which the specified interrupt is disabled. |
AnnaBridge | 145:64910690c574 | 150 | * @param irq Interrupt number. The interrupt must be an INTMUX source. |
AnnaBridge | 145:64910690c574 | 151 | */ |
AnnaBridge | 145:64910690c574 | 152 | static inline void INTMUX_DisableInterrupt(INTMUX_Type *base, uint32_t channel, IRQn_Type irq) |
AnnaBridge | 145:64910690c574 | 153 | { |
AnnaBridge | 145:64910690c574 | 154 | assert(channel < FSL_FEATURE_INTMUX_CHANNEL_COUNT); |
AnnaBridge | 145:64910690c574 | 155 | assert(irq >= FSL_FEATURE_INTMUX_IRQ_START_INDEX); |
AnnaBridge | 145:64910690c574 | 156 | |
AnnaBridge | 145:64910690c574 | 157 | base->CHANNEL[channel].CHn_IER_31_0 &= ~(1U << ((uint32_t)irq - FSL_FEATURE_INTMUX_IRQ_START_INDEX)); |
AnnaBridge | 145:64910690c574 | 158 | } |
AnnaBridge | 145:64910690c574 | 159 | |
AnnaBridge | 145:64910690c574 | 160 | /*@}*/ |
AnnaBridge | 145:64910690c574 | 161 | /*! @name Status */ |
AnnaBridge | 145:64910690c574 | 162 | /*@{*/ |
AnnaBridge | 145:64910690c574 | 163 | |
AnnaBridge | 145:64910690c574 | 164 | /*! |
AnnaBridge | 145:64910690c574 | 165 | * @brief Gets INTMUX pending interrupt sources for a specific channel. |
AnnaBridge | 145:64910690c574 | 166 | * |
AnnaBridge | 145:64910690c574 | 167 | * @param base INTMUX peripheral base address. |
AnnaBridge | 145:64910690c574 | 168 | * @param channel The INTMUX channel number. |
AnnaBridge | 145:64910690c574 | 169 | * @return The mask of pending interrupt bits. Bit[n] set means INTMUX source n is pending. |
AnnaBridge | 145:64910690c574 | 170 | */ |
AnnaBridge | 145:64910690c574 | 171 | static inline uint32_t INTMUX_GetChannelPendingSources(INTMUX_Type *base, uint32_t channel) |
AnnaBridge | 145:64910690c574 | 172 | { |
AnnaBridge | 145:64910690c574 | 173 | assert(channel < FSL_FEATURE_INTMUX_CHANNEL_COUNT); |
AnnaBridge | 145:64910690c574 | 174 | |
AnnaBridge | 145:64910690c574 | 175 | return base->CHANNEL[channel].CHn_IPR_31_0; |
AnnaBridge | 145:64910690c574 | 176 | } |
AnnaBridge | 145:64910690c574 | 177 | |
AnnaBridge | 145:64910690c574 | 178 | /*@}*/ |
AnnaBridge | 145:64910690c574 | 179 | |
AnnaBridge | 145:64910690c574 | 180 | #if defined(__cplusplus) |
AnnaBridge | 145:64910690c574 | 181 | } |
AnnaBridge | 145:64910690c574 | 182 | #endif |
AnnaBridge | 145:64910690c574 | 183 | |
AnnaBridge | 145:64910690c574 | 184 | /*! @} */ |
AnnaBridge | 145:64910690c574 | 185 | |
AnnaBridge | 145:64910690c574 | 186 | #endif /* _FSL_INTMUX_H_ */ |