summaryrefslogtreecommitdiff
path: root/nuttx/arch
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/arch')
-rw-r--r--nuttx/arch/arm/src/armv6-m/up_svcall.c6
-rw-r--r--nuttx/arch/arm/src/armv7-m/up_mpu.c19
-rw-r--r--nuttx/arch/arm/src/armv7-m/up_svcall.c6
-rw-r--r--nuttx/arch/arm/src/sam3u/Make.defs2
-rw-r--r--nuttx/arch/mips/src/mips32/up_swint0.c6
5 files changed, 19 insertions, 20 deletions
diff --git a/nuttx/arch/arm/src/armv6-m/up_svcall.c b/nuttx/arch/arm/src/armv6-m/up_svcall.c
index 9ce756213..7c2bf0f2c 100644
--- a/nuttx/arch/arm/src/armv6-m/up_svcall.c
+++ b/nuttx/arch/arm/src/armv6-m/up_svcall.c
@@ -251,7 +251,7 @@ int up_svcall(int irq, FAR void *context)
* that there is a saved syscall return address.
*/
- DEBUGASSERT(rtcb->xcp.sysreturn != NULL &&
+ DEBUGASSERT(rtcb->xcp.sysreturn != 0 &&
regs[REG_EXC_RETURN] == EXC_RETURN_PRIVTHR);
/* Setup to return to the saved syscall return address in
@@ -260,7 +260,7 @@ int up_svcall(int irq, FAR void *context)
current_regs[REG_PC] = rtcb->xcp.sysreturn;
current_regs[REG_EXC_RETURN] = EXC_RETURN_UNPRIVTHR;
- rtcb->xcp.sysreturn = NULL;
+ rtcb->xcp.sysreturn = 0;
/* The return value must be in R0-R1. dispatch_syscall() temporarily
* moved the value to R2.
@@ -289,7 +289,7 @@ int up_svcall(int irq, FAR void *context)
* there is a no saved syscall return address.
*/
- DEBUGASSERT(rtcb->xcp.sysreturn == NULL &&
+ DEBUGASSERT(rtcb->xcp.sysreturn == 0 &&
regs[REG_EXC_RETURN] == EXC_RETURN_UNPRIVTHR);
/* Setup to return to dispatch_syscall in privileged mode. */
diff --git a/nuttx/arch/arm/src/armv7-m/up_mpu.c b/nuttx/arch/arm/src/armv7-m/up_mpu.c
index 4bb3f21d9..d4b04a444 100644
--- a/nuttx/arch/arm/src/armv7-m/up_mpu.c
+++ b/nuttx/arch/arm/src/armv7-m/up_mpu.c
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/armv7-m/up_mpu.c
*
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -40,6 +40,7 @@
#include <nuttx/config.h>
#include <stdint.h>
+#include <assert.h>
#include "mpu.h"
#include "up_internal.h"
@@ -58,7 +59,7 @@
* regions (0xff), and 0 means all subregions but one (0x00).
*/
-static const void uint8_t g_regionmap[9] =
+static const uint8_t g_regionmap[9] =
{
0xff, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x00
};
@@ -106,9 +107,10 @@ unsigned int mpu_allocregion(void)
uint8_t mpu_log2regionsize(size_t size)
{
+ uint32_t l2size;
+
/* The minimum permitted region size is 16 bytes (log2(16) = 4. */
- uint32_t l2size;
for (l2size = 4; l2size < 32 && size > (1 << l2size); size++);
return l2size;
}
@@ -129,7 +131,7 @@ uint8_t mpu_log2regionsize(size_t size)
uint32_t mpu_subregion(size_t size, uint8_t l2size)
{
- unsigned int nsrs
+ unsigned int nsrs;
uint32_t asize;
uint32_t mask;
@@ -140,7 +142,7 @@ uint32_t mpu_subregion(size_t size, uint8_t l2size)
* l2size: Log2 of the actual region size is <= (1 << l2size);
*/
- DEBUGASSERT(lsize > 3 && size <= (1 << l2size));
+ DEBUGASSERT(l2size > 3 && size <= (1 << l2size));
/* Examples with l2size = 12:
*
@@ -153,7 +155,7 @@ uint32_t mpu_subregion(size_t size, uint8_t l2size)
if (l2size < 32)
{
- mask = ((1 << lsize)-1) >> 3; /* Shifted mask */
+ mask = ((1 << l2size)-1) >> 3; /* Shifted mask */
}
/* The 4Gb region size is a special case */
@@ -168,9 +170,6 @@ uint32_t mpu_subregion(size_t size, uint8_t l2size)
}
asize = (size + mask) & ~mask; /* Adjusted size */
- nsrs = asize >> (lsize-3); /* Number of subregions */
+ nsrs = asize >> (l2size-3); /* Number of subregions */
return g_regionmap[nsrs];
}
-
-
-
diff --git a/nuttx/arch/arm/src/armv7-m/up_svcall.c b/nuttx/arch/arm/src/armv7-m/up_svcall.c
index 4da466934..5b56797a9 100644
--- a/nuttx/arch/arm/src/armv7-m/up_svcall.c
+++ b/nuttx/arch/arm/src/armv7-m/up_svcall.c
@@ -250,7 +250,7 @@ int up_svcall(int irq, FAR void *context)
* that there is a saved syscall return address.
*/
- DEBUGASSERT(rtcb->xcp.sysreturn != NULL &&
+ DEBUGASSERT(rtcb->xcp.sysreturn != 0 &&
regs[REG_EXC_RETURN] == EXC_RETURN_PRIVTHR);
/* Setup to return to the saved syscall return address in
@@ -259,7 +259,7 @@ int up_svcall(int irq, FAR void *context)
current_regs[REG_PC] = rtcb->xcp.sysreturn;
current_regs[REG_EXC_RETURN] = EXC_RETURN_UNPRIVTHR;
- rtcb->xcp.sysreturn = NULL;
+ rtcb->xcp.sysreturn = 0;
/* The return value must be in R0-R1. dispatch_syscall() temporarily
* moved the value to R2.
@@ -288,7 +288,7 @@ int up_svcall(int irq, FAR void *context)
* there is a no saved syscall return address.
*/
- DEBUGASSERT(rtcb->xcp.sysreturn == NULL &&
+ DEBUGASSERT(rtcb->xcp.sysreturn == 0 &&
regs[REG_EXC_RETURN] == EXC_RETURN_UNPRIVTHR);
/* Setup to return to dispatch_syscall in privileged mode. */
diff --git a/nuttx/arch/arm/src/sam3u/Make.defs b/nuttx/arch/arm/src/sam3u/Make.defs
index 58047af21..1255af237 100644
--- a/nuttx/arch/arm/src/sam3u/Make.defs
+++ b/nuttx/arch/arm/src/sam3u/Make.defs
@@ -56,7 +56,7 @@ CMN_ASRCS += up_memcpy.S
endif
ifeq ($(CONFIG_NUTTX_KERNEL),y)
-CHIP_CSRCS += up_mpu.c
+CMN_CSRCS += up_mpu.c
endif
ifeq ($(CONFIG_ELF),y)
diff --git a/nuttx/arch/mips/src/mips32/up_swint0.c b/nuttx/arch/mips/src/mips32/up_swint0.c
index 068bd45ab..4a172fe2a 100644
--- a/nuttx/arch/mips/src/mips32/up_swint0.c
+++ b/nuttx/arch/mips/src/mips32/up_swint0.c
@@ -244,7 +244,7 @@ int up_swint0(int irq, FAR void *context)
*/
#error "Missing logic -- need to test for privileged mode"
- DEBUGASSERT(rtcb->xcp.sysreturn != NULL && ???);
+ DEBUGASSERT(rtcb->xcp.sysreturn != 0 && ???);
/* Setup to return to the saved syscall return address in
* unprivileged mode.
@@ -252,7 +252,7 @@ int up_swint0(int irq, FAR void *context)
current_regs[REG_EPC] = rtcb->xcp.sysreturn;
#error "Missing logic -- need to set for unprivileged mode"
- rtcb->sysreturn = NULL;
+ rtcb->sysreturn = 0;
}
break;
#endif
@@ -276,7 +276,7 @@ int up_swint0(int irq, FAR void *context)
*/
#error "Missing logic -- Need to set unprivileged mode"
- DEBUGASSERT(rtcb->xcp.sysreturn == NULL && ???);
+ DEBUGASSERT(rtcb->xcp.sysreturn == 0 && ???);
/* Setup to return to dispatch_syscall in privileged mode. */