Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Programmable Multilevel Interrupt Controller

See Quick start guide for PMIC driver.

This is a low-level driver implementation for the AVR XMEGA Programmable Multilevel Interrupt Controller.

Note
If these functions are used in interrupt service routines (ISRs), any non-ISR code or ISR code for lower level interrupts must ensure that the operations are atomic, i.e., by disabling interrupts during the function calls.

Enumerations

enum  pmic_level {
  PMIC_LVL_LOW = PMIC_LOLVLEN_bm,
  PMIC_LVL_MEDIUM = PMIC_MEDLVLEN_bm,
  PMIC_LVL_HIGH = PMIC_HILVLEN_bm,
  PMIC_LVL_NMI = PMIC_NMIEX_bp
}
 Interrupt level bitmasks. More...
 
enum  pmic_schedule {
  PMIC_SCH_FIXED_PRIORITY,
  PMIC_SCH_ROUND_ROBIN,
  PMIC_NR_OF_SCHEDULES
}
 Interrupt scheduling schemes. More...
 
enum  pmic_vector {
  PMIC_VEC_APPLICATION,
  PMIC_VEC_BOOT,
  PMIC_NR_OF_VECTORS
}
 Interrupt vector locations. More...
 

Functions

static void pmic_disable_level (enum pmic_level level)
 Disable interrupts with specified level(s). More...
 
static void pmic_enable_level (enum pmic_level level)
 Enable interrupts with specified level(s). More...
 
static enum pmic_level pmic_get_enabled_levels (void)
 Get currently enabled level(s) More...
 
static void pmic_init (void)
 Initialize the PMIC. More...
 
static bool pmic_level_is_enabled (enum pmic_level level)
 Check if specified interrupt level(s) is enabled. More...
 
static bool pmic_level_is_executing (enum pmic_level level)
 Check if an interrupt level(s) is currently executing. More...
 
static void pmic_set_scheduling (enum pmic_schedule schedule)
 Set interrupt scheduling for low-level interrupts. More...
 
static void pmic_set_vector_location (enum pmic_vector vector)
 Set location of interrupt vectors. More...
 

enum pmic_level

Interrupt level bitmasks.

Note
These may be OR'ed, e.g., if multiple levels are to be enabled or disabled.
Enumerator
PMIC_LVL_LOW 

Low-level interrupts.

PMIC_LVL_MEDIUM 

Medium-level interrupts.

PMIC_LVL_HIGH 

High-level interrupts.

PMIC_LVL_NMI 

Non-maskable interrupts.

Note
These cannot be enabled nor disabled.

Interrupt scheduling schemes.

Enumerator
PMIC_SCH_FIXED_PRIORITY 

Default, fixed priority scheduling.

PMIC_SCH_ROUND_ROBIN 

Round-robin scheduling.

PMIC_NR_OF_SCHEDULES 

Number of interrupt scheduling schemes.

Interrupt vector locations.

Enumerator
PMIC_VEC_APPLICATION 

Application section.

PMIC_VEC_BOOT 

Boot section.

PMIC_NR_OF_VECTORS 

Number of interrupt vector locations.

static void pmic_disable_level ( enum pmic_level  level)
inlinestatic

Disable interrupts with specified level(s).

Parameters
levelInterrupt level(s) to disable.

References Assert, and PMIC_LVL_NMI.

static void pmic_enable_level ( enum pmic_level  level)
inlinestatic

Enable interrupts with specified level(s).

Parameters
levelInterrupt level(s) to enable.

References Assert, and PMIC_LVL_NMI.

static enum pmic_level pmic_get_enabled_levels ( void  )
inlinestatic

Get currently enabled level(s)

Returns
Bitmask with currently enabled levels.

References PMIC_LVL_HIGH, PMIC_LVL_LOW, and PMIC_LVL_MEDIUM.

static void pmic_init ( void  )
inlinestatic

Initialize the PMIC.

Enables all interrupt levels, with vectors located in the application section and fixed priority scheduling.

References PMIC_LVL_HIGH, PMIC_LVL_LOW, and PMIC_LVL_MEDIUM.

Referenced by main().

static bool pmic_level_is_enabled ( enum pmic_level  level)
inlinestatic

Check if specified interrupt level(s) is enabled.

Parameters
levelInterrupt level(s) to check.
Returns
True if interrupt level(s) is enabled.

References Assert, and PMIC_LVL_NMI.

static bool pmic_level_is_executing ( enum pmic_level  level)
inlinestatic

Check if an interrupt level(s) is currently executing.

Parameters
levelInterrupt level(s) to check.
Returns
True if interrupt level(s) is currently executing.
static void pmic_set_scheduling ( enum pmic_schedule  schedule)
inlinestatic

Set interrupt scheduling for low-level interrupts.

Parameters
scheduleInterrupt scheduling method to set.
Note
The low-priority vector, INTPRI, must be set to 0 when round-robin scheduling is disabled to return to default interrupt priority order.

References Assert, PMIC_NR_OF_SCHEDULES, PMIC_SCH_FIXED_PRIORITY, and PMIC_SCH_ROUND_ROBIN.

static void pmic_set_vector_location ( enum pmic_vector  vector)
inlinestatic

Set location of interrupt vectors.

Parameters
vectorLocation to use for interrupt vectors.

References Assert, ccp_write_io(), pll_config::ctrl, PMIC_NR_OF_VECTORS, PMIC_VEC_APPLICATION, and PMIC_VEC_BOOT.