mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
fix LPC177x/8x GPIO debug instrumentation
This commit is contained in:
@@ -4514,4 +4514,13 @@
|
|||||||
* arch/arm/src/lpc17xx/lpc17_gpio.c/.h: Separate LPC176x and LPC178x
|
* arch/arm/src/lpc17xx/lpc17_gpio.c/.h: Separate LPC176x and LPC178x
|
||||||
logic into separate files. The logic is diverging to much to
|
logic into separate files. The logic is diverging to much to
|
||||||
try to retain common code (2013-4-03).
|
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).
|
||||||
|
|
||||||
|
|||||||
@@ -398,71 +398,99 @@ config DEBUG_LCD
|
|||||||
default n
|
default n
|
||||||
depends on LCD
|
depends on LCD
|
||||||
---help---
|
---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
|
config DEBUG_LEDS
|
||||||
bool "Enable Low-level LED Debug Output"
|
bool "Enable Low-level LED Debug Output"
|
||||||
default n
|
default n
|
||||||
depends on ARCH_HAVE_LEDS
|
depends on ARCH_HAVE_LEDS
|
||||||
---help---
|
---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
|
config DEBUG_INPUT
|
||||||
bool "Enable Input Device Debug Output"
|
bool "Enable Input Device Debug Output"
|
||||||
default n
|
default n
|
||||||
depends on INPUT
|
depends on INPUT
|
||||||
---help---
|
---help---
|
||||||
Enable low level debug SYSLOG output from the input device drivers such as
|
Enable low level debug SYSLOG output from the input device drivers
|
||||||
mice and touchscreens (disabled by default)
|
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
|
config DEBUG_ANALOG
|
||||||
bool "Enable Analog Device Debug Output"
|
bool "Enable Analog Device Debug Output"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Enable low level debug SYSLOG output from the analog device drivers such as
|
Enable low level debug SYSLOG output from the analog device drivers
|
||||||
A/D and D/A converters (disabled by default)
|
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
|
config DEBUG_I2C
|
||||||
bool "Enable I2C Debug Output"
|
bool "Enable I2C Debug Output"
|
||||||
default n
|
default n
|
||||||
depends on I2C
|
depends on I2C
|
||||||
---help---
|
---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
|
config DEBUG_SPI
|
||||||
bool "Enable SPI Debug Output"
|
bool "Enable SPI Debug Output"
|
||||||
default n
|
default n
|
||||||
depends on SPI
|
depends on SPI
|
||||||
---help---
|
---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
|
config DEBUG_CAN
|
||||||
bool "Enable CAN Debug Output"
|
bool "Enable CAN Debug Output"
|
||||||
default n
|
default n
|
||||||
depends on CAN
|
depends on CAN
|
||||||
---help---
|
---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
|
config DEBUG_SDIO
|
||||||
bool "Enable SDIO Debug Output"
|
bool "Enable SDIO Debug Output"
|
||||||
default n
|
default n
|
||||||
depends on MMCSD_SDIO
|
depends on MMCSD_SDIO
|
||||||
---help---
|
---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
|
config DEBUG_DMA
|
||||||
bool "Enable DMA Debug Output"
|
bool "Enable DMA Debug Output"
|
||||||
default n
|
default n
|
||||||
depends on ARCH_DMA
|
depends on ARCH_DMA
|
||||||
---help---
|
---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
|
config DEBUG_WATCHDOG
|
||||||
bool "Enable Watchdog Timer Debug Output"
|
bool "Enable Watchdog Timer Debug Output"
|
||||||
default n
|
default n
|
||||||
depends on WATCHDOG
|
depends on WATCHDOG
|
||||||
---help---
|
---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
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -195,12 +195,6 @@ extern "C"
|
|||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
#endif
|
#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
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/lpc17xx/lpc17_gpiodbg.c
|
* 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>
|
* 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
|
||||||
@@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
@@ -48,7 +49,6 @@
|
|||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
#include "lpc17_gpio.h"
|
#include "lpc17_gpio.h"
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -80,6 +80,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef LPC176x
|
||||||
static uint32_t lpc17_pinsel(unsigned int port, unsigned int pin)
|
static uint32_t lpc17_pinsel(unsigned int port, unsigned int pin)
|
||||||
{
|
{
|
||||||
if (pin < 16)
|
if (pin < 16)
|
||||||
@@ -91,6 +92,7 @@ static uint32_t lpc17_pinsel(unsigned int port, unsigned int pin)
|
|||||||
return g_hipinsel[port];
|
return g_hipinsel[port];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* LPC176x */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: lpc17_pinmode
|
* 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)
|
static uint32_t lpc17_pinmode(unsigned int port, unsigned int pin)
|
||||||
{
|
{
|
||||||
if (pin < 16)
|
if (pin < 16)
|
||||||
@@ -112,6 +115,7 @@ static uint32_t lpc17_pinmode(unsigned int port, unsigned int pin)
|
|||||||
return g_hipinmode[port];
|
return g_hipinmode[port];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* LPC176x */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Global Functions
|
* 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;
|
irqstate_t flags;
|
||||||
uint32_t base;
|
uint32_t base;
|
||||||
|
#if defined(LPC176x)
|
||||||
uint32_t pinsel;
|
uint32_t pinsel;
|
||||||
uint32_t pinmode;
|
uint32_t pinmode;
|
||||||
|
#elif defined(LPC178x)
|
||||||
|
uint32_t iocon;
|
||||||
|
#endif /* LPC176x */
|
||||||
unsigned int port;
|
unsigned int port;
|
||||||
unsigned int pin;
|
unsigned int pin;
|
||||||
|
|
||||||
@@ -138,19 +146,28 @@ int lpc17_dumpgpio(uint16_t pinset, const char *msg)
|
|||||||
|
|
||||||
port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
|
port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT;
|
||||||
pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
|
pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT;
|
||||||
|
|
||||||
|
#if defined(LPC176x)
|
||||||
pinsel = lpc17_pinsel(port, pin);
|
pinsel = lpc17_pinsel(port, pin);
|
||||||
pinmode = lpc17_pinmode(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 */
|
/* The following requires exclusive access to the GPIO registers */
|
||||||
|
|
||||||
flags = irqsave();
|
flags = irqsave();
|
||||||
lldbg("GPIO%c pinset: %08x -- %s\n",
|
lldbg("GPIO%c pin%d (pinset: %08x) -- %s\n",
|
||||||
port + '0', pinset, msg);
|
port + '0', pin, pinset, msg);
|
||||||
|
|
||||||
|
#if defined(LPC176x)
|
||||||
lldbg(" PINSEL[%08x]: %08x PINMODE[%08x]: %08x ODMODE[%08x]: %08x\n",
|
lldbg(" PINSEL[%08x]: %08x PINMODE[%08x]: %08x ODMODE[%08x]: %08x\n",
|
||||||
pinsel, pinsel ? getreg32(pinsel) : 0,
|
pinsel, pinsel ? getreg32(pinsel) : 0,
|
||||||
pinmode, pinmode ? getreg32(pinmode) : 0,
|
pinmode, pinmode ? getreg32(pinmode) : 0,
|
||||||
g_odmode[port], getreg32(g_odmode[port]));
|
g_odmode[port], getreg32(g_odmode[port]));
|
||||||
|
#elif defined(LPC178x)
|
||||||
|
lldbg(" IOCON[%08x]:\n", getreg32(iocon));
|
||||||
|
#endif
|
||||||
|
|
||||||
base = g_fiobase[port];
|
base = g_fiobase[port];
|
||||||
lldbg(" FIODIR[%08x]: %08x FIOMASK[%08x]: %08x FIOPIN[%08x]: %08x\n",
|
lldbg(" FIODIR[%08x]: %08x FIOMASK[%08x]: %08x FIOPIN[%08x]: %08x\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user