fix LPC177x/8x GPIO debug instrumentation

This commit is contained in:
Gregory Nutt 2013-04-05 12:46:53 -06:00
parent f66e89b8cf
commit 1925e60dd1
4 changed files with 71 additions and 23 deletions

View file

@ -4514,4 +4514,13 @@
* arch/arm/src/lpc17xx/lpc17_gpio.c/.h: Separate LPC176x and LPC178x
logic into separate files. The logic is diverging to much to
try to retain common code (2013-4-03).
* net/net_clone.c: Fix compilation error when socket options are
are disabled. Reported by Daniel O'Connor (2013-4-05).
* configs/zkit-arm-1769/src/up_leds.c: Fix a typo introduced into
the button interrupt logic (2013-4-05).
* arch/arm/src/lpc17xx/lpc178x_gpio.c: Re-design of the GPIO
logic for the LPC178x family by Rommel Marcelo (2013-4-05).
* arch/arm/src/lpc17_gpiodbg.c: Updated so that it correctly
reports LPC177x/8x GPIO registers when GPIO debug is enabled
(2013-4-05).

52
Kconfig
View file

@ -398,71 +398,99 @@ config DEBUG_LCD
default n
depends on LCD
---help---
Enable low level debug SYSLOG output from the LCD driver (disabled by default)
Enable low level debug SYSLOG output from the LCD driver (disabled
by default). Support for this debug option is board-specific and
may not be available for some boards.
config DEBUG_LEDS
bool "Enable Low-level LED Debug Output"
default n
depends on ARCH_HAVE_LEDS
---help---
Enable low level debug from board-specific LED logic
Enable low level debug from board-specific LED logic. Support for
this debug option is board-specific and may not be available for
some boards.
config DEBUG_INPUT
bool "Enable Input Device Debug Output"
default n
depends on INPUT
---help---
Enable low level debug SYSLOG output from the input device drivers such as
mice and touchscreens (disabled by default)
Enable low level debug SYSLOG output from the input device drivers
such as mice and touchscreens (disabled by default). Support for
this debug option is board-specific and may not be available for
some boards.
config DEBUG_ANALOG
bool "Enable Analog Device Debug Output"
default n
---help---
Enable low level debug SYSLOG output from the analog device drivers such as
A/D and D/A converters (disabled by default)
Enable low level debug SYSLOG output from the analog device drivers
such as A/D and D/A converters (disabled by default). Support for
this debug option is architecgture-specific and may not be available
for some MCUs.
config DEBUG_I2C
bool "Enable I2C Debug Output"
default n
depends on I2C
---help---
Enable I2C driver debug SYSLOG output (disabled by default)
Enable I2C driver debug SYSLOG output (disabled by default).
Support for this debug option is architecgture-specific and may not
be available for some MCUs.
config DEBUG_SPI
bool "Enable SPI Debug Output"
default n
depends on SPI
---help---
Enable I2C driver debug SYSLOG output (disabled by default)
Enable I2C driver debug SYSLOG output (disabled by default).
Support for this debug option is architecgture-specific and may not
be available for some MCUs.
config DEBUG_CAN
bool "Enable CAN Debug Output"
default n
depends on CAN
---help---
Enable CAN driver debug SYSLOG output (disabled by default)
Enable CAN driver debug SYSLOG output (disabled by default).
Support for this debug option is architecgture-specific and may not
be available for some MCUs.
config DEBUG_SDIO
bool "Enable SDIO Debug Output"
default n
depends on MMCSD_SDIO
---help---
Enable SDIO driver debug SYSLOG output (disabled by default)
Enable SDIO driver debug SYSLOG output (disabled by default).
Support for this debug option is architecgture-specific and may not
be available for some MCUs.
config DEBUG_GPIO
bool "Enable GPIO Debug Output"
default n
---help---
Enable GPIO-releated debug SYSLOG output (disabled by default).
Support for this debug option is architecgture-specific and may not
be available for some MCUs.
config DEBUG_DMA
bool "Enable DMA Debug Output"
default n
depends on ARCH_DMA
---help---
Enable DMA-releated debug SYSLOG output (disabled by default)
Enable DMA-releated debug SYSLOG output (disabled by default).
Support for this debug option is architecgture-specific and may not
be available for some MCUs.
config DEBUG_WATCHDOG
bool "Enable Watchdog Timer Debug Output"
default n
depends on WATCHDOG
---help---
Enable watchdog timer debug SYSLOG output (disabled by default)
Enable watchdog timer debug SYSLOG output (disabled by default).
Support for this debug option is architecgture-specific and may not
be available for some MCUs.
endif

View file

@ -195,12 +195,6 @@ extern "C"
#define EXTERN extern
#endif
/* These tables have global scope only because they are shared between lpc17_gpio.c,
* lpc17_gpioint.c, and lpc17_gpiodbg.c
*/
EXTERN const uint32_t g_ioconport[GPIO_NPORTS];
/****************************************************************************
* Public Functions
****************************************************************************/

View file

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/lpc17xx/lpc17_gpiodbg.c
*
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -39,6 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <debug.h>
@ -48,7 +49,6 @@
#include "chip.h"
#include "lpc17_gpio.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@ -80,6 +80,7 @@
*
****************************************************************************/
#ifdef LPC176x
static uint32_t lpc17_pinsel(unsigned int port, unsigned int pin)
{
if (pin < 16)
@ -91,6 +92,7 @@ static uint32_t lpc17_pinsel(unsigned int port, unsigned int pin)
return g_hipinsel[port];
}
}
#endif /* LPC176x */
/****************************************************************************
* Name: lpc17_pinmode
@ -101,6 +103,7 @@ static uint32_t lpc17_pinsel(unsigned int port, unsigned int pin)
*
****************************************************************************/
#ifdef LPC176x
static uint32_t lpc17_pinmode(unsigned int port, unsigned int pin)
{
if (pin < 16)
@ -112,6 +115,7 @@ static uint32_t lpc17_pinmode(unsigned int port, unsigned int pin)
return g_hipinmode[port];
}
}
#endif /* LPC176x */
/****************************************************************************
* Global Functions
@ -125,12 +129,16 @@ static uint32_t lpc17_pinmode(unsigned int port, unsigned int pin)
*
****************************************************************************/
int lpc17_dumpgpio(uint16_t pinset, const char *msg)
int lpc17_dumpgpio(lpc17_pinset_t pinset, const char *msg)
{
irqstate_t flags;
uint32_t base;
#if defined(LPC176x)
uint32_t pinsel;
uint32_t pinmode;
#elif defined(LPC178x)
uint32_t iocon;
#endif /* LPC176x */
unsigned int port;
unsigned int pin;
@ -138,19 +146,28 @@ int lpc17_dumpgpio(uint16_t pinset, const char *msg)
port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
#if defined(LPC176x)
pinsel = lpc17_pinsel(port, pin);
pinmode = lpc17_pinmode(port, pin);
#elif defined(LPC178x)
iocon = LPC17_IOCON_P(port, pin);
#endif /* LPC176x */
/* The following requires exclusive access to the GPIO registers */
flags = irqsave();
lldbg("GPIO%c pinset: %08x -- %s\n",
port + '0', pinset, msg);
lldbg("GPIO%c pin%d (pinset: %08x) -- %s\n",
port + '0', pin, pinset, msg);
#if defined(LPC176x)
lldbg(" PINSEL[%08x]: %08x PINMODE[%08x]: %08x ODMODE[%08x]: %08x\n",
pinsel, pinsel ? getreg32(pinsel) : 0,
pinmode, pinmode ? getreg32(pinmode) : 0,
g_odmode[port], getreg32(g_odmode[port]));
#elif defined(LPC178x)
lldbg(" IOCON[%08x]:\n", getreg32(iocon));
#endif
base = g_fiobase[port];
lldbg(" FIODIR[%08x]: %08x FIOMASK[%08x]: %08x FIOPIN[%08x]: %08x\n",