diff options
Diffstat (limited to 'nuttx/configs')
-rwxr-xr-x | nuttx/configs/sam3u-ek/nsh/setenv.sh | 1 | ||||
-rw-r--r-- | nuttx/configs/sam3u-ek/src/sam3u-ek.h | 10 | ||||
-rw-r--r-- | nuttx/configs/sam4l-xplained/Kconfig | 39 | ||||
-rw-r--r-- | nuttx/configs/sam4l-xplained/README.txt | 174 | ||||
-rw-r--r-- | nuttx/configs/sam4l-xplained/include/board.h | 11 | ||||
-rwxr-xr-x | nuttx/configs/sam4l-xplained/nsh/setenv.sh | 13 | ||||
-rwxr-xr-x | nuttx/configs/sam4l-xplained/ostest/setenv.sh | 13 | ||||
-rw-r--r-- | nuttx/configs/sam4l-xplained/src/Makefile | 14 | ||||
-rw-r--r-- | nuttx/configs/sam4l-xplained/src/sam4l-xplained.h | 63 | ||||
-rw-r--r-- | nuttx/configs/sam4l-xplained/src/sam_buttons.c | 2 | ||||
-rw-r--r-- | nuttx/configs/sam4l-xplained/src/sam_spi.c | 54 | ||||
-rwxr-xr-x | nuttx/configs/sam4s-xplained/nsh/setenv.sh | 26 | ||||
-rwxr-xr-x | nuttx/configs/sam4s-xplained/ostest/setenv.sh | 13 |
13 files changed, 382 insertions, 51 deletions
diff --git a/nuttx/configs/sam3u-ek/nsh/setenv.sh b/nuttx/configs/sam3u-ek/nsh/setenv.sh index c867a5e55..7f9b452be 100755 --- a/nuttx/configs/sam3u-ek/nsh/setenv.sh +++ b/nuttx/configs/sam3u-ek/nsh/setenv.sh @@ -63,7 +63,6 @@ fi # the Atollic bin path because there is are binaries named gcc.exe and g++.exe # at those locations as well. #export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin" -#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin" # This is the Cygwin path to the location where I build the buildroot # toolchain. diff --git a/nuttx/configs/sam3u-ek/src/sam3u-ek.h b/nuttx/configs/sam3u-ek/src/sam3u-ek.h index 24d0d99e2..909abc42a 100644 --- a/nuttx/configs/sam3u-ek/src/sam3u-ek.h +++ b/nuttx/configs/sam3u-ek/src/sam3u-ek.h @@ -213,7 +213,7 @@ * ************************************************************************************/ -extern void weak_function sam_spiinitialize(void); +void weak_function sam_spiinitialize(void); /************************************************************************************ * Name: sam_usbinitialize @@ -223,7 +223,7 @@ extern void weak_function sam_spiinitialize(void); * ************************************************************************************/ -extern void weak_function sam_usbinitialize(void); +void weak_function sam_usbinitialize(void); /**************************************************************************** * Name: sam_hsmciinit @@ -234,7 +234,7 @@ extern void weak_function sam_usbinitialize(void); ****************************************************************************/ #ifdef CONFIG_SAM34_HSMCI -extern int weak_function sam_hsmciinit(void); +int weak_function sam_hsmciinit(void); #else # define sam_hsmciinit() #endif @@ -256,7 +256,7 @@ void up_ledinit(void); ****************************************************************************/ #ifdef CONFIG_SAM34_HSMCI -extern bool sam_cardinserted(unsigned char slot); +bool sam_cardinserted(unsigned char slot); #else # define sam_cardinserted(slot) (false) #endif @@ -270,7 +270,7 @@ extern bool sam_cardinserted(unsigned char slot); ****************************************************************************/ #ifdef CONFIG_SAM34_HSMCI -extern bool sam_writeprotected(unsigned char slot); +bool sam_writeprotected(unsigned char slot); #else # define sam_writeprotected(slot) (false) #endif diff --git a/nuttx/configs/sam4l-xplained/Kconfig b/nuttx/configs/sam4l-xplained/Kconfig index daae10472..d80c38ff8 100644 --- a/nuttx/configs/sam4l-xplained/Kconfig +++ b/nuttx/configs/sam4l-xplained/Kconfig @@ -4,4 +4,43 @@ # if ARCH_BOARD_SAM4L_XPLAINED + +menu "SAM4L Xplained Pro Modules" + +config SAM4L_XPLAINED_IOMODULE + bool "I/O1 Module" + default n + ---help--- + The I/O 1 module is attached. This module provides an MMC/SD card + slot. + +if SAM4L_XPLAINED_IOMODULE +choice + prompt "I/O1 Module Location" + default SAM4L_XPLAINED_IOMODULE_EXT1 + +config SAM4L_XPLAINED_IOMODULE_EXT1 + bool "EXT1" + +config SAM4L_XPLAINED_IOMODULE_EXT2 + bool "EXT2" + +endchoice +endif + +config SAM4L_XPLAINED_OLED1MODULE + bool "OLED1 Module" + default n + ---help--- + The OLED 1 module is attached. This module provides an OLED plus 3 + additional switches and 3 additional LEDs. + +config SAM4L_XPLAINED_SLCD1MODULE + bool "SLCD1 Module" + default n + ---help--- + The SLCD 1 module is attached. This module provides a segment LCD + that connects directly to the "EXT5 SEGMENT LCD" connector + +endmenu endif diff --git a/nuttx/configs/sam4l-xplained/README.txt b/nuttx/configs/sam4l-xplained/README.txt index bc4756f17..d87a566b3 100644 --- a/nuttx/configs/sam4l-xplained/README.txt +++ b/nuttx/configs/sam4l-xplained/README.txt @@ -3,11 +3,22 @@ README This README discusses issues unique to NuttX configurations for the Atmel SAM4L Xplained Pro development board. This board features the -ATSAM4LC4C MCU +ATSAM4LC4C MCU. + +The SAM4L Xplained Pro Starter Kit is bundled with four modules: + +1) I/O1 - An MMC/SD card slot, PWM LED control, ADC light sensor, UART + loopback, TWI AT30TSE758 Temperature sensor. +2) OLED1 - An OLED plus 3 additional switches and 3 additional LEDs +3) SLCD1 - A segment LCD that connects directly to the "EXT5 SEGMENT LCD" + connector +4) PROTO1 - A prototyping board with logic on board (other than power-related + logic). Contents ^^^^^^^^ + - Modules - Development Environment - GNU Toolchain Options - IDEs @@ -19,6 +30,123 @@ Contents - SAM4L Xplained Pro-specific Configuration Options - Configurations +Modules +^^^^^^^ + The SAM4L Xplained Pro Starter Kit is bundled with four modules: + + I/O1 + ---- + The primary function of this module is to provide SD card support, but + the full list of modules features include: + + - microSD card connector (SPI interface) + - PWM (LED control) + - ADC (light sensor) + - UART loopback + - TWI AT30TSE758 Temperature sensor with EEPROM + + SPI is available on two of the SAM4L Xplained connectors, EXT1 and EXT2. + They mate with the I/O1 connector as indicated in this table. + + I/O1 Connector + -------------- + I/O1 EXT1 EXT2 Other use of either pin + ----------------- -------------------- -------------------- ------------------------------------ + 1 ID 1 1 + 2 GND 2 GND 2 + 3 LIGHTSENSOR 3 PA04 ADCIFE/AD0 3 PA07 ADCIFE/AD2 + 4 LP_OUT 4 PA05 ADCIFE/AD1 4 PB02 ADCIFE/AD3 + 5 GPIO1 5 PB12 GPIO 5 PC08 GPIO PB12 and PC8 on EXT5 + 6 GPIO2 6 PC02 GPIO 6 PB10 GPIO PB10 on EXT5 + 7 LED 7 PC00 TC/1/A0 7 PC04 TC/1/A2 + 8 LP_IN 8 PC01 TC/1/B0 8 PC05 TC/1/B2 PC05 on EXT5 + 9 TEMP_ALERT 9 PC25 EIC/EXTINT2 9 PC06 EIC/EXTINT8 PC25 on EXT5 + 10 microSD_DETECT 10 PB13 SPI/NPCS1 10 PC09 GPIO PB13 on EXT5 + 11 TWI SDA 11 PA23 TWIMS/0/TWD 11 PB14 TWIMS/3/TWD PB14 on EXT3&4, PA23 and PB14 on EXT5 + 12 TWI SCL 12 PA24 TWIMS/0/TWCK 12 PB15 TWIMS/3/TWCK PB15 on EXT3&4, PA24 and PB15 on EXT5 + 13 UART RX 13 PB00 USART/0/RXD 13 PC26 USART/1/RXD PB00 on EXT4, PC26 on EXT3&5 + 14 UART TX 14 PB01 USART/0/TXD 14 PC27 USART/1/TXD PB01 on EXT4, PC27 on EXT3&5 + 15 microSD_SS 15 PC03 SPI/NPCS0 15 PB11 SPI/NPCS2 PB11 on EXT5 + 16 SPI_MOSI 16 PA22 SPI/MOSI 16 PA22 SPI/MOSI PA22 on EXT5 + 17 SPI_MISO 17 PA21 SPI/MISO 17 PA21 SPI/MISO PA21 on EXT5 + 18 SPI_SCK 18 PC30 SPI/SCK 18 PC30 SPI/SCK PC30 on EXT5 + 19 GND 19 GND GND + 20 VCC 20 VCC VCC + + The mapping between the I/O1 pins and the SD connector are shown in the + following table. + + SD Card Connection + ------------------ + I/O1 SD PIN Description + ---- ---- --- ------------------------------------------------- + D2 1 Data line 2 (not used) + 15 D3 2 Data line 3. Active low chip select, pulled high + 16 CMD 3 Command line, connected to SPI_MOSI. + 20 VDD 4 + 18 CLK 5 Clock line, connected to SPI_SCK. + 2/19 GND 6 + 17 D0 7 Data line 0, connected to SPI_MISO. + D1 8 Data line 1 (not used) + 10 SW_A 9 Card detect + 2/19 SW_B 10 GND + + Card Detect + ----------- + When a microSD card is put into the connector SW_A and SW_B are short- + circuited. SW_A is connected to the microSD_DETECT signal. To use this + as a card indicator remember to enable internal pullup in the target + device. + + GPIOs + ----- + So all that is required to connect the SD is configure the SPI + + PIN EXT1 EXT2 Description + --- -------------- --------------- ------------------------------------- + 15 PC03 SPI/NPCS0 PB11 SPI/NPCS2 Active low chip select OUTPUT, pulled + high on board. + 10 PB13 SPI/NPCS1 10 PC09 GPIO Active low card detect INPUT, must + use internal pull-up. + + Configuration Options: + ---------------------- + CONFIG_SAM4L_XPLAINED_IOMODULE=y : Informs the system that the + I/O1 module is installed + CONFIG_SAM4L_XPLAINED_IOMODULE_EXT1=y : The module is installed in EXT1 + CONFIG_SAM4L_XPLAINED_IOMODULE_EXT2=y : The mdoule is installed in EXT2 + + NOTE: As of this writing, only the SD card slot is supported in the I/O1 + module. + + OLED1 + ----- + This module provides an OLED plus 3 additional switches and 3 additional\ + LEDs. + + Configuration Options: + ---------------------- + CONFIG_SAM4L_XPLAINED_OLED1MODULE=y : Informs the system that the + I/O1 module is installed + + NOTE: As of this writing, the OLED1 module is not supported. + + SLCD1 + ----- + This module provides a A segment LCD that connects directly to the "EXT5 SEGMENT LCD" + connector + Configuration Options: + ---------------------- + CONFIG_SAM4L_XPLAINED_SLCD1MODULE=y : Informs the system that the + I/O1 module is installed + + NOTE: As of this writing, the SLCD1 module is not supported. + + PROTO1 + ------ + A prototyping board with logic on board (other than power-related logic). + There is no built-in support for the PROTO1 module. + Development Environment ^^^^^^^^^^^^^^^^^^^^^^^ @@ -548,4 +676,46 @@ Configuration sub-directories NOTES: nsh: - This configuration directory will built the NuttShell. See NOTES above. + This configuration directory will built the NuttShell. See NOTES above + and below: + + NOTE: + If the I/O1 module is connected to the SAM4L Xplained Pro, then support + for the SD card slot can be enabled by making the following changes + to the configuration: + + File Systems: + CONFIG_FS_FAT=y : Enable the FAT file system + CONFIG_FAT_LCNAMES=y : Enable upper/lower case 8.3 file names (Optional, see below) + CONFIG_FAT_LFN=y : Enable long file named (Optional, see below) + CONFIG_FAT_MAXFNAME=32 : Maximum supported file name length + + There are issues related to patents that Microsoft holds on FAT long + file name technologies. See the top level COPYING file for further + details. + + System Type -> Peripherals: + 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 + + Board Selection -> SAM4L Xplained Pro Modules + CONFIG_SAM4L_XPLAINED_IOMODULE=y : I/O1 module is connected + CONFIG_SAM4L_XPLAINED_IOMODULE_EXT1=y : In EXT1, or EXT2 + CONFIG_SAM4L_XPLAINED_IOMODULE_EXT2=y + + Device Drivers + CONFIG_SPI=y : Enable SPI support + CONFIG_SPI_EXCHANGE=y : The exchang() method is supported + + CONFIG_MMCSD=y : Enable MMC/SD support + CONFIG_MMCSD_NSLOTS=1 : Only one MMC/SD card slot + CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : I tested this way, but this may not be required + CONFIG_MMCSD_HAVECARDDETECT=y : I/O1 module as a card detect GPIO + CONFIG_MMCSD_SPI=y : Use the SPI interface to the MMC/SD card + CONFIG_MMCSD_SPICLOCK=20000000 : This is a guess for the optimal MMC/SD frequency + + Application Configuration -> NSH Library + CONFIG_NSH_ARCHINIT=y : Board has architecture-specific initialization diff --git a/nuttx/configs/sam4l-xplained/include/board.h b/nuttx/configs/sam4l-xplained/include/board.h index de175a484..c314e4cfe 100644 --- a/nuttx/configs/sam4l-xplained/include/board.h +++ b/nuttx/configs/sam4l-xplained/include/board.h @@ -276,6 +276,17 @@ #define GPIO_USART1_RXD GPIO_USART1_RXD_2 #define GPIO_USART1_TXD GPIO_USART1_TXD_2 +/* SPI pins are brought out on EXT1 and EXT2 as: + * + * PA22 SPI/MOSI + * PA21 SPI/MISO + * PC30 SPI/SCK + */ + +#define GPIO_SPI0_MISO GPIO_SPI0_MISO_1 +#define GPIO_SPI0_MOSI GPIO_SPI0_MOSI_1 +#define GPIO_SPI0_SPCK GPIO_SPI0_SPCK_4 + /************************************************************************************ * Public Data ************************************************************************************/ diff --git a/nuttx/configs/sam4l-xplained/nsh/setenv.sh b/nuttx/configs/sam4l-xplained/nsh/setenv.sh index f83126fdf..56dd91ccf 100755 --- a/nuttx/configs/sam4l-xplained/nsh/setenv.sh +++ b/nuttx/configs/sam4l-xplained/nsh/setenv.sh @@ -32,7 +32,6 @@ # POSSIBILITY OF SUCH DAMAGE. # - if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 @@ -48,11 +47,23 @@ if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}" fi +# This is the Cygwin path to the location where I installed the Atmel GCC +# toolchain under Windows. You will also have to edit this if you install +# this toolchain in any other location +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin" + # This is the Cygwin path to the location where I installed the CodeSourcery # toolchain under windows. You will also have to edit this if you install # the CodeSourcery toolchain in any other location #export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" +# These are the Cygwin paths to the locations where I installed the Atollic +# toolchain under windows. You will also have to edit this if you install +# the Atollic toolchain in any other location. /usr/bin is added before +# the Atollic bin path because there is are binaries named gcc.exe and g++.exe +# at those locations as well. +#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin" + # This is the Cygwin path to the location where I build the buildroot # toolchain. export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" diff --git a/nuttx/configs/sam4l-xplained/ostest/setenv.sh b/nuttx/configs/sam4l-xplained/ostest/setenv.sh index bf503b833..6b8ae4016 100755 --- a/nuttx/configs/sam4l-xplained/ostest/setenv.sh +++ b/nuttx/configs/sam4l-xplained/ostest/setenv.sh @@ -32,7 +32,6 @@ # POSSIBILITY OF SUCH DAMAGE. # - if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 @@ -48,11 +47,23 @@ if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}" fi +# This is the Cygwin path to the location where I installed the Atmel GCC +# toolchain under Windows. You will also have to edit this if you install +# this toolchain in any other location +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin" + # This is the Cygwin path to the location where I installed the CodeSourcery # toolchain under windows. You will also have to edit this if you install # the CodeSourcery toolchain in any other location #export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" +# These are the Cygwin paths to the locations where I installed the Atollic +# toolchain under windows. You will also have to edit this if you install +# the Atollic toolchain in any other location. /usr/bin is added before +# the Atollic bin path because there is are binaries named gcc.exe and g++.exe +# at those locations as well. +#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin" + # This is the Cygwin path to the location where I build the buildroot # toolchain. export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" diff --git a/nuttx/configs/sam4l-xplained/src/Makefile b/nuttx/configs/sam4l-xplained/src/Makefile index 01813faf4..3768f7ebb 100644 --- a/nuttx/configs/sam4l-xplained/src/Makefile +++ b/nuttx/configs/sam4l-xplained/src/Makefile @@ -40,7 +40,11 @@ CFLAGS += -I$(TOPDIR)/sched ASRCS = AOBJS = $(ASRCS:.S=$(OBJEXT)) -CSRCS = sam_boot.c sam_spi.c +CSRCS = sam_boot.c + +ifeq ($(CONFIG_SAM34_SPI),y) +CSRCS += sam_spi.c +endif ifeq ($(CONFIG_HAVE_CXX),y) CSRCS += sam_cxxinitialize.c @@ -56,6 +60,14 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += sam_buttons.c endif +ifeq ($(CONFIG_NSH_ARCHINIT),y) +CSRCS += sam_nsh.c +endif + +ifeq ($(CONFIG_SAM4L_XPLAINED_IOMODULE),y) +CSRCS += sam_mmcsd.c +endif + COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) diff --git a/nuttx/configs/sam4l-xplained/src/sam4l-xplained.h b/nuttx/configs/sam4l-xplained/src/sam4l-xplained.h index ba6978a82..9e7a0f4ac 100644 --- a/nuttx/configs/sam4l-xplained/src/sam4l-xplained.h +++ b/nuttx/configs/sam4l-xplained/src/sam4l-xplained.h @@ -99,10 +99,54 @@ * PC24 SW0 */ -#define GPIO_SW0 (GPIO_INPUT | GPIO_PULL_UP | GPIO_GLITCH_FILTER | \ +#define GPIO_SW0 (GPIO_INTERRUPT | GPIO_PULL_UP | GPIO_GLITCH_FILTER | \ GPIO_PORTC | GPIO_PIN24) #define IRQ_SW0 SAM_IRQ_PC24 +/* I/O1 + * + * Support for the microSD card slot on the I/O1 module. The I/O1 requires + * SPI support and two GPIOs. These two GPIOs will vary if the + * + * + * PIN EXT1 EXT2 Description + * --- -------------- --------------- ------------------------------------- + * 15 PC03 SPI/NPCS0 PB11 SPI/NPCS2 Active low chip select OUTPUT, pulled + * high on board. + * 10 PB13 SPI/NPCS1 10 PC09 GPIO Active low card detect INPUT, must + * use internal pull-up. + */ + +#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE + +# ifndef CONFIG_SAM34_SPI +# error CONFIG_SAM34_SPI is required to use the I/O1 module +# endif + +# if defined(CONFIG_SAM4L_XPLAINED_IOMODULE_EXT1) + +# define GPIO_SD_CD (GPIO_INTERRUPT | GPIO_INT_CHANGE | GPIO_PULL_UP | \ + GPIO_GLITCH_FILTER | GPIO_PORTB | GPIO_PIN13) +# define IRQ_SD_CD SAM_IRQ_PB13 + +# define GPIO_SD_CS (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_SET | \ + GPIO_PORTC | GPIO_PIN3) +# define SD_CSNO 0 + +# elif defined(CONFIG_SAM4L_XPLAINED_IOMODULE_EXT2) +# define GPIO_CD (GPIO_INTERRUPT | GPIO_INT_CHANGE | GPIO_PULL_UP | \ + GPIO_GLITCH_FILTER | GPIO_PORTC | GPIO_PIN9) +# define IRQ_CD SAM_IRQ_PC9 + +# define GPIO_SD_CS (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_SET | \ + GPIO_PORTB | GPIO_PIN11) +# define SD_CSNO 2 + +# else +# error Which connector is the I/O1 module installed in? +# endif +#endif + /************************************************************************************ * Public Types ************************************************************************************/ @@ -127,9 +171,22 @@ void weak_function sam_spiinitialize(void); -/**************************************************************************** +/************************************************************************************ + * Name: sam_sdinitialize + * + * Description: + * Initialize the SPI-based SD card. Requires CONFIG_SAM4L_XPLAINED_IOMODULE=y, + * CONFIG_DISABLE_MOUNTPOINT=n, CONFIG_MMCSD=y, and CONFIG_SAM34_SPI=y + * + ************************************************************************************/ + +#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE +int sam_sdinitialize(int minor); +#endif + +/************************************************************************************ * Name: up_ledinit - ****************************************************************************/ + ************************************************************************************/ #ifdef CONFIG_ARCH_LEDS void up_ledinit(void); diff --git a/nuttx/configs/sam4l-xplained/src/sam_buttons.c b/nuttx/configs/sam4l-xplained/src/sam_buttons.c index 2a5081a44..4c4b8cb83 100644 --- a/nuttx/configs/sam4l-xplained/src/sam_buttons.c +++ b/nuttx/configs/sam4l-xplained/src/sam_buttons.c @@ -59,7 +59,9 @@ * Private Data ****************************************************************************/ +#if defined(CONFIG_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS) static xcpt_t g_irqsw0; +#endif /**************************************************************************** * Private Functions diff --git a/nuttx/configs/sam4l-xplained/src/sam_spi.c b/nuttx/configs/sam4l-xplained/src/sam_spi.c index 0bd7df9bb..b977db246 100644 --- a/nuttx/configs/sam4l-xplained/src/sam_spi.c +++ b/nuttx/configs/sam4l-xplained/src/sam_spi.c @@ -39,7 +39,6 @@ #include <nuttx/config.h> -#include <stdint.h> #include <stdbool.h> #include <debug.h> #include <errno.h> @@ -92,14 +91,15 @@ void weak_function sam_spiinitialize(void) { - /* The ZigBee module connects used NPCS0. However, there is not yet any - * ZigBee support. + /* The I/O module containing the SD connector may or may not be installed. And, if + * it is installed, it may be in connector EXT1 or EXT2. */ - /* The touchscreen connects using NPCS2 (PC14). */ +#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE + /* TODO: enable interrupt on card detect */ -#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E) - sam_configgpio(GPIO_TSC_NPCS2); + sam_configgpio(GPIO_SD_CD); /* Card detect input */ + sam_configgpio(GPIO_SD_CS); /* Chip select output */ #endif } @@ -161,12 +161,12 @@ int sam_spicsnumber(enum spi_dev_e devid) { int cs = -EINVAL; -#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E) - if (devid == SPIDEV_TOUCHSCREEN) +#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE + if (devid == SPIDEV_MMCSD) { - /* Assert the CS pin to the OLED display */ + /* Return the chip select number */ - cs = 2; + cs = SD_CSNO; } #endif @@ -201,18 +201,14 @@ int sam_spicsnumber(enum spi_dev_e devid) void sam_spiselect(enum spi_dev_e devid, bool selected) { - /* The touchscreen chip select is implemented as a GPIO OUTPUT that must - * be controlled by this function. This is because the ADS7843E driver - * must be able to sample the device BUSY GPIO input between SPI transfers. - * However, the AD7843E will tri-state the BUSY input whenever the chip - * select is de-asserted. So the only option is to control the chip select - * manually and hold it low throughout the SPI transfer. - */ +#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE + /* Select/de-select the SD card */ -#if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E) - if (devid == SPIDEV_TOUCHSCREEN) + if (devid == SPIDEV_MMCSD) { - sam_gpiowrite(GPIO_TSC_NPCS2, !selected); + /* Active low */ + + sam_gpiowrite(GPIO_SD_CS, !selected); } #endif } @@ -233,7 +229,23 @@ void sam_spiselect(enum spi_dev_e devid, bool selected) uint8_t sam_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid) { - return 0; + uint8_t ret = 0; + +#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE + /* Check if an SD card is present in the microSD slot */ + + if (devid == SPIDEV_MMCSD) + { + /* Active low */ + + if (!sam_gpioread(GPIO_SD_CD)) + { + ret |= SPI_STATUS_PRESENT; + } + } +#endif + + return ret; } #endif /* CONFIG_SAM34_SPI */ diff --git a/nuttx/configs/sam4s-xplained/nsh/setenv.sh b/nuttx/configs/sam4s-xplained/nsh/setenv.sh index cf9df57ed..493fe18c1 100755 --- a/nuttx/configs/sam4s-xplained/nsh/setenv.sh +++ b/nuttx/configs/sam4s-xplained/nsh/setenv.sh @@ -32,27 +32,23 @@ # POSSIBILITY OF SUCH DAMAGE. # - -if [ "$_" = "$0" ] ; then - echo "You must source this script, not run it!" 1>&2 - exit 1 -fi - -WD=`pwd` -if [ ! -x "setenv.sh" ]; then - echo "This script must be executed from the top-level NuttX build directory" - exit 1 -fi - -if [ -z "${PATH_ORIG}" ]; then - export PATH_ORIG="${PATH}" -fi +# This is the Cygwin path to the location where I installed the Atmel GCC +# toolchain under Windows. You will also have to edit this if you install +# this toolchain in any other location +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin" # This is the Cygwin path to the location where I installed the CodeSourcery # toolchain under windows. You will also have to edit this if you install # the CodeSourcery toolchain in any other location #export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" +# These are the Cygwin paths to the locations where I installed the Atollic +# toolchain under windows. You will also have to edit this if you install +# the Atollic toolchain in any other location. /usr/bin is added before +# the Atollic bin path because there is are binaries named gcc.exe and g++.exe +# at those locations as well. +#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin" + # This is the Cygwin path to the location where I build the buildroot # toolchain. export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" diff --git a/nuttx/configs/sam4s-xplained/ostest/setenv.sh b/nuttx/configs/sam4s-xplained/ostest/setenv.sh index f6ddcb085..fcfab5e24 100755 --- a/nuttx/configs/sam4s-xplained/ostest/setenv.sh +++ b/nuttx/configs/sam4s-xplained/ostest/setenv.sh @@ -32,7 +32,6 @@ # POSSIBILITY OF SUCH DAMAGE. # - if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 @@ -48,11 +47,23 @@ if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}" fi +# This is the Cygwin path to the location where I installed the Atmel GCC +# toolchain under Windows. You will also have to edit this if you install +# this toolchain in any other location +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin" + # This is the Cygwin path to the location where I installed the CodeSourcery # toolchain under windows. You will also have to edit this if you install # the CodeSourcery toolchain in any other location #export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" +# These are the Cygwin paths to the locations where I installed the Atollic +# toolchain under windows. You will also have to edit this if you install +# the Atollic toolchain in any other location. /usr/bin is added before +# the Atollic bin path because there is are binaries named gcc.exe and g++.exe +# at those locations as well. +#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin" + # This is the Cygwin path to the location where I build the buildroot # toolchain. export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" |