Microchip® Advanced Software Framework

extint.c File Reference

SAM External Interrupt Driver.

Copyright (c) 2014-2020 Microchip Technology Inc. and its subsidiaries.

#include <system.h>
#include <system_interrupt.h>
#include <extint.h>
#include <conf_extint.h>

Macros

#define _extint_is_gclk_required(filter_input_signal, detection_criteria)
 Determin if the general clock is required. More...
 
#define EXTINT_CLOCK_SELECTION   EXTINT_CLK_GCLK
 Configuration option, setting the EIC clock source which can be used for EIC edge detection or filtering. More...
 

Functions

static void _extint_disable (void)
 Disables the External Interrupt driver. More...
 
static void _extint_enable (void)
 Enables the External Interrupt driver. More...
 
void _system_extint_init (void)
 Initializes and enables the External Interrupt driver. More...
 
void extint_chan_get_config_defaults (struct extint_chan_conf *const config)
 Initializes an External Interrupt channel configuration structure to defaults. More...
 
void extint_chan_set_config (const uint8_t channel, const struct extint_chan_conf *const config)
 Writes an External Interrupt channel configuration to the hardware module. More...
 
void extint_disable_events (struct extint_events *const events)
 Disables an External Interrupt event output. More...
 
void extint_enable_events (struct extint_events *const events)
 Enables an External Interrupt event output. More...
 
static bool extint_is_syncing (void)
 Determines if the hardware module(s) are currently synchronizing to the bus. More...
 
enum status_code extint_nmi_set_config (const uint8_t nmi_channel, const struct extint_nmi_conf *const config)
 Writes an External Interrupt NMI channel configuration to the hardware module. More...
 

Variables

struct _extint_module _extint_dev
 

#define _extint_is_gclk_required (   filter_input_signal,
  detection_criteria 
)
Value:
((filter_input_signal) ? true : (\
(EXTINT_DETECT_RISING == (detection_criteria)) ? true : (\
(EXTINT_DETECT_FALLING == (detection_criteria)) ? true : (\
(EXTINT_DETECT_BOTH == (detection_criteria)) ? true : false))))
Detect rising signal edges.
Definition: extint.h:236
Detect both signal edges.
Definition: extint.h:240
Detect falling signal edges.
Definition: extint.h:238

Determin if the general clock is required.

Parameters
[in]filter_input_signalFilter the raw input signal to prevent noise
[in]detection_criteriaEdge detection mode to use (extint_detect)

Referenced by extint_chan_set_config(), and extint_nmi_set_config().

#define EXTINT_CLOCK_SELECTION   EXTINT_CLK_GCLK

Configuration option, setting the EIC clock source which can be used for EIC edge detection or filtering.

This option may be overridden in the module configuration header file conf_extint.h.

void _extint_disable ( void  )
static

Disables the External Interrupt driver.

Disables EIC modules that were previously started via a call to _extint_enable(). Registered callback list will not be affected if callback mode is used.

References extint_is_syncing().

Referenced by extint_chan_set_config(), extint_disable_events(), extint_enable_events(), and extint_nmi_set_config().

void _extint_enable ( void  )
static

Enables the External Interrupt driver.

Enables EIC modules. Registered callback list will not be affected if callback mode is used.

References extint_is_syncing().

Referenced by _system_extint_init(), extint_chan_set_config(), extint_disable_events(), extint_enable_events(), and extint_nmi_set_config().

void _system_extint_init ( void  )

Initializes and enables the External Interrupt driver.

Enable the clocks used by External Interrupt driver.

Resets the External Interrupt driver, resetting all hardware module registers to their power-on defaults, then enable it for further use.

Reset the callback list if callback mode is used.

This function must be called before attempting to use any NMI or standard external interrupt channel functions.

Note
When SYSTEM module is used, this function will be invoked by system_init() automatically if the module is included.

References _extint_dev, _extint_enable(), EIC_NUMBER_OF_INTERRUPTS, EXTINT_CLK_GCLK, EXTINT_CLK_ULP32K, EXTINT_CLOCK_SOURCE, extint_is_syncing(), system_gclk_chan_config::source_generator, system_apb_clock_set_mask(), SYSTEM_CLOCK_APB_APBA, system_gclk_chan_enable(), system_gclk_chan_get_config_defaults(), system_gclk_chan_set_config(), system_interrupt_enable(), and SYSTEM_INTERRUPT_MODULE_EIC.

Referenced by system_init().

static bool extint_is_syncing ( void  )
inlinestatic

Determines if the hardware module(s) are currently synchronizing to the bus.

Checks to see if the underlying hardware peripheral module(s) are currently synchronizing across multiple clock domains to the hardware bus, This function can be used to delay further operations on a module until such time that it is ready, to prevent blocking delays for synchronization in the user application.

Returns
Synchronization status of the underlying hardware module(s).
Return values
trueIf the module synchronization is ongoing
falseIf the module has completed synchronization

Referenced by _extint_disable(), _extint_enable(), and _system_extint_init().

struct _extint_module _extint_dev

Internal driver device instance struct.

Referenced by _system_extint_init(), EIC_Handler(), extint_register_callback(), and extint_unregister_callback().