summaryrefslogtreecommitdiff
path: root/nuttx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-12-25 15:56:08 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-12-25 15:56:08 +0000
commit405e3e05c19a5af78b0be51c77bc79eed5d21108 (patch)
tree3482b22ad156a7be2cfae963dcd80e993fa3cd77 /nuttx
parent05f9ddee3b6976be77d91ab1cf0efdec98729081 (diff)
downloadpx4-nuttx-405e3e05c19a5af78b0be51c77bc79eed5d21108.tar.gz
px4-nuttx-405e3e05c19a5af78b0be51c77bc79eed5d21108.tar.bz2
px4-nuttx-405e3e05c19a5af78b0be51c77bc79eed5d21108.zip
Fix a PIC32 software interrupt bug (pipeline hazard)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4224 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rwxr-xr-xnuttx/arch/mips/include/mips32/irq.h2
-rw-r--r--nuttx/arch/mips/src/common/up_initialize.c2
-rwxr-xr-xnuttx/arch/mips/src/common/up_internal.h10
-rw-r--r--nuttx/arch/mips/src/mips32/up_swint0.c2
-rw-r--r--nuttx/arch/mips/src/mips32/up_syscall0.S24
-rw-r--r--nuttx/configs/pic32-starterkit/README.txt38
-rw-r--r--nuttx/configs/pic32-starterkit/include/board.h14
-rw-r--r--nuttx/configs/pic32-starterkit/src/up_leds.c12
8 files changed, 85 insertions, 19 deletions
diff --git a/nuttx/arch/mips/include/mips32/irq.h b/nuttx/arch/mips/include/mips32/irq.h
index ed6cd37f6..01a50029f 100755
--- a/nuttx/arch/mips/include/mips32/irq.h
+++ b/nuttx/arch/mips/include/mips32/irq.h
@@ -2,7 +2,7 @@
* arch/mips/include/mips32/irq.h
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/nuttx/arch/mips/src/common/up_initialize.c b/nuttx/arch/mips/src/common/up_initialize.c
index b51319175..15e242a6e 100644
--- a/nuttx/arch/mips/src/common/up_initialize.c
+++ b/nuttx/arch/mips/src/common/up_initialize.c
@@ -2,7 +2,7 @@
* arch/mips/src/common/up_initialize.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/nuttx/arch/mips/src/common/up_internal.h b/nuttx/arch/mips/src/common/up_internal.h
index 8da7e9605..bca7656b8 100755
--- a/nuttx/arch/mips/src/common/up_internal.h
+++ b/nuttx/arch/mips/src/common/up_internal.h
@@ -2,7 +2,7 @@
* arch/mips/common/up_internal.h
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -169,6 +169,14 @@ extern void up_copystate(uint32_t *dest, uint32_t *src);
extern void up_puts(const char *str);
extern void up_lowputs(const char *str);
+/* Defined in drivers/lowconsole.c */
+
+#ifdef CONFIG_DEV_LOWCONSOLE
+extern void lowconsole_init(void);
+#else
+# define lowconsole_init()
+#endif
+
/* Debug */
#ifdef CONFIG_ARCH_STACKDUMP
diff --git a/nuttx/arch/mips/src/mips32/up_swint0.c b/nuttx/arch/mips/src/mips32/up_swint0.c
index 6929d0b12..0e2270caa 100644
--- a/nuttx/arch/mips/src/mips32/up_swint0.c
+++ b/nuttx/arch/mips/src/mips32/up_swint0.c
@@ -2,7 +2,7 @@
* arch/mips/src/mips32/up_swint0.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/nuttx/arch/mips/src/mips32/up_syscall0.S b/nuttx/arch/mips/src/mips32/up_syscall0.S
index 241fd7aa7..b5a0e5213 100644
--- a/nuttx/arch/mips/src/mips32/up_syscall0.S
+++ b/nuttx/arch/mips/src/mips32/up_syscall0.S
@@ -2,7 +2,7 @@
* arch/mips/src/mips32/up_syscall0.S
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -73,6 +73,9 @@
* up_syscall2 - System call SYS_ argument and two additional parameters.
* up_syscall3 - System call SYS_ argument and three additional parameters.
*
+ * Assumption:
+ * All interrupts are disabled except for the software interrupts.
+ *
****************************************************************************/
.text
@@ -85,10 +88,25 @@ sys_call3: /* r4 holds the syscall number, arguments in r5, r6, and r7 */
.set push
.set noat
+
+ /* Set Bit 8 to request the software interrupt */
+
mfc0 t3, MIPS32_CP0_CAUSE /* t3 = CP0 cause register */
ori t3, (1 << 8) /* Bit 8: Request software interrupt 0 */
.set noreorder
mtc0 t3, MIPS32_CP0_CAUSE /* Trigger the software interrupt */
- nop /* Delay slot */
- j ra /* Return with result in v0 */
+
+ /* The actual interrupt will not a occur for a few more cycles. Let's
+ * put a few nop's here in hope that the SW interrupt occurs during
+ * the sequence of nops.
+ */
+
+ nop
+ nop
+ nop
+ nop
+
+ /* Then return with the result of the software interrupt in v0 */
+
+ j ra
.end sys_call0
diff --git a/nuttx/configs/pic32-starterkit/README.txt b/nuttx/configs/pic32-starterkit/README.txt
index 825a00560..10ddfa2b2 100644
--- a/nuttx/configs/pic32-starterkit/README.txt
+++ b/nuttx/configs/pic32-starterkit/README.txt
@@ -54,6 +54,7 @@ Contents
Powering the Board
Creating Compatible NuttX HEX files
Serial Console
+ LEDs
PIC32MX Configuration Options
Configurations
@@ -596,6 +597,43 @@ Serial Console
26 3.3V
28 GND
+LEDs
+====
+
+ The PIC32MX Ethernet Starter kit has 3 user LEDs labeled LED1-3 on the
+ board graphics (but referred to as LED4-6 in the schematic):
+
+ PIN User's Guide Board Stencil Notes
+ --- ------------- -------------- -------------------------
+ RD0 "User LED D4" "LED1 (RD0") High illuminates (RED)
+ RD2 "User LED D5" "LED3 (RD2)" High illuminates (YELLOW)
+ RD1 "User LED D6" "LED2 (RD1)" High illuminates (GREEN)
+
+ We will use the labels on the board to identify LEDs. If CONFIG_ARCH_LEDS
+ is defined, then NuttX will control these LEDs as follows:
+
+ ON OFF
+ ------------------------- ---- ---- ---- ---- ---- ----
+ LED1 LED2 LED3 LED1 LED2 LED3
+ ------------------------- ---- ---- ---- ---- ---- ----
+ LED_STARTED 0 OFF OFF OFF --- --- ---
+ LED_HEAPALLOCATE 1 ON OFF N/C --- --- ---
+ LED_IRQSENABLED 2 OFF ON N/C --- --- ---
+ LED_STACKCREATED 3 ON ON N/C --- --- ---
+ LED_INIRQ 4 N/C N/C ON N/C N/C OFF
+ LED_SIGNAL 4 N/C N/C ON N/C N/C OFF
+ LED_ASSERTION 4 N/C N/C ON N/C N/C OFF
+ LED_PANIC 5 ON N/C N/C OFF N/C N/C
+
+ There are 5 additional LEDs available on the MEB. These are not
+ used by NuttX.
+
+ RD1 LED1
+ RD2 LED2
+ RD3 LED3
+ RC1 LED4
+ RC2 LED5
+
PIC32MX Configuration Options
=============================
diff --git a/nuttx/configs/pic32-starterkit/include/board.h b/nuttx/configs/pic32-starterkit/include/board.h
index d0597ec02..5a2ca7692 100644
--- a/nuttx/configs/pic32-starterkit/include/board.h
+++ b/nuttx/configs/pic32-starterkit/include/board.h
@@ -89,10 +89,10 @@
* board graphics (but referred to as LED4-6 in the schematic):
*
* PIN User's Guide Board Stencil Notes
- * --- ------------- -------------- -------------------
- * RD0 "User LED D4" "LED1 (RD0") High illuminates
- * RD2 "User LED D5" "LED3 (RD2)" High illuminates
- * RD1 "User LED D6" "LED2 (RD1)" High illuminates
+ * --- ------------- -------------- -------------------------
+ * RD0 "User LED D4" "LED1 (RD0") High illuminates (RED)
+ * RD2 "User LED D5" "LED3 (RD2)" High illuminates (YELLOW)
+ * RD1 "User LED D6" "LED2 (RD1)" High illuminates (GREEN)
*
* We will use the labels on the board to identify LEDs
*
@@ -107,7 +107,7 @@
* LED_INIRQ 4 N/C N/C ON N/C N/C OFF
* LED_SIGNAL 4 N/C N/C ON N/C N/C OFF
* LED_ASSERTION 4 N/C N/C ON N/C N/C OFF
- * LED_PANIC 4 N/C N/C ON N/C N/C OFF
+ * LED_PANIC 5 ON N/C N/C OFF N/C N/C
*
* There are 5 additional LEDs available on the MEB:
*
@@ -125,9 +125,9 @@
#define LED_INIRQ 4
#define LED_SIGNAL 4
#define LED_ASSERTION 4
-#define LED_PANIC 4
+#define LED_PANIC 5
-#define LED_NVALUES 5
+#define LED_NVALUES 6
/* Switch definitions *******************************************************/
/* The PIC32 start kit has 3 switches:
diff --git a/nuttx/configs/pic32-starterkit/src/up_leds.c b/nuttx/configs/pic32-starterkit/src/up_leds.c
index 24a6ae9f6..7d07b4331 100644
--- a/nuttx/configs/pic32-starterkit/src/up_leds.c
+++ b/nuttx/configs/pic32-starterkit/src/up_leds.c
@@ -64,10 +64,10 @@
* board graphics (but referred to as LED4-6 in the schematic):
*
* PIN User's Guide Board Stencil Notes
- * --- ------------- -------------- -------------------
- * RD0 "User LED D4" "LED1 (RD0") High illuminates
- * RD2 "User LED D5" "LED3 (RD2)" High illuminates
- * RD1 "User LED D6" "LED2 (RD1)" High illuminates
+ * --- ------------- -------------- -------------------------
+ * RD0 "User LED D4" "LED1 (RD0") High illuminates (RED)
+ * RD2 "User LED D5" "LED3 (RD2)" High illuminates (YELLOW)
+ * RD1 "User LED D6" "LED2 (RD1)" High illuminates (GREEN)
*
* We will use the labels on the board to identify LEDs
*
@@ -82,7 +82,7 @@
* LED_INIRQ 4 N/C N/C ON N/C N/C OFF
* LED_SIGNAL 4 N/C N/C ON N/C N/C OFF
* LED_ASSERTION 4 N/C N/C ON N/C N/C OFF
- * LED_PANIC 4 N/C N/C ON N/C N/C OFF
+ * LED_PANIC 5 ON N/C N/C OFF N/C N/C
*/
#define GPIO_LED_1 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTD|GPIO_PIN0)
@@ -134,6 +134,7 @@ static const struct led_setting_s g_ledonvalues[LED_NVALUES] =
{LED_OFF, LED_ON, LED_NC, LED_OFF},
{LED_ON, LED_ON, LED_NC, LED_OFF},
{LED_NC, LED_NC, LED_ON, LED_OFF},
+ {LED_ON, LED_NC, LED_NC, LED_OFF},
};
static const struct led_setting_s g_ledoffvalues[LED_NVALUES] =
@@ -143,6 +144,7 @@ static const struct led_setting_s g_ledoffvalues[LED_NVALUES] =
{LED_NC, LED_NC, LED_NC, LED_OFF},
{LED_NC, LED_NC, LED_NC, LED_OFF},
{LED_NC, LED_NC, LED_OFF, LED_OFF},
+ {LED_OFF, LED_NC, LED_NC, LED_OFF},
};
/****************************************************************************