diff options
41 files changed, 246 insertions, 64 deletions
diff --git a/apps/examples/dhcpd/Makefile b/apps/examples/dhcpd/Makefile index 783418c66..ba9a62c61 100644 --- a/apps/examples/dhcpd/Makefile +++ b/apps/examples/dhcpd/Makefile @@ -73,11 +73,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/hello/Makefile b/apps/examples/hello/Makefile index 11046dbeb..8644cbbbc 100644 --- a/apps/examples/hello/Makefile +++ b/apps/examples/hello/Makefile @@ -73,11 +73,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/helloxx/Makefile b/apps/examples/helloxx/Makefile index e4f58a4ea..3d930191c 100755 --- a/apps/examples/helloxx/Makefile +++ b/apps/examples/helloxx/Makefile @@ -90,11 +90,12 @@ $(BIN): chkcxx $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/hidkbd/Makefile b/apps/examples/hidkbd/Makefile index 9ea170b8e..f83a4ded0 100644 --- a/apps/examples/hidkbd/Makefile +++ b/apps/examples/hidkbd/Makefile @@ -73,11 +73,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/igmp/Makefile b/apps/examples/igmp/Makefile index 947b95484..744cd875d 100755 --- a/apps/examples/igmp/Makefile +++ b/apps/examples/igmp/Makefile @@ -73,11 +73,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/mm/Makefile b/apps/examples/mm/Makefile index 30cfea32f..eff33ffe7 100644 --- a/apps/examples/mm/Makefile +++ b/apps/examples/mm/Makefile @@ -73,11 +73,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/mount/Makefile b/apps/examples/mount/Makefile index 3cfc2f35c..200fcc99d 100644 --- a/apps/examples/mount/Makefile +++ b/apps/examples/mount/Makefile @@ -73,11 +73,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/nettest/Makefile b/apps/examples/nettest/Makefile index 52e205f34..38b930f45 100644 --- a/apps/examples/nettest/Makefile +++ b/apps/examples/nettest/Makefile @@ -103,11 +103,12 @@ $(HOST_BIN): $(HOST_OBJS) .built: $(TARG_BIN) $(HOST_BIN) @touch .built +context: + .depend: Makefile $(TARG_SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(TARG_SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/nsh/Makefile b/apps/examples/nsh/Makefile index d6d78bc00..56695431a 100644 --- a/apps/examples/nsh/Makefile +++ b/apps/examples/nsh/Makefile @@ -73,11 +73,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/null/Makefile b/apps/examples/null/Makefile index 472b06289..8bcd8f1b8 100644 --- a/apps/examples/null/Makefile +++ b/apps/examples/null/Makefile @@ -73,11 +73,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/nx/Makefile b/apps/examples/nx/Makefile index 1f543a34e..6b13c3402 100644 --- a/apps/examples/nx/Makefile +++ b/apps/examples/nx/Makefile @@ -76,11 +76,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/nxflat/Makefile b/apps/examples/nxflat/Makefile index 570a059a8..d8573735e 100644 --- a/apps/examples/nxflat/Makefile +++ b/apps/examples/nxflat/Makefile @@ -76,13 +76,14 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + # We can't make dependencies in this directory because the required # header files may not yet exist. .depend: @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/ostest/Makefile b/apps/examples/ostest/Makefile index 3c0284d73..5a7e6246c 100644 --- a/apps/examples/ostest/Makefile +++ b/apps/examples/ostest/Makefile @@ -113,11 +113,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/pashello/Makefile b/apps/examples/pashello/Makefile index 11d99ce56..a46231080 100644 --- a/apps/examples/pashello/Makefile +++ b/apps/examples/pashello/Makefile @@ -80,11 +80,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/pipe/Makefile b/apps/examples/pipe/Makefile index 0f56c5553..f5e73f758 100644 --- a/apps/examples/pipe/Makefile +++ b/apps/examples/pipe/Makefile @@ -73,11 +73,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/poll/Makefile b/apps/examples/poll/Makefile index 0a0e0e65d..5e2a4cf6a 100644 --- a/apps/examples/poll/Makefile +++ b/apps/examples/poll/Makefile @@ -73,6 +73,8 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ diff --git a/apps/examples/romfs/Makefile b/apps/examples/romfs/Makefile index 764f70640..354e7987f 100644 --- a/apps/examples/romfs/Makefile +++ b/apps/examples/romfs/Makefile @@ -89,6 +89,8 @@ $(BIN): romfs_testdir.h $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ diff --git a/apps/examples/sendmail/Makefile b/apps/examples/sendmail/Makefile index a3beb7059..94208b8fc 100644 --- a/apps/examples/sendmail/Makefile +++ b/apps/examples/sendmail/Makefile @@ -73,6 +73,8 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ diff --git a/apps/examples/serloop/Makefile b/apps/examples/serloop/Makefile index 0366d6248..487a86242 100644 --- a/apps/examples/serloop/Makefile +++ b/apps/examples/serloop/Makefile @@ -73,6 +73,8 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ diff --git a/apps/examples/thttpd/Makefile b/apps/examples/thttpd/Makefile index 2690e6297..4d5fb964e 100644 --- a/apps/examples/thttpd/Makefile +++ b/apps/examples/thttpd/Makefile @@ -76,11 +76,12 @@ $(BIN): headers $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/udp/Makefile b/apps/examples/udp/Makefile index ddffda703..36aa0a169 100644 --- a/apps/examples/udp/Makefile +++ b/apps/examples/udp/Makefile @@ -101,11 +101,12 @@ $(HOST_BIN): $(HOST_OBJS) .built: $(TARG_BIN) $(HOST_BIN) +context: + .depend: Makefile $(TARG_SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(TARG_SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/uip/Makefile b/apps/examples/uip/Makefile index 59c5f76b4..f7e82f6b1 100644 --- a/apps/examples/uip/Makefile +++ b/apps/examples/uip/Makefile @@ -73,12 +73,13 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application -depend: .depend +epend: .depend clean: @rm -f *.o *~ .*.swp .built diff --git a/apps/examples/usbserial/Makefile b/apps/examples/usbserial/Makefile index b4d51ab82..a0b530122 100644 --- a/apps/examples/usbserial/Makefile +++ b/apps/examples/usbserial/Makefile @@ -73,11 +73,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/usbstorage/Makefile b/apps/examples/usbstorage/Makefile index aa3512547..c57e96acd 100644 --- a/apps/examples/usbstorage/Makefile +++ b/apps/examples/usbstorage/Makefile @@ -73,11 +73,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/wget/Makefile b/apps/examples/wget/Makefile index f245bf5a4..09e06c735 100644 --- a/apps/examples/wget/Makefile +++ b/apps/examples/wget/Makefile @@ -73,11 +73,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/examples/wlan/Makefile b/apps/examples/wlan/Makefile index 313436815..5097e4186 100755 --- a/apps/examples/wlan/Makefile +++ b/apps/examples/wlan/Makefile @@ -74,11 +74,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/netutils/dhcpc/Makefile b/apps/netutils/dhcpc/Makefile index 26f9c9e12..6374933bf 100644 --- a/apps/netutils/dhcpc/Makefile +++ b/apps/netutils/dhcpc/Makefile @@ -76,13 +76,14 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) ifneq ($(SRCS),) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep endif @touch $@ -# Register application depend: .depend clean: diff --git a/apps/netutils/dhcpd/Makefile b/apps/netutils/dhcpd/Makefile index 5731d551f..96857c6de 100644 --- a/apps/netutils/dhcpd/Makefile +++ b/apps/netutils/dhcpd/Makefile @@ -76,13 +76,14 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) ifneq ($(SRCS),) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep endif @touch $@ -# Register application depend: .depend clean: diff --git a/apps/netutils/resolv/Makefile b/apps/netutils/resolv/Makefile index 07b68b995..1a9fa8e6f 100644 --- a/apps/netutils/resolv/Makefile +++ b/apps/netutils/resolv/Makefile @@ -76,13 +76,14 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) ifneq ($(SRCS),) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep endif @touch $@ -# Register application depend: .depend clean: diff --git a/apps/netutils/smtp/Makefile b/apps/netutils/smtp/Makefile index 75a929b58..245188e9d 100644 --- a/apps/netutils/smtp/Makefile +++ b/apps/netutils/smtp/Makefile @@ -76,13 +76,14 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) ifneq ($(SRCS),) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep endif @touch $@ -# Register application depend: .depend clean: diff --git a/apps/netutils/telnetd/Makefile b/apps/netutils/telnetd/Makefile index 3d53a693b..736f1e130 100644 --- a/apps/netutils/telnetd/Makefile +++ b/apps/netutils/telnetd/Makefile @@ -76,13 +76,14 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) ifneq ($(SRCS),) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep endif @touch $@ -# Register application depend: .depend clean: diff --git a/apps/netutils/tftpc/Makefile b/apps/netutils/tftpc/Makefile index c3f49c906..b4b8e80b3 100644 --- a/apps/netutils/tftpc/Makefile +++ b/apps/netutils/tftpc/Makefile @@ -78,13 +78,14 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) ifneq ($(SRCS),) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep endif @touch $@ -# Register application depend: .depend clean: diff --git a/apps/netutils/thttpd/Makefile b/apps/netutils/thttpd/Makefile index 133139a77..375484379 100644 --- a/apps/netutils/thttpd/Makefile +++ b/apps/netutils/thttpd/Makefile @@ -103,13 +103,14 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) ifneq ($(SRCS),) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep endif @touch $@ -# Register application depend: .depend clean: diff --git a/apps/netutils/uiplib/Makefile b/apps/netutils/uiplib/Makefile index 84708a639..ef41adda3 100644 --- a/apps/netutils/uiplib/Makefile +++ b/apps/netutils/uiplib/Makefile @@ -85,11 +85,12 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep @touch $@ -# Register application depend: .depend clean: diff --git a/apps/netutils/webclient/Makefile b/apps/netutils/webclient/Makefile index a59eaca92..f0fb805bd 100644 --- a/apps/netutils/webclient/Makefile +++ b/apps/netutils/webclient/Makefile @@ -76,13 +76,14 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) ifneq ($(SRCS),) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep endif @touch $@ -# Register application depend: .depend clean: diff --git a/apps/netutils/webserver/Makefile b/apps/netutils/webserver/Makefile index 8d7a74773..a836f48ac 100644 --- a/apps/netutils/webserver/Makefile +++ b/apps/netutils/webserver/Makefile @@ -76,13 +76,14 @@ $(BIN): $(OBJS) .built: $(BIN) +context: + .depend: Makefile $(SRCS) ifneq ($(SRCS),) @$(MKDEP) $(ROOTDEPPATH) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep endif @touch $@ -# Register application depend: .depend clean: diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 0d08388a8..9787ddcde 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -1609,6 +1609,9 @@ Decio Renno. * Initialization for the CONFIG_APPS_DIR is now supported during the earlier, 'context' build phase. + * arch/arm/src/lpc17_gpioint.c -- Finish coding of the LPC17xx GPIO + interrupt logic. + diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index c8e89dc68..75d09209a 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@ <tr align="center" bgcolor="#e4e4e4"> <td> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> - <p>Last Updated: March 21, 2011</p> + <p>Last Updated: March 23, 2011</p> </td> </tr> </table> @@ -2157,8 +2157,19 @@ buildroot-1.9 2011-02-10 <spudmonkey@racsa.co.cr> <ul><pre> nuttx-6.1 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> + * arch/arm/include/lpc17xx/irq.h and arch/arm/src/lpc17xx/lpc17_gpio*.c + -- Fix several bugs in the GPIO interrupt logic. Submited by + Decio Renno. + * Initialization for the CONFIG_APPS_DIR is now supported during the + earlier, 'context' build phase. + * arch/arm/src/lpc17_gpioint.c -- Finish coding of the LPC17xx GPIO + interrupt logic. + apps-6.1 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> + * Creation of auto-generated header files now occurs during the context + build phase. + pascal-2.1 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> buildroot-1.10 2011-xx-xx <spudmonkey@racsa.co.cr> diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c index aa658d3e8..8a894d31c 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c @@ -278,7 +278,7 @@ static int lpc17_pullup(uint16_t cfgset, unsigned int port, unsigned int pin) ****************************************************************************/ #ifdef CONFIG_GPIO_IRQ -static int lpc17_setintedge(unsigned int port, unsigned int pin, unsigned int value) +static void lpc17_setintedge(unsigned int port, unsigned int pin, unsigned int value) { uint64_t *intedge; unsigned int shift; @@ -287,11 +287,11 @@ static int lpc17_setintedge(unsigned int port, unsigned int pin, unsigned int va if (port == 0) { - intedge = g_intedge0; + intedge = &g_intedge0; } else if (port == 2) { - intedge = g_intedge2; + intedge = &g_intedge2; } else { diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c index 5b7672d91..213b80596 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c @@ -45,6 +45,7 @@ #include <debug.h> #include <arch/irq.h> +#include <nuttx/arch.h> #include "up_arch.h" #include "chip.h" @@ -84,17 +85,17 @@ static unsigned int lpc17_getintedge(unsigned int port, unsigned int pin) { - const uint64_t *intedge; + uint64_t *intedge; /* Which word to we use? */ if (port == 0) { - intedge = g_intedge0; + intedge = &g_intedge0; } else if (port == 2) { - intedge = g_intedge2; + intedge = &g_intedge2; } else { @@ -129,7 +130,6 @@ static void lpc17_setintedge(uint32_t intbase, unsigned int pin, unsigned int ed { regval &= ~GPIOINT(pin); } - endif putreg32(regval, intbase + LPC17_GPIOINT_INTENR_OFFSET); /* Set/clear the rising edge enable bit */ @@ -143,7 +143,6 @@ static void lpc17_setintedge(uint32_t intbase, unsigned int pin, unsigned int ed { regval &= ~GPIOINT(pin); } - endif putreg32(regval, intbase + LPC17_GPIOINT_INTENF_OFFSET); } @@ -159,21 +158,21 @@ static int lpc17_irq2port(int irq) { /* Set 1: 12 interrupts p0.0-p0.11 */ - if (irq >= LPC17_VALID_FIRST0L && irq < (LPC17_VALID_FIRST0L+LPC17_VALID_NIRQS0L) + if (irq >= LPC17_VALID_FIRST0L && irq < (LPC17_VALID_FIRST0L+LPC17_VALID_NIRQS0L)) { return 0; } /* Set 2: 16 interrupts p0.15-p0.30 */ - else if (irq >= LPC17_VALID_FIRST0H && irq < (LPC17_VALID_FIRST0H+LPC17_VALID_NIRQS0H) + else if (irq >= LPC17_VALID_FIRST0H && irq < (LPC17_VALID_FIRST0H+LPC17_VALID_NIRQS0H)) { return 0; } /* Set 3: 14 interrupts p2.0-p2.13 */ - else if (irq >= LPC17_VALID_NIRQS2 && irq < (LPC17_VALID_FIRST2+LPC17_VALID_NIRQS2) + else if (irq >= LPC17_VALID_NIRQS2 && irq < (LPC17_VALID_FIRST2+LPC17_VALID_NIRQS2)) { return 2; } @@ -188,45 +187,176 @@ static int lpc17_irq2port(int irq) * ****************************************************************************/ -static int lpc17_irq2port(int irq) +static int lpc17_irq2pin(int irq) { /* Set 1: 12 interrupts p0.0-p0.11 */ - if (irq >= LPC17_VALID_FIRST0L && irq < (LPC17_VALID_FIRST0L+LPC17_VALID_NIRQS0L) + if (irq >= LPC17_VALID_FIRST0L && irq < (LPC17_VALID_FIRST0L+LPC17_VALID_NIRQS0L)) { return irq - LPC17_VALID_FIRST0L + LPC17_VALID_SHIFT0L; } /* Set 2: 16 interrupts p0.15-p0.30 */ - else if (irq >= LPC17_VALID_FIRST0H && irq < (LPC17_VALID_FIRST0H+LPC17_VALID_NIRQS0H) + else if (irq >= LPC17_VALID_FIRST0H && irq < (LPC17_VALID_FIRST0H+LPC17_VALID_NIRQS0H)) { return irq - LPC17_VALID_FIRST0H + LPC17_VALID_SHIFT0H; - - 12 } /* Set 3: 14 interrupts p2.0-p2.13 */ - else if (irq >= LPC17_VALID_NIRQS2 && irq < (LPC17_VALID_FIRST2+LPC17_VALID_NIRQS2) + else if (irq >= LPC17_VALID_NIRQS2 && irq < (LPC17_VALID_FIRST2+LPC17_VALID_NIRQS2)) { return irq - LPC17_VALID_FIRST0H + LPC17_VALID_SHIFT2; } return -EINVAL; } +/**************************************************************************** + * Name: lpc17_gpiodemux + * + * Description: + * Demux all interrupts on one GPIO interrupt status register. + * + ****************************************************************************/ + +static void lpc17_gpiodemux(uint32_t intbase, uint32_t intmask, + int irqbase, void *context) +{ + uint32_t intstatr; + uint32_t intstatf; + uint32_t intstatus; + uint32_t bit; + int irq; + + /* Get the interrupt rising and falling edge status and mask out only the + * interrupts that are enabled. + */ + + intstatr = getreg32(intbase + LPC17_GPIOINT_INTSTATR_OFFSET); + intstatr &= getreg32(intbase + LPC17_GPIOINT_INTENR_OFFSET); + + intstatf = getreg32(intbase + LPC17_GPIOINT_INTSTATF_OFFSET); + intstatf &= getreg32(intbase + LPC17_GPIOINT_INTENF_OFFSET); + + /* And get the OR of the enabled interrupt sources. We do not make any + * distinction between rising and falling edges (but the hardware does support + * the ability to differently if needed. + */ + + intstatus = intstatr | intstatf; + + /* Now march through the (valid) bits and dispatch each interrupt */ + + irq = irqbase; + bit = 1; + while (intstatus != 0) + { + /* Does this pin support an interrupt? If no, skip over it WITHOUT + * incrementing irq. + */ + + if ((intmask & bit) != 0) + { + /* This pin can support an interrupt. Is there an interrupt pending + * and enabled? + */ + + if ((intstatus & bit) != 0) + { + /* Clear the interrupt status */ + + putreg32(bit, intbase + LPC17_GPIOINT_INTCLR_OFFSET); + + /* And dispatch the interrupt */ + + irq_dispatch(irq, context); + } + + /* Increment the IRQ number on each interrupt pin */ + + irq++; + } + + /* Next bit */ + + intstatus &= ~bit; + bit <<= 1; + } +} + +/**************************************************************************** + * Name: lpc17_gpiointerrupt + * + * Description: + * Handle the EINT3 interrupt that also indicates that a GPIO interrupt has + * occurred. NOTE: This logic will have to be extended if EINT3 is + * actually used for External Interrupt 3. + * + ****************************************************************************/ + +static int lpc17_gpiointerrupt(int irq, void *context) +{ + /* Get the GPIO interrupt status */ + + uint32_t intstatus = getreg32(LPC17_GPIOINT_IOINTSTATUS); + + /* Check for an interrupt on GPIO0 */ + + if ((intstatus & GPIOINT_IOINTSTATUS_P0INT) != 0) + { + lpc17_gpiodemux(LPC17_GPIOINT0_BASE, LPC17_VALID_GPIOINT0, + LPC17_VALID_FIRST0L, context); + } + + /* Check for an interrupt on GPIO2 */ + + if ((intstatus & GPIOINT_IOINTSTATUS_P2INT) != 0) + { + lpc17_gpiodemux(LPC17_GPIOINT2_BASE, LPC17_VALID_GPIOINT2, + LPC17_VALID_FIRST2, context); + } + + return OK; +} /**************************************************************************** * Global Functions ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** + * Name: lpc17_gpioirqinitialize + * + * Description: + * Initialize logic to support a second level of interrupt decoding for + * GPIO pins. + * + ****************************************************************************/ + +void lpc17_gpioirqinitialize(void) +{ + /* Disable all GPIO interrupts */ + + putreg32(0, LPC17_GPIOINT0_INTENR); + putreg32(0, LPC17_GPIOINT0_INTENF); + putreg32(0, LPC17_GPIOINT2_INTENR); + putreg32(0, LPC17_GPIOINT2_INTENF); + + /* Attach and enable the GPIO IRQ. Note: GPIO0 and GPIO2 interrupts share + * the same position in the NVIC with External Interrupt 3 + */ + + (void)irq_attach(LPC17_IRQ_EINT3, lpc17_gpiointerrupt); + up_enable_irq(LPC17_IRQ_EINT3); +} + +/**************************************************************************** * Name: lpc17_gpioirqenable * * Description: * Enable the interrupt for specified GPIO IRQ * - ************************************************************************************/ + ****************************************************************************/ void lpc17_gpioirqenable(int irq) { @@ -239,25 +369,25 @@ void lpc17_gpioirqenable(int irq) * address of the GPIOINT registers for the port. */ - uint32_t intbase = g_intbase[GPIO_NPORTS]; - if (intabase != 0) + uint32_t intbase = g_intbase[port]; + if (intbase != 0) { /* And get the pin number associated with the port */ - unsigned int pin = g_irq2pin(irq); + unsigned int pin = lpc17_irq2pin(irq); unsigned int edges = lpc17_getintedge(port, pin); lpc17_setintedge(intbase, pin, edges); } } } -/************************************************************************************ +/**************************************************************************** * Name: lpc17_gpioirqdisable * * Description: * Disable the interrupt for specified GPIO IRQ * - ************************************************************************************/ + ****************************************************************************/ void lpc17_gpioirqdisable(int irq) { @@ -270,18 +400,16 @@ void lpc17_gpioirqdisable(int irq) * address of the GPIOINT registers for the port. */ - uint32_t intbase = g_intbase[GPIO_NPORTS]; - if (intabase != 0) + uint32_t intbase = g_intbase[port]; + if (intbase != 0) { /* And get the pin number associated with the port */ - unsigned int pin = g_irq2pin(irq); + unsigned int pin = lpc17_irq2pin(irq); lpc17_setintedge(intbase, pin, 0); } } } -#warning "Still needs initialization, interrupt handling and decoding logic" - #endif /* CONFIG_GPIO_IRQ */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c index dad1d1ca4..5190c8e66 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c @@ -2,7 +2,7 @@ * arch/arm/src/lpc17/lpc17_irq.c * arch/arm/src/chip/lpc17_irq.c * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> * * Redistribution and use in source and binary forms, with or without |