This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration and management of the device's on-chip External Interrupt Controller (EIC).
Devices from the following series can use this module:
The outline of this documentation is as follows:
Module Overview
The External Interrupt Controller (EIC) allows pins to be configured as external interrupts. Each external interrupt has its own interrupt request and can be individually masked. Each external interrupt can generate an interrupt on rising or falling edge, or high or low level. Every interrupt input has a configurable filter to remove spikes from the interrupt source. Every interrupt pin can also be configured to be asynchronous, in order to wake-up the part from sleep modes where the CLK_SYNC clock has been disabled.
An additional Non-Maskable Interrupt (NMI) pin is also supported. This has the same properties as the other external interrupts, but is connected to the NMI request of the CPU, enabling it to interrupt any other interrupt mode.
Special Considerations
- The external interrupt pins (EXTINTn and NMI) may be multiplexed with I/O Controller lines. The programmer must first program the I/O Controller to assign the desired EIC pins to their peripheral function. If I/O lines of the EIC are not used by the application, they can be used for other purposes by the I/O Controller. It is only required to enable the EIC inputs actually in use. For example, if an application only requires two external interrupts, then only two I/O lines will be assigned to EIC inputs.
- All interrupts are available in all sleep modes as long as the EIC module is powered. However, in sleep modes where CLK_SYNC is stopped, the interrupt must be configured to asynchronous mode.
- The clock for the EIC bus interface (CLK_EIC) is generated by the Power Manager. This clock is enabled at reset, and can be disabled in the Power Manager. The filter and synchronous edge/level detector runs on a clock which is stopped in any of the sleep modes where the system RC oscillator (RCSYS) is not running. This clock is referred to as CLK_SYNC.
- The external interrupt request lines are connected to the NVIC. Using the external interrupts requires the NVIC to be programmed first. Using the Non-Maskable Interrupt does not require the NVIC to be programmed.
- When an external debugger forces the CPU into debug mode, the EIC continues normal operation. If the EIC is configured in a way that requires it to be periodically serviced by the CPU through interrupts or similar, improper operation or data loss may result during debugging.
Prerequisites
Extra Information
For extra information, see Extra Information for EIC. This includes:
Examples
For a list of examples related to this driver, see
API Overview
|
void | eic_disable (Eic *eic) |
| Disable the EIC module. More...
|
|
void | eic_enable (Eic *eic) |
| Enable the EIC module. More...
|
|
static void | eic_line_clear_interrupt (Eic *eic, uint8_t line_number) |
| Clear the interrupt flag of specified pin. More...
|
|
static void | eic_line_disable (Eic *eic, uint8_t line_number) |
| Disable the external interrupt on specified line. More...
|
|
static void | eic_line_disable_interrupt (Eic *eic, uint8_t line_number) |
| Disables the propagation from the EIC to the interrupt controller of the external interrupt on a specified line. More...
|
|
static void | eic_line_enable (Eic *eic, uint8_t line_number) |
| Enable the external interrupt on specified line. More...
|
|
static void | eic_line_enable_interrupt (Eic *eic, uint8_t line_number) |
| Enables the propagation from the EIC to the interrupt controller of the external interrupt on a specified line. More...
|
|
static bool | eic_line_interrupt_is_enabled (Eic *eic, uint8_t line_number) |
| Tells whether an EIC interrupt line is enabled. More...
|
|
static bool | eic_line_interrupt_is_pending (Eic *eic, uint8_t line_number) |
| Tells whether an EIC interrupt line is pending. More...
|
|
static bool | eic_line_is_enabled (Eic *eic, uint8_t line_number) |
| Tells whether an EIC line is enabled. More...
|
|
void | eic_line_set_callback (Eic *eic, uint8_t line_number, eic_callback_t callback, uint8_t irq_line, uint8_t irq_level) |
| Set callback for given EIC line. More...
|
|
void | eic_line_set_config (Eic *eic, uint8_t line_number, struct eic_line_config *eic_line_conf) |
| Program the EIC hardware with the specified configuration. More...
|
|
#define EIC_ASYNCH_MODE 1 |
#define EIC_EDGE_FALLING_EDGE 0 |
#define EIC_EDGE_RISING_EDGE 1 |
#define EIC_FILTER_DISABLED 0 |
#define EIC_FILTER_ENABLED 1 |
#define EIC_LEVEL_HIGH_LEVEL 1 |
#define EIC_LEVEL_LOW_LEVEL 0 |
#define EIC_MODE_EDGE_TRIGGERED 0 |
#define EIC_MODE_LEVEL_TRIGGERED 1 |
#define EIC_NUMBER_OF_LINES 9 |
Number of available EIC lines, device dependent.
The interrupt is synchronized to CLK_SYNC.
typedef void(* eic_callback_t)(void) |
void eic_disable |
( |
Eic * |
eic | ) |
|
void eic_enable |
( |
Eic * |
eic | ) |
|
static void eic_line_clear_interrupt |
( |
Eic * |
eic, |
|
|
uint8_t |
line_number |
|
) |
| |
|
inlinestatic |
Clear the interrupt flag of specified pin.
Call this function once you have handled the interrupt.
- Parameters
-
[in] | eic | Base address of the EIC (i.e. EIC) |
[in] | line_number | Line number to clear |
Referenced by button_handler().
static void eic_line_disable |
( |
Eic * |
eic, |
|
|
uint8_t |
line_number |
|
) |
| |
|
inlinestatic |
Disable the external interrupt on specified line.
- Parameters
-
[in] | eic | Base address of the EIC module |
[in] | line_number | Line number to disable |
static void eic_line_disable_interrupt |
( |
Eic * |
eic, |
|
|
uint8_t |
line_number |
|
) |
| |
|
inlinestatic |
Disables the propagation from the EIC to the interrupt controller of the external interrupt on a specified line.
- Parameters
-
[in] | eic | Base address of the EIC (i.e. EIC) |
[in] | line_number | Line number of interrupt to disable |
static void eic_line_enable |
( |
Eic * |
eic, |
|
|
uint8_t |
line_number |
|
) |
| |
|
inlinestatic |
Enable the external interrupt on specified line.
- Parameters
-
[in] | eic | Base address of the EIC module |
[in] | line_number | The line number to enable |
Referenced by configure_button().
static void eic_line_enable_interrupt |
( |
Eic * |
eic, |
|
|
uint8_t |
line_number |
|
) |
| |
|
inlinestatic |
Enables the propagation from the EIC to the interrupt controller of the external interrupt on a specified line.
- Parameters
-
[in] | eic | Base address of the EIC module |
[in] | line_number | Line number of interrupt to enable |
Referenced by eic_line_set_callback().
static bool eic_line_interrupt_is_enabled |
( |
Eic * |
eic, |
|
|
uint8_t |
line_number |
|
) |
| |
|
inlinestatic |
Tells whether an EIC interrupt line is enabled.
- Parameters
-
[in] | eic | Base address of the EIC module |
[in] | line_number | Line number to test |
- Return values
-
true | EIC interrupt line is enabled |
false | EIC interrupt line is not enabled |
static bool eic_line_interrupt_is_pending |
( |
Eic * |
eic, |
|
|
uint8_t |
line_number |
|
) |
| |
|
inlinestatic |
Tells whether an EIC interrupt line is pending.
- Parameters
-
[in] | eic | Base address of the EIC module |
[in] | line_number | Line number to test |
- Return values
-
true | EIC interrupt line is pending |
false | EIC interrupt line is not pending |
Referenced by button_handler().
static bool eic_line_is_enabled |
( |
Eic * |
eic, |
|
|
uint8_t |
line_number |
|
) |
| |
|
inlinestatic |
Tells whether an EIC line is enabled.
- Parameters
-
[in] | eic | Base address of the EIC module |
[in] | line_number | Line number to test |
- Return values
-
true | EIC line is enabled |
false | EIC line is not enabled |
void eic_line_set_callback |
( |
Eic * |
eic, |
|
|
uint8_t |
line_number, |
|
|
eic_callback_t |
callback, |
|
|
uint8_t |
irq_line, |
|
|
uint8_t |
irq_level |
|
) |
| |
Set callback for given EIC line.
- Parameters
-
[in] | eic | Base address of the EIC module |
[in] | line_number | Number of line |
[in] | callback | Callback function pointer |
[in] | irq_line | Interrupt line number (EIC_1_IRQn to EIC_8_IRQn) |
[in] | irq_level | Interrupt level (the priority of the interrupt request) |
References eic_line_enable_interrupt(), and irq_register_handler.
Referenced by configure_button().
void eic_line_set_config |
( |
Eic * |
eic, |
|
|
uint8_t |
line_number, |
|
|
struct eic_line_config * |
eic_line_conf |
|
) |
| |