mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
arch/arm: Add NVIC_AIRCR_VECTKEY macro to avoid the hard code value
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
David Sidrane
parent
21316466d2
commit
33666832c5
@@ -53,7 +53,7 @@ void up_systemreset(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
regval = getreg32(NVIC_AIRCR) & NVIC_AIRCR_PRIGROUP_MASK;
|
regval = getreg32(NVIC_AIRCR) & NVIC_AIRCR_PRIGROUP_MASK;
|
||||||
regval |= ((0x5fa << NVIC_AIRCR_VECTKEY_SHIFT) | NVIC_AIRCR_SYSRESETREQ);
|
regval |= (NVIC_AIRCR_VECTKEY | NVIC_AIRCR_SYSRESETREQ);
|
||||||
putreg32(regval, NVIC_AIRCR);
|
putreg32(regval, NVIC_AIRCR);
|
||||||
|
|
||||||
/* Ensure completion of memory accesses */
|
/* Ensure completion of memory accesses */
|
||||||
|
|||||||
@@ -559,8 +559,10 @@
|
|||||||
#define NVIC_AIRCR_ENDIANNESS (1 << 15) /* Bit 15: 1=Big endian */
|
#define NVIC_AIRCR_ENDIANNESS (1 << 15) /* Bit 15: 1=Big endian */
|
||||||
#define NVIC_AIRCR_VECTKEY_SHIFT (16) /* Bits 16-31: VECTKEY */
|
#define NVIC_AIRCR_VECTKEY_SHIFT (16) /* Bits 16-31: VECTKEY */
|
||||||
#define NVIC_AIRCR_VECTKEY_MASK (0xffff << NVIC_AIRCR_VECTKEY_SHIFT)
|
#define NVIC_AIRCR_VECTKEY_MASK (0xffff << NVIC_AIRCR_VECTKEY_SHIFT)
|
||||||
|
#define NVIC_AIRCR_VECTKEY (0x05fa << NVIC_AIRCR_VECTKEY_SHIFT)
|
||||||
#define NVIC_AIRCR_VECTKEYSTAT_SHIFT (16) /* Bits 16-31: VECTKEYSTAT */
|
#define NVIC_AIRCR_VECTKEYSTAT_SHIFT (16) /* Bits 16-31: VECTKEYSTAT */
|
||||||
#define NVIC_AIRCR_VECTKEYSTAT_MASK (0xffff << NVIC_AIRCR_VECTKEYSTAT_SHIFT)
|
#define NVIC_AIRCR_VECTKEYSTAT_MASK (0xffff << NVIC_AIRCR_VECTKEYSTAT_SHIFT)
|
||||||
|
#define NVIC_AIRCR_VECTKEYSTAT (0xfa05 << NVIC_AIRCR_VECTKEYSTAT_SHIFT)
|
||||||
|
|
||||||
/* System handler control and state register (SYSHCON) */
|
/* System handler control and state register (SYSHCON) */
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ void up_systemreset(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
regval = getreg32(NVIC_AIRCR) & NVIC_AIRCR_PRIGROUP_MASK;
|
regval = getreg32(NVIC_AIRCR) & NVIC_AIRCR_PRIGROUP_MASK;
|
||||||
regval |= ((0x5fa << NVIC_AIRCR_VECTKEY_SHIFT) | NVIC_AIRCR_SYSRESETREQ);
|
regval |= (NVIC_AIRCR_VECTKEY | NVIC_AIRCR_SYSRESETREQ);
|
||||||
putreg32(regval, NVIC_AIRCR);
|
putreg32(regval, NVIC_AIRCR);
|
||||||
|
|
||||||
/* Ensure completion of memory accesses */
|
/* Ensure completion of memory accesses */
|
||||||
|
|||||||
@@ -578,8 +578,10 @@
|
|||||||
#define NVIC_AIRCR_ENDIANNESS (1 << 15) /* Bit 15: 1=Big endian */
|
#define NVIC_AIRCR_ENDIANNESS (1 << 15) /* Bit 15: 1=Big endian */
|
||||||
#define NVIC_AIRCR_VECTKEY_SHIFT (16) /* Bits 16-31: VECTKEY */
|
#define NVIC_AIRCR_VECTKEY_SHIFT (16) /* Bits 16-31: VECTKEY */
|
||||||
#define NVIC_AIRCR_VECTKEY_MASK (0xffff << NVIC_AIRCR_VECTKEY_SHIFT)
|
#define NVIC_AIRCR_VECTKEY_MASK (0xffff << NVIC_AIRCR_VECTKEY_SHIFT)
|
||||||
|
#define NVIC_AIRCR_VECTKEY (0x05fa << NVIC_AIRCR_VECTKEY_SHIFT)
|
||||||
#define NVIC_AIRCR_VECTKEYSTAT_SHIFT (16) /* Bits 16-31: VECTKEYSTAT */
|
#define NVIC_AIRCR_VECTKEYSTAT_SHIFT (16) /* Bits 16-31: VECTKEYSTAT */
|
||||||
#define NVIC_AIRCR_VECTKEYSTAT_MASK (0xffff << NVIC_AIRCR_VECTKEYSTAT_SHIFT)
|
#define NVIC_AIRCR_VECTKEYSTAT_MASK (0xffff << NVIC_AIRCR_VECTKEYSTAT_SHIFT)
|
||||||
|
#define NVIC_AIRCR_VECTKEYSTAT (0xfa05 << NVIC_AIRCR_VECTKEYSTAT_SHIFT)
|
||||||
|
|
||||||
/* System handler control and state register (SYSHCON) */
|
/* System handler control and state register (SYSHCON) */
|
||||||
|
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ void up_irqinitialize(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
modifyreg32(NVIC_AIRCR, NVIC_AIRCR_VECTKEY_MASK | NVIC_AIRCR_PRIGROUP_MASK,
|
modifyreg32(NVIC_AIRCR, NVIC_AIRCR_VECTKEY_MASK | NVIC_AIRCR_PRIGROUP_MASK,
|
||||||
(0x5fa << NVIC_AIRCR_VECTKEY_SHIFT) | (0x5 << NVIC_AIRCR_PRIGROUP_SHIFT));
|
NVIC_AIRCR_VECTKEY | (0x5 << NVIC_AIRCR_PRIGROUP_SHIFT));
|
||||||
|
|
||||||
/* Set all interrupts (and exceptions) to the default priority */
|
/* Set all interrupts (and exceptions) to the default priority */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user