summaryrefslogtreecommitdiff
path: root/nuttx/configs
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-05-24 20:40:11 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-05-24 20:40:11 +0000
commit27ba39c2e6bc41ff30705525a98444dfbe5da1cd (patch)
tree690e9c2d705fa5fe195757591b2bbb400c1df08c /nuttx/configs
parent9b2ed5ff44f02983b6ed3ca810ab6a951b838b17 (diff)
downloadpx4-nuttx-27ba39c2e6bc41ff30705525a98444dfbe5da1cd.tar.gz
px4-nuttx-27ba39c2e6bc41ff30705525a98444dfbe5da1cd.tar.bz2
px4-nuttx-27ba39c2e6bc41ff30705525a98444dfbe5da1cd.zip
Debug microSD CS
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1824 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs')
-rw-r--r--nuttx/configs/eagle100/include/board.h7
-rw-r--r--nuttx/configs/eagle100/src/eagle100_internal.h93
-rw-r--r--nuttx/configs/eagle100/src/up_boot.c16
-rw-r--r--nuttx/configs/eagle100/src/up_leds.c3
-rw-r--r--nuttx/configs/eagle100/src/up_ssi.c52
5 files changed, 160 insertions, 11 deletions
diff --git a/nuttx/configs/eagle100/include/board.h b/nuttx/configs/eagle100/include/board.h
index 096ca8410..febc93038 100644
--- a/nuttx/configs/eagle100/include/board.h
+++ b/nuttx/configs/eagle100/include/board.h
@@ -110,13 +110,6 @@
#define LED_ASSERTION 6 /* ON OFF */
#define LED_PANIC 7 /* ON OFF */
-/* Eagle-100 GPIOs ******************************************************************/
-
-/* GPIO for microSD card chip select */
-
-#define SDCCS_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | GPIO_VALUE_ONE | GPIO_PORTG | 2)
-#define LED_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTE | 1)
-
/************************************************************************************
* Public Function Prototypes
************************************************************************************/
diff --git a/nuttx/configs/eagle100/src/eagle100_internal.h b/nuttx/configs/eagle100/src/eagle100_internal.h
new file mode 100644
index 000000000..e2ff65fd3
--- /dev/null
+++ b/nuttx/configs/eagle100/src/eagle100_internal.h
@@ -0,0 +1,93 @@
+/************************************************************************************
+ * configs/eagle100/src/eagle100_internal.h
+ * arch/arm/src/board/eagle100_internal.n
+ *
+ * Copyright (C) 2009 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * 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.
+ *
+ ************************************************************************************/
+
+#ifndef __CONFIGS_EAGLE100_SRC_EAGLE100_INTERNAL_H
+#define __CONFIGS_EAGLE100_SRC_EAGLE100_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+#include <sys/types.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* How many SSI modules does this chip support? The LM3S6918 supports 2 SSI
+ * modules (others may support more -- in such case, the following must be
+ * expanded).
+ */
+
+#if LM3S_NSSI == 0
+# undef CONFIG_SSI0_DISABLE
+# define CONFIG_SSI0_DISABLE 1
+# undef CONFIG_SSI1_DISABLE
+# define CONFIG_SSI1_DISABLE 1
+#elif LM3S_NSSI == 1
+# undef CONFIG_SSI1_DISABLE
+# define CONFIG_SSI1_DISABLE 1
+#endif
+
+/* Eagle-100 GPIOs ******************************************************************/
+
+/* GPIO for microSD card chip select */
+
+#define SDCCS_GPIO (GPIO_FUNC_OUTPUT | GPIO_PADTYPE_STDWPU | GPIO_STRENGTH_4MA | \
+ GPIO_VALUE_ONE | GPIO_PORTG | 1)
+#define LED_GPIO (GPIO_FUNC_OUTPUT | GPIO_VALUE_ONE | GPIO_PORTE | 1)
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Eagle100 board.
+ *
+ ************************************************************************************/
+
+extern void weak_function lm3s_ssiinitialize(void);
+
+#endif /* __ASSEMBLY__ */
+#endif /* __CONFIGS_EAGLE100_SRC_EAGLE100_INTERNAL_H */
+
diff --git a/nuttx/configs/eagle100/src/up_boot.c b/nuttx/configs/eagle100/src/up_boot.c
index 874d3dc06..175e8e924 100644
--- a/nuttx/configs/eagle100/src/up_boot.c
+++ b/nuttx/configs/eagle100/src/up_boot.c
@@ -46,6 +46,7 @@
#include <arch/board/board.h>
#include "up_arch.h"
+#include "eagle100_internal.h"
/************************************************************************************
* Definitions
@@ -70,11 +71,20 @@
void lm3s_boardinitialize(void)
{
- /* Configure the SPI-based microSD CS GPIO */
+ /* Configure SPI chip selects if 1) SSI is not disabled, and 2) the weak function
+ * lm3s_ssiinitialize() has been brought into the link.
+ */
- lm3s_configgpio(SDCCS_GPIO);
+/* The Eagle100 microSD CS is on SSI0 */
- /* Configure on-board LEDs */
+#if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */
+ if (lm3s_ssiinitialize)
+ {
+ lm3s_ssiinitialize();
+ }
+#endif
+
+ /* Configure on-board LEDs if LED support has been selected. */
#ifdef CONFIG_ARCH_LEDS
up_ledinit();
diff --git a/nuttx/configs/eagle100/src/up_leds.c b/nuttx/configs/eagle100/src/up_leds.c
index 5cb6be0d7..f382e63a3 100644
--- a/nuttx/configs/eagle100/src/up_leds.c
+++ b/nuttx/configs/eagle100/src/up_leds.c
@@ -49,6 +49,7 @@
#include "up_arch.h"
#include "up_internal.h"
#include "lm3s_internal.h"
+#include "eagle100_internal.h"
/****************************************************************************
* Definitions
@@ -58,7 +59,7 @@
* CONFIG_DEBUG_VERBOSE too)
*/
-#undef LED_DEBUG /* Define to enable debug */
+#undef LED_DEBUG /* Define to enable debug */
#ifdef LED_DEBUG
# define leddbg lldbg
diff --git a/nuttx/configs/eagle100/src/up_ssi.c b/nuttx/configs/eagle100/src/up_ssi.c
index c14c7ab89..723012042 100644
--- a/nuttx/configs/eagle100/src/up_ssi.c
+++ b/nuttx/configs/eagle100/src/up_ssi.c
@@ -41,16 +41,46 @@
#include <nuttx/config.h>
#include <sys/types.h>
+#include <debug.h>
+
#include <nuttx/spi.h>
#include <arch/board/board.h>
#include "up_arch.h"
+#include "chip.h"
#include "lm3s_internal.h"
+#include "eagle100_internal.h"
+
+/* The Eagle100 microSD CS is on SSI0 */
+
+#if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */
/************************************************************************************
* Definitions
************************************************************************************/
+/* Enables debug output from this file (needs CONFIG_DEBUG with CONFIG_DEBUG_VERBOSE
+ * too)
+ */
+
+#undef SSI_DEBUG /* Define to enable debug */
+
+#ifdef SSI_DEBUG
+# define ssidbg lldbg
+# define ssivdbg llvdbg
+#else
+# define ssidbg(x...)
+# define ssivdbg(x...)
+#endif
+
+/* Dump GPIO registers */
+
+#ifdef SSI_DEBUG
+# define ssi_dumpgpio(m) lm3s_dumpgpio(SDCCS_GPIO, m)
+#else
+# define ssi_dumpgpio(m)
+#endif
+
/************************************************************************************
* Private Functions
************************************************************************************/
@@ -59,6 +89,23 @@
* Public Functions
************************************************************************************/
+/************************************************************************************
+ * Name: lm3s_ssiinitialize
+ *
+ * Description:
+ * Called to configure SPI chip select GPIO pins for the Eagle100 board.
+ *
+ ************************************************************************************/
+
+void weak_function lm3s_ssiinitialize(void)
+{
+ /* Configure the SPI-based microSD CS GPIO */
+
+ ssi_dumpgpio("lm3s_ssiinitialize() before lm3s_configgpio()");
+ lm3s_configgpio(SDCCS_GPIO);
+ ssi_dumpgpio("lm3s_ssiinitialize() after lm3s_configgpio()");
+}
+
/****************************************************************************
* The external functions, lm3s_spiselect and lm3s_spistatus must be provided
* by board-specific logic. The are implementations of the select and status
@@ -80,17 +127,22 @@
void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, boolean selected)
{
+ ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
if (devid == SPIDEV_MMCSD)
{
/* Assert the CS pin to the card */
+ ssi_dumpgpio("lm3s_spiselect() before lm3s_gpiowrite()");
lm3s_gpiowrite(SDCCS_GPIO, !selected);
+ ssi_dumpgpio("lm3s_spiselect() after lm3s_gpiowrite()");
}
}
ubyte lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
{
#warning "Need to check schematic"
+ ssidbg("Returning SPI_STATUS_PRESENT\n");
return SPI_STATUS_PRESENT;
}
+#endif /* !CONFIG_SSI0_DISABLE || !CONFIG_SSI1_DISABLE */