Add apps/examples/slcd, Remove USB from STM32L-Discovery, LSE support for the STM32 L family, some STM32L-Discovery LCD debug changes
This commit is contained in:
parent
4b554ae675
commit
5f713af7a1
@ -743,12 +743,49 @@ Configurations
|
||||
for Windows and builds under Cygwin (or probably MSYS). That
|
||||
can easily be reconfigured, of course.
|
||||
|
||||
CONFIG_HOST_WINDOWS=y : Builds under Windows
|
||||
CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
|
||||
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
|
||||
Build Setup:
|
||||
CONFIG_HOST_WINDOWS=y : Builds under Windows
|
||||
CONFIG_WINDOWS_CYGWIN=y : Using Cygwin
|
||||
|
||||
System Type:
|
||||
CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows
|
||||
|
||||
5. To enable SLCD support:
|
||||
|
||||
CONFIG_ARCH_LEDS=y : Disable LED support
|
||||
CONFIG_LIB_SLCDCODEC=y : Enable the SLCD CODEC
|
||||
CONFIG_STM32_LCD=y : Enable the SLCD
|
||||
Board Selection:
|
||||
CONFIG_ARCH_LEDS=y : Disable LED support
|
||||
|
||||
Library Routines:
|
||||
CONFIG_LIB_SLCDCODEC=y : Enable the SLCD CODEC
|
||||
|
||||
System Type:
|
||||
CONFIG_STM32_LCD=y : Enable the SLCD
|
||||
|
||||
When the LCD is enabled and the LEDs are disabled, the USART1
|
||||
serial console will automaticall move to PB6 and PB7 (you will get
|
||||
a compilation error if you forget to disable the LEDs).
|
||||
|
||||
SIGNAL FUNCTION LED CONNECTION
|
||||
------ ---------- ---------- -----------
|
||||
PB6 USART1_TX LED Blue P2, pin 8
|
||||
PB7 USART1_RX LED Green P2, pin 7
|
||||
|
||||
To enable apps/examples/slcd to test the SLCD:
|
||||
|
||||
Binary Formats:
|
||||
CONFIG_BINFMT_DISABLE=n : Don't disable binary support
|
||||
CONFIG_BUILTIN=y : Enable support for built-in binaries
|
||||
|
||||
Application Configuration:
|
||||
CONFIG_NSH_BUILTIN_APPS=y : Enable builtin apps in NSH
|
||||
CONFIG_NSH_ARCHINIT=y : Needed to initialize the SLCD
|
||||
CONFIG_EXAMPLES_SLCD=y : Enable apps/examples/slcd
|
||||
|
||||
To enable LCD debug output:
|
||||
|
||||
Device Drivers:
|
||||
CONFIG_LCD=y : (Needed to enable LCD debug)
|
||||
|
||||
Build Setup:
|
||||
CONFIG_DEBUG=y : Enable debug features
|
||||
CONFIG_DEBUG_VERBOSE=y : Enable LCD debug
|
||||
|
@ -60,6 +60,18 @@ ifeq ($(CONFIG_STM32_LCD),y)
|
||||
CSRCS += stm32_lcd.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PWM),y)
|
||||
CSRCS += up_pwm.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_QENCODER),y)
|
||||
CSRCS += up_qencoder.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_WATCHDOG),y)
|
||||
CSRCS += up_watchdog.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NSH_ARCHINIT),y)
|
||||
CSRCS += stm32_nsh.c
|
||||
endif
|
||||
|
@ -82,18 +82,6 @@ void stm32_boardinitialize(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize USB if the 1) USB device controller is in the configuration and 2)
|
||||
* disabled, and 3) the weak function stm32_usbinitialize() has been brought
|
||||
* into the build. Presumeably either CONFIG_USBDEV is also selected.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_STM32_USB
|
||||
if (stm32_usbinitialize)
|
||||
{
|
||||
stm32_usbinitialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
@ -63,6 +63,7 @@
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "stm32_gpio.h"
|
||||
#include "stm32_rcc.h"
|
||||
#include "chip/stm32_lcd.h"
|
||||
|
||||
#include "stm32ldiscovery.h"
|
||||
@ -291,6 +292,16 @@ struct stm32_slcdstate_s
|
||||
/****************************************************************************
|
||||
* Private Function Protototypes
|
||||
****************************************************************************/
|
||||
/* Debug */
|
||||
|
||||
#if defined(CONFIG_DEBUG_LCD) && defined(CONFIG_DEBUG_VERBOSE)
|
||||
static void slcd_dumpstate(FAR const char *msg);
|
||||
static void slcd_dumpslcd(FAR const char *msg);
|
||||
#else
|
||||
# define slcd_dumpstate(msg)
|
||||
# define slcd_dumpslcd(msg)
|
||||
#endif
|
||||
|
||||
/* Internal utilities */
|
||||
|
||||
static void slcd_clear(void);
|
||||
@ -299,7 +310,7 @@ static uint8_t slcd_getcontrast(void);
|
||||
static int slcd_setcontrast(uint8_t contrast);
|
||||
static void slcd_writebar(void);
|
||||
static inline uint16_t slcd_mapch(uint8_t ch);
|
||||
static inline void slcd_writemem(uint16_t bitset, int curpos);
|
||||
static inline void slcd_writemem(uint16_t segset, int curpos);
|
||||
static void slcd_writech(uint8_t ch, uint8_t curpos, uint8_t options);
|
||||
static inline void slcd_appendch(uint8_t ch, uint8_t options);
|
||||
static inline void slcd_action(enum slcdcode_e code, uint8_t count);
|
||||
@ -421,6 +432,44 @@ static uint32_t g_slcdgpio[BOARD_SLCD_NGPIOS] =
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: slcd_dumpstate
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_DEBUG_LCD) && defined(CONFIG_DEBUG_VERBOSE)
|
||||
static void slcd_dumpstate(FAR const char *msg)
|
||||
{
|
||||
lcdvdbg("%s:\n", msg);
|
||||
lcdvdbg(" curpos: %d\n",
|
||||
g_slcdstate.curpos);
|
||||
lcdvdbg(" Display: [%c%c%c%c%c%c]\n",
|
||||
g_slcdstate.buffer[0], g_slcdstate.buffer[1], g_slcdstate.buffer[2],
|
||||
g_slcdstate.buffer[3], g_slcdstate.buffer[4], g_slcdstate.buffer[5]);
|
||||
lcdvdbg(" Options: [%d%d%d%d%d%d]\n",
|
||||
g_slcdstate.options[0], g_slcdstate.options[1], g_slcdstate.options[2],
|
||||
g_slcdstate.options[3], g_slcdstate.options[4], g_slcdstate.options[5]);
|
||||
lcdvdbg(" Bar: %02x %02x\n",
|
||||
g_slcdstate.bar[0], g_slcdstate.bar[1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: slcd_dumpslcd
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_DEBUG_LCD) && defined(CONFIG_DEBUG_VERBOSE)
|
||||
static void slcd_dumpslcd(FAR const char *msg)
|
||||
{
|
||||
lcdvdbg("%s:\n", msg);
|
||||
lcdvdbg(" CR: %08x FCR: %08x SR: %08x CLR: %08x:\n",
|
||||
getreg32(STM32_LCD_CR), getreg32(STM32_LCD_FCR),
|
||||
getreg32(STM32_LCD_SR), getreg32(STM32_LCD_CLR));
|
||||
lcdvdbg(" RAM0L: %08x RAM0L: %08x RAM0L: %08x RAM0L: %08x\n",
|
||||
getreg32(STM32_LCD_RAM0L), getreg32(STM32_LCD_RAM1L),
|
||||
getreg32(STM32_LCD_RAM2L), getreg32(STM32_LCD_RAM3L));
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: slcd_clear
|
||||
****************************************************************************/
|
||||
@ -429,6 +478,8 @@ static void slcd_clear(void)
|
||||
{
|
||||
uint32_t regaddr;
|
||||
|
||||
lvdbg("Clearing\n");
|
||||
|
||||
/* Make sure that any previous transfer is complete. The firmware sets
|
||||
* the UDR each it modifies the LCD_RAM. The UDR bit stays set until the
|
||||
* end of the update. During this time the LCD_RAM is write protected.
|
||||
@ -509,6 +560,10 @@ static int slcd_setcontrast(uint8_t contrast)
|
||||
regval &= !LCD_FCR_CC_MASK;
|
||||
regval |= contrast << LCD_FCR_CC_SHIFT;
|
||||
putreg32(regval, STM32_LCD_FCR);
|
||||
|
||||
lcdvdbg("contrast: %d FCR: %08x\n",
|
||||
getreg32(STM32_LCD_FCR), contrast);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -520,6 +575,9 @@ static void slcd_writebar(void)
|
||||
{
|
||||
uint32_t regval;
|
||||
|
||||
lcdvdbg("bar: %02x %02x\n", g_slcdstate.bar[0], g_slcdstate.bar[1]);
|
||||
slcd_dumpslcd("BEFORE WRITE");
|
||||
|
||||
/* Make sure that any previous transfer is complete. The firmware sets
|
||||
* the UDR each it modifies the LCD_RAM. The UDR bit stays set until the
|
||||
* end of the update. During this time the LCD_RAM is write protected.
|
||||
@ -544,6 +602,7 @@ static void slcd_writebar(void)
|
||||
*/
|
||||
|
||||
putreg32(1, SLCD_SR_UDR_BB);
|
||||
slcd_dumpslcd("AFTER WRITE");
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -622,7 +681,7 @@ static inline uint16_t slcd_mapch(uint8_t ch)
|
||||
* Name: slcd_writemem
|
||||
****************************************************************************/
|
||||
|
||||
static inline void slcd_writemem(uint16_t bitset, int curpos)
|
||||
static inline void slcd_writemem(uint16_t segset, int curpos)
|
||||
{
|
||||
uint8_t segments[4];
|
||||
uint32_t ram0;
|
||||
@ -632,13 +691,19 @@ static inline void slcd_writemem(uint16_t bitset, int curpos)
|
||||
int i;
|
||||
int j;
|
||||
|
||||
lcdvdbg("segset: %04x curpos: %d\n", segset, curpos);
|
||||
slcd_dumpslcd("BEFORE WRITE");
|
||||
|
||||
/* Isolate the least significant bits */
|
||||
|
||||
for (i = 12, j = 0; j < 4; i -= 4, j++)
|
||||
{
|
||||
segments[j] = (bitset >> i) & 0x0f;
|
||||
segments[j] = (segset >> i) & 0x0f;
|
||||
}
|
||||
|
||||
lcdvdbg("segments: %02x %02x %02x %02x\n",
|
||||
segments[0], segments[1], segments[2], segments[3]);
|
||||
|
||||
/* Make sure that any previous transfer is complete. The firmware sets
|
||||
* the UDR each it modifies the LCD_RAM. The UDR bit stays set until the
|
||||
* end of the update. During this time the LCD_RAM is write protected.
|
||||
@ -755,6 +820,7 @@ static inline void slcd_writemem(uint16_t bitset, int curpos)
|
||||
*/
|
||||
|
||||
putreg32(1, SLCD_SR_UDR_BB);
|
||||
slcd_dumpslcd("AFTER WRITE");
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -763,31 +829,35 @@ static inline void slcd_writemem(uint16_t bitset, int curpos)
|
||||
|
||||
static void slcd_writech(uint8_t ch, uint8_t curpos, uint8_t options)
|
||||
{
|
||||
uint16_t bitset;
|
||||
uint16_t segset;
|
||||
|
||||
/* Map the character code to a 16-bit encoded value */
|
||||
|
||||
bitset = slcd_mapch(ch);
|
||||
segset = slcd_mapch(ch);
|
||||
|
||||
/* Check if the character should be decorated with a decimal point or colon */
|
||||
|
||||
if ((options & SCLD_DP) != 0)
|
||||
{
|
||||
bitset |= 0x0002;
|
||||
segset |= 0x0002;
|
||||
}
|
||||
else if ((options & SCLD_DP) != 0)
|
||||
{
|
||||
bitset |= 0x0020;
|
||||
segset |= 0x0020;
|
||||
}
|
||||
|
||||
lcdvdbg("ch: [%c] options: %02x segset: %04x\n", ch, options, segset);
|
||||
|
||||
/* Decode the value and write it to the SLCD segment memory */
|
||||
|
||||
slcd_writemem(bitset, curpos);
|
||||
slcd_writemem(segset, curpos);
|
||||
|
||||
/* Save these values in the state structure */
|
||||
|
||||
g_slcdstate.buffer[curpos] = ch;
|
||||
g_slcdstate.options[curpos] = options;
|
||||
|
||||
slcd_dumpstate("AFTER WRITE");
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -796,6 +866,8 @@ static void slcd_writech(uint8_t ch, uint8_t curpos, uint8_t options)
|
||||
|
||||
static void slcd_appendch(uint8_t ch, uint8_t options)
|
||||
{
|
||||
lcdvdbg("ch: [%c] options: %02x\n", ch, options);
|
||||
|
||||
/* Write the character at the current cursor position */
|
||||
|
||||
slcd_writech(ch, g_slcdstate.curpos, options);
|
||||
@ -803,6 +875,8 @@ static void slcd_appendch(uint8_t ch, uint8_t options)
|
||||
{
|
||||
g_slcdstate.curpos++;
|
||||
}
|
||||
|
||||
slcd_dumpstate("AFTER APPEND");
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -811,6 +885,9 @@ static void slcd_appendch(uint8_t ch, uint8_t options)
|
||||
|
||||
static void slcd_action(enum slcdcode_e code, uint8_t count)
|
||||
{
|
||||
lcdvdbg("Action: %d count: %d\n", code, count);
|
||||
slcd_dumpstate("BEFORE ACTION");
|
||||
|
||||
switch (code)
|
||||
{
|
||||
/* Erasure */
|
||||
@ -885,7 +962,7 @@ static void slcd_action(enum slcdcode_e code, uint8_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Erasecharacters after the current cursor position to the end of the line */
|
||||
/* Erase characters after the current cursor position to the end of the line */
|
||||
|
||||
for (i = g_slcdstate.curpos; i < SLCD_NCHARS; i++)
|
||||
{
|
||||
@ -949,6 +1026,8 @@ static void slcd_action(enum slcdcode_e code, uint8_t count)
|
||||
case SLCDCODE_NORMAL: /* Not a special keycode */
|
||||
break;
|
||||
}
|
||||
|
||||
slcd_dumpstate("AFTER ACTION");
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -984,6 +1063,7 @@ static ssize_t slcd_read(FAR struct file *filp, FAR char *buffer, size_t len)
|
||||
}
|
||||
}
|
||||
|
||||
slcd_dumpstate("READ");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1013,6 +1093,10 @@ static ssize_t slcd_write(FAR struct file *filp,
|
||||
|
||||
memset(&state, 0, sizeof(struct slcdstate_s));
|
||||
result = slcd_decode(&instream.stream, &state, &prev, &count);
|
||||
|
||||
lcdvdbg("slcd_decode returned result=%d char=%d count=%d\n",
|
||||
result, prev, count);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case SLCDRET_CHAR:
|
||||
@ -1034,6 +1118,9 @@ static ssize_t slcd_write(FAR struct file *filp,
|
||||
|
||||
while ((result = slcd_decode(&instream.stream, &state, &ch, &count)) != SLCDRET_EOF)
|
||||
{
|
||||
lcdvdbg("slcd_decode returned result=%d char=%d count=%d\n",
|
||||
result, ch, count);
|
||||
|
||||
if (result == SLCDRET_CHAR) /* A normal character was returned */
|
||||
{
|
||||
/* Check for ASCII control characters */
|
||||
@ -1132,6 +1219,8 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg)
|
||||
{
|
||||
FAR struct slcd_geometry_s *geo = (FAR struct slcd_geometry_s *)((uintptr_t)arg);
|
||||
|
||||
lcdvdbg("SLCDIOC_GEOMETRY: nrows=%d ncolumns=%d\n", SLCD_NROWS, SLCD_NCHARS);
|
||||
|
||||
if (!geo)
|
||||
{
|
||||
return -EINVAL;
|
||||
@ -1149,6 +1238,8 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg)
|
||||
|
||||
case SLCDIOC_SETBAR:
|
||||
{
|
||||
lcdvdbg("SLCDIOC_SETBAR: arg=0x%02lx\n", arg);
|
||||
|
||||
/* Format the bar */
|
||||
|
||||
g_slcdstate.bar[0] = 0;
|
||||
@ -1195,6 +1286,7 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg)
|
||||
}
|
||||
|
||||
*contrast = (int)slcd_getcontrast();
|
||||
lcdvdbg("SLCDIOC_GETCONTRAST: contrast=%d\n", *contrast);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1207,6 +1299,9 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg)
|
||||
case SLCDIOC_MAXCONTRAST:
|
||||
{
|
||||
FAR int *contrast = (FAR int *)((uintptr_t)arg);
|
||||
|
||||
lcdvdbg("SLCDIOC_MAXCONTRAST: contrast=%d\n", SLCD_MAXCONTRAST);
|
||||
|
||||
if (!contrast)
|
||||
{
|
||||
return -EINVAL;
|
||||
@ -1223,6 +1318,8 @@ static int slcd_ioctl(FAR struct file *filp, int cmd, unsigned long arg)
|
||||
|
||||
case SLCDIOC_SETCONTRAST:
|
||||
{
|
||||
lcdvdbg("SLCDIOC_SETCONTRAST: arg=%ld\n", arg);
|
||||
|
||||
if (arg > SLCD_MAXCONTRAST)
|
||||
{
|
||||
return -ERANGE;
|
||||
@ -1294,20 +1391,34 @@ int stm32_slcd_initialize(void)
|
||||
stm32_configgpio(g_slcdgpio[i]);
|
||||
}
|
||||
|
||||
/* Enable the External Low-Speed (LSE) oscillator and select it as the
|
||||
* LCD clock source.
|
||||
*
|
||||
* NOTE: LCD clocking should already be enabled in the RCC APB1ENR register.
|
||||
*/
|
||||
|
||||
stm32_rcc_enablelse();
|
||||
|
||||
lcdvdbg("APB1ENR: %08x CSR: %08x\n",
|
||||
getreg32(STM32_RCC_APB1ENR), getreg32(STM32_RCC_CSR));
|
||||
|
||||
/* Set the LCD prescaler and divider values */
|
||||
|
||||
regval = getreg32(STM32_LCD_FCR);
|
||||
regval = getreg32(STM32_LCD_FCR);
|
||||
regval &= ~(LCD_FCR_DIV_MASK | LCD_FCR_PS_MASK);
|
||||
regval |= ( LCD_FCR_PS_DIV1 | LCD_FCR_DIV(31));
|
||||
regval |= (LCD_FCR_PS_DIV1 | LCD_FCR_DIV(31));
|
||||
putreg32(regval, STM32_LCD_FCR);
|
||||
|
||||
/* Wait for the FCRSF flag to be set */
|
||||
|
||||
lcdvdbg("Wait for FCRSF, FSR: %08x SR: %08x\n",
|
||||
getreg32(STM32_LCD_FCR), getreg32(STM32_LCD_SR));
|
||||
|
||||
while ((getreg32(STM32_LCD_SR) & LCD_SR_FCRSF) == 0);
|
||||
|
||||
/* Set the duty (1/4), bias (1/3), and the internal voltage source (VSEL=0) */
|
||||
|
||||
regval = getreg32(STM32_LCD_CR);
|
||||
regval = getreg32(STM32_LCD_CR);
|
||||
regval &= ~(LCD_CR_BIAS_MASK | LCD_CR_DUTY_MASK | LCD_CR_VSEL);
|
||||
regval |= (LCD_CR_DUTY_1TO4 | LCD_CR_BIAS_1TO3);
|
||||
putreg32(regval, STM32_LCD_CR);
|
||||
@ -1337,6 +1448,9 @@ int stm32_slcd_initialize(void)
|
||||
|
||||
/* Wait Until the LCD FCR register is synchronized */
|
||||
|
||||
lcdvdbg("Wait for FCRSF, FSR: %08x SR: %08x\n",
|
||||
getreg32(STM32_LCD_FCR), getreg32(STM32_LCD_SR));
|
||||
|
||||
while ((getreg32(STM32_LCD_SR) & LCD_SR_FCRSF) == 0);
|
||||
|
||||
/* Enable LCD peripheral */
|
||||
@ -1345,6 +1459,9 @@ int stm32_slcd_initialize(void)
|
||||
|
||||
/* Wait Until the LCD is enabled and the LCD booster is ready */
|
||||
|
||||
lcdvdbg("Wait for LCD_SR_ENS and LCD_SR_RDY, CR: %08x SR: %08x\n",
|
||||
getreg32(STM32_LCD_CR), getreg32(STM32_LCD_SR));
|
||||
|
||||
while ((getreg32(STM32_LCD_SR) & (LCD_SR_ENS | LCD_SR_RDY)) != (LCD_SR_ENS | LCD_SR_RDY));
|
||||
|
||||
/* Disable blinking */
|
||||
@ -1354,6 +1471,8 @@ int stm32_slcd_initialize(void)
|
||||
regval |= (LCD_FCR_BLINK_DISABLE | LCD_FCR_BLINKF_DIV32);
|
||||
putreg32(regval, STM32_LCD_FCR);
|
||||
|
||||
slcd_dumpslcd("AFTER INITIALIZATION");
|
||||
|
||||
/* Register the LCD device driver */
|
||||
|
||||
ret = register_driver("/dev/slcd", &g_slcdops, 0644, (FAR struct file_operations *)&g_slcdops);
|
||||
@ -1362,6 +1481,7 @@ int stm32_slcd_initialize(void)
|
||||
/* Then clear the display */
|
||||
|
||||
slcd_clear();
|
||||
slcd_dumpstate("AFTER INITIALIZATION");
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -40,16 +40,10 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR
|
||||
# include <apps/usbmonitor.h>
|
||||
#endif
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "stm32.h"
|
||||
#include "stm32ldiscovery.h"
|
||||
|
||||
/****************************************************************************
|
||||
@ -58,31 +52,6 @@
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#define HAVE_USBDEV 1
|
||||
#define HAVE_USBMONITOR 1
|
||||
|
||||
/* Can't support USB device features if the STM32 USB peripheral is not
|
||||
* enabled.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_STM32_USB
|
||||
# undef HAVE_USBDEV
|
||||
# undef HAVE_USBMONITOR
|
||||
#endif
|
||||
|
||||
/* Can't support USB device is USB device is not enabled */
|
||||
|
||||
#ifndef CONFIG_USBDEV
|
||||
# undef HAVE_USBDEV
|
||||
# undef HAVE_USBMONITOR
|
||||
#endif
|
||||
|
||||
/* Check if we should enable the USB monitor before starting NSH */
|
||||
|
||||
#if !defined(CONFIG_USBDEV_TRACE) || !defined(CONFIG_SYSTEM_USBMONITOR)
|
||||
# undef HAVE_USBMONITOR
|
||||
#endif
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
@ -113,17 +82,13 @@
|
||||
|
||||
int nsh_archinitialize(void)
|
||||
{
|
||||
#ifdef HAVE_USBMONITOR
|
||||
int ret;
|
||||
int ret = OK;
|
||||
|
||||
/* Start the USB Monitor */
|
||||
/* Initialize the SLCD and register the SLCD device as /dev/slcd */
|
||||
|
||||
ret = usbmonitor_start(0, NULL);
|
||||
if (ret != OK)
|
||||
{
|
||||
message("nsh_archinitialize: Start USB monitor: %d\n", ret);
|
||||
}
|
||||
#ifdef CONFIG_STM32_LCD
|
||||
ret = stm32_slcd_initialize();
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,131 +0,0 @@
|
||||
/************************************************************************************
|
||||
* configs/stm32ldiscovery/src/up_usbdev.c
|
||||
* arch/arm/src/board/up_boot.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* 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
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/usb/usbdev.h>
|
||||
#include <nuttx/usb/usbdev_trace.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "stm32.h"
|
||||
#include "stm32ldiscovery.h"
|
||||
|
||||
#ifdef CONFIG_STM32_USB
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
# define HAVE_USB 1
|
||||
#else
|
||||
# warning "CONFIG_STM32_USB is enabled but CONFIG_USBDEV is not"
|
||||
# undef HAVE_USB
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_usbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
||||
* GPIO pins for the STM32F3Discovery board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void stm32_usbinitialize(void)
|
||||
{
|
||||
/* Does the STM32 F3 hava an external soft pull-up? */
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_usbpullup
|
||||
*
|
||||
* Description:
|
||||
* If USB is supported and the board supports a pullup via GPIO (for USB software
|
||||
* connect and disconnect), then the board software must provide stm32_pullup.
|
||||
* See include/nuttx/usb/usbdev.h for additional description of this method.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int stm32_usbpullup(FAR struct usbdev_s *dev, bool enable)
|
||||
{
|
||||
usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_usbsuspend
|
||||
*
|
||||
* Description:
|
||||
* Board logic must provide the stm32_usbsuspend logic if the USBDEV driver is
|
||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
||||
* while the USB is suspended.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
|
||||
{
|
||||
ulldbg("resume: %d\n", resume);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_STM32_USB */
|
||||
|
||||
|
||||
|
@ -243,19 +243,6 @@
|
||||
|
||||
void weak_function stm32_spiinitialize(void);
|
||||
|
||||
/****************************************************************************************************
|
||||
* Name: stm32_usbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called from stm32_usbinitialize very early in inialization to setup USB-related
|
||||
* GPIO pins for the STM32L-Discovery board.
|
||||
*
|
||||
****************************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32_USB
|
||||
void weak_function stm32_usbinitialize(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIGS_STM32F3DISCOVERY_SRC_STM32F3DISCOVERY_INTERNAL_H */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user