fsl_intmux.h
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _FSL_INTMUX_H_
#define _FSL_INTMUX_H_
#include "fsl_common.h"
/*******************************************************************************
* Definitions
******************************************************************************/
#define FSL_INTMUX_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))
typedef enum _intmux_channel_logic_mode
{
kINTMUX_ChannelLogicOR = 0x0U,
kINTMUX_ChannelLogicAND,
} intmux_channel_logic_mode_t;
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
void INTMUX_Init(INTMUX_Type *base);
void INTMUX_Deinit(INTMUX_Type *base);
static inline void INTMUX_ResetChannel(INTMUX_Type *base, uint32_t channel)
{
assert(channel < FSL_FEATURE_INTMUX_CHANNEL_COUNT);
base->CHANNEL[channel].CHn_CSR |= INTMUX_CHn_CSR_RST_MASK;
}
static inline void INTMUX_SetChannelMode(INTMUX_Type *base, uint32_t channel, intmux_channel_logic_mode_t logic)
{
assert(channel < FSL_FEATURE_INTMUX_CHANNEL_COUNT);
base->CHANNEL[channel].CHn_CSR = INTMUX_CHn_CSR_AND(logic);
}
static inline void INTMUX_EnableInterrupt(INTMUX_Type *base, uint32_t channel, IRQn_Type irq)
{
assert(channel < FSL_FEATURE_INTMUX_CHANNEL_COUNT);
assert(irq >= FSL_FEATURE_INTMUX_IRQ_START_INDEX);
base->CHANNEL[channel].CHn_IER_31_0 |= (1U << ((uint32_t)irq - FSL_FEATURE_INTMUX_IRQ_START_INDEX));
}
static inline void INTMUX_DisableInterrupt(INTMUX_Type *base, uint32_t channel, IRQn_Type irq)
{
assert(channel < FSL_FEATURE_INTMUX_CHANNEL_COUNT);
assert(irq >= FSL_FEATURE_INTMUX_IRQ_START_INDEX);
base->CHANNEL[channel].CHn_IER_31_0 &= ~(1U << ((uint32_t)irq - FSL_FEATURE_INTMUX_IRQ_START_INDEX));
}
static inline uint32_t INTMUX_GetChannelPendingSources(INTMUX_Type *base, uint32_t channel)
{
assert(channel < FSL_FEATURE_INTMUX_CHANNEL_COUNT);
return base->CHANNEL[channel].CHn_IPR_31_0;
}
#if defined(__cplusplus)
}
#endif
#endif /* _FSL_INTMUX_H_ */
kINTMUX_ChannelLogicAND
Definition: fsl_intmux.h:52
INTMUX_DisableInterrupt
static void INTMUX_DisableInterrupt(INTMUX_Type *base, uint32_t channel, IRQn_Type irq)
Disable an interrupt source on an INTMUX channel.
Definition: fsl_intmux.h:148
kINTMUX_ChannelLogicOR
Definition: fsl_intmux.h:51
INTMUX_GetChannelPendingSources
static uint32_t INTMUX_GetChannelPendingSources(INTMUX_Type *base, uint32_t channel)
Get INTMUX pending interrupt sources for specific channel.
Definition: fsl_intmux.h:167
INTMUX_Init
void INTMUX_Init(INTMUX_Type *base)
Initializes INTMUX module.
Definition: fsl_intmux.c:110
intmux_channel_logic_mode_t
intmux_channel_logic_mode_t
INTMUX channel logic mode.
Definition: fsl_intmux.h:49
INTMUX_Deinit
void INTMUX_Deinit(INTMUX_Type *base)
Deinitializes an INTMUX instance for operation.
Definition: fsl_intmux.c:124
INTMUX_SetChannelMode
static void INTMUX_SetChannelMode(INTMUX_Type *base, uint32_t channel, intmux_channel_logic_mode_t logic)
Set the logic mode for an INTMUX channel.
Definition: fsl_intmux.h:115
INTMUX_EnableInterrupt
static void INTMUX_EnableInterrupt(INTMUX_Type *base, uint32_t channel, IRQn_Type irq)
Enable an interrupt source on an INTMUX channel.
Definition: fsl_intmux.h:133
INTMUX_ResetChannel
static void INTMUX_ResetChannel(INTMUX_Type *base, uint32_t channel)
Reset an INTMUX channel.
Definition: fsl_intmux.h:95