Skip to content

Commit cafbbb1

Browse files
crafcat7xiaoxiang781216
authored andcommitted
armv7amr/v8m:Modify hardcodes to macro definitions and update commit.
Signed-off-by: chenrun1 <[email protected]>
1 parent 9c2bc0e commit cafbbb1

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

arch/arm/src/armv7-a/cp15_cacheops.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828

2929
#include "cp15_cacheops.h"
3030

31+
/****************************************************************************
32+
* Pre-processor Definitions
33+
****************************************************************************/
34+
35+
#define NVIC_CSSELR_IND (1 << 0)
36+
3137
/****************************************************************************
3238
* Private Functions
3339
****************************************************************************/
@@ -52,7 +58,7 @@ static inline uint32_t cp15_cache_get_info(uint32_t *sets, uint32_t *ways,
5258

5359
csselr = CP15_GET(CSSELR);
5460

55-
CP15_SET(CSSELR, (csselr & ~0x01) | (icache & 0x01));
61+
CP15_SET(CSSELR, (csselr & ~NVIC_CSSELR_IND) | (icache & NVIC_CSSELR_IND));
5662

5763
ccsidr = CP15_GET(CCSIDR);
5864

arch/arm/src/armv7-m/nvic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,8 @@
679679
/* Cache Size Selection Register (Cortex-M7) */
680680

681681
#define NVIC_CSSELR_IND (1 << 0) /* Bit 0: Selects either instruction or data cache */
682-
# define NVIC_CSSELR_IND_ICACHE (1 << 0) /* 0=Instruction Cache */
683-
# define NVIC_CSSELR_IND_DCACHE (0 << 0) /* 1=Data Cache */
682+
# define NVIC_CSSELR_IND_ICACHE (1 << 0) /* 1=Instruction Cache */
683+
# define NVIC_CSSELR_IND_DCACHE (0 << 0) /* 0=Data Cache */
684684

685685
#define NVIC_CSSELR_LEVEL_SHIFT (1) /* Bit 1-3: Selects cache level */
686686
#define NVIC_CSSELR_LEVEL_MASK (7 << NVIC_CSSELR_LEVEL_SHIFT)

arch/arm/src/armv7-r/cp15_cacheops.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828

2929
#include "cp15_cacheops.h"
3030

31+
/****************************************************************************
32+
* Pre-processor Definitions
33+
****************************************************************************/
34+
35+
#define NVIC_CSSELR_IND (1 << 0)
36+
3137
/****************************************************************************
3238
* Private Functions
3339
****************************************************************************/
@@ -52,7 +58,7 @@ static inline uint32_t cp15_cache_get_info(uint32_t *sets, uint32_t *ways,
5258

5359
csselr = CP15_GET(CSSELR);
5460

55-
CP15_SET(CSSELR, (csselr & ~0x01) | (icache & 0x01));
61+
CP15_SET(CSSELR, (csselr & ~NVIC_CSSELR_IND) | (icache & NVIC_CSSELR_IND));
5662

5763
ccsidr = CP15_GET(CCSIDR);
5864

arch/arm/src/armv8-m/nvic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,8 +778,8 @@
778778
/* Cache Size Selection Register */
779779

780780
#define NVIC_CSSELR_IND (1 << 0) /* Bit 0: Selects either instruction or data cache */
781-
# define NVIC_CSSELR_IND_ICACHE (1 << 0) /* 0=Instruction Cache */
782-
# define NVIC_CSSELR_IND_DCACHE (0 << 0) /* 1=Data Cache */
781+
# define NVIC_CSSELR_IND_ICACHE (1 << 0) /* 1=Instruction Cache */
782+
# define NVIC_CSSELR_IND_DCACHE (0 << 0) /* 0=Data Cache */
783783

784784
#define NVIC_CSSELR_LEVEL_SHIFT (1) /* Bit 1-3: Selects cache level */
785785
#define NVIC_CSSELR_LEVEL_MASK (7 << NVIC_CSSELR_LEVEL_SHIFT)

0 commit comments

Comments
 (0)