Xmega Application Note | |||||
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). | |
static void | pmic_enable_level (enum pmic_level level) |
Enable interrupts with specified level(s). | |
static enum pmic_level | pmic_get_enabled_levels (void) |
Get currently enabled level(s). | |
static void | pmic_init (void) |
Initialize the PMIC. | |
static bool | pmic_level_is_enabled (enum pmic_level level) |
Check if specified interrupt level(s) is enabled. | |
static bool | pmic_level_is_executing (enum pmic_level level) |
Check if an interrupt level(s) is currently executing. | |
static void | pmic_set_scheduling (enum pmic_schedule schedule) |
Set interrupt scheduling for low-level interrupts. | |
static void | pmic_set_vector_location (enum pmic_vector vector) |
Set location of interrupt vectors. |
This is a low-level driver implementation for the AVR XMEGA Programmable Multilevel Interrupt Controller.
enum pmic_level |
Interrupt level bitmasks.
PMIC_LVL_LOW |
Low-level interrupts. |
PMIC_LVL_MEDIUM |
Medium-level interrupts. |
PMIC_LVL_HIGH |
High-level interrupts. |
PMIC_LVL_NMI |
Non-maskable interrupts.
|
Definition at line 63 of file pmic.h.
00063 { 00064 PMIC_LVL_LOW = PMIC_LOLVLEN_bm, 00065 PMIC_LVL_MEDIUM = PMIC_MEDLVLEN_bm, 00066 PMIC_LVL_HIGH = PMIC_HILVLEN_bm, 00067 00071 PMIC_LVL_NMI = PMIC_NMIEX_bp, 00072 };
enum pmic_schedule |
Interrupt scheduling schemes.
PMIC_SCH_FIXED_PRIORITY |
Default, fixed priority scheduling. |
PMIC_SCH_ROUND_ROBIN |
Round-robin scheduling. |
PMIC_NR_OF_SCHEDULES |
Number of interrupt scheduling schemes. |
Definition at line 82 of file pmic.h.
00082 { 00083 PMIC_SCH_FIXED_PRIORITY, 00084 PMIC_SCH_ROUND_ROBIN, 00085 PMIC_NR_OF_SCHEDULES, 00086 };
enum pmic_vector |
Interrupt vector locations.
PMIC_VEC_APPLICATION |
Application section. |
PMIC_VEC_BOOT |
Boot section. |
PMIC_NR_OF_VECTORS |
Number of interrupt vector locations. |
Definition at line 75 of file pmic.h.
00075 { 00076 PMIC_VEC_APPLICATION, 00077 PMIC_VEC_BOOT, 00078 PMIC_NR_OF_VECTORS, 00079 };
static void pmic_disable_level | ( | enum pmic_level | level | ) | [inline, static] |
Disable interrupts with specified level(s).
level | Interrupt level(s) to disable. |
Definition at line 117 of file pmic.h.
References Assert, and PMIC_LVL_NMI.
00118 { 00119 Assert(!(level & PMIC_LVL_NMI)); 00120 00121 PMIC.CTRL &= ~level; 00122 }
static void pmic_enable_level | ( | enum pmic_level | level | ) | [inline, static] |
Enable interrupts with specified level(s).
level | Interrupt level(s) to enable. |
Definition at line 105 of file pmic.h.
References Assert, and PMIC_LVL_NMI.
Referenced by main().
00106 { 00107 Assert(!(level & PMIC_LVL_NMI)); 00108 00109 PMIC.CTRL |= level; 00110 }
static enum pmic_level pmic_get_enabled_levels | ( | void | ) | [inline, static] |
Get currently enabled level(s).
Definition at line 143 of file pmic.h.
References PMIC_LVL_HIGH, PMIC_LVL_LOW, and PMIC_LVL_MEDIUM.
00144 { 00145 return (enum pmic_level)(PMIC.CTRL & (PMIC_LVL_LOW | PMIC_LVL_MEDIUM 00146 | PMIC_LVL_HIGH)); 00147 }
static void pmic_init | ( | void | ) | [inline, static] |
Initialize the PMIC.
Enables all interrupt levels, with vectors located in the application section and fixed priority scheduling.
Definition at line 94 of file pmic.h.
References PMIC_LVL_HIGH, PMIC_LVL_LOW, and PMIC_LVL_MEDIUM.
00095 { 00096 PMIC.CTRL = PMIC_LVL_LOW | PMIC_LVL_MEDIUM | 00097 PMIC_LVL_HIGH; 00098 }
static bool pmic_level_is_enabled | ( | enum pmic_level | level | ) | [inline, static] |
Check if specified interrupt level(s) is enabled.
level | Interrupt level(s) to check. |
Definition at line 131 of file pmic.h.
References Assert, and PMIC_LVL_NMI.
00132 { 00133 Assert(!(level & PMIC_LVL_NMI)); 00134 00135 return PMIC.CTRL & level; 00136 }
static bool pmic_level_is_executing | ( | enum pmic_level | level | ) | [inline, static] |
static void pmic_set_scheduling | ( | enum pmic_schedule | schedule | ) | [inline, static] |
Set interrupt scheduling for low-level interrupts.
schedule | Interrupt scheduling method to set. |
Definition at line 169 of file pmic.h.
References Assert, PMIC_NR_OF_SCHEDULES, PMIC_SCH_FIXED_PRIORITY, and PMIC_SCH_ROUND_ROBIN.
00170 { 00171 Assert(schedule < PMIC_NR_OF_SCHEDULES); 00172 00173 switch (schedule) { 00174 case PMIC_SCH_FIXED_PRIORITY: 00175 PMIC.CTRL &= ~PMIC_RREN_bm; 00176 PMIC.INTPRI = 0; 00177 break; 00178 00179 case PMIC_SCH_ROUND_ROBIN: 00180 PMIC.CTRL |= PMIC_RREN_bm; 00181 break; 00182 00183 default: 00184 break; 00185 }; 00186 }
static void pmic_set_vector_location | ( | enum pmic_vector | vector | ) | [inline, static] |
Set location of interrupt vectors.
vector | Location to use for interrupt vectors. |
Definition at line 193 of file pmic.h.
References Assert, ccp_write_io(), PMIC_NR_OF_VECTORS, PMIC_VEC_APPLICATION, and PMIC_VEC_BOOT.
00194 { 00195 uint8_t ctrl = PMIC.CTRL; 00196 00197 Assert(vector < PMIC_NR_OF_VECTORS); 00198 00199 switch (vector) { 00200 case PMIC_VEC_APPLICATION: 00201 ctrl &= ~PMIC_IVSEL_bm; 00202 break; 00203 00204 case PMIC_VEC_BOOT: 00205 ctrl |= PMIC_IVSEL_bm; 00206 break; 00207 00208 default: 00209 break; 00210 } 00211 00212 ccp_write_io((uint8_t*)&PMIC.CTRL, ctrl); 00213 }
Generated on Fri Oct 22 12:15:26 2010 for AVR1300 Using the Xmega ADC by ![]() |