modified at91 interrupt code from contiki to use the mc1322x registers
and to produce code that works with THUMB.
This commit is contained in:
parent
4f45e43984
commit
cfd985c837
4 changed files with 325 additions and 14 deletions
|
@ -17,18 +17,29 @@
|
|||
#define FIQ_MASK 0x00000040
|
||||
#define INT_MASK (IRQ_MASK | FIQ_MASK)
|
||||
|
||||
static inline unsigned __get_cpsr(void)
|
||||
unsigned __get_cpsr(void)
|
||||
{
|
||||
unsigned long retval;
|
||||
asm volatile (" mrs %0, cpsr" : "=r" (retval) : /* no inputs */ );
|
||||
asm volatile (
|
||||
".code 32;"
|
||||
"mrs %0, cpsr;"
|
||||
".code 16;"
|
||||
: "=r" (retval) :
|
||||
);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline void __set_cpsr(unsigned val)
|
||||
void __set_cpsr(unsigned val)
|
||||
{
|
||||
asm volatile (" msr cpsr_c, %0" : /* no outputs */ : "r" (val) );
|
||||
asm volatile (
|
||||
".code 32;"
|
||||
"msr cpsr_c, %0;"
|
||||
".code 16;"
|
||||
: : "r" (val)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
unsigned disableIRQ(void)
|
||||
{
|
||||
unsigned _cpsr;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <sys-interrupt.h>
|
||||
#include <interrupt-utils.h>
|
||||
#include <AT91SAM7S64.h>
|
||||
#include "sys-interrupt.h"
|
||||
#include "interrupt-utils.h"
|
||||
|
||||
#include "embedded_types.h"
|
||||
|
||||
#define ATTR
|
||||
|
||||
|
@ -30,24 +31,20 @@ system_int (void) /* System Interrupt Handler */
|
|||
{
|
||||
ISR_ENTRY();
|
||||
system_int_safe();
|
||||
*AT91C_AIC_EOICR = 0; /* End of Interrupt */
|
||||
ISR_EXIT();
|
||||
}
|
||||
|
||||
static unsigned int enabled = 0; /* Number of times the system
|
||||
interrupt has been enabled */
|
||||
|
||||
#define DIS_INT *AT91C_AIC_IDCR = (1 << AT91C_ID_SYS)
|
||||
#define EN_INT if (enabled > 0) *AT91C_AIC_IECR = (1 << AT91C_ID_SYS)
|
||||
#define INTCNTL 0x80020000
|
||||
#define DIS_INT *((volatile uint32_t *)INTCNTL) = 3 << 19;
|
||||
#define EN_INT if (enabled > 0) *((volatile uint32_t *)INTCNTL) = 0;
|
||||
|
||||
void
|
||||
sys_interrupt_enable()
|
||||
{
|
||||
if (enabled++ == 0) {
|
||||
/* Level trigged at priority 5 */
|
||||
AT91C_AIC_SMR[AT91C_ID_SYS] = AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL | 5;
|
||||
/* Interrupt vector */
|
||||
AT91C_AIC_SVR[AT91C_ID_SYS] = (unsigned long) system_int;
|
||||
/* Enable */
|
||||
EN_INT;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue