Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
armVIC.c
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* $RCSfile$
4
* $Revision$
5
*
6
* This module provides the interface routines for setting up and
7
* controlling the various interrupt modes present on the ARM processor.
8
* Copyright 2004, R O SoftWare
9
* No guarantees, warrantees, or promises, implied or otherwise.
10
* May be used for hobby or commercial purposes provided copyright
11
* notice remains intact.
12
*
13
*****************************************************************************/
14
#include "
types.h
"
15
#include "
armVIC.h
"
16
17
#define IRQ_MASK 0x00000080
18
#define FIQ_MASK 0x00000040
19
#define INT_MASK (IRQ_MASK | FIQ_MASK)
20
21
static
inline
unsigned
__get_cpsr
(
void
)
22
{
23
unsigned
long
retval;
24
asm
volatile
(
" mrs %0, cpsr"
:
"=r"
(retval) :
/* no inputs */
);
25
return
retval;
26
}
27
28
static
inline
void
__set_cpsr
(
unsigned
val
)
29
{
30
asm
volatile
(
" msr cpsr, %0"
:
/* no outputs */
:
"r"
(
val
));
31
}
32
33
unsigned
disableIRQ
(
void
)
34
{
35
unsigned
_cpsr;
36
37
_cpsr =
__get_cpsr
();
38
__set_cpsr
(_cpsr |
IRQ_MASK
);
39
return
_cpsr;
40
}
41
42
unsigned
restoreIRQ
(
unsigned
oldCPSR)
43
{
44
unsigned
_cpsr;
45
46
_cpsr =
__get_cpsr
();
47
__set_cpsr
((_cpsr & ~
IRQ_MASK
) | (oldCPSR &
IRQ_MASK
));
48
return
_cpsr;
49
}
50
51
unsigned
enableIRQ
(
void
)
52
{
53
unsigned
_cpsr;
54
55
_cpsr =
__get_cpsr
();
56
__set_cpsr
(_cpsr & ~
IRQ_MASK
);
57
return
_cpsr;
58
}
59
60
unsigned
disableFIQ
(
void
)
61
{
62
unsigned
_cpsr;
63
64
_cpsr =
__get_cpsr
();
65
__set_cpsr
(_cpsr |
FIQ_MASK
);
66
return
_cpsr;
67
}
68
69
unsigned
restoreFIQ
(
unsigned
oldCPSR)
70
{
71
unsigned
_cpsr;
72
73
_cpsr =
__get_cpsr
();
74
__set_cpsr
((_cpsr & ~
FIQ_MASK
) | (oldCPSR &
FIQ_MASK
));
75
return
_cpsr;
76
}
77
78
unsigned
enableFIQ
(
void
)
79
{
80
unsigned
_cpsr;
81
82
_cpsr =
__get_cpsr
();
83
__set_cpsr
(_cpsr & ~
FIQ_MASK
);
84
return
_cpsr;
85
}
val
uint16_t val[TCOUPLE_NB]
Definition:
temp_tcouple_adc.c:49
disableIRQ
unsigned disableIRQ(void)
Definition:
armVIC.c:33
FIQ_MASK
#define FIQ_MASK
Definition:
armVIC.c:18
types.h
__get_cpsr
static unsigned __get_cpsr(void)
Definition:
armVIC.c:21
armVIC.h
__set_cpsr
static void __set_cpsr(unsigned val)
Definition:
armVIC.c:28
disableFIQ
unsigned disableFIQ(void)
Definition:
armVIC.c:60
restoreFIQ
unsigned restoreFIQ(unsigned oldCPSR)
Definition:
armVIC.c:69
IRQ_MASK
#define IRQ_MASK
Definition:
armVIC.c:17
enableFIQ
unsigned enableFIQ(void)
Definition:
armVIC.c:78
enableIRQ
unsigned enableIRQ(void)
Definition:
armVIC.c:51
restoreIRQ
unsigned restoreIRQ(unsigned oldCPSR)
Definition:
armVIC.c:42
sw
airborne
arch
lpc21
armVIC.c
Generated on Tue Feb 1 2022 13:51:12 for Paparazzi UAS by
1.8.17