mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 00:53:33 +08:00
Fix a PIC32 software interrupt bug (pipeline hazard)
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4224 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* arch/mips/include/mips32/irq.h
|
* arch/mips/include/mips32/irq.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* 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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* arch/mips/src/common/up_initialize.c
|
* arch/mips/src/common/up_initialize.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* 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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* arch/mips/common/up_internal.h
|
* arch/mips/common/up_internal.h
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* 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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* 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_puts(const char *str);
|
||||||
extern void up_lowputs(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 */
|
/* Debug */
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_STACKDUMP
|
#ifdef CONFIG_ARCH_STACKDUMP
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* arch/mips/src/mips32/up_swint0.c
|
* arch/mips/src/mips32/up_swint0.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* 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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* arch/mips/src/mips32/up_syscall0.S
|
* arch/mips/src/mips32/up_syscall0.S
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
* 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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -73,6 +73,9 @@
|
|||||||
* up_syscall2 - System call SYS_ argument and two additional parameters.
|
* up_syscall2 - System call SYS_ argument and two additional parameters.
|
||||||
* up_syscall3 - System call SYS_ argument and three additional parameters.
|
* up_syscall3 - System call SYS_ argument and three additional parameters.
|
||||||
*
|
*
|
||||||
|
* Assumption:
|
||||||
|
* All interrupts are disabled except for the software interrupts.
|
||||||
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
.text
|
.text
|
||||||
@@ -85,10 +88,25 @@ sys_call3: /* r4 holds the syscall number, arguments in r5, r6, and r7 */
|
|||||||
|
|
||||||
.set push
|
.set push
|
||||||
.set noat
|
.set noat
|
||||||
|
|
||||||
|
/* Set Bit 8 to request the software interrupt */
|
||||||
|
|
||||||
mfc0 t3, MIPS32_CP0_CAUSE /* t3 = CP0 cause register */
|
mfc0 t3, MIPS32_CP0_CAUSE /* t3 = CP0 cause register */
|
||||||
ori t3, (1 << 8) /* Bit 8: Request software interrupt 0 */
|
ori t3, (1 << 8) /* Bit 8: Request software interrupt 0 */
|
||||||
.set noreorder
|
.set noreorder
|
||||||
mtc0 t3, MIPS32_CP0_CAUSE /* Trigger the software interrupt */
|
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
|
.end sys_call0
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ Contents
|
|||||||
Powering the Board
|
Powering the Board
|
||||||
Creating Compatible NuttX HEX files
|
Creating Compatible NuttX HEX files
|
||||||
Serial Console
|
Serial Console
|
||||||
|
LEDs
|
||||||
PIC32MX Configuration Options
|
PIC32MX Configuration Options
|
||||||
Configurations
|
Configurations
|
||||||
|
|
||||||
@@ -596,6 +597,43 @@ Serial Console
|
|||||||
26 3.3V
|
26 3.3V
|
||||||
28 GND
|
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
|
PIC32MX Configuration Options
|
||||||
=============================
|
=============================
|
||||||
|
|
||||||
|
|||||||
@@ -89,10 +89,10 @@
|
|||||||
* board graphics (but referred to as LED4-6 in the schematic):
|
* board graphics (but referred to as LED4-6 in the schematic):
|
||||||
*
|
*
|
||||||
* PIN User's Guide Board Stencil Notes
|
* PIN User's Guide Board Stencil Notes
|
||||||
* --- ------------- -------------- -------------------
|
* --- ------------- -------------- -------------------------
|
||||||
* RD0 "User LED D4" "LED1 (RD0") High illuminates
|
* RD0 "User LED D4" "LED1 (RD0") High illuminates (RED)
|
||||||
* RD2 "User LED D5" "LED3 (RD2)" High illuminates
|
* RD2 "User LED D5" "LED3 (RD2)" High illuminates (YELLOW)
|
||||||
* RD1 "User LED D6" "LED2 (RD1)" High illuminates
|
* RD1 "User LED D6" "LED2 (RD1)" High illuminates (GREEN)
|
||||||
*
|
*
|
||||||
* We will use the labels on the board to identify LEDs
|
* 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_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_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_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:
|
* There are 5 additional LEDs available on the MEB:
|
||||||
*
|
*
|
||||||
@@ -125,9 +125,9 @@
|
|||||||
#define LED_INIRQ 4
|
#define LED_INIRQ 4
|
||||||
#define LED_SIGNAL 4
|
#define LED_SIGNAL 4
|
||||||
#define LED_ASSERTION 4
|
#define LED_ASSERTION 4
|
||||||
#define LED_PANIC 4
|
#define LED_PANIC 5
|
||||||
|
|
||||||
#define LED_NVALUES 5
|
#define LED_NVALUES 6
|
||||||
|
|
||||||
/* Switch definitions *******************************************************/
|
/* Switch definitions *******************************************************/
|
||||||
/* The PIC32 start kit has 3 switches:
|
/* The PIC32 start kit has 3 switches:
|
||||||
|
|||||||
@@ -64,10 +64,10 @@
|
|||||||
* board graphics (but referred to as LED4-6 in the schematic):
|
* board graphics (but referred to as LED4-6 in the schematic):
|
||||||
*
|
*
|
||||||
* PIN User's Guide Board Stencil Notes
|
* PIN User's Guide Board Stencil Notes
|
||||||
* --- ------------- -------------- -------------------
|
* --- ------------- -------------- -------------------------
|
||||||
* RD0 "User LED D4" "LED1 (RD0") High illuminates
|
* RD0 "User LED D4" "LED1 (RD0") High illuminates (RED)
|
||||||
* RD2 "User LED D5" "LED3 (RD2)" High illuminates
|
* RD2 "User LED D5" "LED3 (RD2)" High illuminates (YELLOW)
|
||||||
* RD1 "User LED D6" "LED2 (RD1)" High illuminates
|
* RD1 "User LED D6" "LED2 (RD1)" High illuminates (GREEN)
|
||||||
*
|
*
|
||||||
* We will use the labels on the board to identify LEDs
|
* 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_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_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_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)
|
#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_OFF, LED_ON, LED_NC, LED_OFF},
|
||||||
{LED_ON, LED_ON, LED_NC, LED_OFF},
|
{LED_ON, LED_ON, LED_NC, LED_OFF},
|
||||||
{LED_NC, LED_NC, LED_ON, 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] =
|
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_NC, LED_OFF},
|
{LED_NC, LED_NC, LED_NC, LED_OFF},
|
||||||
{LED_NC, LED_NC, LED_OFF, LED_OFF},
|
{LED_NC, LED_NC, LED_OFF, LED_OFF},
|
||||||
|
{LED_OFF, LED_NC, LED_NC, LED_OFF},
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user