Fix-up some SAMD20 SERCOM conditionals

This commit is contained in:
Gregory Nutt 2014-02-12 18:29:23 -06:00
parent bd15ec2565
commit 1bd5ff87c4
8 changed files with 113 additions and 31 deletions

View File

@ -46,7 +46,7 @@
/************************************************************************************ /************************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
************************************************************************************/ ************************************************************************************/
/* How many SERCOM peripherals are configured as peripherals */ /* How many SERCOM peripherals are configured as UART peripherals? */
#define SAMD_HAVE_UART0 1 #define SAMD_HAVE_UART0 1
#define SAMD_HAVE_UART1 1 #define SAMD_HAVE_UART1 1
@ -55,54 +55,54 @@
#define SAMD_HAVE_UART4 1 #define SAMD_HAVE_UART4 1
#define SAMD_HAVE_UART5 1 #define SAMD_HAVE_UART5 1
#if !defined(CONFIG_SAMD_SERCOM0) || !defined(CONFIG_SAMD_SERCOM0_UART) #if !defined(CONFIG_SAMD_SERCOM0) || !defined(CONFIG_SAMD_SERCOM0_ISUART)
# undef SAMD_HAVE_UART0 # undef SAMD_HAVE_UART0
# undef CONFIG_SAMD_SERCOM0_UART # undef CONFIG_SAMD_SERCOM0_ISUART
# undef CONFIG_UART0_SERIAL_CONSOLE # undef CONFIG_UART0_SERIAL_CONSOLE
# undef CONFIG_UART0_FLOW_CONTROL # undef CONFIG_UART0_FLOW_CONTROL
# undef CONFIG_UART0_IRDAMODE # undef CONFIG_UART0_IRDAMODE
# undef CONFIG_UART0_RS485MODE # undef CONFIG_UART0_RS485MODE
#endif #endif
#if !defined(CONFIG_SAMD_SERCOM1) || !defined(CONFIG_SAMD_SERCOM1_UART) #if !defined(CONFIG_SAMD_SERCOM1) || !defined(CONFIG_SAMD_SERCOM1_ISUART)
# undef SAMD_HAVE_UART1 # undef SAMD_HAVE_UART1
# undef CONFIG_SAMD_SERCOM1_UART # undef CONFIG_SAMD_SERCOM1_ISUART
# undef CONFIG_UART1_SERIAL_CONSOLE # undef CONFIG_UART1_SERIAL_CONSOLE
# undef CONFIG_UART1_FLOW_CONTROL # undef CONFIG_UART1_FLOW_CONTROL
# undef CONFIG_UART1_IRDAMODE # undef CONFIG_UART1_IRDAMODE
# undef CONFIG_UART1_RS485MODE # undef CONFIG_UART1_RS485MODE
#endif #endif
#if !defined(CONFIG_SAMD_SERCOM2) || !defined(CONFIG_SAMD_SERCOM2_UART) #if !defined(CONFIG_SAMD_SERCOM2) || !defined(CONFIG_SAMD_SERCOM2_ISUART)
# undef SAMD_HAVE_UART2 # undef SAMD_HAVE_UART2
# undef CONFIG_SAMD_SERCOM2_UART # undef CONFIG_SAMD_SERCOM2_ISUART
# undef CONFIG_UART2_SERIAL_CONSOLE # undef CONFIG_UART2_SERIAL_CONSOLE
# undef CONFIG_UART2_FLOW_CONTROL # undef CONFIG_UART2_FLOW_CONTROL
# undef CONFIG_UART2_IRDAMODE # undef CONFIG_UART2_IRDAMODE
# undef CONFIG_UART2_RS485MODE # undef CONFIG_UART2_RS485MODE
#endif #endif
#if !defined(CONFIG_SAMD_SERCOM3) || !defined(CONFIG_SAMD_SERCOM3_UART) #if !defined(CONFIG_SAMD_SERCOM3) || !defined(CONFIG_SAMD_SERCOM3_ISUART)
# undef SAMD_HAVE_UART3 # undef SAMD_HAVE_UART3
# undef CONFIG_SAMD_SERCOM3_UART # undef CONFIG_SAMD_SERCOM3_ISUART
# undef CONFIG_UART3_SERIAL_CONSOLE # undef CONFIG_UART3_SERIAL_CONSOLE
# undef CONFIG_UART3_FLOW_CONTROL # undef CONFIG_UART3_FLOW_CONTROL
# undef CONFIG_UART3_IRDAMODE # undef CONFIG_UART3_IRDAMODE
# undef CONFIG_UART3_RS485MODE # undef CONFIG_UART3_RS485MODE
#endif #endif
#if !defined(CONFIG_SAMD_SERCOM4) || !defined(CONFIG_SAMD_SERCOM4_UART) #if !defined(CONFIG_SAMD_SERCOM4) || !defined(CONFIG_SAMD_SERCOM4_ISUART)
# undef SAMD_HAVE_UART4 # undef SAMD_HAVE_UART4
# undef CONFIG_SAMD_SERCOM4_UART # undef CONFIG_SAMD_SERCOM4_ISUART
# undef CONFIG_UART4_SERIAL_CONSOLE # undef CONFIG_UART4_SERIAL_CONSOLE
# undef CONFIG_UART4_FLOW_CONTROL # undef CONFIG_UART4_FLOW_CONTROL
# undef CONFIG_UART4_IRDAMODE # undef CONFIG_UART4_IRDAMODE
# undef CONFIG_UART4_RS485MODE # undef CONFIG_UART4_RS485MODE
#endif #endif
#if !defined(CONFIG_SAMD_SERCOM5) || !defined(CONFIG_SAMD_SERCOM5_UART) #if !defined(CONFIG_SAMD_SERCOM5) || !defined(CONFIG_SAMD_SERCOM5_ISUART)
# undef SAMD_HAVE_UART5 # undef SAMD_HAVE_UART5
# undef CONFIG_SAMD_SERCOM5_UART # undef CONFIG_SAMD_SERCOM5_ISUART
# undef CONFIG_UART5_SERIAL_CONSOLE # undef CONFIG_UART5_SERIAL_CONSOLE
# undef CONFIG_UART5_FLOW_CONTROL # undef CONFIG_UART5_FLOW_CONTROL
# undef CONFIG_UART5_IRDAMODE # undef CONFIG_UART5_IRDAMODE
@ -174,6 +174,84 @@
# undef HAVE_SERIAL_CONSOLE # undef HAVE_SERIAL_CONSOLE
#endif #endif
/* Are any SERCOM peripherals are configured as SPI peripherals? */
#define SAMD_HAVE_SPI0 1
#define SAMD_HAVE_SPI1 1
#define SAMD_HAVE_SPI2 1
#define SAMD_HAVE_SPI3 1
#define SAMD_HAVE_SPI4 1
#define SAMD_HAVE_SPI5 1
#if !defined(CONFIG_SAMD_SERCOM0) || !defined(CONFIG_SAMD_SERCOM0_ISSPI)
# undef SAMD_HAVE_SPI0
# undef CONFIG_SAMD_SERCOM0_ISSPI
#endif
#if !defined(CONFIG_SAMD_SERCOM1) || !defined(CONFIG_SAMD_SERCOM1_ISSPI)
# undef SAMD_HAVE_SPI1
# undef CONFIG_SAMD_SERCOM1_ISSPI
#endif
#if !defined(CONFIG_SAMD_SERCOM2) || !defined(CONFIG_SAMD_SERCOM2_ISSPI)
# undef SAMD_HAVE_SPI2
# undef CONFIG_SAMD_SERCOM2_ISSPI
#endif
#if !defined(CONFIG_SAMD_SERCOM3) || !defined(CONFIG_SAMD_SERCOM3_ISSPI)
# undef SAMD_HAVE_SPI3
# undef CONFIG_SAMD_SERCOM3_ISSPI
#endif
#if !defined(CONFIG_SAMD_SERCOM4) || !defined(CONFIG_SAMD_SERCOM4_ISSPI)
# undef SAMD_HAVE_SPI4
# undef CONFIG_SAMD_SERCOM4_ISSPI
#endif
#if !defined(CONFIG_SAMD_SERCOM5) || !defined(CONFIG_SAMD_SERCOM5_ISSPI)
# undef SAMD_HAVE_SPI5
# undef CONFIG_SAMD_SERCOM5_ISSPI
#endif
/* Are any SERCOM peripherals are configured as I2C peripherals? */
#define SAMD_HAVE_I2C0 1
#define SAMD_HAVE_I2C1 1
#define SAMD_HAVE_I2C2 1
#define SAMD_HAVE_I2C3 1
#define SAMD_HAVE_I2C4 1
#define SAMD_HAVE_I2C5 1
#if !defined(CONFIG_SAMD_SERCOM0) || !defined(CONFIG_SAMD_SERCOM0_ISI2C)
# undef SAMD_HAVE_I2C0
# undef CONFIG_SAMD_SERCOM0_ISI2C
#endif
#if !defined(CONFIG_SAMD_SERCOM1) || !defined(CONFIG_SAMD_SERCOM1_ISI2C)
# undef SAMD_HAVE_I2C1
# undef CONFIG_SAMD_SERCOM1_ISI2C
#endif
#if !defined(CONFIG_SAMD_SERCOM2) || !defined(CONFIG_SAMD_SERCOM2_ISI2C)
# undef SAMD_HAVE_I2C2
# undef CONFIG_SAMD_SERCOM2_ISI2C
#endif
#if !defined(CONFIG_SAMD_SERCOM3) || !defined(CONFIG_SAMD_SERCOM3_ISI2C)
# undef SAMD_HAVE_I2C3
# undef CONFIG_SAMD_SERCOM3_ISI2C
#endif
#if !defined(CONFIG_SAMD_SERCOM4) || !defined(CONFIG_SAMD_SERCOM4_ISI2C)
# undef SAMD_HAVE_I2C4
# undef CONFIG_SAMD_SERCOM4_ISI2C
#endif
#if !defined(CONFIG_SAMD_SERCOM5) || !defined(CONFIG_SAMD_SERCOM5_ISI2C)
# undef SAMD_HAVE_I2C5
# undef CONFIG_SAMD_SERCOM5_ISI2C
#endif
/************************************************************************************ /************************************************************************************
* Public Types * Public Types
************************************************************************************/ ************************************************************************************/

View File

@ -46,7 +46,7 @@ ifeq ($(CONFIG_HAVE_CXX),y)
CSRCS += sam_cxxinitialize.c CSRCS += sam_cxxinitialize.c
endif endif
ifeq ($(CONFIG_SAMD_SPI0),y) ifeq ($(CONFIG_SAMD_SERCOM0),y)
CSRCS += sam_spi.c CSRCS += sam_spi.c
endif endif
@ -64,13 +64,13 @@ ifeq ($(CONFIG_NSH_ARCHINIT),y)
CSRCS += sam_nsh.c CSRCS += sam_nsh.c
endif endif
ifeq ($(CONFIG_SAMD_SPI0),y) ifeq ($(CONFIG_SAMD_SERCOM0),y)
ifeq ($(CONFIG_SAM4L_XPLAINED_IOMODULE),y) ifeq ($(CONFIG_SAM4L_XPLAINED_IOMODULE),y)
CSRCS += sam_mmcsd.c CSRCS += sam_mmcsd.c
endif endif
endif endif
ifeq ($(CONFIG_SAMD_SPI0),y) ifeq ($(CONFIG_SAMD_SERCOM0),y)
ifeq ($(CONFIG_SAM4L_XPLAINED_OLED1MODULE),y) ifeq ($(CONFIG_SAM4L_XPLAINED_OLED1MODULE),y)
ifeq ($(CONFIG_LCD_UG2832HSWEG04),y) ifeq ($(CONFIG_LCD_UG2832HSWEG04),y)
CSRCS += sam_ug2832hsweg04.c CSRCS += sam_ug2832hsweg04.c

View File

@ -41,6 +41,7 @@
#include <debug.h> #include <debug.h>
#include "sam_config.h"
#include "samd20-xplained.h" #include "samd20-xplained.h"
/************************************************************************************ /************************************************************************************
@ -71,7 +72,7 @@ void sam_boardinitialize(void)
* sam_spiinitialize() has been brought into the link. * sam_spiinitialize() has been brought into the link.
*/ */
#ifdef CONFIG_SAMD_SPI0 #ifdef SAMD_HAVE_SPI0
if (sam_spiinitialize) if (sam_spiinitialize)
{ {
sam_spiinitialize(); sam_spiinitialize();

View File

@ -46,6 +46,7 @@
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/mmcsd.h> #include <nuttx/mmcsd.h>
#include "sam_config.h"
#include "samd20-xplained.h" #include "samd20-xplained.h"
#ifdef CONFIG_SAM4L_XPLAINED_IOMODULE #ifdef CONFIG_SAM4L_XPLAINED_IOMODULE
@ -59,8 +60,8 @@
# error Mountpoints are disabled (CONFIG_DISABLE_MOUNTPOINT=y) # error Mountpoints are disabled (CONFIG_DISABLE_MOUNTPOINT=y)
#endif #endif
#ifndef CONFIG_SAMD_SPI0 /* REVISIT */ #ifndef SAMD_HAVE_SPI0
# error SPI support is required (CONFIG_SAMD_SPI0) # error SERCOM0 SPI support is required
#endif #endif
#ifndef CONFIG_MMCSD #ifndef CONFIG_MMCSD
@ -81,7 +82,7 @@
* - CONFIG_SAM4L_XPLAINED_IOMODULE=y, * - CONFIG_SAM4L_XPLAINED_IOMODULE=y,
* - CONFIG_DISABLE_MOUNTPOINT=n, * - CONFIG_DISABLE_MOUNTPOINT=n,
* - CONFIG_MMCSD=y, and * - CONFIG_MMCSD=y, and
* - CONFIG_SAMD_SPI0=y * - SAMD_HAVE_SPI0=y (CONFIG_SAMD_SERCOM0 && CONFIG_SAMD_SERCOM0_ISSPI)
* *
*****************************************************************************/ *****************************************************************************/

View File

@ -99,7 +99,7 @@
int nsh_archinitialize(void) 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 */ /* Initialize the SPI-based MMC/SD slot */
{ {

View File

@ -45,11 +45,12 @@
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include "sam_config.h"
#include "sam_gpio.h" #include "sam_gpio.h"
#include "sam_spi.h" #include "sam_spi.h"
#include "samd20-xplained.h" #include "samd20-xplained.h"
#ifdef CONFIG_SAMD_SPI0 /* REVISIT */ #ifdef SAMD_HAVE_SPI0
/************************************************************************************ /************************************************************************************
* Definitions * Definitions
@ -236,7 +237,7 @@ uint8_t sam_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
return ret; return ret;
} }
#endif /* CONFIG_SAMD_SPI0 */ #endif /* SAMD_HAVE_SPI0 */
/**************************************************************************** /****************************************************************************
* Name: sam_spicmddata * Name: sam_spicmddata

View File

@ -133,8 +133,8 @@
# error "The OLED driver requires CONFIG_LCD_UG2832HSWEG04 in the configuration" # error "The OLED driver requires CONFIG_LCD_UG2832HSWEG04 in the configuration"
#endif #endif
#ifndef CONFIG_SAMD_SPI0 #ifndef SAMD_HAVE_SPI0
# error "The OLED driver requires CONFIG_SAMD_SPI0 in the configuration" # error "The OLED driver requires SAMD_HAVE_SPI0 in the configuration"
#endif #endif
#ifndef CONFIG_SPI_CMDDATA #ifndef CONFIG_SPI_CMDDATA

View File

@ -48,6 +48,7 @@
#include <arch/irq.h> #include <arch/irq.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include "sam_config.h"
#include "chip/sam_pinmap.h" #include "chip/sam_pinmap.h"
/************************************************************************************ /************************************************************************************
@ -115,8 +116,8 @@
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE #ifdef CONFIG_SAMD20_XPLAINED_IOMODULE
# ifndef CONFIG_SAMD_SPI0 # ifndef SAMD_HAVE_SPI0
# error CONFIG_SAMD_SPI0 is required to use the I/O1 module # error SAMD_HAVE_SPI0 is required to use the I/O1 module
# endif # endif
# if defined(CONFIG_SAMD20_XPLAINED_IOMODULE_EXT1) # if defined(CONFIG_SAMD20_XPLAINED_IOMODULE_EXT1)
@ -171,8 +172,8 @@
#ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE #ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE
# ifndef CONFIG_SAMD_SPI0 /* REVISIT */ # ifndef SAMD_HAVE_SPI0
# error CONFIG_SAMD_SPI0 is required to use the OLED1 module # error SAMD_HAVE_SPI0 is required to use the OLED1 module
# endif # endif
# ifndef CONFIG_SPI_CMDDATA # ifndef CONFIG_SPI_CMDDATA
@ -256,11 +257,11 @@ void weak_function sam_spiinitialize(void);
* *
* Description: * Description:
* Initialize the SPI-based SD card. Requires CONFIG_SAMD20_XPLAINED_IOMODULE=y, * 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); int sam_sdinitialize(int minor);
#endif #endif