From a0cb3588a5ceb90d76010d3a380111c485939650 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 12 Feb 2014 18:29:23 -0600 Subject: [PATCH] Fix-up some SAMD20 SERCOM conditionals --- configs/samd20-xplained/src/Makefile | 6 +++--- configs/samd20-xplained/src/sam_boot.c | 3 ++- configs/samd20-xplained/src/sam_mmcsd.c | 7 ++++--- configs/samd20-xplained/src/sam_nsh.c | 2 +- configs/samd20-xplained/src/sam_spi.c | 5 +++-- configs/samd20-xplained/src/sam_ug2832hsweg04.c | 4 ++-- configs/samd20-xplained/src/samd20-xplained.h | 13 +++++++------ 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/configs/samd20-xplained/src/Makefile b/configs/samd20-xplained/src/Makefile index d27dde71d7..6be9b5e5e0 100644 --- a/configs/samd20-xplained/src/Makefile +++ b/configs/samd20-xplained/src/Makefile @@ -46,7 +46,7 @@ ifeq ($(CONFIG_HAVE_CXX),y) CSRCS += sam_cxxinitialize.c endif -ifeq ($(CONFIG_SAMD_SPI0),y) +ifeq ($(CONFIG_SAMD_SERCOM0),y) CSRCS += sam_spi.c endif @@ -64,13 +64,13 @@ ifeq ($(CONFIG_NSH_ARCHINIT),y) CSRCS += sam_nsh.c endif -ifeq ($(CONFIG_SAMD_SPI0),y) +ifeq ($(CONFIG_SAMD_SERCOM0),y) ifeq ($(CONFIG_SAM4L_XPLAINED_IOMODULE),y) CSRCS += sam_mmcsd.c endif endif -ifeq ($(CONFIG_SAMD_SPI0),y) +ifeq ($(CONFIG_SAMD_SERCOM0),y) ifeq ($(CONFIG_SAM4L_XPLAINED_OLED1MODULE),y) ifeq ($(CONFIG_LCD_UG2832HSWEG04),y) CSRCS += sam_ug2832hsweg04.c diff --git a/configs/samd20-xplained/src/sam_boot.c b/configs/samd20-xplained/src/sam_boot.c index b806b2a813..082638fbb6 100644 --- a/configs/samd20-xplained/src/sam_boot.c +++ b/configs/samd20-xplained/src/sam_boot.c @@ -41,6 +41,7 @@ #include +#include "sam_config.h" #include "samd20-xplained.h" /************************************************************************************ @@ -71,7 +72,7 @@ void sam_boardinitialize(void) * sam_spiinitialize() has been brought into the link. */ -#ifdef CONFIG_SAMD_SPI0 +#ifdef SAMD_HAVE_SPI0 if (sam_spiinitialize) { sam_spiinitialize(); diff --git a/configs/samd20-xplained/src/sam_mmcsd.c b/configs/samd20-xplained/src/sam_mmcsd.c index 0c4e297af2..0cb4ddef37 100644 --- a/configs/samd20-xplained/src/sam_mmcsd.c +++ b/configs/samd20-xplained/src/sam_mmcsd.c @@ -46,6 +46,7 @@ #include #include +#include "sam_config.h" #include "samd20-xplained.h" #ifdef CONFIG_SAM4L_XPLAINED_IOMODULE @@ -59,8 +60,8 @@ # error Mountpoints are disabled (CONFIG_DISABLE_MOUNTPOINT=y) #endif -#ifndef CONFIG_SAMD_SPI0 /* REVISIT */ -# error SPI support is required (CONFIG_SAMD_SPI0) +#ifndef SAMD_HAVE_SPI0 +# error SERCOM0 SPI support is required #endif #ifndef CONFIG_MMCSD @@ -81,7 +82,7 @@ * - CONFIG_SAM4L_XPLAINED_IOMODULE=y, * - CONFIG_DISABLE_MOUNTPOINT=n, * - CONFIG_MMCSD=y, and - * - CONFIG_SAMD_SPI0=y + * - SAMD_HAVE_SPI0=y (CONFIG_SAMD_SERCOM0 && CONFIG_SAMD_SERCOM0_ISSPI) * *****************************************************************************/ diff --git a/configs/samd20-xplained/src/sam_nsh.c b/configs/samd20-xplained/src/sam_nsh.c index 0b028ce9e7..a90c6457f4 100644 --- a/configs/samd20-xplained/src/sam_nsh.c +++ b/configs/samd20-xplained/src/sam_nsh.c @@ -99,7 +99,7 @@ int nsh_archinitialize(void) { -#if defined(CONFIG_SAMD_SPI0) && defined(CONFIG_SAM4L_XPLAINED_IOMODULE) +#if defined(SAMD_HAVE_SPI0) && defined(CONFIG_SAM4L_XPLAINED_IOMODULE) /* Initialize the SPI-based MMC/SD slot */ { diff --git a/configs/samd20-xplained/src/sam_spi.c b/configs/samd20-xplained/src/sam_spi.c index b802dfec05..19a18d17c4 100644 --- a/configs/samd20-xplained/src/sam_spi.c +++ b/configs/samd20-xplained/src/sam_spi.c @@ -45,11 +45,12 @@ #include +#include "sam_config.h" #include "sam_gpio.h" #include "sam_spi.h" #include "samd20-xplained.h" -#ifdef CONFIG_SAMD_SPI0 /* REVISIT */ +#ifdef SAMD_HAVE_SPI0 /************************************************************************************ * Definitions @@ -236,7 +237,7 @@ uint8_t sam_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid) return ret; } -#endif /* CONFIG_SAMD_SPI0 */ +#endif /* SAMD_HAVE_SPI0 */ /**************************************************************************** * Name: sam_spicmddata diff --git a/configs/samd20-xplained/src/sam_ug2832hsweg04.c b/configs/samd20-xplained/src/sam_ug2832hsweg04.c index b7b6194188..42772cf00a 100644 --- a/configs/samd20-xplained/src/sam_ug2832hsweg04.c +++ b/configs/samd20-xplained/src/sam_ug2832hsweg04.c @@ -133,8 +133,8 @@ # error "The OLED driver requires CONFIG_LCD_UG2832HSWEG04 in the configuration" #endif -#ifndef CONFIG_SAMD_SPI0 -# error "The OLED driver requires CONFIG_SAMD_SPI0 in the configuration" +#ifndef SAMD_HAVE_SPI0 +# error "The OLED driver requires SAMD_HAVE_SPI0 in the configuration" #endif #ifndef CONFIG_SPI_CMDDATA diff --git a/configs/samd20-xplained/src/samd20-xplained.h b/configs/samd20-xplained/src/samd20-xplained.h index 72157ab2ef..89d7928c62 100644 --- a/configs/samd20-xplained/src/samd20-xplained.h +++ b/configs/samd20-xplained/src/samd20-xplained.h @@ -48,6 +48,7 @@ #include #include +#include "sam_config.h" #include "chip/sam_pinmap.h" /************************************************************************************ @@ -115,8 +116,8 @@ #ifdef CONFIG_SAMD20_XPLAINED_IOMODULE -# ifndef CONFIG_SAMD_SPI0 -# error CONFIG_SAMD_SPI0 is required to use the I/O1 module +# ifndef SAMD_HAVE_SPI0 +# error SAMD_HAVE_SPI0 is required to use the I/O1 module # endif # if defined(CONFIG_SAMD20_XPLAINED_IOMODULE_EXT1) @@ -171,8 +172,8 @@ #ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE -# ifndef CONFIG_SAMD_SPI0 /* REVISIT */ -# error CONFIG_SAMD_SPI0 is required to use the OLED1 module +# ifndef SAMD_HAVE_SPI0 +# error SAMD_HAVE_SPI0 is required to use the OLED1 module # endif # ifndef CONFIG_SPI_CMDDATA @@ -256,11 +257,11 @@ void weak_function sam_spiinitialize(void); * * Description: * Initialize the SPI-based SD card. Requires CONFIG_SAMD20_XPLAINED_IOMODULE=y, - * CONFIG_DISABLE_MOUNTPOINT=n, CONFIG_MMCSD=y, and CONFIG_SAMD_SPI0=y + * CONFIG_DISABLE_MOUNTPOINT=n, CONFIG_MMCSD=y, and SAMD_HAVE_SPI0 * ************************************************************************************/ -#if defined(CONFIG_SAMD_SPI0) && defined(CONFIG_SAMD20_XPLAINED_IOMODULE) +#if defined(SAMD_HAVE_SPI0) && defined(CONFIG_SAMD20_XPLAINED_IOMODULE) int sam_sdinitialize(int minor); #endif