Changes from review of PR 118

This commit is contained in:
Gregory Nutt 2016-08-18 11:29:48 -06:00
parent c0074fd6b8
commit cfad547b8d
23 changed files with 55 additions and 1300 deletions

View file

@ -937,14 +937,14 @@ config ARCH_BOARD_SPARK
MCU from STMicro. MCU from STMicro.
config ARCH_BOARD_STM32_BUTTERFLY2 config ARCH_BOARD_STM32_BUTTERFLY2
bool "Kamami STM32Butterfly2 development board" bool "Kamami STM32Butterfly2 development board"
depends on ARCH_CHIP_STM32F107VC depends on ARCH_CHIP_STM32F107VC
select ARCH_HAVE_LEDS select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS select ARCH_HAVE_BUTTONS
---help--- ---help---
A configuration for the Kamami STM32Butterfly2 development board A configuration for the Kamami STM32Butterfly2 development board
based on STM32F107VC micro-controler chip with optional ETH based on STM32F107VC micro-controler chip with optional ETH
board. board.
config ARCH_BOARD_STM32_TINY config ARCH_BOARD_STM32_TINY
bool "STM32-Tiny board" bool "STM32-Tiny board"

View file

@ -173,7 +173,8 @@
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
#define EXTERN extern "C" #define EXTERN extern "C"
extern "C" { extern "C"
{
#else #else
#define EXTERN extern #define EXTERN extern
#endif #endif
@ -192,7 +193,7 @@ extern "C" {
* initialized. * initialized.
******************************************************************************/ ******************************************************************************/
EXTERN void stm32_boardinitialize(void); void stm32_boardinitialize(void);
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)

View file

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# configs/viewtool-stm32f107/nsh/Make.defs # configs/stm32butterfly2/nsh/Make.defs
# #
# Copyright (C) 2013 Gregory Nutt. All rights reserved. # Copyright (C) 2016 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

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# configs/viewtool-stm32f107/nsh/setenv.sh # configs/stm32butterfly2/nsh/setenv.sh
# #
# Copyright (C) 2013 Gregory Nutt. All rights reserved. # Copyright (C) 2016 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

View file

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# configs/viewtool-stm32f107/nsh/Make.defs # configs/stm32butterfly2/nsh/Make.defs
# #
# Copyright (C) 2013 Gregory Nutt. All rights reserved. # Copyright (C) 2016 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

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# configs/viewtool-stm32f107/nsh/setenv.sh # configs/stm32butterfly2/nsh/setenv.sh
# #
# Copyright (C) 2013 Gregory Nutt. All rights reserved. # Copyright (C) 2016 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

View file

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# configs/viewtool-stm32f107/nsh/Make.defs # configs/stm32butterfly2/nsh/Make.defs
# #
# Copyright (C) 2013 Gregory Nutt. All rights reserved. # Copyright (C) 2016 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

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# configs/viewtool-stm32f107/nsh/setenv.sh # configs/stm32butterfly2/nsh/setenv.sh
# #
# Copyright (C) 2013 Gregory Nutt. All rights reserved. # Copyright (C) 2016 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

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
############################################################################ ############################################################################
# configs/viewtool-stm32f107/nsh/Make.defs # configs/stm32butterfly2/nsh/Make.defs
# #
# Copyright (C) 2013 Gregory Nutt. All rights reserved. # Copyright (C) 2016 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

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# configs/viewtool-stm32f107/nsh/setenv.sh # configs/stm32butterfly2/nsh/setenv.sh
# #
# Copyright (C) 2013 Gregory Nutt. All rights reserved. # Copyright (C) 2016 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

View file

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/viewtool-stm32f107/scripts/dfu.ld * configs/stm32butterfly2/scripts/dfu.ld
* *
* Copyright (C) 2013 Gregory Nutt. All rights reserved. * Copyright (C) 2016 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

View file

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/viewtool-stm32f107/scripts/flash.ld * configs/stm32butterfly2/scripts/flash.ld
* *
* Copyright (C) 2013 Gregory Nutt. All rights reserved. * Copyright (C) 2016 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

View file

@ -83,4 +83,3 @@ int board_adc_setup(void)
ainfo("INFO: ADC12_IN10 initialized succesfully\n"); ainfo("INFO: ADC12_IN10 initialized succesfully\n");
return OK; return OK;
} }

View file

@ -92,4 +92,3 @@ int board_app_initialize(uintptr_t arg)
return rv; return rv;
} }

View file

@ -127,5 +127,5 @@ int stm32_usbhost_initialize(void);
static inline int stm32_usbhost_initialize(void) { return 0; } static inline int stm32_usbhost_initialize(void) { return 0; }
#endif #endif
#endif // __CONFIGS_STM32_BUTTERFLY2_SRC_STM32_BUTTERFLY2_H #endif /* __CONFIGS_STM32_BUTTERFLY2_SRC_STM32_BUTTERFLY2_H */

View file

@ -59,8 +59,10 @@
* Private Declarations * Private Declarations
****************************************************************************/ ****************************************************************************/
static const uint32_t buttons[NUM_BUTTONS] = { static const uint32_t buttons[NUM_BUTTONS] =
GPIO_JOY_O, GPIO_JOY_U, GPIO_JOY_D, GPIO_JOY_R, GPIO_JOY_L }; {
GPIO_JOY_O, GPIO_JOY_U, GPIO_JOY_D, GPIO_JOY_R, GPIO_JOY_L
};
/***************************************************************************** /*****************************************************************************
* Public Functions * Public Functions
@ -76,6 +78,7 @@ static const uint32_t buttons[NUM_BUTTONS] = {
void board_button_initialize(void) void board_button_initialize(void)
{ {
int i; int i;
for (i = 0; i != NUM_BUTTONS; ++i) for (i = 0; i != NUM_BUTTONS; ++i)
{ {
stm32_configgpio(buttons[i]); stm32_configgpio(buttons[i]);
@ -104,4 +107,3 @@ uint8_t board_buttons(void)
return rv; return rv;
} }

View file

@ -62,6 +62,7 @@
****************************************************************************/ ****************************************************************************/
/* Identifies led state */ /* Identifies led state */
enum led_state enum led_state
{ {
LED_ON = false, LED_ON = false,
@ -231,13 +232,16 @@ void board_userled_initialize(void)
void board_userled(int led, bool ledon) void board_userled(int led, bool ledon)
{ {
unsigned int ledbit;
#ifndef CONFIG_ARCH_LEDS #ifndef CONFIG_ARCH_LEDS
if (led == BOARD_LED4) if (led == BOARD_LED4)
{ {
return; return;
} }
#endif #endif
unsigned int ledbit = 1 << led;
ledbit = 1 << led;
led_state(ledon, ledbit); led_state(ledon, ledbit);
} }
@ -261,4 +265,3 @@ void board_userled_all(uint8_t ledset)
led_state(led_OFF, ~ledset); led_state(led_OFF, ~ledset);
#endif #endif
} }

View file

@ -135,8 +135,8 @@ static int stm32_cd(int irq, void *context)
now = tp.tv_sec * 1000 + tp.tv_nsec / 1000000; now = tp.tv_sec * 1000 + tp.tv_nsec / 1000000;
/* When inserting card, card detect plate might bounce causing this /* When inserting card, card detect plate might bounce causing this
* interrupt to be called many time on single card insert/deinsert. Thus we * interrupt to be called many time on single card insert/deinsert. Thus
* are allowing only one interrupt every 100ms. * we are allowing only one interrupt every 100ms.
*/ */
if (now - debounce_time > prev) if (now - debounce_time > prev)
@ -214,4 +214,3 @@ int stm32_mmcsd_initialize(int minor)
spiinfo("INFO: mmcsd card has been initialized successfully\n"); spiinfo("INFO: mmcsd card has been initialized successfully\n");
return OK; return OK;
} }

View file

@ -61,6 +61,7 @@
void stm32_spidev_initialize(void) void stm32_spidev_initialize(void)
{ {
spiinfo("INFO: Initializing spi gpio pins\n"); spiinfo("INFO: Initializing spi gpio pins\n");
stm32_configgpio(GPIO_SD_CS); stm32_configgpio(GPIO_SD_CS);
stm32_configgpio(GPIO_SD_CD); stm32_configgpio(GPIO_SD_CD);
} }
@ -76,6 +77,7 @@ void stm32_spi1select(struct spi_dev_s *dev, enum spi_dev_e devid,
bool select) bool select)
{ {
spiinfo("INFO: Selecting spi dev: %d, state: %d\n", devid, select); spiinfo("INFO: Selecting spi dev: %d, state: %d\n", devid, select);
if (devid == SPIDEV_MMCSD) if (devid == SPIDEV_MMCSD)
{ {
stm32_gpiowrite(GPIO_SD_CS, !select); stm32_gpiowrite(GPIO_SD_CS, !select);
@ -92,6 +94,7 @@ void stm32_spi1select(struct spi_dev_s *dev, enum spi_dev_e devid,
uint8_t stm32_spi1status(struct spi_dev_s *dev, enum spi_dev_e devid) uint8_t stm32_spi1status(struct spi_dev_s *dev, enum spi_dev_e devid)
{ {
spiinfo("INFO: Requesting info from spi dev: %d\n", devid); spiinfo("INFO: Requesting info from spi dev: %d\n", devid);
if (devid == SPIDEV_MMCSD) if (devid == SPIDEV_MMCSD)
{ {
if (stm32_gpioread(GPIO_SD_CD) == 0) if (stm32_gpioread(GPIO_SD_CD) == 0)
@ -100,6 +103,5 @@ uint8_t stm32_spi1status(struct spi_dev_s *dev, enum spi_dev_e devid)
} }
} }
return 0; return 0;
} }

View file

@ -56,7 +56,7 @@
void stm32_usb_initialize(void) void stm32_usb_initialize(void)
{ {
uinfo("INFO: Initializing usb otgfs gpio pins\n"); uinfo("INFO: Initializing usb otgfs gpio pins\n");
stm32_configgpio(GPIO_OTGFS_VBUS); stm32_configgpio(GPIO_OTGFS_VBUS);
stm32_configgpio(GPIO_OTGFS_PWRON); stm32_configgpio(GPIO_OTGFS_PWRON);
} }

View file

@ -75,4 +75,3 @@ void stm32_usbsuspend(struct usbdev_s *dev, bool resume)
{ {
uinfo("INFO: usb %s", resume ? "resumed" : "suspended"); uinfo("INFO: usb %s", resume ? "resumed" : "suspended");
} }

View file

@ -85,6 +85,7 @@ static void* usbhost_detect(void *arg)
struct usbhost_hubport_s *hport; struct usbhost_hubport_s *hport;
uinfo("INFO: Starting usb detect thread\n"); uinfo("INFO: Starting usb detect thread\n");
for (;;) for (;;)
{ {
CONN_WAIT(g_usbconn, &hport); CONN_WAIT(g_usbconn, &hport);
@ -115,6 +116,7 @@ int stm32_usbhost_initialize(void)
#ifdef CONFIG_USBHOST_MSC #ifdef CONFIG_USBHOST_MSC
uinfo("INFO: Initializing USB MSC class\n"); uinfo("INFO: Initializing USB MSC class\n");
if ((rv = usbhost_msc_initialize()) < 0) if ((rv = usbhost_msc_initialize()) < 0)
{ {
uerr("ERROR: Failed to register mass storage class: %d\n", rv); uerr("ERROR: Failed to register mass storage class: %d\n", rv);
@ -123,6 +125,7 @@ int stm32_usbhost_initialize(void)
#ifdef CONFIG_USBHOST_CDACM #ifdef CONFIG_USBHOST_CDACM
uinfo("INFO: Initializing CDCACM usb class\n"); uinfo("INFO: Initializing CDCACM usb class\n");
if ((rv = usbhost_cdacm_initialize()) < 0) if ((rv = usbhost_cdacm_initialize()) < 0)
{ {
uerr("ERROR: Failed to register CDC/ACM serial class: %d\n", rv); uerr("ERROR: Failed to register CDC/ACM serial class: %d\n", rv);
@ -131,6 +134,7 @@ int stm32_usbhost_initialize(void)
#ifdef CONFIG_USBHOST_HIDKBD #ifdef CONFIG_USBHOST_HIDKBD
uinfo("INFO: Initializing HID Keyboard usb class\n"); uinfo("INFO: Initializing HID Keyboard usb class\n");
if ((rv = usbhost_kbdinit()) < 0) if ((rv = usbhost_kbdinit()) < 0)
{ {
uerr("ERROR: Failed to register the KBD class: %d\n", rv); uerr("ERROR: Failed to register the KBD class: %d\n", rv);
@ -139,6 +143,7 @@ int stm32_usbhost_initialize(void)
#ifdef CONFIG_USBHOST_HIDMOUSE #ifdef CONFIG_USBHOST_HIDMOUSE
uinfo("INFO: Initializing HID Mouse usb class\n"); uinfo("INFO: Initializing HID Mouse usb class\n");
if ((rv = usbhost_mouse_init()) < 0) if ((rv = usbhost_mouse_init()) < 0)
{ {
uerr("ERROR: Failed to register the mouse class: %d\n", rv); uerr("ERROR: Failed to register the mouse class: %d\n", rv);
@ -147,6 +152,7 @@ int stm32_usbhost_initialize(void)
#ifdef CONFIG_USBHOST_HUB #ifdef CONFIG_USBHOST_HUB
uinfo("INFO: Initializing USB HUB class\n"); uinfo("INFO: Initializing USB HUB class\n");
if ((rv = usbhost_hub_initialize()) < 0) if ((rv = usbhost_hub_initialize()) < 0)
{ {
uerr("ERROR: Failed to register hub class: %d\n", rv); uerr("ERROR: Failed to register hub class: %d\n", rv);
@ -192,4 +198,3 @@ void stm32_usbhost_vbusdrive(int iface, bool enable)
{ {
stm32_gpiowrite(GPIO_OTGFS_PWRON, enable); stm32_gpiowrite(GPIO_OTGFS_PWRON, enable);
} }