mbed official / mbed-dev

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Tue Mar 20 16:56:18 2018 +0000
Revision:
182:a56a73fd2a6f
Parent:
175:af195413fb11
mbed-dev library. Release version 160

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 170:19eb464bc2be 1 /*
AnnaBridge 182:a56a73fd2a6f 2 * The Clear BSD License
Kojto 170:19eb464bc2be 3 * Copyright (c) 2016, Freescale Semiconductor, Inc.
Kojto 170:19eb464bc2be 4 * Copyright 2016-2017 NXP
AnnaBridge 182:a56a73fd2a6f 5 * All rights reserved.
Kojto 170:19eb464bc2be 6 *
Kojto 170:19eb464bc2be 7 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 182:a56a73fd2a6f 8 * are permitted (subject to the limitations in the disclaimer below) provided
AnnaBridge 182:a56a73fd2a6f 9 * that the following conditions are met:
Kojto 170:19eb464bc2be 10 *
Kojto 170:19eb464bc2be 11 * o Redistributions of source code must retain the above copyright notice, this list
Kojto 170:19eb464bc2be 12 * of conditions and the following disclaimer.
Kojto 170:19eb464bc2be 13 *
Kojto 170:19eb464bc2be 14 * o Redistributions in binary form must reproduce the above copyright notice, this
Kojto 170:19eb464bc2be 15 * list of conditions and the following disclaimer in the documentation and/or
Kojto 170:19eb464bc2be 16 * other materials provided with the distribution.
Kojto 170:19eb464bc2be 17 *
Kojto 170:19eb464bc2be 18 * o Neither the name of the copyright holder nor the names of its
Kojto 170:19eb464bc2be 19 * contributors may be used to endorse or promote products derived from this
Kojto 170:19eb464bc2be 20 * software without specific prior written permission.
Kojto 170:19eb464bc2be 21 *
AnnaBridge 182:a56a73fd2a6f 22 * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
Kojto 170:19eb464bc2be 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
Kojto 170:19eb464bc2be 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Kojto 170:19eb464bc2be 25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 170:19eb464bc2be 26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
Kojto 170:19eb464bc2be 27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
Kojto 170:19eb464bc2be 28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
Kojto 170:19eb464bc2be 29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
Kojto 170:19eb464bc2be 30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Kojto 170:19eb464bc2be 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Kojto 170:19eb464bc2be 32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 170:19eb464bc2be 33 */
Kojto 170:19eb464bc2be 34
Kojto 170:19eb464bc2be 35 #ifndef _FSL_PINT_H_
Kojto 170:19eb464bc2be 36 #define _FSL_PINT_H_
Kojto 170:19eb464bc2be 37
Kojto 170:19eb464bc2be 38 #include "fsl_common.h"
Kojto 170:19eb464bc2be 39
Kojto 170:19eb464bc2be 40 /*!
Kojto 170:19eb464bc2be 41 * @addtogroup pint_driver
Kojto 170:19eb464bc2be 42 * @{
Kojto 170:19eb464bc2be 43 */
Kojto 170:19eb464bc2be 44
Kojto 170:19eb464bc2be 45 /*! @file */
Kojto 170:19eb464bc2be 46
Kojto 170:19eb464bc2be 47 /*******************************************************************************
Kojto 170:19eb464bc2be 48 * Definitions
Kojto 170:19eb464bc2be 49 ******************************************************************************/
Kojto 170:19eb464bc2be 50
Kojto 170:19eb464bc2be 51 /*! @name Driver version */
Kojto 170:19eb464bc2be 52 /*@{*/
Kojto 170:19eb464bc2be 53 #define FSL_PINT_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) /*!< Version 2.0.0 */
Kojto 170:19eb464bc2be 54 /*@}*/
Kojto 170:19eb464bc2be 55
Kojto 170:19eb464bc2be 56 /* Number of interrupt line supported by PINT */
Kojto 170:19eb464bc2be 57 #define PINT_PIN_INT_COUNT 8U
Kojto 170:19eb464bc2be 58
Kojto 170:19eb464bc2be 59 /* Number of input sources supported by PINT */
Kojto 170:19eb464bc2be 60 #define PINT_INPUT_COUNT 8U
Kojto 170:19eb464bc2be 61
Kojto 170:19eb464bc2be 62 /* PININT Bit slice source register bits */
Kojto 170:19eb464bc2be 63 #define PININT_BITSLICE_SRC_START 8U
Kojto 170:19eb464bc2be 64 #define PININT_BITSLICE_SRC_MASK 7U
Kojto 170:19eb464bc2be 65
Kojto 170:19eb464bc2be 66 /* PININT Bit slice configuration register bits */
Kojto 170:19eb464bc2be 67 #define PININT_BITSLICE_CFG_START 8U
Kojto 170:19eb464bc2be 68 #define PININT_BITSLICE_CFG_MASK 7U
Kojto 170:19eb464bc2be 69 #define PININT_BITSLICE_ENDP_MASK 7U
Kojto 170:19eb464bc2be 70
Kojto 170:19eb464bc2be 71 #define PINT_PIN_INT_LEVEL 0x10U
Kojto 170:19eb464bc2be 72 #define PINT_PIN_INT_EDGE 0x00U
Kojto 170:19eb464bc2be 73 #define PINT_PIN_INT_FALL_OR_HIGH_LEVEL 0x02U
Kojto 170:19eb464bc2be 74 #define PINT_PIN_INT_RISE 0x01U
Kojto 170:19eb464bc2be 75 #define PINT_PIN_RISE_EDGE (PINT_PIN_INT_EDGE | PINT_PIN_INT_RISE)
Kojto 170:19eb464bc2be 76 #define PINT_PIN_FALL_EDGE (PINT_PIN_INT_EDGE | PINT_PIN_INT_FALL_OR_HIGH_LEVEL)
Kojto 170:19eb464bc2be 77 #define PINT_PIN_BOTH_EDGE (PINT_PIN_INT_EDGE | PINT_PIN_INT_RISE | PINT_PIN_INT_FALL_OR_HIGH_LEVEL)
Kojto 170:19eb464bc2be 78 #define PINT_PIN_LOW_LEVEL (PINT_PIN_INT_LEVEL)
Kojto 170:19eb464bc2be 79 #define PINT_PIN_HIGH_LEVEL (PINT_PIN_INT_LEVEL | PINT_PIN_INT_FALL_OR_HIGH_LEVEL)
Kojto 170:19eb464bc2be 80
Kojto 170:19eb464bc2be 81 /*! @brief PINT Pin Interrupt enable type */
Kojto 170:19eb464bc2be 82 typedef enum _pint_pin_enable
Kojto 170:19eb464bc2be 83 {
Kojto 170:19eb464bc2be 84 kPINT_PinIntEnableNone = 0U, /*!< Do not generate Pin Interrupt */
Kojto 170:19eb464bc2be 85 kPINT_PinIntEnableRiseEdge = PINT_PIN_RISE_EDGE, /*!< Generate Pin Interrupt on rising edge */
Kojto 170:19eb464bc2be 86 kPINT_PinIntEnableFallEdge = PINT_PIN_FALL_EDGE, /*!< Generate Pin Interrupt on falling edge */
Kojto 170:19eb464bc2be 87 kPINT_PinIntEnableBothEdges = PINT_PIN_BOTH_EDGE, /*!< Generate Pin Interrupt on both edges */
Kojto 170:19eb464bc2be 88 kPINT_PinIntEnableLowLevel = PINT_PIN_LOW_LEVEL, /*!< Generate Pin Interrupt on low level */
Kojto 170:19eb464bc2be 89 kPINT_PinIntEnableHighLevel = PINT_PIN_HIGH_LEVEL /*!< Generate Pin Interrupt on high level */
Kojto 170:19eb464bc2be 90 } pint_pin_enable_t;
Kojto 170:19eb464bc2be 91
Kojto 170:19eb464bc2be 92 /*! @brief PINT Pin Interrupt type */
Kojto 170:19eb464bc2be 93 typedef enum _pint_int
Kojto 170:19eb464bc2be 94 {
Kojto 170:19eb464bc2be 95 kPINT_PinInt0 = 0U, /*!< Pin Interrupt 0 */
Kojto 170:19eb464bc2be 96 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 1U)
Kojto 170:19eb464bc2be 97 kPINT_PinInt1 = 1U, /*!< Pin Interrupt 1 */
Kojto 170:19eb464bc2be 98 #endif
Kojto 170:19eb464bc2be 99 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 2U)
Kojto 170:19eb464bc2be 100 kPINT_PinInt2 = 2U, /*!< Pin Interrupt 2 */
Kojto 170:19eb464bc2be 101 #endif
Kojto 170:19eb464bc2be 102 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 3U)
Kojto 170:19eb464bc2be 103 kPINT_PinInt3 = 3U, /*!< Pin Interrupt 3 */
Kojto 170:19eb464bc2be 104 #endif
Kojto 170:19eb464bc2be 105 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 4U)
Kojto 170:19eb464bc2be 106 kPINT_PinInt4 = 4U, /*!< Pin Interrupt 4 */
Kojto 170:19eb464bc2be 107 #endif
Kojto 170:19eb464bc2be 108 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 5U)
Kojto 170:19eb464bc2be 109 kPINT_PinInt5 = 5U, /*!< Pin Interrupt 5 */
Kojto 170:19eb464bc2be 110 #endif
Kojto 170:19eb464bc2be 111 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 6U)
Kojto 170:19eb464bc2be 112 kPINT_PinInt6 = 6U, /*!< Pin Interrupt 6 */
Kojto 170:19eb464bc2be 113 #endif
Kojto 170:19eb464bc2be 114 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 7U)
Kojto 170:19eb464bc2be 115 kPINT_PinInt7 = 7U, /*!< Pin Interrupt 7 */
Kojto 170:19eb464bc2be 116 #endif
Kojto 170:19eb464bc2be 117 } pint_pin_int_t;
Kojto 170:19eb464bc2be 118
Kojto 170:19eb464bc2be 119 /*! @brief PINT Pattern Match bit slice input source type */
Kojto 170:19eb464bc2be 120 typedef enum _pint_pmatch_input_src
Kojto 170:19eb464bc2be 121 {
Kojto 170:19eb464bc2be 122 kPINT_PatternMatchInp0Src = 0U, /*!< Input source 0 */
Kojto 170:19eb464bc2be 123 kPINT_PatternMatchInp1Src = 1U, /*!< Input source 1 */
Kojto 170:19eb464bc2be 124 kPINT_PatternMatchInp2Src = 2U, /*!< Input source 2 */
Kojto 170:19eb464bc2be 125 kPINT_PatternMatchInp3Src = 3U, /*!< Input source 3 */
Kojto 170:19eb464bc2be 126 kPINT_PatternMatchInp4Src = 4U, /*!< Input source 4 */
Kojto 170:19eb464bc2be 127 kPINT_PatternMatchInp5Src = 5U, /*!< Input source 5 */
Kojto 170:19eb464bc2be 128 kPINT_PatternMatchInp6Src = 6U, /*!< Input source 6 */
Kojto 170:19eb464bc2be 129 kPINT_PatternMatchInp7Src = 7U, /*!< Input source 7 */
Kojto 170:19eb464bc2be 130 } pint_pmatch_input_src_t;
Kojto 170:19eb464bc2be 131
Kojto 170:19eb464bc2be 132 /*! @brief PINT Pattern Match bit slice type */
Kojto 170:19eb464bc2be 133 typedef enum _pint_pmatch_bslice
Kojto 170:19eb464bc2be 134 {
Kojto 170:19eb464bc2be 135 kPINT_PatternMatchBSlice0 = 0U, /*!< Bit slice 0 */
Kojto 170:19eb464bc2be 136 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 1U)
Kojto 170:19eb464bc2be 137 kPINT_PatternMatchBSlice1 = 1U, /*!< Bit slice 1 */
Kojto 170:19eb464bc2be 138 #endif
Kojto 170:19eb464bc2be 139 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 2U)
Kojto 170:19eb464bc2be 140 kPINT_PatternMatchBSlice2 = 2U, /*!< Bit slice 2 */
Kojto 170:19eb464bc2be 141 #endif
Kojto 170:19eb464bc2be 142 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 3U)
Kojto 170:19eb464bc2be 143 kPINT_PatternMatchBSlice3 = 3U, /*!< Bit slice 3 */
Kojto 170:19eb464bc2be 144 #endif
Kojto 170:19eb464bc2be 145 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 4U)
Kojto 170:19eb464bc2be 146 kPINT_PatternMatchBSlice4 = 4U, /*!< Bit slice 4 */
Kojto 170:19eb464bc2be 147 #endif
Kojto 170:19eb464bc2be 148 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 5U)
Kojto 170:19eb464bc2be 149 kPINT_PatternMatchBSlice5 = 5U, /*!< Bit slice 5 */
Kojto 170:19eb464bc2be 150 #endif
Kojto 170:19eb464bc2be 151 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 6U)
Kojto 170:19eb464bc2be 152 kPINT_PatternMatchBSlice6 = 6U, /*!< Bit slice 6 */
Kojto 170:19eb464bc2be 153 #endif
Kojto 170:19eb464bc2be 154 #if (FSL_FEATURE_PINT_NUMBER_OF_CONNECTED_OUTPUTS > 7U)
Kojto 170:19eb464bc2be 155 kPINT_PatternMatchBSlice7 = 7U, /*!< Bit slice 7 */
Kojto 170:19eb464bc2be 156 #endif
Kojto 170:19eb464bc2be 157 } pint_pmatch_bslice_t;
Kojto 170:19eb464bc2be 158
Kojto 170:19eb464bc2be 159 /*! @brief PINT Pattern Match configuration type */
Kojto 170:19eb464bc2be 160 typedef enum _pint_pmatch_bslice_cfg
Kojto 170:19eb464bc2be 161 {
Kojto 170:19eb464bc2be 162 kPINT_PatternMatchAlways = 0U, /*!< Always Contributes to product term match */
Kojto 170:19eb464bc2be 163 kPINT_PatternMatchStickyRise = 1U, /*!< Sticky Rising edge */
Kojto 170:19eb464bc2be 164 kPINT_PatternMatchStickyFall = 2U, /*!< Sticky Falling edge */
Kojto 170:19eb464bc2be 165 kPINT_PatternMatchStickyBothEdges = 3U, /*!< Sticky Rising or Falling edge */
Kojto 170:19eb464bc2be 166 kPINT_PatternMatchHigh = 4U, /*!< High level */
Kojto 170:19eb464bc2be 167 kPINT_PatternMatchLow = 5U, /*!< Low level */
Kojto 170:19eb464bc2be 168 kPINT_PatternMatchNever = 6U, /*!< Never contributes to product term match */
Kojto 170:19eb464bc2be 169 kPINT_PatternMatchBothEdges = 7U, /*!< Either rising or falling edge */
Kojto 170:19eb464bc2be 170 } pint_pmatch_bslice_cfg_t;
Kojto 170:19eb464bc2be 171
Kojto 170:19eb464bc2be 172 /*! @brief PINT Callback function. */
Kojto 170:19eb464bc2be 173 typedef void (*pint_cb_t)(pint_pin_int_t pintr, uint32_t pmatch_status);
Kojto 170:19eb464bc2be 174
Kojto 170:19eb464bc2be 175 typedef struct _pint_pmatch_cfg
Kojto 170:19eb464bc2be 176 {
Kojto 170:19eb464bc2be 177 pint_pmatch_input_src_t bs_src;
Kojto 170:19eb464bc2be 178 pint_pmatch_bslice_cfg_t bs_cfg;
Kojto 170:19eb464bc2be 179 bool end_point;
Kojto 170:19eb464bc2be 180 pint_cb_t callback;
Kojto 170:19eb464bc2be 181 } pint_pmatch_cfg_t;
Kojto 170:19eb464bc2be 182
Kojto 170:19eb464bc2be 183 /*******************************************************************************
Kojto 170:19eb464bc2be 184 * API
Kojto 170:19eb464bc2be 185 ******************************************************************************/
Kojto 170:19eb464bc2be 186
Kojto 170:19eb464bc2be 187 #if defined(__cplusplus)
Kojto 170:19eb464bc2be 188 extern "C" {
Kojto 170:19eb464bc2be 189 #endif
Kojto 170:19eb464bc2be 190
Kojto 170:19eb464bc2be 191 /*!
Kojto 170:19eb464bc2be 192 * @brief Initialize PINT peripheral.
Kojto 170:19eb464bc2be 193
Kojto 170:19eb464bc2be 194 * This function initializes the PINT peripheral and enables the clock.
Kojto 170:19eb464bc2be 195 *
Kojto 170:19eb464bc2be 196 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 197 *
Kojto 170:19eb464bc2be 198 * @retval None.
Kojto 170:19eb464bc2be 199 */
Kojto 170:19eb464bc2be 200 void PINT_Init(PINT_Type *base);
Kojto 170:19eb464bc2be 201
Kojto 170:19eb464bc2be 202 /*!
Kojto 170:19eb464bc2be 203 * @brief Configure PINT peripheral pin interrupt.
Kojto 170:19eb464bc2be 204
Kojto 170:19eb464bc2be 205 * This function configures a given pin interrupt.
Kojto 170:19eb464bc2be 206 *
Kojto 170:19eb464bc2be 207 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 208 * @param intr Pin interrupt.
Kojto 170:19eb464bc2be 209 * @param enable Selects detection logic.
Kojto 170:19eb464bc2be 210 * @param callback Callback.
Kojto 170:19eb464bc2be 211 *
Kojto 170:19eb464bc2be 212 * @retval None.
Kojto 170:19eb464bc2be 213 */
Kojto 170:19eb464bc2be 214 void PINT_PinInterruptConfig(PINT_Type *base, pint_pin_int_t intr, pint_pin_enable_t enable, pint_cb_t callback);
Kojto 170:19eb464bc2be 215
Kojto 170:19eb464bc2be 216 /*!
Kojto 170:19eb464bc2be 217 * @brief Get PINT peripheral pin interrupt configuration.
Kojto 170:19eb464bc2be 218
Kojto 170:19eb464bc2be 219 * This function returns the configuration of a given pin interrupt.
Kojto 170:19eb464bc2be 220 *
Kojto 170:19eb464bc2be 221 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 222 * @param pintr Pin interrupt.
Kojto 170:19eb464bc2be 223 * @param enable Pointer to store the detection logic.
Kojto 170:19eb464bc2be 224 * @param callback Callback.
Kojto 170:19eb464bc2be 225 *
Kojto 170:19eb464bc2be 226 * @retval None.
Kojto 170:19eb464bc2be 227 */
Kojto 170:19eb464bc2be 228 void PINT_PinInterruptGetConfig(PINT_Type *base, pint_pin_int_t pintr, pint_pin_enable_t *enable, pint_cb_t *callback);
Kojto 170:19eb464bc2be 229
Kojto 170:19eb464bc2be 230 /*!
Kojto 170:19eb464bc2be 231 * @brief Clear Selected pin interrupt status.
Kojto 170:19eb464bc2be 232
Kojto 170:19eb464bc2be 233 * This function clears the selected pin interrupt status.
Kojto 170:19eb464bc2be 234 *
Kojto 170:19eb464bc2be 235 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 236 * @param pintr Pin interrupt.
Kojto 170:19eb464bc2be 237 *
Kojto 170:19eb464bc2be 238 * @retval None.
Kojto 170:19eb464bc2be 239 */
Kojto 170:19eb464bc2be 240 static inline void PINT_PinInterruptClrStatus(PINT_Type *base, pint_pin_int_t pintr)
Kojto 170:19eb464bc2be 241 {
Kojto 170:19eb464bc2be 242 base->IST = (1U << pintr);
Kojto 170:19eb464bc2be 243 }
Kojto 170:19eb464bc2be 244
Kojto 170:19eb464bc2be 245 /*!
Kojto 170:19eb464bc2be 246 * @brief Get Selected pin interrupt status.
Kojto 170:19eb464bc2be 247
Kojto 170:19eb464bc2be 248 * This function returns the selected pin interrupt status.
Kojto 170:19eb464bc2be 249 *
Kojto 170:19eb464bc2be 250 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 251 * @param pintr Pin interrupt.
Kojto 170:19eb464bc2be 252 *
Kojto 170:19eb464bc2be 253 * @retval status = 0 No pin interrupt request. = 1 Selected Pin interrupt request active.
Kojto 170:19eb464bc2be 254 */
Kojto 170:19eb464bc2be 255 static inline uint32_t PINT_PinInterruptGetStatus(PINT_Type *base, pint_pin_int_t pintr)
Kojto 170:19eb464bc2be 256 {
Kojto 170:19eb464bc2be 257 return ((base->IST & (1U << pintr)) ? 1U : 0U);
Kojto 170:19eb464bc2be 258 }
Kojto 170:19eb464bc2be 259
Kojto 170:19eb464bc2be 260 /*!
Kojto 170:19eb464bc2be 261 * @brief Clear all pin interrupts status.
Kojto 170:19eb464bc2be 262
Kojto 170:19eb464bc2be 263 * This function clears the status of all pin interrupts.
Kojto 170:19eb464bc2be 264 *
Kojto 170:19eb464bc2be 265 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 266 *
Kojto 170:19eb464bc2be 267 * @retval None.
Kojto 170:19eb464bc2be 268 */
Kojto 170:19eb464bc2be 269 static inline void PINT_PinInterruptClrStatusAll(PINT_Type *base)
Kojto 170:19eb464bc2be 270 {
Kojto 170:19eb464bc2be 271 base->IST = PINT_IST_PSTAT_MASK;
Kojto 170:19eb464bc2be 272 }
Kojto 170:19eb464bc2be 273
Kojto 170:19eb464bc2be 274 /*!
Kojto 170:19eb464bc2be 275 * @brief Get all pin interrupts status.
Kojto 170:19eb464bc2be 276
Kojto 170:19eb464bc2be 277 * This function returns the status of all pin interrupts.
Kojto 170:19eb464bc2be 278 *
Kojto 170:19eb464bc2be 279 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 280 *
Kojto 170:19eb464bc2be 281 * @retval status Each bit position indicates the status of corresponding pin interrupt.
Kojto 170:19eb464bc2be 282 * = 0 No pin interrupt request. = 1 Pin interrupt request active.
Kojto 170:19eb464bc2be 283 */
Kojto 170:19eb464bc2be 284 static inline uint32_t PINT_PinInterruptGetStatusAll(PINT_Type *base)
Kojto 170:19eb464bc2be 285 {
Kojto 170:19eb464bc2be 286 return (base->IST);
Kojto 170:19eb464bc2be 287 }
Kojto 170:19eb464bc2be 288
Kojto 170:19eb464bc2be 289 /*!
Kojto 170:19eb464bc2be 290 * @brief Clear Selected pin interrupt fall flag.
Kojto 170:19eb464bc2be 291
Kojto 170:19eb464bc2be 292 * This function clears the selected pin interrupt fall flag.
Kojto 170:19eb464bc2be 293 *
Kojto 170:19eb464bc2be 294 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 295 * @param pintr Pin interrupt.
Kojto 170:19eb464bc2be 296 *
Kojto 170:19eb464bc2be 297 * @retval None.
Kojto 170:19eb464bc2be 298 */
Kojto 170:19eb464bc2be 299 static inline void PINT_PinInterruptClrFallFlag(PINT_Type *base, pint_pin_int_t pintr)
Kojto 170:19eb464bc2be 300 {
Kojto 170:19eb464bc2be 301 base->FALL = (1U << pintr);
Kojto 170:19eb464bc2be 302 }
Kojto 170:19eb464bc2be 303
Kojto 170:19eb464bc2be 304 /*!
Kojto 170:19eb464bc2be 305 * @brief Get selected pin interrupt fall flag.
Kojto 170:19eb464bc2be 306
Kojto 170:19eb464bc2be 307 * This function returns the selected pin interrupt fall flag.
Kojto 170:19eb464bc2be 308 *
Kojto 170:19eb464bc2be 309 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 310 * @param pintr Pin interrupt.
Kojto 170:19eb464bc2be 311 *
Kojto 170:19eb464bc2be 312 * @retval flag = 0 Falling edge has not been detected. = 1 Falling edge has been detected.
Kojto 170:19eb464bc2be 313 */
Kojto 170:19eb464bc2be 314 static inline uint32_t PINT_PinInterruptGetFallFlag(PINT_Type *base, pint_pin_int_t pintr)
Kojto 170:19eb464bc2be 315 {
Kojto 170:19eb464bc2be 316 return ((base->FALL & (1U << pintr)) ? 1U : 0U);
Kojto 170:19eb464bc2be 317 }
Kojto 170:19eb464bc2be 318
Kojto 170:19eb464bc2be 319 /*!
Kojto 170:19eb464bc2be 320 * @brief Clear all pin interrupt fall flags.
Kojto 170:19eb464bc2be 321
Kojto 170:19eb464bc2be 322 * This function clears the fall flag for all pin interrupts.
Kojto 170:19eb464bc2be 323 *
Kojto 170:19eb464bc2be 324 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 325 *
Kojto 170:19eb464bc2be 326 * @retval None.
Kojto 170:19eb464bc2be 327 */
Kojto 170:19eb464bc2be 328 static inline void PINT_PinInterruptClrFallFlagAll(PINT_Type *base)
Kojto 170:19eb464bc2be 329 {
Kojto 170:19eb464bc2be 330 base->FALL = PINT_FALL_FDET_MASK;
Kojto 170:19eb464bc2be 331 }
Kojto 170:19eb464bc2be 332
Kojto 170:19eb464bc2be 333 /*!
Kojto 170:19eb464bc2be 334 * @brief Get all pin interrupt fall flags.
Kojto 170:19eb464bc2be 335
Kojto 170:19eb464bc2be 336 * This function returns the fall flag of all pin interrupts.
Kojto 170:19eb464bc2be 337 *
Kojto 170:19eb464bc2be 338 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 339 *
Kojto 170:19eb464bc2be 340 * @retval flags Each bit position indicates the falling edge detection of the corresponding pin interrupt.
Kojto 170:19eb464bc2be 341 * 0 Falling edge has not been detected. = 1 Falling edge has been detected.
Kojto 170:19eb464bc2be 342 */
Kojto 170:19eb464bc2be 343 static inline uint32_t PINT_PinInterruptGetFallFlagAll(PINT_Type *base)
Kojto 170:19eb464bc2be 344 {
Kojto 170:19eb464bc2be 345 return (base->FALL);
Kojto 170:19eb464bc2be 346 }
Kojto 170:19eb464bc2be 347
Kojto 170:19eb464bc2be 348 /*!
Kojto 170:19eb464bc2be 349 * @brief Clear Selected pin interrupt rise flag.
Kojto 170:19eb464bc2be 350
Kojto 170:19eb464bc2be 351 * This function clears the selected pin interrupt rise flag.
Kojto 170:19eb464bc2be 352 *
Kojto 170:19eb464bc2be 353 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 354 * @param pintr Pin interrupt.
Kojto 170:19eb464bc2be 355 *
Kojto 170:19eb464bc2be 356 * @retval None.
Kojto 170:19eb464bc2be 357 */
Kojto 170:19eb464bc2be 358 static inline void PINT_PinInterruptClrRiseFlag(PINT_Type *base, pint_pin_int_t pintr)
Kojto 170:19eb464bc2be 359 {
Kojto 170:19eb464bc2be 360 base->RISE = (1U << pintr);
Kojto 170:19eb464bc2be 361 }
Kojto 170:19eb464bc2be 362
Kojto 170:19eb464bc2be 363 /*!
Kojto 170:19eb464bc2be 364 * @brief Get selected pin interrupt rise flag.
Kojto 170:19eb464bc2be 365
Kojto 170:19eb464bc2be 366 * This function returns the selected pin interrupt rise flag.
Kojto 170:19eb464bc2be 367 *
Kojto 170:19eb464bc2be 368 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 369 * @param pintr Pin interrupt.
Kojto 170:19eb464bc2be 370 *
Kojto 170:19eb464bc2be 371 * @retval flag = 0 Rising edge has not been detected. = 1 Rising edge has been detected.
Kojto 170:19eb464bc2be 372 */
Kojto 170:19eb464bc2be 373 static inline uint32_t PINT_PinInterruptGetRiseFlag(PINT_Type *base, pint_pin_int_t pintr)
Kojto 170:19eb464bc2be 374 {
Kojto 170:19eb464bc2be 375 return ((base->RISE & (1U << pintr)) ? 1U : 0U);
Kojto 170:19eb464bc2be 376 }
Kojto 170:19eb464bc2be 377
Kojto 170:19eb464bc2be 378 /*!
Kojto 170:19eb464bc2be 379 * @brief Clear all pin interrupt rise flags.
Kojto 170:19eb464bc2be 380
Kojto 170:19eb464bc2be 381 * This function clears the rise flag for all pin interrupts.
Kojto 170:19eb464bc2be 382 *
Kojto 170:19eb464bc2be 383 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 384 *
Kojto 170:19eb464bc2be 385 * @retval None.
Kojto 170:19eb464bc2be 386 */
Kojto 170:19eb464bc2be 387 static inline void PINT_PinInterruptClrRiseFlagAll(PINT_Type *base)
Kojto 170:19eb464bc2be 388 {
Kojto 170:19eb464bc2be 389 base->RISE = PINT_RISE_RDET_MASK;
Kojto 170:19eb464bc2be 390 }
Kojto 170:19eb464bc2be 391
Kojto 170:19eb464bc2be 392 /*!
Kojto 170:19eb464bc2be 393 * @brief Get all pin interrupt rise flags.
Kojto 170:19eb464bc2be 394
Kojto 170:19eb464bc2be 395 * This function returns the rise flag of all pin interrupts.
Kojto 170:19eb464bc2be 396 *
Kojto 170:19eb464bc2be 397 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 398 *
Kojto 170:19eb464bc2be 399 * @retval flags Each bit position indicates the rising edge detection of the corresponding pin interrupt.
Kojto 170:19eb464bc2be 400 * 0 Rising edge has not been detected. = 1 Rising edge has been detected.
Kojto 170:19eb464bc2be 401 */
Kojto 170:19eb464bc2be 402 static inline uint32_t PINT_PinInterruptGetRiseFlagAll(PINT_Type *base)
Kojto 170:19eb464bc2be 403 {
Kojto 170:19eb464bc2be 404 return (base->RISE);
Kojto 170:19eb464bc2be 405 }
Kojto 170:19eb464bc2be 406
Kojto 170:19eb464bc2be 407 /*!
Kojto 170:19eb464bc2be 408 * @brief Configure PINT pattern match.
Kojto 170:19eb464bc2be 409
Kojto 170:19eb464bc2be 410 * This function configures a given pattern match bit slice.
Kojto 170:19eb464bc2be 411 *
Kojto 170:19eb464bc2be 412 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 413 * @param bslice Pattern match bit slice number.
Kojto 170:19eb464bc2be 414 * @param cfg Pointer to bit slice configuration.
Kojto 170:19eb464bc2be 415 *
Kojto 170:19eb464bc2be 416 * @retval None.
Kojto 170:19eb464bc2be 417 */
Kojto 170:19eb464bc2be 418 void PINT_PatternMatchConfig(PINT_Type *base, pint_pmatch_bslice_t bslice, pint_pmatch_cfg_t *cfg);
Kojto 170:19eb464bc2be 419
Kojto 170:19eb464bc2be 420 /*!
Kojto 170:19eb464bc2be 421 * @brief Get PINT pattern match configuration.
Kojto 170:19eb464bc2be 422
Kojto 170:19eb464bc2be 423 * This function returns the configuration of a given pattern match bit slice.
Kojto 170:19eb464bc2be 424 *
Kojto 170:19eb464bc2be 425 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 426 * @param bslice Pattern match bit slice number.
Kojto 170:19eb464bc2be 427 * @param cfg Pointer to bit slice configuration.
Kojto 170:19eb464bc2be 428 *
Kojto 170:19eb464bc2be 429 * @retval None.
Kojto 170:19eb464bc2be 430 */
Kojto 170:19eb464bc2be 431 void PINT_PatternMatchGetConfig(PINT_Type *base, pint_pmatch_bslice_t bslice, pint_pmatch_cfg_t *cfg);
Kojto 170:19eb464bc2be 432
Kojto 170:19eb464bc2be 433 /*!
Kojto 170:19eb464bc2be 434 * @brief Get pattern match bit slice status.
Kojto 170:19eb464bc2be 435
Kojto 170:19eb464bc2be 436 * This function returns the status of selected bit slice.
Kojto 170:19eb464bc2be 437 *
Kojto 170:19eb464bc2be 438 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 439 * @param bslice Pattern match bit slice number.
Kojto 170:19eb464bc2be 440 *
Kojto 170:19eb464bc2be 441 * @retval status = 0 Match has not been detected. = 1 Match has been detected.
Kojto 170:19eb464bc2be 442 */
Kojto 170:19eb464bc2be 443 static inline uint32_t PINT_PatternMatchGetStatus(PINT_Type *base, pint_pmatch_bslice_t bslice)
Kojto 170:19eb464bc2be 444 {
Kojto 170:19eb464bc2be 445 return ((base->PMCTRL >> PINT_PMCTRL_PMAT_SHIFT) & (0x1U << bslice)) >> bslice;
Kojto 170:19eb464bc2be 446 }
Kojto 170:19eb464bc2be 447
Kojto 170:19eb464bc2be 448 /*!
Kojto 170:19eb464bc2be 449 * @brief Get status of all pattern match bit slices.
Kojto 170:19eb464bc2be 450
Kojto 170:19eb464bc2be 451 * This function returns the status of all bit slices.
Kojto 170:19eb464bc2be 452 *
Kojto 170:19eb464bc2be 453 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 454 *
Kojto 170:19eb464bc2be 455 * @retval status Each bit position indicates the match status of corresponding bit slice.
Kojto 170:19eb464bc2be 456 * = 0 Match has not been detected. = 1 Match has been detected.
Kojto 170:19eb464bc2be 457 */
Kojto 170:19eb464bc2be 458 static inline uint32_t PINT_PatternMatchGetStatusAll(PINT_Type *base)
Kojto 170:19eb464bc2be 459 {
Kojto 170:19eb464bc2be 460 return base->PMCTRL >> PINT_PMCTRL_PMAT_SHIFT;
Kojto 170:19eb464bc2be 461 }
Kojto 170:19eb464bc2be 462
Kojto 170:19eb464bc2be 463 /*!
Kojto 170:19eb464bc2be 464 * @brief Reset pattern match detection logic.
Kojto 170:19eb464bc2be 465
Kojto 170:19eb464bc2be 466 * This function resets the pattern match detection logic if any of the product term is matching.
Kojto 170:19eb464bc2be 467 *
Kojto 170:19eb464bc2be 468 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 469 *
Kojto 170:19eb464bc2be 470 * @retval pmstatus Each bit position indicates the match status of corresponding bit slice.
Kojto 170:19eb464bc2be 471 * = 0 Match was detected. = 1 Match was not detected.
Kojto 170:19eb464bc2be 472 */
Kojto 170:19eb464bc2be 473 uint32_t PINT_PatternMatchResetDetectLogic(PINT_Type *base);
Kojto 170:19eb464bc2be 474
Kojto 170:19eb464bc2be 475 /*!
Kojto 170:19eb464bc2be 476 * @brief Enable pattern match function.
Kojto 170:19eb464bc2be 477
Kojto 170:19eb464bc2be 478 * This function enables the pattern match function.
Kojto 170:19eb464bc2be 479 *
Kojto 170:19eb464bc2be 480 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 481 *
Kojto 170:19eb464bc2be 482 * @retval None.
Kojto 170:19eb464bc2be 483 */
Kojto 170:19eb464bc2be 484 static inline void PINT_PatternMatchEnable(PINT_Type *base)
Kojto 170:19eb464bc2be 485 {
Kojto 170:19eb464bc2be 486 base->PMCTRL = (base->PMCTRL & PINT_PMCTRL_ENA_RXEV_MASK) | PINT_PMCTRL_SEL_PMATCH_MASK;
Kojto 170:19eb464bc2be 487 }
Kojto 170:19eb464bc2be 488
Kojto 170:19eb464bc2be 489 /*!
Kojto 170:19eb464bc2be 490 * @brief Disable pattern match function.
Kojto 170:19eb464bc2be 491
Kojto 170:19eb464bc2be 492 * This function disables the pattern match function.
Kojto 170:19eb464bc2be 493 *
Kojto 170:19eb464bc2be 494 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 495 *
Kojto 170:19eb464bc2be 496 * @retval None.
Kojto 170:19eb464bc2be 497 */
Kojto 170:19eb464bc2be 498 static inline void PINT_PatternMatchDisable(PINT_Type *base)
Kojto 170:19eb464bc2be 499 {
Kojto 170:19eb464bc2be 500 base->PMCTRL = (base->PMCTRL & PINT_PMCTRL_ENA_RXEV_MASK) & ~PINT_PMCTRL_SEL_PMATCH_MASK;
Kojto 170:19eb464bc2be 501 }
Kojto 170:19eb464bc2be 502
Kojto 170:19eb464bc2be 503 /*!
Kojto 170:19eb464bc2be 504 * @brief Enable RXEV output.
Kojto 170:19eb464bc2be 505
Kojto 170:19eb464bc2be 506 * This function enables the pattern match RXEV output.
Kojto 170:19eb464bc2be 507 *
Kojto 170:19eb464bc2be 508 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 509 *
Kojto 170:19eb464bc2be 510 * @retval None.
Kojto 170:19eb464bc2be 511 */
Kojto 170:19eb464bc2be 512 static inline void PINT_PatternMatchEnableRXEV(PINT_Type *base)
Kojto 170:19eb464bc2be 513 {
Kojto 170:19eb464bc2be 514 base->PMCTRL = (base->PMCTRL & PINT_PMCTRL_SEL_PMATCH_MASK) | PINT_PMCTRL_ENA_RXEV_MASK;
Kojto 170:19eb464bc2be 515 }
Kojto 170:19eb464bc2be 516
Kojto 170:19eb464bc2be 517 /*!
Kojto 170:19eb464bc2be 518 * @brief Disable RXEV output.
Kojto 170:19eb464bc2be 519
Kojto 170:19eb464bc2be 520 * This function disables the pattern match RXEV output.
Kojto 170:19eb464bc2be 521 *
Kojto 170:19eb464bc2be 522 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 523 *
Kojto 170:19eb464bc2be 524 * @retval None.
Kojto 170:19eb464bc2be 525 */
Kojto 170:19eb464bc2be 526 static inline void PINT_PatternMatchDisableRXEV(PINT_Type *base)
Kojto 170:19eb464bc2be 527 {
Kojto 170:19eb464bc2be 528 base->PMCTRL = (base->PMCTRL & PINT_PMCTRL_SEL_PMATCH_MASK) & ~PINT_PMCTRL_ENA_RXEV_MASK;
Kojto 170:19eb464bc2be 529 }
Kojto 170:19eb464bc2be 530
Kojto 170:19eb464bc2be 531 /*!
Kojto 170:19eb464bc2be 532 * @brief Enable callback.
Kojto 170:19eb464bc2be 533
Kojto 170:19eb464bc2be 534 * This function enables the interrupt for the selected PINT peripheral. Although the pin(s) are monitored
Kojto 170:19eb464bc2be 535 * as soon as they are enabled, the callback function is not enabled until this function is called.
Kojto 170:19eb464bc2be 536 *
Kojto 170:19eb464bc2be 537 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 538 *
Kojto 170:19eb464bc2be 539 * @retval None.
Kojto 170:19eb464bc2be 540 */
Kojto 170:19eb464bc2be 541 void PINT_EnableCallback(PINT_Type *base);
Kojto 170:19eb464bc2be 542
Kojto 170:19eb464bc2be 543 /*!
Kojto 170:19eb464bc2be 544 * @brief Disable callback.
Kojto 170:19eb464bc2be 545
Kojto 170:19eb464bc2be 546 * This function disables the interrupt for the selected PINT peripheral. Although the pins are still
Kojto 170:19eb464bc2be 547 * being monitored but the callback function is not called.
Kojto 170:19eb464bc2be 548 *
Kojto 170:19eb464bc2be 549 * @param base Base address of the peripheral.
Kojto 170:19eb464bc2be 550 *
Kojto 170:19eb464bc2be 551 * @retval None.
Kojto 170:19eb464bc2be 552 */
Kojto 170:19eb464bc2be 553 void PINT_DisableCallback(PINT_Type *base);
Kojto 170:19eb464bc2be 554
Kojto 170:19eb464bc2be 555 /*!
Kojto 170:19eb464bc2be 556 * @brief Deinitialize PINT peripheral.
Kojto 170:19eb464bc2be 557
Kojto 170:19eb464bc2be 558 * This function disables the PINT clock.
Kojto 170:19eb464bc2be 559 *
Kojto 170:19eb464bc2be 560 * @param base Base address of the PINT peripheral.
Kojto 170:19eb464bc2be 561 *
Kojto 170:19eb464bc2be 562 * @retval None.
Kojto 170:19eb464bc2be 563 */
Kojto 170:19eb464bc2be 564 void PINT_Deinit(PINT_Type *base);
Kojto 170:19eb464bc2be 565
Kojto 170:19eb464bc2be 566 #ifdef __cplusplus
Kojto 170:19eb464bc2be 567 }
Kojto 170:19eb464bc2be 568 #endif
Kojto 170:19eb464bc2be 569
Kojto 170:19eb464bc2be 570 /*@}*/
Kojto 170:19eb464bc2be 571
Kojto 170:19eb464bc2be 572 #endif /* _FSL_PINT_H_ */