arch: arc: fix the comments and coding style
Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
diff --git a/arch/arc/core/mpu/arc_mpu.c b/arch/arc/core/mpu/arc_mpu.c
index 21776f9..83937b0 100644
--- a/arch/arc/core/mpu/arc_mpu.c
+++ b/arch/arc/core/mpu/arc_mpu.c
@@ -73,6 +73,7 @@
/* no Write and Execute to guard region */
#if CONFIG_ARC_MPU_VER == 2
u8_t bits = find_msb_set(size) + 1;
+
return AUX_MPU_RDP_REGION_SIZE(bits) |
AUX_MPU_RDP_UR | AUX_MPU_RDP_KR;
#elif CONFIG_ARC_MPU_VER == 3
@@ -87,7 +88,7 @@
static inline void _region_init(u32_t index, u32_t region_addr, u32_t size,
u32_t region_attr)
{
-/* ARC MPU version 2 and verison 3 have different aux reg interface */
+/* ARC MPU version 2 and version 3 have different aux reg interface */
#if CONFIG_ARC_MPU_VER == 2
u8_t bits = find_msb_set(size) + 1;
index = 2 * index;
@@ -126,6 +127,7 @@
static inline s32_t _mpu_probe(u32_t addr)
{
u32_t val;
+
_arc_v2_aux_reg_write(_ARC_V2_MPU_PROBE, addr);
val = _arc_v2_aux_reg_read(_ARC_V2_MPU_INDEX);
@@ -215,7 +217,7 @@
_region_init(region_index, base, size, region_attr);
#elif CONFIG_ARC_MPU_VER == 3
- static s32_t last_index = 0;
+ static s32_t last_index;
s32_t index;
u32_t last_region = _get_num_regions() - 1;
@@ -237,21 +239,21 @@
*/
index = _mpu_probe(base);
- /* ARC MPU version doesnot support region overlap.
- * So it can not be directly used for stack/stack guard prtocet.
+ /* ARC MPU version doesn't support region overlap.
+ * So it can not be directly used for stack/stack guard protect
* One way to do this is splitting the ram region as follow:
*
* Take THREAD_STACK_GUARD_REGION as example:
- * RAM region 0: the ram region before THREAD_STACK_GUARD_REGION,rw
+ * RAM region 0: the ram region before THREAD_STACK_GUARD_REGION, rw
* RAM THREAD_STACK_GUARD_REGION: RO
* RAM region 1: the region after THREAD_STACK_GUARD_REGIO, same
- * as region 0
+ * as region 0
*/
if (index >= 0) { /* need to split, only 1 split is allowed */
/* find the correct region to mpu_config.mpu_regions */
if (index == last_region) {
- /* already splitted */
+ /* already split */
index = last_index;
} else {
/* new split */
diff --git a/arch/arc/core/swap.S b/arch/arc/core/swap.S
index 13aa360..29f5026 100644
--- a/arch/arc/core/swap.S
+++ b/arch/arc/core/swap.S
@@ -173,7 +173,7 @@
sr ilink, [_ARC_V2_ERET]
/* put status32 into estatus */
- ld ilink, [sp, ___isf_t_status32_OFFSET - ___isf_t_pc_OFFSET] /* status32 into ilink */
+ ld ilink, [sp, ___isf_t_status32_OFFSET - ___isf_t_pc_OFFSET]
sr ilink, [_ARC_V2_ERSTATUS]
add_s sp, sp, ___isf_t_status32_OFFSET - ___isf_t_pc_OFFSET + 4
rtie
diff --git a/include/arch/arc/v2/mpu/arc_core_mpu.h b/include/arch/arc/v2/mpu/arc_core_mpu.h
index 2bee190..62f9ec5 100644
--- a/include/arch/arc/v2/mpu/arc_core_mpu.h
+++ b/include/arch/arc/v2/mpu/arc_core_mpu.h
@@ -64,9 +64,11 @@
*
* @param index MPU region index
* @param base base address
+ * @param size size of region
* @param region_attr region attribute
*/
-void arc_core_mpu_region(u32_t index, u32_t base, u32_t size, u32_t region_attr);
+void arc_core_mpu_region(u32_t index, u32_t base, u32_t size,
+ u32_t region_attr);
/**
* @brief configure the base address and size for an MPU region
diff --git a/include/arch/arc/v2/mpu/arc_mpu.h b/include/arch/arc/v2/mpu/arc_mpu.h
index a744f44..83f823c 100644
--- a/include/arch/arc/v2/mpu/arc_mpu.h
+++ b/include/arch/arc/v2/mpu/arc_mpu.h
@@ -14,8 +14,8 @@
#define AUX_MPU_RDP_KE 0x040 /* only allow kernel execution */
#define AUX_MPU_RDP_KW 0x080 /* only allow kernel write */
#define AUX_MPU_RDP_KR 0x100 /* only allow kernel read */
-#define AUX_MPU_RDP_S 0x8000 /* secure */
-#define AUX_MPU_RDP_N 0x0000 /* normal */
+#define AUX_MPU_RDP_S 0x8000 /* secure */
+#define AUX_MPU_RDP_N 0x0000 /* normal */