From 262fe457162a5c2c1329be901b18b6e2be58b3ee Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 23 Oct 2013 08:37:16 -0600 Subject: Changes to the Spark configuration from David Sidrane --- nuttx/configs/spark/nsh/defconfig | 14 +++++++------- nuttx/configs/spark/src/spark.h | 9 ++++++--- nuttx/configs/spark/src/up_nsh.c | 6 +++--- nuttx/configs/spark/src/up_wireless.c | 34 +++++++++++++++++++++++++++++----- 4 files changed, 45 insertions(+), 18 deletions(-) diff --git a/nuttx/configs/spark/nsh/defconfig b/nuttx/configs/spark/nsh/defconfig index 63e076bdd..074870438 100644 --- a/nuttx/configs/spark/nsh/defconfig +++ b/nuttx/configs/spark/nsh/defconfig @@ -362,7 +362,7 @@ CONFIG_SIG_SIGUSR1=1 CONFIG_SIG_SIGUSR2=2 CONFIG_SIG_SIGALARM=3 CONFIG_SIG_SIGCONDTIMEDOUT=16 -CONFIG_SIG_SIGWORK=17 +# CONFIG_SIG_SIGWORK is not set # # Sizes of configurable things (0 disables) @@ -374,7 +374,7 @@ CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 CONFIG_NAME_MAX=32 CONFIG_PREALLOC_MQ_MSGS=4 -CONFIG_MQ_MAXMSGSIZE=32 +CONFIG_MQ_MAXMSGSIZE=132 CONFIG_MAX_WDOGPARMS=2 CONFIG_PREALLOC_WDOGS=4 CONFIG_PREALLOC_TIMERS=4 @@ -655,11 +655,11 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Non-standard Library Support # -CONFIG_SCHED_WORKQUEUE=y -CONFIG_SCHED_HPWORK=y -CONFIG_SCHED_WORKPRIORITY=192 -CONFIG_SCHED_WORKPERIOD=50000 -CONFIG_SCHED_WORKSTACKSIZE=2048 +# CONFIG_SCHED_WORKQUEUE is not set +# CONFIG_SCHED_HPWORK is not set +# CONFIG_SCHED_WORKPRIORITY is not set +# CONFIG_SCHED_WORKPERIOD is not set +# CONFIG_SCHED_WORKSTACKSIZE is not set # CONFIG_SCHED_LPWORK is not set # CONFIG_LIB_KBDCODEC is not set # CONFIG_LIB_SLCDCODEC is not set diff --git a/nuttx/configs/spark/src/spark.h b/nuttx/configs/spark/src/spark.h index c17504acc..c729a679d 100644 --- a/nuttx/configs/spark/src/spark.h +++ b/nuttx/configs/spark/src/spark.h @@ -214,10 +214,13 @@ * PB[12] SPI2_NSS/I2C2_SMBA/USART3_CK/TIM1_BKIN 25 WIFI_CS J2-1 */ -#define GPIO_WIFI_EN (GPIO_PORTB | GPIO_PIN8 | GPIO_OUTPUT_SET | GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz) -#define GPIO_WIFI_CS (GPIO_PORTB | GPIO_PIN12 | GPIO_OUTPUT_SET | GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz) +#define GPIO_WIFI_EN (GPIO_PORTB | GPIO_PIN8 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz) +#define GPIO_WIFI_CS (GPIO_PORTB | GPIO_PIN12 | GPIO_OUTPUT_SET | GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz) -#define GPIO_WIFI_INT (GPIO_PORTB | GPIO_PIN11 | GPIO_INPUT | GPIO_CNF_INPULLUP | GPIO_EXTI) +#define GPIO_WIFI_INT (GPIO_PORTB | GPIO_PIN11 | GPIO_INPUT | GPIO_CNF_INPULLUP | GPIO_EXTI) + +#define GPIO_D0 (GPIO_PORTB | GPIO_PIN7 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz) +#define GPIO_D1 (GPIO_PORTB | GPIO_PIN6 | GPIO_OUTPUT_CLEAR | GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz) /************************************************************************************ * Public Types diff --git a/nuttx/configs/spark/src/up_nsh.c b/nuttx/configs/spark/src/up_nsh.c index 67c92465d..a40ff57df 100644 --- a/nuttx/configs/spark/src/up_nsh.c +++ b/nuttx/configs/spark/src/up_nsh.c @@ -169,17 +169,17 @@ int nsh_archinitialize(void) message("nsh_archinitialize: Successfully initialized SPI port %d\n",CONFIG_SPARK_FLASH_SPI); - /* Now bind the SPI interface to the SST25 SPI FLASH driver */ + /* Now bind the SPI interface to the SST25 SPI FLASH driver */ message("nsh_archinitialize: Bind SPI to the SPI flash driver\n"); mtd = sst25_initialize(spi); if (!mtd) { - message("nsh_archinitialize: Failed to bind SPI port %d to the SPI FLASH driver\n",CONFIG_SPARK_FLASH_SPI); + message("nsh_archinitialize: Failed to bind SPI port %d to the SPI FLASH driver\n", CONFIG_SPARK_FLASH_SPI); } else { - message("nsh_archinitialize: Successfully bound SPI port %d to the SPI FLASH driver\n",CONFIG_SPARK_FLASH_SPI); + message("nsh_archinitialize: Successfully bound SPI port %d to the SPI FLASH driver\n", CONFIG_SPARK_FLASH_SPI); } #ifdef CONFIG_SPARK_FLASH_PART diff --git a/nuttx/configs/spark/src/up_wireless.c b/nuttx/configs/spark/src/up_wireless.c index c620301fd..08e1a8c82 100644 --- a/nuttx/configs/spark/src/up_wireless.c +++ b/nuttx/configs/spark/src/up_wireless.c @@ -119,7 +119,8 @@ static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable); static void wl_clear_irq(FAR struct cc3000_config_s *state); static void wl_select(FAR struct cc3000_config_s *state, bool enable); static void wl_enable_power(FAR struct cc3000_config_s *state, bool enable); -static bool wl_busy(FAR struct cc3000_config_s *state); +static bool wl_read_irq(FAR struct cc3000_config_s *state); +static bool probe(FAR struct cc3000_config_s *state,int n, bool s); /**************************************************************************** * Private Data @@ -145,7 +146,8 @@ static struct stm32_config_s g_cc3000_info = .dev.irq_clear = wl_clear_irq, .dev.power_enable = wl_enable_power, .dev.chip_select = wl_select, - .dev.busy = wl_busy, + .dev.irq_read = wl_read_irq, + .dev.probe = probe, /* This is used for debugging */ .handler = NULL, }; @@ -190,7 +192,7 @@ static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable) ivdbg("enable:%d\n", enable); if (enable) { - (void)stm32_gpiosetevent(GPIO_WIFI_INT, true, true, false, priv->handler); + (void)stm32_gpiosetevent(GPIO_WIFI_INT, false, true, false, priv->handler); } else { @@ -221,9 +223,11 @@ static void wl_clear_irq(FAR struct cc3000_config_s *state) /* Does nothing */ } -static bool wl_busy(FAR struct cc3000_config_s *state) +static bool wl_read_irq(FAR struct cc3000_config_s *state) { - return stm32_gpioread(GPIO_WIFI_INT); + /* Active low*/ + + return stm32_gpioread(GPIO_WIFI_INT) ? false : true; } static long read_IRQ(void) @@ -274,6 +278,11 @@ int wireless_archinitialize(void) idbg("minor %d\n", minor); DEBUGASSERT(CONFIG_CC3000_DEVMINOR == 0); + stm32_configgpio(GPIO_D0); + stm32_configgpio(GPIO_D1); + stm32_gpiowrite(GPIO_D0, 1); + stm32_gpiowrite(GPIO_D1, 1); + /* Get an instance of the SPI interface */ spi = up_spiinitialize(CONFIG_CC3000_SPIDEV); @@ -295,6 +304,21 @@ int wireless_archinitialize(void) return OK; } +static bool probe(FAR struct cc3000_config_s *state,int n, bool s) +{ + if (n == 0) + { + stm32_gpiowrite(GPIO_D0, s); + } + + if (n == 1) + { + stm32_gpiowrite(GPIO_D1, s); + } + + return true; +} + /***************************************************************************** * Name: C3000_wlan_init * -- cgit v1.2.3