rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
interrupt.h
Go to the documentation of this file.
1 /* This file is part of rflpc. Copyright 2010-2011 Michael Hauspie
2  *
3  * rflpc is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * rflpc is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with rflpc. If not, see <http://www.gnu.org/licenses/>.
15  */
16 /*
17  Author: Michael Hauspie <michael.hauspie@univ-lille1.fr>
18  Created:
19  Time-stamp: <2014-05-28 14:20:01 (hauspie)>
20 */
21 
26 #ifndef __RFLPC_INTERRUPT_H__
27 #define __RFLPC_INTERRUPT_H__
28 
29 
30 #include "nxp/LPC17xx.h"
31 
38 static inline void rflpc_irq_global_enable()
39 {
40  __asm volatile("cpsie i");
41 }
42 
44 static inline void rflpc_irq_global_disable()
45 {
46  __asm volatile("cpsid i");
47 }
48 
50 static inline void rflpc_irq_enable(IRQn_Type irq)
51 {
52  NVIC->ISER[irq >> 5] |= (1 << irq);
53 }
54 
56 static inline void rflpc_irq_disable(IRQn_Type irq)
57 {
58  NVIC->ICER[irq >> 5] |= (1 << irq);
59 }
60 
62 typedef void (*rflpc_irq_handler_t)(void);
63 
65 #define RFLPC_IRQ_HANDLER void __attribute__((interrupt("IRQ")))
66 
70 void rflpc_irq_init();
71 
73 void rflpc_irq_set_handler(IRQn_Type irq, rflpc_irq_handler_t handler);
74 
77 #endif
void rflpc_irq_init()
Inits the interruption by relocating the interrupt vector to ram.
void rflpc_irq_set_handler(IRQn_Type irq, rflpc_irq_handler_t handler)
Sets an handler for the given IRQ.
static void rflpc_irq_global_disable()
Disable interrupts.
Definition: interrupt.h:44
static void rflpc_irq_enable(IRQn_Type irq)
Enables a specific interrupt.
Definition: interrupt.h:50
static void rflpc_irq_disable(IRQn_Type irq)
Disables a specific interrupt.
Definition: interrupt.h:56
static void rflpc_irq_global_enable()
Enables interrupts.
Definition: interrupt.h:38
void(* rflpc_irq_handler_t)(void)
Interrupt handler type.
Definition: interrupt.h:62