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_LPC54114/TOOLCHAIN_IAR/fsl_gint.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 |
---|---|---|---|
Kojto | 148:fd96258d940d | 1 | /* |
Kojto | 148:fd96258d940d | 2 | * Copyright (c) 2016, Freescale Semiconductor, Inc. |
Kojto | 148:fd96258d940d | 3 | * All rights reserved. |
Kojto | 148:fd96258d940d | 4 | * |
Kojto | 148:fd96258d940d | 5 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 148:fd96258d940d | 6 | * are permitted provided that the following conditions are met: |
Kojto | 148:fd96258d940d | 7 | * |
Kojto | 148:fd96258d940d | 8 | * o Redistributions of source code must retain the above copyright notice, this list |
Kojto | 148:fd96258d940d | 9 | * of conditions and the following disclaimer. |
Kojto | 148:fd96258d940d | 10 | * |
Kojto | 148:fd96258d940d | 11 | * o Redistributions in binary form must reproduce the above copyright notice, this |
Kojto | 148:fd96258d940d | 12 | * list of conditions and the following disclaimer in the documentation and/or |
Kojto | 148:fd96258d940d | 13 | * other materials provided with the distribution. |
Kojto | 148:fd96258d940d | 14 | * |
Kojto | 148:fd96258d940d | 15 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
Kojto | 148:fd96258d940d | 16 | * contributors may be used to endorse or promote products derived from this |
Kojto | 148:fd96258d940d | 17 | * software without specific prior written permission. |
Kojto | 148:fd96258d940d | 18 | * |
Kojto | 148:fd96258d940d | 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
Kojto | 148:fd96258d940d | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
Kojto | 148:fd96258d940d | 21 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 148:fd96258d940d | 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
Kojto | 148:fd96258d940d | 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
Kojto | 148:fd96258d940d | 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
Kojto | 148:fd96258d940d | 25 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
Kojto | 148:fd96258d940d | 26 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
Kojto | 148:fd96258d940d | 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
Kojto | 148:fd96258d940d | 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 148:fd96258d940d | 29 | */ |
Kojto | 148:fd96258d940d | 30 | |
Kojto | 148:fd96258d940d | 31 | #ifndef _FSL_GINT_H_ |
Kojto | 148:fd96258d940d | 32 | #define _FSL_GINT_H_ |
Kojto | 148:fd96258d940d | 33 | |
Kojto | 148:fd96258d940d | 34 | #include "fsl_common.h" |
Kojto | 148:fd96258d940d | 35 | |
Kojto | 148:fd96258d940d | 36 | /*! |
Kojto | 148:fd96258d940d | 37 | * @addtogroup gint_driver |
Kojto | 148:fd96258d940d | 38 | * @{ |
Kojto | 148:fd96258d940d | 39 | */ |
Kojto | 148:fd96258d940d | 40 | |
Kojto | 148:fd96258d940d | 41 | /*! @file */ |
Kojto | 148:fd96258d940d | 42 | |
Kojto | 148:fd96258d940d | 43 | /******************************************************************************* |
Kojto | 148:fd96258d940d | 44 | * Definitions |
Kojto | 148:fd96258d940d | 45 | ******************************************************************************/ |
Kojto | 148:fd96258d940d | 46 | |
Kojto | 148:fd96258d940d | 47 | /*! @name Driver version */ |
Kojto | 148:fd96258d940d | 48 | /*@{*/ |
Kojto | 148:fd96258d940d | 49 | #define FSL_GINT_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) /*!< Version 2.0.0. */ |
Kojto | 148:fd96258d940d | 50 | /*@}*/ |
Kojto | 148:fd96258d940d | 51 | |
Kojto | 148:fd96258d940d | 52 | /*! @brief GINT combine inputs type */ |
Kojto | 148:fd96258d940d | 53 | typedef enum _gint_comb |
Kojto | 148:fd96258d940d | 54 | { |
Kojto | 148:fd96258d940d | 55 | kGINT_CombineOr = 0U, /*!< A grouped interrupt is generated when any one of the enabled inputs is active */ |
Kojto | 148:fd96258d940d | 56 | kGINT_CombineAnd = 1U /*!< A grouped interrupt is generated when all enabled inputs are active */ |
Kojto | 148:fd96258d940d | 57 | } gint_comb_t; |
Kojto | 148:fd96258d940d | 58 | |
Kojto | 148:fd96258d940d | 59 | /*! @brief GINT trigger type */ |
Kojto | 148:fd96258d940d | 60 | typedef enum _gint_trig |
Kojto | 148:fd96258d940d | 61 | { |
Kojto | 148:fd96258d940d | 62 | kGINT_TrigEdge = 0U, /*!< Edge triggered based on polarity */ |
Kojto | 148:fd96258d940d | 63 | kGINT_TrigLevel = 1U /*!< Level triggered based on polarity */ |
Kojto | 148:fd96258d940d | 64 | } gint_trig_t; |
Kojto | 148:fd96258d940d | 65 | |
Kojto | 148:fd96258d940d | 66 | /* @brief GINT port type */ |
Kojto | 148:fd96258d940d | 67 | typedef enum _gint_port |
Kojto | 148:fd96258d940d | 68 | { |
Kojto | 148:fd96258d940d | 69 | kGINT_Port0 = 0U, |
Kojto | 148:fd96258d940d | 70 | kGINT_Port1 = 1U, |
Kojto | 148:fd96258d940d | 71 | #if defined(FSL_FEATURE_GINT_PORT_COUNT) && (FSL_FEATURE_GINT_PORT_COUNT > 2U) |
Kojto | 148:fd96258d940d | 72 | kGINT_Port2 = 2U, |
Kojto | 148:fd96258d940d | 73 | #endif |
Kojto | 148:fd96258d940d | 74 | #if defined(FSL_FEATURE_GINT_PORT_COUNT) && (FSL_FEATURE_GINT_PORT_COUNT > 3U) |
Kojto | 148:fd96258d940d | 75 | kGINT_Port3 = 3U, |
Kojto | 148:fd96258d940d | 76 | #endif |
Kojto | 148:fd96258d940d | 77 | #if defined(FSL_FEATURE_GINT_PORT_COUNT) && (FSL_FEATURE_GINT_PORT_COUNT > 4U) |
Kojto | 148:fd96258d940d | 78 | kGINT_Port4 = 4U, |
Kojto | 148:fd96258d940d | 79 | #endif |
Kojto | 148:fd96258d940d | 80 | #if defined(FSL_FEATURE_GINT_PORT_COUNT) && (FSL_FEATURE_GINT_PORT_COUNT > 5U) |
Kojto | 148:fd96258d940d | 81 | kGINT_Port5 = 5U, |
Kojto | 148:fd96258d940d | 82 | #endif |
Kojto | 148:fd96258d940d | 83 | #if defined(FSL_FEATURE_GINT_PORT_COUNT) && (FSL_FEATURE_GINT_PORT_COUNT > 6U) |
Kojto | 148:fd96258d940d | 84 | kGINT_Port6 = 6U, |
Kojto | 148:fd96258d940d | 85 | #endif |
Kojto | 148:fd96258d940d | 86 | #if defined(FSL_FEATURE_GINT_PORT_COUNT) && (FSL_FEATURE_GINT_PORT_COUNT > 7U) |
Kojto | 148:fd96258d940d | 87 | kGINT_Port7 = 7U, |
Kojto | 148:fd96258d940d | 88 | #endif |
Kojto | 148:fd96258d940d | 89 | } gint_port_t; |
Kojto | 148:fd96258d940d | 90 | |
Kojto | 148:fd96258d940d | 91 | /*! @brief GINT Callback function. */ |
Kojto | 148:fd96258d940d | 92 | typedef void (*gint_cb_t)(void); |
Kojto | 148:fd96258d940d | 93 | |
Kojto | 148:fd96258d940d | 94 | /******************************************************************************* |
Kojto | 148:fd96258d940d | 95 | * API |
Kojto | 148:fd96258d940d | 96 | ******************************************************************************/ |
Kojto | 148:fd96258d940d | 97 | |
Kojto | 148:fd96258d940d | 98 | #if defined(__cplusplus) |
Kojto | 148:fd96258d940d | 99 | extern "C" { |
Kojto | 148:fd96258d940d | 100 | #endif |
Kojto | 148:fd96258d940d | 101 | |
Kojto | 148:fd96258d940d | 102 | /*! |
Kojto | 148:fd96258d940d | 103 | * @brief Initialize GINT peripheral. |
Kojto | 148:fd96258d940d | 104 | |
Kojto | 148:fd96258d940d | 105 | * This function initializes the GINT peripheral and enables the clock. |
Kojto | 148:fd96258d940d | 106 | * |
Kojto | 148:fd96258d940d | 107 | * @param base Base address of the GINT peripheral. |
Kojto | 148:fd96258d940d | 108 | * |
Kojto | 148:fd96258d940d | 109 | * @retval None. |
Kojto | 148:fd96258d940d | 110 | */ |
Kojto | 148:fd96258d940d | 111 | void GINT_Init(GINT_Type *base); |
Kojto | 148:fd96258d940d | 112 | |
Kojto | 148:fd96258d940d | 113 | /*! |
Kojto | 148:fd96258d940d | 114 | * @brief Setup GINT peripheral control parameters. |
Kojto | 148:fd96258d940d | 115 | |
Kojto | 148:fd96258d940d | 116 | * This function sets the control parameters of GINT peripheral. |
Kojto | 148:fd96258d940d | 117 | * |
Kojto | 148:fd96258d940d | 118 | * @param base Base address of the GINT peripheral. |
Kojto | 148:fd96258d940d | 119 | * @param comb Controls if the enabled inputs are logically ORed or ANDed for interrupt generation. |
Kojto | 148:fd96258d940d | 120 | * @param trig Controls if the enabled inputs are level or edge sensitive based on polarity. |
Kojto | 148:fd96258d940d | 121 | * @param callback This function is called when configured group interrupt is generated. |
Kojto | 148:fd96258d940d | 122 | * |
Kojto | 148:fd96258d940d | 123 | * @retval None. |
Kojto | 148:fd96258d940d | 124 | */ |
Kojto | 148:fd96258d940d | 125 | void GINT_SetCtrl(GINT_Type *base, gint_comb_t comb, gint_trig_t trig, gint_cb_t callback); |
Kojto | 148:fd96258d940d | 126 | |
Kojto | 148:fd96258d940d | 127 | /*! |
Kojto | 148:fd96258d940d | 128 | * @brief Get GINT peripheral control parameters. |
Kojto | 148:fd96258d940d | 129 | |
Kojto | 148:fd96258d940d | 130 | * This function returns the control parameters of GINT peripheral. |
Kojto | 148:fd96258d940d | 131 | * |
Kojto | 148:fd96258d940d | 132 | * @param base Base address of the GINT peripheral. |
Kojto | 148:fd96258d940d | 133 | * @param comb Pointer to store combine input value. |
Kojto | 148:fd96258d940d | 134 | * @param trig Pointer to store trigger value. |
Kojto | 148:fd96258d940d | 135 | * @param callback Pointer to store callback function. |
Kojto | 148:fd96258d940d | 136 | * |
Kojto | 148:fd96258d940d | 137 | * @retval None. |
Kojto | 148:fd96258d940d | 138 | */ |
Kojto | 148:fd96258d940d | 139 | void GINT_GetCtrl(GINT_Type *base, gint_comb_t *comb, gint_trig_t *trig, gint_cb_t *callback); |
Kojto | 148:fd96258d940d | 140 | |
Kojto | 148:fd96258d940d | 141 | /*! |
Kojto | 148:fd96258d940d | 142 | * @brief Configure GINT peripheral pins. |
Kojto | 148:fd96258d940d | 143 | |
Kojto | 148:fd96258d940d | 144 | * This function enables and controls the polarity of enabled pin(s) of a given port. |
Kojto | 148:fd96258d940d | 145 | * |
Kojto | 148:fd96258d940d | 146 | * @param base Base address of the GINT peripheral. |
Kojto | 148:fd96258d940d | 147 | * @param port Port number. |
Kojto | 148:fd96258d940d | 148 | * @param polarityMask Each bit position selects the polarity of the corresponding enabled pin. |
Kojto | 148:fd96258d940d | 149 | * 0 = The pin is active LOW. 1 = The pin is active HIGH. |
Kojto | 148:fd96258d940d | 150 | * @param enableMask Each bit position selects if the corresponding pin is enabled or not. |
Kojto | 148:fd96258d940d | 151 | * 0 = The pin is disabled. 1 = The pin is enabled. |
Kojto | 148:fd96258d940d | 152 | * |
Kojto | 148:fd96258d940d | 153 | * @retval None. |
Kojto | 148:fd96258d940d | 154 | */ |
Kojto | 148:fd96258d940d | 155 | void GINT_ConfigPins(GINT_Type *base, gint_port_t port, uint32_t polarityMask, uint32_t enableMask); |
Kojto | 148:fd96258d940d | 156 | |
Kojto | 148:fd96258d940d | 157 | /*! |
Kojto | 148:fd96258d940d | 158 | * @brief Get GINT peripheral pin configuration. |
Kojto | 148:fd96258d940d | 159 | |
Kojto | 148:fd96258d940d | 160 | * This function returns the pin configuration of a given port. |
Kojto | 148:fd96258d940d | 161 | * |
Kojto | 148:fd96258d940d | 162 | * @param base Base address of the GINT peripheral. |
Kojto | 148:fd96258d940d | 163 | * @param port Port number. |
Kojto | 148:fd96258d940d | 164 | * @param polarityMask Pointer to store the polarity mask Each bit position indicates the polarity of the corresponding |
Kojto | 148:fd96258d940d | 165 | enabled pin. |
Kojto | 148:fd96258d940d | 166 | * 0 = The pin is active LOW. 1 = The pin is active HIGH. |
Kojto | 148:fd96258d940d | 167 | * @param enableMask Pointer to store the enable mask. Each bit position indicates if the corresponding pin is enabled |
Kojto | 148:fd96258d940d | 168 | or not. |
Kojto | 148:fd96258d940d | 169 | * 0 = The pin is disabled. 1 = The pin is enabled. |
Kojto | 148:fd96258d940d | 170 | * |
Kojto | 148:fd96258d940d | 171 | * @retval None. |
Kojto | 148:fd96258d940d | 172 | */ |
Kojto | 148:fd96258d940d | 173 | void GINT_GetConfigPins(GINT_Type *base, gint_port_t port, uint32_t *polarityMask, uint32_t *enableMask); |
Kojto | 148:fd96258d940d | 174 | |
Kojto | 148:fd96258d940d | 175 | /*! |
Kojto | 148:fd96258d940d | 176 | * @brief Enable callback. |
Kojto | 148:fd96258d940d | 177 | |
Kojto | 148:fd96258d940d | 178 | * This function enables the interrupt for the selected GINT peripheral. Although the pin(s) are monitored |
Kojto | 148:fd96258d940d | 179 | * as soon as they are enabled, the callback function is not enabled until this function is called. |
Kojto | 148:fd96258d940d | 180 | * |
Kojto | 148:fd96258d940d | 181 | * @param base Base address of the GINT peripheral. |
Kojto | 148:fd96258d940d | 182 | * |
Kojto | 148:fd96258d940d | 183 | * @retval None. |
Kojto | 148:fd96258d940d | 184 | */ |
Kojto | 148:fd96258d940d | 185 | void GINT_EnableCallback(GINT_Type *base); |
Kojto | 148:fd96258d940d | 186 | |
Kojto | 148:fd96258d940d | 187 | /*! |
Kojto | 148:fd96258d940d | 188 | * @brief Disable callback. |
Kojto | 148:fd96258d940d | 189 | |
Kojto | 148:fd96258d940d | 190 | * This function disables the interrupt for the selected GINT peripheral. Although the pins are still |
Kojto | 148:fd96258d940d | 191 | * being monitored but the callback function is not called. |
Kojto | 148:fd96258d940d | 192 | * |
Kojto | 148:fd96258d940d | 193 | * @param base Base address of the peripheral. |
Kojto | 148:fd96258d940d | 194 | * |
Kojto | 148:fd96258d940d | 195 | * @retval None. |
Kojto | 148:fd96258d940d | 196 | */ |
Kojto | 148:fd96258d940d | 197 | void GINT_DisableCallback(GINT_Type *base); |
Kojto | 148:fd96258d940d | 198 | |
Kojto | 148:fd96258d940d | 199 | /*! |
Kojto | 148:fd96258d940d | 200 | * @brief Clear GINT status. |
Kojto | 148:fd96258d940d | 201 | |
Kojto | 148:fd96258d940d | 202 | * This function clears the GINT status bit. |
Kojto | 148:fd96258d940d | 203 | * |
Kojto | 148:fd96258d940d | 204 | * @param base Base address of the GINT peripheral. |
Kojto | 148:fd96258d940d | 205 | * |
Kojto | 148:fd96258d940d | 206 | * @retval None. |
Kojto | 148:fd96258d940d | 207 | */ |
Kojto | 148:fd96258d940d | 208 | static inline void GINT_ClrStatus(GINT_Type *base) |
Kojto | 148:fd96258d940d | 209 | { |
Kojto | 148:fd96258d940d | 210 | base->CTRL |= GINT_CTRL_INT_MASK; |
Kojto | 148:fd96258d940d | 211 | } |
Kojto | 148:fd96258d940d | 212 | |
Kojto | 148:fd96258d940d | 213 | /*! |
Kojto | 148:fd96258d940d | 214 | * @brief Get GINT status. |
Kojto | 148:fd96258d940d | 215 | |
Kojto | 148:fd96258d940d | 216 | * This function returns the GINT status. |
Kojto | 148:fd96258d940d | 217 | * |
Kojto | 148:fd96258d940d | 218 | * @param base Base address of the GINT peripheral. |
Kojto | 148:fd96258d940d | 219 | * |
Kojto | 148:fd96258d940d | 220 | * @retval status = 0 No group interrupt request. = 1 Group interrupt request active. |
Kojto | 148:fd96258d940d | 221 | */ |
Kojto | 148:fd96258d940d | 222 | static inline uint32_t GINT_GetStatus(GINT_Type *base) |
Kojto | 148:fd96258d940d | 223 | { |
Kojto | 148:fd96258d940d | 224 | return (base->CTRL & GINT_CTRL_INT_MASK); |
Kojto | 148:fd96258d940d | 225 | } |
Kojto | 148:fd96258d940d | 226 | |
Kojto | 148:fd96258d940d | 227 | /*! |
Kojto | 148:fd96258d940d | 228 | * @brief Deinitialize GINT peripheral. |
Kojto | 148:fd96258d940d | 229 | |
Kojto | 148:fd96258d940d | 230 | * This function disables the GINT clock. |
Kojto | 148:fd96258d940d | 231 | * |
Kojto | 148:fd96258d940d | 232 | * @param base Base address of the GINT peripheral. |
Kojto | 148:fd96258d940d | 233 | * |
Kojto | 148:fd96258d940d | 234 | * @retval None. |
Kojto | 148:fd96258d940d | 235 | */ |
Kojto | 148:fd96258d940d | 236 | void GINT_Deinit(GINT_Type *base); |
Kojto | 148:fd96258d940d | 237 | |
Kojto | 148:fd96258d940d | 238 | #ifdef __cplusplus |
Kojto | 148:fd96258d940d | 239 | } |
Kojto | 148:fd96258d940d | 240 | #endif |
Kojto | 148:fd96258d940d | 241 | |
Kojto | 148:fd96258d940d | 242 | /*@}*/ |
Kojto | 148:fd96258d940d | 243 | |
Kojto | 148:fd96258d940d | 244 | #endif /* _FSL_GINT_H_ */ |