82 lines
1.6 KiB
C
82 lines
1.6 KiB
C
/*
|
|
irq.c - irq core functions
|
|
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "lpc2220.h"
|
|
#include "irq.h"
|
|
|
|
#define IRQ_MASK 0x00000080
|
|
|
|
static inline unsigned asm_get_cpsr(void)
|
|
{
|
|
unsigned long retval;
|
|
asm volatile (" mrs %0, cpsr" : "=r" (retval) : /* no inputs */ );
|
|
return retval;
|
|
|
|
}
|
|
|
|
static inline void asm_set_cpsr(unsigned val)
|
|
{
|
|
asm volatile (" msr cpsr, %0" : /* no outputs */ : "r" (val) );
|
|
}
|
|
|
|
unsigned enableIRQ(void)
|
|
{
|
|
unsigned _cpsr;
|
|
|
|
_cpsr = asm_get_cpsr();
|
|
asm_set_cpsr(_cpsr & ~IRQ_MASK);
|
|
return _cpsr;
|
|
}
|
|
|
|
unsigned disableIRQ(void)
|
|
{
|
|
unsigned _cpsr;
|
|
|
|
_cpsr = asm_get_cpsr();
|
|
asm_set_cpsr(_cpsr | IRQ_MASK);
|
|
return _cpsr;
|
|
}
|
|
|
|
unsigned restoreIRQ(unsigned oldCPSR)
|
|
{
|
|
unsigned _cpsr;
|
|
|
|
_cpsr = asm_get_cpsr();
|
|
asm_set_cpsr((_cpsr & ~IRQ_MASK) | (oldCPSR & IRQ_MASK));
|
|
return _cpsr;
|
|
}
|
|
|
|
void IRQ_Routine (void) {
|
|
|
|
}
|
|
|
|
void FIQ_Routine (void) {
|
|
while (1) ;
|
|
}
|
|
|
|
|
|
void SWI_Routine (void) {
|
|
while (1) ;
|
|
}
|
|
|
|
|
|
void UNDEF_Routine (void) {
|
|
while (1) ;
|
|
}
|
|
|
|
|