summaryrefslogtreecommitdiff
path: root/nuttx/arch
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-29 00:07:02 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-29 00:07:02 +0000
commit9d3dd1fbba6b9c1dff1f1b6699cb0b293857ed74 (patch)
tree82bf5b0e6e26f447eedb4044500a97a0108f4572 /nuttx/arch
parent3b136a8a2bba17e4f5ab0a18118a9f69e5f5eab1 (diff)
downloadpx4-nuttx-9d3dd1fbba6b9c1dff1f1b6699cb0b293857ed74.tar.gz
px4-nuttx-9d3dd1fbba6b9c1dff1f1b6699cb0b293857ed74.tar.bz2
px4-nuttx-9d3dd1fbba6b9c1dff1f1b6699cb0b293857ed74.zip
Moving toward system call infrastructure
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3435 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch')
-rw-r--r--nuttx/arch/arm/include/arm/irq.h47
-rw-r--r--nuttx/arch/arm/include/cortexm3/irq.h58
-rw-r--r--nuttx/arch/avr/include/avr32/irq.h6
-rwxr-xr-xnuttx/arch/hc/include/hc12/irq.h6
-rwxr-xr-xnuttx/arch/hc/include/hcs12/irq.h7
-rwxr-xr-xnuttx/arch/x86/include/i486/irq.h6
6 files changed, 120 insertions, 10 deletions
diff --git a/nuttx/arch/arm/include/arm/irq.h b/nuttx/arch/arm/include/arm/irq.h
index 65ccd1356..befc1218b 100644
--- a/nuttx/arch/arm/include/arm/irq.h
+++ b/nuttx/arch/arm/include/arm/irq.h
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/include/arm/irq.h
*
- * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -204,8 +204,46 @@ static inline void irqrestore(irqstate_t flags)
: "memory");
}
-static inline void system_call(swint_t func, int parm1,
- int parm2, int parm3)
+static inline void system_call0(unsigned int nbr)
+{
+ __asm__ __volatile__
+ (
+ "mov\tr0,%0\n\t"
+ "swi\t0x900001\n\t"
+ :
+ : "r" ((long)(nbr))
+ : "r0", "lr");
+}
+
+static inline void system_call1(unsigned int nbr, uintptr_t parm1)
+{
+ __asm__ __volatile__
+ (
+ "mov\tr0,%0\n\t"
+ "mov\tr1,%1\n\t"
+ "swi\t0x900001\n\t"
+ :
+ : "r" ((long)(nbr)), "r" ((long)(parm1))
+ : "r0", "r1", "lr");
+}
+
+static inline void system_call2(unsigned int nbr, uintptr_t parm1,
+ uintptr_t parm2)
+{
+ __asm__ __volatile__
+ (
+ "mov\tr0,%0\n\t"
+ "mov\tr1,%1\n\t"
+ "mov\tr2,%2\n\t"
+ "swi\t0x900001\n\t"
+ :
+ : "r" ((long)(nbr)), "r" ((long)(parm1)),
+ "r" ((long)(parm2))
+ : "r0", "r1", "r2", "lr");
+}
+
+static inline void system_call3(unsigned int nbr, uintptr_t parm1,
+ uintptr_t parm2, uintptr_t parm3)
{
__asm__ __volatile__
(
@@ -215,10 +253,11 @@ static inline void system_call(swint_t func, int parm1,
"mov\tr3,%3\n\t"
"swi\t0x900001\n\t"
:
- : "r" ((long)(func)), "r" ((long)(parm1)),
+ : "r" ((long)(nbr)), "r" ((long)(parm1)),
"r" ((long)(parm2)), "r" ((long)(parm3))
: "r0", "r1", "r2", "r3", "lr");
}
+
#endif /* __ASSEMBLY__ */
/****************************************************************************
diff --git a/nuttx/arch/arm/include/cortexm3/irq.h b/nuttx/arch/arm/include/cortexm3/irq.h
index 3f731385b..f57c1dc33 100644
--- a/nuttx/arch/arm/include/cortexm3/irq.h
+++ b/nuttx/arch/arm/include/cortexm3/irq.h
@@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/include/cortexm3/irq.h
*
- * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -49,7 +49,6 @@
# include <stdint.h>
#endif
-
/****************************************************************************
* Definitions
****************************************************************************/
@@ -281,6 +280,61 @@ static inline void svcall(uint32_t cmd, uint32_t arg)
: "r" (cmd), "r" (arg)
: "memory");
}
+
+static inline void system_call0(unsigned int nbr)
+{
+ __asm__ __volatile__
+ (
+ "mov\tr0,%0\n\t"
+ "\tsvc 0\n"
+ :
+ : "r" ((long)(nbr))
+ : "r0", "lr");
+}
+
+static inline void system_call1(unsigned int nbr, uintptr_t parm1)
+{
+ __asm__ __volatile__
+ (
+ "mov\tr0,%0\n\t"
+ "mov\tr1,%1\n\t"
+ "\tsvc 0\n"
+ :
+ : "r" ((long)(nbr)), "r" ((long)(parm1))
+ : "r0", "r1", "lr");
+}
+
+static inline void system_call2(unsigned int nbr, uintptr_t parm1,
+ uintptr_t parm2)
+{
+ __asm__ __volatile__
+ (
+ "mov\tr0,%0\n\t"
+ "mov\tr1,%1\n\t"
+ "mov\tr2,%2\n\t"
+ "\tsvc 0\n"
+ :
+ : "r" ((long)(nbr)), "r" ((long)(parm1)),
+ "r" ((long)(parm2))
+ : "r0", "r1", "r2", "lr");
+}
+
+static inline void system_call3(unsigned int nbr, uintptr_t parm1,
+ uintptr_t parm2, uintptr_t parm3)
+{
+ __asm__ __volatile__
+ (
+ "mov\tr0,%0\n\t"
+ "mov\tr1,%1\n\t"
+ "mov\tr2,%2\n\t"
+ "mov\tr3,%3\n\t"
+ "\tsvc 0\n"
+ :
+ : "r" ((long)(nbr)), "r" ((long)(parm1)),
+ "r" ((long)(parm2)), "r" ((long)(parm3))
+ : "r0", "r1", "r2", "r3", "lr");
+}
+
#endif /* __ASSEMBLY__ */
/****************************************************************************
diff --git a/nuttx/arch/avr/include/avr32/irq.h b/nuttx/arch/avr/include/avr32/irq.h
index a9d0d8626..691bc72d4 100644
--- a/nuttx/arch/avr/include/avr32/irq.h
+++ b/nuttx/arch/avr/include/avr32/irq.h
@@ -188,6 +188,12 @@ static inline void irqrestore(irqstate_t flags)
);
}
}
+
+static inline void system_call3(unsigned int nbr, uintptr_t parm1,
+ uintptr_t parm2, uintptr_t parm3)
+{
+ /* To be provided */
+}
#endif /* __ASSEMBLY__ */
/****************************************************************************
diff --git a/nuttx/arch/hc/include/hc12/irq.h b/nuttx/arch/hc/include/hc12/irq.h
index b499b171d..8754dc5d8 100755
--- a/nuttx/arch/hc/include/hc12/irq.h
+++ b/nuttx/arch/hc/include/hc12/irq.h
@@ -1,7 +1,7 @@
/************************************************************************************
* arch/hc/include/hc12/irq.h
*
- * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -81,8 +81,8 @@ static inline void irqrestore(irqstate_t flags)
/* To be provided */
}
-static inline void system_call(swint_t func, int parm1,
- int parm2, int parm3)
+static inline void system_call3(unsigned int nbr, uintptr_t parm1,
+ uintptr_t parm2, uintptr_t parm3)
{
/* To be provided */
}
diff --git a/nuttx/arch/hc/include/hcs12/irq.h b/nuttx/arch/hc/include/hcs12/irq.h
index cb3eb8ecb..d6162b82e 100755
--- a/nuttx/arch/hc/include/hcs12/irq.h
+++ b/nuttx/arch/hc/include/hcs12/irq.h
@@ -243,7 +243,12 @@ static inline void irqrestore(irqstate_t flags)
/* System call */
-#define system_call(f,p1,p2,p3) __asm("swi")
+static inline void system_call3(unsigned int nbr, uintptr_t parm1,
+ uintptr_t parm2, uintptr_t parm3)
+{
+ /* To be provided */
+ /* __asm("swi") */
+}
/************************************************************************************
* Public Data
diff --git a/nuttx/arch/x86/include/i486/irq.h b/nuttx/arch/x86/include/i486/irq.h
index 437352199..bca34b3ba 100755
--- a/nuttx/arch/x86/include/i486/irq.h
+++ b/nuttx/arch/x86/include/i486/irq.h
@@ -256,6 +256,12 @@ static inline void irqrestore(irqstate_t flags)
}
}
+static inline void system_call3(unsigned int nbr, uintptr_t parm1,
+ uintptr_t parm2, uintptr_t parm3)
+{
+ /* To be provided */
+}
+
/****************************************************************************
* Public Variables
****************************************************************************/