summaryrefslogtreecommitdiff
path: root/nuttx/configs
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/configs')
-rw-r--r--nuttx/configs/sam3u-ek/README.txt14
-rw-r--r--nuttx/configs/sam3u-ek/src/sam3u-ek.h18
-rw-r--r--nuttx/configs/sam3u-ek/src/up_spi.c50
-rw-r--r--nuttx/configs/sam3u-ek/src/up_touchscreen.c14
-rw-r--r--nuttx/configs/sam4l-xplained/README.txt11
-rw-r--r--nuttx/configs/sam4l-xplained/src/sam_mmcsd.c27
-rw-r--r--nuttx/configs/sam4l-xplained/src/sam_nsh.c5
-rw-r--r--nuttx/configs/sam4l-xplained/src/sam_spi.c50
8 files changed, 61 insertions, 128 deletions
diff --git a/nuttx/configs/sam3u-ek/README.txt b/nuttx/configs/sam3u-ek/README.txt
index 59aa65144..32d994329 100644
--- a/nuttx/configs/sam3u-ek/README.txt
+++ b/nuttx/configs/sam3u-ek/README.txt
@@ -572,20 +572,24 @@ Configuration sub-directories
application. You can enable the touchscreen and test by modifying the
default configuration in the following ways:
- Drivers:
+ Device Drivers
+ CONFIG_SPI=y : Enable SPI support
+ CONFIG_SPI_EXCHANGE=y : The exchange() method is supported
+ CONFIG_SPI_OWNBUS=y : Smaller code if this is the only SPI device
+
CONFIG_INPUT=y : Enable support for input devices
CONFIG_INPUT_ADS7843E=y : Enable support for the XPT2048
- CONFIG_ADS7843E_SPIDEV=0 : Use SPI for communication
+ CONFIG_ADS7843E_SPIDEV=2 : Use SPI CS 2 for communication
CONFIG_ADS7843E_SPIMODE=0 : Use SPI mode 0
CONFIG_ADS7843E_THRESHX=39 : These will probably need to be tuned
CONFIG_ADS7843E_THRESHY=51
- CONFIG_SPI=y : Enable SPI support
- CONFIG_SPI_EXCHANGE=n : exchange() method is not supported
+
+ System Type -> Peripherals:
+ CONFIG_SAM34_SPI=y : Enable support for SPI
System Type:
CONFIG_GPIO_IRQ=y : GPIO interrupt support
CONFIG_GPIOA_IRQ=y : Enable GPIO interrupts from port A
- CONFIG_SAM34_SPI=y : Enable support for SPI
RTOS Features:
CONFIG_DISABLE_SIGNALS=n : Signals are required
diff --git a/nuttx/configs/sam3u-ek/src/sam3u-ek.h b/nuttx/configs/sam3u-ek/src/sam3u-ek.h
index 909abc42a..af68df42a 100644
--- a/nuttx/configs/sam3u-ek/src/sam3u-ek.h
+++ b/nuttx/configs/sam3u-ek/src/sam3u-ek.h
@@ -190,6 +190,7 @@
#define GPIO_TSC_NPCS2 (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \
GPIO_PORT_PIOC | GPIO_PIN14)
+#define TSC_CSNUM 2
/************************************************************************************
* Public Types
@@ -225,13 +226,13 @@ void weak_function sam_spiinitialize(void);
void weak_function sam_usbinitialize(void);
-/****************************************************************************
+/************************************************************************************
* Name: sam_hsmciinit
*
* Description:
* Initialize HSMCI support
*
- ****************************************************************************/
+ ************************************************************************************/
#ifdef CONFIG_SAM34_HSMCI
int weak_function sam_hsmciinit(void);
@@ -239,21 +240,21 @@ int weak_function sam_hsmciinit(void);
# define sam_hsmciinit()
#endif
-/****************************************************************************
+/************************************************************************************
* Name: up_ledinit
- ****************************************************************************/
+ ************************************************************************************/
#ifdef CONFIG_ARCH_LEDS
void up_ledinit(void);
#endif
-/****************************************************************************
+/************************************************************************************
* Name: sam_cardinserted
*
* Description:
* Check if a card is inserted into the selected HSMCI slot
*
- ****************************************************************************/
+ ************************************************************************************/
#ifdef CONFIG_SAM34_HSMCI
bool sam_cardinserted(unsigned char slot);
@@ -261,13 +262,13 @@ bool sam_cardinserted(unsigned char slot);
# define sam_cardinserted(slot) (false)
#endif
-/****************************************************************************
+/************************************************************************************
* Name: sam_writeprotected
*
* Description:
* Check if a card is inserted into the selected HSMCI slot
*
- ****************************************************************************/
+ ************************************************************************************/
#ifdef CONFIG_SAM34_HSMCI
bool sam_writeprotected(unsigned char slot);
@@ -277,4 +278,3 @@ bool sam_writeprotected(unsigned char slot);
#endif /* __ASSEMBLY__ */
#endif /* __CONFIGS_SAM3U_EK_SRC_SAM3U_EK_H */
-
diff --git a/nuttx/configs/sam3u-ek/src/up_spi.c b/nuttx/configs/sam3u-ek/src/up_spi.c
index b14029f5d..5d4073237 100644
--- a/nuttx/configs/sam3u-ek/src/up_spi.c
+++ b/nuttx/configs/sam3u-ek/src/up_spi.c
@@ -107,28 +107,25 @@ void weak_function sam_spiinitialize(void)
}
/****************************************************************************
- * Name: sam_spicsnumber, sam_spiselect, sam_spistatus, and sam_spicmddata
+ * Name: sam_spiselect, sam_spistatus, and sam_spicmddata
*
* Description:
* These external functions must be provided by board-specific logic. They
* include:
*
- * o sam_spicsnumber and sam_spiselect which are helper functions to
- * manage the board-specific aspects of the unique SAM3U chip select
- * architecture.
+ * o sam_spiselect is a functions tomanage the board-specific chip selects
* o sam_spistatus and sam_spicmddata: Implementations of the status
* and cmddata methods of the SPI interface defined by struct spi_ops_
* (see include/nuttx/spi.h). All other methods including
- * up_spiinitialize()) are provided by common SAM3U logic.
+ * up_spiinitialize()) are provided by common SAM3/4 logic.
*
* To use this common SPI logic on your board:
*
* 1. Provide logic in sam_boardinitialize() to configure SPI chip select
* pins.
- * 2. Provide sam_spicsnumber(), sam_spiselect() and sam_spistatus()
- * functions in your board-specific logic. These functions will perform
- * chip selection and status operations using GPIOs in the way your board
- * is configured.
+ * 2. Provide sam_spiselect() and sam_spistatus() functions in your board-
+ * specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
* 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
* sam_spicmddata() functions in your board-specific logic. This
* function will perform cmd/data selection operations using GPIOs in
@@ -143,41 +140,6 @@ void weak_function sam_spiinitialize(void)
****************************************************************************/
/****************************************************************************
- * Name: sam_spicsnumber
- *
- * Description:
- * The SAM3U has 4 CS registers for controlling device features. This
- * function must be provided by board-specific code. Given a logical device
- * ID, this function returns a number from 0 to 3 that identifies one of
- * these SAM3U CS resources.
- *
- * Input Parameters:
- * devid - Identifies the (logical) device
- *
- * Returned Values:
- * On success, a CS number from 0 to 3 is returned; A negated errno may
- * be returned on a failure.
- *
- ****************************************************************************/
-
-int sam_spicsnumber(enum spi_dev_e devid)
-{
- int cs = -EINVAL;
-
-#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E)
- if (devid == SPIDEV_TOUCHSCREEN)
- {
- /* Assert the CS pin to the OLED display */
-
- cs = 2;
- }
-#endif
-
- spidbg("devid: %d CS: %d\n", (int)devid, cs);
- return cs;
-}
-
-/****************************************************************************
* Name: sam_spiselect
*
* Description:
diff --git a/nuttx/configs/sam3u-ek/src/up_touchscreen.c b/nuttx/configs/sam3u-ek/src/up_touchscreen.c
index ea2ad3d0a..46a814c6f 100644
--- a/nuttx/configs/sam3u-ek/src/up_touchscreen.c
+++ b/nuttx/configs/sam3u-ek/src/up_touchscreen.c
@@ -75,11 +75,11 @@
#endif
#ifndef CONFIG_ADS7843E_SPIDEV
-# define CONFIG_ADS7843E_SPIDEV 0
+# define CONFIG_ADS7843E_SPIDEV TSC_CSNUM
#endif
-#if CONFIG_ADS7843E_SPIDEV != 0
-# error "CONFIG_ADS7843E_SPIDEV must be zero"
+#if CONFIG_ADS7843E_SPIDEV != TSC_CSNUM
+# error "CONFIG_ADS7843E_SPIDEV must have the same value as TSC_CSNUM"
#endif
#ifndef CONFIG_ADS7843E_DEVMINOR
@@ -247,12 +247,12 @@ int arch_tcinitialize(int minor)
sam_gpioirq(GPIO_TCS_IRQ);
- /* Get an instance of the SPI interface */
+ /* Get an instance of the SPI interface for the touchscreen chip select */
- dev = up_spiinitialize(CONFIG_ADS7843E_SPIDEV);
+ dev = up_spiinitialize(TSC_CSNUM);
if (!dev)
{
- idbg("Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV);
+ idbg("Failed to initialize SPI chip select %d\n", TSC_CSNUM);
return -ENODEV;
}
@@ -261,7 +261,7 @@ int arch_tcinitialize(int minor)
ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR);
if (ret < 0)
{
- idbg("Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV);
+ idbg("Failed to initialize SPI chip select %d\n", TSC_CSNUM);
/* up_spiuninitialize(dev); */
return -ENODEV;
}
diff --git a/nuttx/configs/sam4l-xplained/README.txt b/nuttx/configs/sam4l-xplained/README.txt
index 79b6f5bc8..4b67f6513 100644
--- a/nuttx/configs/sam4l-xplained/README.txt
+++ b/nuttx/configs/sam4l-xplained/README.txt
@@ -698,8 +698,9 @@ Configuration sub-directories
CONFIG_SAM34_SPI=y : Enable the SAM4L SPI peripheral
Board Selection -> Common Board Options
- CONFIG_NSH_MMCSDSLOTNO=0 : Only one slot, slot 0
- CONFIG_NSH_MMCSDSPIPORTNO=0 : Only one SPI port, port 0
+ CONFIG_NSH_MMCSDSLOTNO=0 : Only one MMC/SD slot, slot 0
+ CONFIG_NSH_MMCSDSPIPORTNO=0 : Use CS=0 if the I/O1 is in EXT1, OR
+ CONFIG_NSH_MMCSDSPIPORTNO=2 : Use CS=2 if the I/O1 is in EXT2
Board Selection -> SAM4L Xplained Pro Modules
CONFIG_SAM4L_XPLAINED_IOMODULE=y : I/O1 module is connected
@@ -708,7 +709,8 @@ Configuration sub-directories
Device Drivers
CONFIG_SPI=y : Enable SPI support
- CONFIG_SPI_EXCHANGE=y : The exchang() method is supported
+ CONFIG_SPI_EXCHANGE=y : The exchange() method is supported
+ CONFIG_SPI_OWNBUS=y : Smaller code if this is the only SPI device
CONFIG_MMCSD=y : Enable MMC/SD support
CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot
@@ -725,3 +727,6 @@ Configuration sub-directories
jumper. Otherwise, you have lookpack on USART0 and NSH will *not*
behave very well (since its outgoing prompts also appear as incoming
commands).
+
+ STATUS: As of 2013-6-16, the SPI interface is not communicating with
+ the SD card. \ No newline at end of file
diff --git a/nuttx/configs/sam4l-xplained/src/sam_mmcsd.c b/nuttx/configs/sam4l-xplained/src/sam_mmcsd.c
index be4a334ec..c23adf324 100644
--- a/nuttx/configs/sam4l-xplained/src/sam_mmcsd.c
+++ b/nuttx/configs/sam4l-xplained/src/sam_mmcsd.c
@@ -46,6 +46,8 @@
#include <nuttx/spi.h>
#include <nuttx/mmcsd.h>
+#include "sam4l-xplained.h"
+
#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE
/****************************************************************************
@@ -65,7 +67,6 @@
# error MMC/SD support is required (CONFIG_MMCSD)
#endif
-#define SAM34_MMCSDSPIPORTNO 0 /* Port is SPI (there is only one port) */
#define SAM34_MMCSDSLOTNO 0 /* There is only one slot */
/****************************************************************************
@@ -89,34 +90,34 @@ int sam_sdinitialize(int minor)
FAR struct spi_dev_s *spi;
int ret;
- /* Get the SPI port */
+ /* Get the SPI driver instance for the SD chip select */
- fvdbg("Initializing SPI port %d\n", SAM34_MMCSDSPIPORTNO);
+ fvdbg("Initializing SPI chip select %d\n", SD_CSNO);
- spi = up_spiinitialize(SAM34_MMCSDSPIPORTNO);
+ spi = up_spiinitialize(SD_CSNO);
if (!spi)
{
- fdbg("Failed to initialize SPI port %d\n", SAM34_MMCSDSPIPORTNO);
+ fdbg("Failed to initialize SPI chip select %d\n", SD_CSNO);
return -ENODEV;
}
- fvdbg("Successfully initialized SPI port %d\n", SAM34_MMCSDSPIPORTNO);
+ fvdbg("Successfully initialized SPI chip select %d\n", SD_CSNO);
- /* Bind the SPI port to the slot */
+ /* Bind the SPI device for the chip select to the slot */
- fvdbg("Binding SPI port %d to MMC/SD slot %d\n",
- SAM34_MMCSDSPIPORTNO, SAM34_MMCSDSLOTNO);
+ fvdbg("Binding SPI chip select %d to MMC/SD slot %d\n",
+ SD_CSNO, SAM34_MMCSDSLOTNO);
ret = mmcsd_spislotinitialize(minor, SAM34_MMCSDSLOTNO, spi);
if (ret < 0)
{
- fdbg("Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
- SAM34_MMCSDSPIPORTNO, SAM34_MMCSDSLOTNO, ret);
+ fdbg("Failed to bind SPI chip select %d to MMC/SD slot %d: %d\n",
+ SD_CSNO, SAM34_MMCSDSLOTNO, ret);
return ret;
}
- fvdbg("Successfuly bound SPI port %d to MMC/SD slot %d\n",
- SAM34_MMCSDSPIPORTNO, SAM34_MMCSDSLOTNO);
+ fvdbg("Successfuly bound SPI chip select %d to MMC/SD slot %d\n",
+ SD_CSNO, SAM34_MMCSDSLOTNO);
return OK;
}
diff --git a/nuttx/configs/sam4l-xplained/src/sam_nsh.c b/nuttx/configs/sam4l-xplained/src/sam_nsh.c
index e5c77a926..a2b8b8534 100644
--- a/nuttx/configs/sam4l-xplained/src/sam_nsh.c
+++ b/nuttx/configs/sam4l-xplained/src/sam_nsh.c
@@ -52,15 +52,14 @@
/* Support for the SD card slot on the I/O1 module */
/* Verify NSH PORT and SLOT settings */
-# define SAM34_MMCSDSPIPORTNO 0 /* Port is SPI (there is only one port) */
# define SAM34_MMCSDSLOTNO 0 /* There is only one slot */
# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != SAM34_MMCSDSLOTNO
# error Only one MMC/SD slot: Slot 0 (CONFIG_NSH_MMCSDSLOTNO)
# endif
-# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != SAM34_MMCSDSPIPORTNO
-# error Only one MMC/SD port: Port 0 (CONFIG_NSH_MMCSDSPIPORTNO)
+# if defined(CONFIG_NSH_MMCSDSPIPORTNO) && CONFIG_NSH_MMCSDSPIPORTNO != SD_CSNO
+# error CONFIG_NSH_MMCSDSPIPORTNO must have the same value as SD_CSNO
# endif
/* Default MMC/SD minor number */
diff --git a/nuttx/configs/sam4l-xplained/src/sam_spi.c b/nuttx/configs/sam4l-xplained/src/sam_spi.c
index b977db246..465f59e61 100644
--- a/nuttx/configs/sam4l-xplained/src/sam_spi.c
+++ b/nuttx/configs/sam4l-xplained/src/sam_spi.c
@@ -104,28 +104,25 @@ void weak_function sam_spiinitialize(void)
}
/****************************************************************************
- * Name: sam_spicsnumber, sam_spiselect, sam_spistatus, and sam_spicmddata
+ * Name: sam_spiselect, sam_spistatus, and sam_spicmddata
*
* Description:
* These external functions must be provided by board-specific logic. They
* include:
*
- * o sam_spicsnumber and sam_spiselect which are helper functions to
- * manage the board-specific aspects of the unique SAM3U chip select
- * architecture.
+ * o sam_spiselect is a functions tomanage the board-specific chip selects
* o sam_spistatus and sam_spicmddata: Implementations of the status
* and cmddata methods of the SPI interface defined by struct spi_ops_
* (see include/nuttx/spi.h). All other methods including
- * up_spiinitialize()) are provided by common SAM3U logic.
+ * up_spiinitialize()) are provided by common SAM3/4 logic.
*
* To use this common SPI logic on your board:
*
* 1. Provide logic in sam_boardinitialize() to configure SPI chip select
* pins.
- * 2. Provide sam_spicsnumber(), sam_spiselect() and sam_spistatus()
- * functions in your board-specific logic. These functions will perform
- * chip selection and status operations using GPIOs in the way your board
- * is configured.
+ * 2. Provide sam_spiselect() and sam_spistatus() functions in your board-
+ * specific logic. These functions will perform chip selection and
+ * status operations using GPIOs in the way your board is configured.
* 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
* sam_spicmddata() functions in your board-specific logic. This
* function will perform cmd/data selection operations using GPIOs in
@@ -140,41 +137,6 @@ void weak_function sam_spiinitialize(void)
****************************************************************************/
/****************************************************************************
- * Name: sam_spicsnumber
- *
- * Description:
- * The SAM3U has 4 CS registers for controlling device features. This
- * function must be provided by board-specific code. Given a logical device
- * ID, this function returns a number from 0 to 3 that identifies one of
- * these SAM3U CS resources.
- *
- * Input Parameters:
- * devid - Identifies the (logical) device
- *
- * Returned Values:
- * On success, a CS number from 0 to 3 is returned; A negated errno may
- * be returned on a failure.
- *
- ****************************************************************************/
-
-int sam_spicsnumber(enum spi_dev_e devid)
-{
- int cs = -EINVAL;
-
-#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE
- if (devid == SPIDEV_MMCSD)
- {
- /* Return the chip select number */
-
- cs = SD_CSNO;
- }
-#endif
-
- spidbg("devid: %d CS: %d\n", (int)devid, cs);
- return cs;
-}
-
-/****************************************************************************
* Name: sam_spiselect
*
* Description: