Merged in alinjerpelea/nuttx (pull request #999)

arm: sam & tiva: codestyle fixes

* arm: samd2l2: codestyle fixes

    After the board restructuration is time for codestyle cleanup

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* arm: samd5e5: codestyle fixes

    After the board restructuration is time for codestyle cleanup

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* arm: samv7: codestyle fixes

    After the board restructuration is time for codestyle cleanup

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

* arm: tiva: codestyle fixes

    After the board restructuration is time for codestyle cleanup

    Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Alin Jerpelea
2019-08-16 13:40:59 +00:00
committed by Gregory Nutt
parent 29ab94198c
commit 210de35cb5
252 changed files with 2658 additions and 2280 deletions
@@ -1,5 +1,5 @@
/************************************************************************************
* boards/samd20-xplained/include/board.h
/****************************************************************************
* boards/arm/samd2l2/samd20-xplained/include/board.h
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __BOARDS_ARM_SAMD20_XPLAINED_INCLUDE_BOARD_H
#define __BOARDS_ARM_SAMD20_XPLAINED_INCLUDE_BOARD_H
#ifndef __BOARDS_ARM_SAMD2L2_SAMD20_XPLAINED_INCLUDE_BOARD_H
#define __BOARDS_ARM_SAMD2L2_SAMD20_XPLAINED_INCLUDE_BOARD_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -49,11 +49,12 @@
# endif
#endif
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Clocking *****************************************************************/
/* Clocking *************************************************************************/
/* Overview
*
* OSC8M Output = 8MHz
@@ -288,9 +289,10 @@
#undef BOARD_GCLK7_OUTPUT_ENABLE
#define BOARD_GCLK7_FREQUENCY (BOARD_OSC8M_FREQUENCY / BOARD_GCLK7_PRESCALER)
/* The source of the main clock is always GCLK_MAIN. Also called GCLKGEN[0], this is
* the clock feeding the Power Manager. The Power Manager, in turn, generates main
* clock which is divided down to produce the CPU, AHB, and APB clocks.
/* The source of the main clock is always GCLK_MAIN.
* Also called GCLKGEN[0], this is the clock feeding the Power Manager.
* The Power Manager, in turn, generates main clock which is divided
* down to produce the CPU, AHB, and APB clocks.
*
* The main clock is initially OSC8M divided by 8.
*/
@@ -343,9 +345,10 @@
# define BOARD_FLASH_WAITSTATES 2
#endif
/* SERCOM definitions ***************************************************************/
/* This is the source clock generator for the GCLK_SERCOM_SLOW clock that is common
* to all SERCOM modules.
/* SERCOM definitions *******************************************************/
/* This is the source clock generator for the GCLK_SERCOM_SLOW clock that
* is common to all SERCOM modules.
*/
#define BOARD_SERCOM05_SLOW_GCLKGEN 0
@@ -469,14 +472,15 @@
#define BOARD_SERCOM5_FREQUENCY BOARD_GCLK0_FREQUENCY
/* LED definitions ******************************************************************/
/* LED definitions **********************************************************/
/* There are three LEDs on board the SAMD20 Xplained Pro board: The EDBG
* controls two of the LEDs, a power LED and a status LED. There is only
* one user controllable LED, a yellow LED labelled STATUS near the SAMD20 USB
* connector.
* one user controllable LED, a yellow LED labelled STATUS near the SAMD20
* USB connector.
*
* This LED is controlled by PC07 and the LED can be activated by driving the
* PA14 to GND.
* This LED is controlled by PC07 and the LED can be activated by driving
* the PA14 to GND.
*/
/* LED index values for use with board_userled() */
@@ -489,10 +493,10 @@
#define BOARD_STATUS LED_BIT (1 << BOARD_STATUS_LED)
/* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
* control the LED as defined below. Thus if the LED is statically on, NuttX has
* successfully booted and is, apparently, running normally. If the LED is
* flashing at approximately 2Hz, then a fatal error has been detected and the
* system has halted.
* control the LED as defined below. Thus if the LED is statically on,
* NuttX has successfully booted and is, apparently, running normally.
* If the LED is flashing at approximately 2Hz,
* then a fatal error has been detected and the system has halted.
*/
#define LED_STARTED 0 /* STATUS LED=OFF */
@@ -504,12 +508,14 @@
#define LED_ASSERTION 2 /* STATUS LED=no change */
#define LED_PANIC 3 /* STATUS LED=flashing */
/* Button definitions ***************************************************************/
/* Button definitions *******************************************************/
/* Mechanical buttons:
*
* The SAMD20 Xplained Pro contains two mechanical buttons. One button is the
* RESET button connected to the SAMD20 reset line and the other is a generic user
* configurable button. When a button is pressed it will drive the I/O line to GND.
* The SAMD20 Xplained Pro contains two mechanical buttons.
* One button is the RESET button connected to the SAMD20 reset line and
* the other is a generic user configurable button.
* When a button is pressed it will drive the I/O line to GND.
*
* PA15 SW0
*/
@@ -521,4 +527,4 @@
#define BUTTON_SW0_BIT (1 << BUTTON_SW0)
#endif /* __BOARDS_ARM_SAMD20_XPLAINED_INCLUDE_BOARD_H */
#endif /* __BOARDS_ARM_SAMD2L2_SAMD20_XPLAINED_INCLUDE_BOARD_H */
@@ -1,5 +1,5 @@
############################################################################
# boards/samd20-xplained/scripts/Make.defs
# boards/arm/samd2l2/samd20-xplained/scripts/Make.defs
#
# Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/samd20-xplained/scripts/flash.ld
* boards/arm/samd2l2/samd20-xplained/scripts/flash.ld
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -1,5 +1,5 @@
############################################################################
# boards/samd20-xplained/src/Makefile
# boards/arm/samd2l2/samd20-xplained/src/Makefile
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
@@ -1,5 +1,5 @@
/****************************************************************************
* config/samd20-xplained/src/sam_appinit.c
* boards/samd20-xplained/src/sam_appinit.c
*
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -50,6 +50,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Some configuration checks */
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE_EXT1
@@ -70,6 +71,7 @@
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE
/* Support for the SD card slot on the I/O1 module */
/* Verify NSH PORT and SLOT settings */
# define SAMD2L2_MMCSDSLOTNO 0 /* There is only one slot */
@@ -123,15 +125,13 @@ int board_app_initialize(uintptr_t arg)
#if defined(SAMD2L2_HAVE_SPI0) && defined(CONFIG_SAMD20_XPLAINED_IOMODULE)
/* Initialize the SPI-based MMC/SD slot */
{
int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n",
ret);
return ret;
}
}
int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n",
ret);
return ret;
}
#endif
return OK;
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/samd20-xplained/src/sam_autoleds.c
* boards/arm/samd2l2/samd20-xplained/src/sam_autoleds.c
*
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -32,13 +32,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/* There are three LEDs on board the SAMD20 Xplained Pro board: The EDBG
* controls two of the LEDs, a power LED and a status LED. There is only
* one user controllable LED, a yellow LED labelled STATUS near the SAMD20 USB
* connector.
* one user controllable LED, a yellow LED labelled STATUS near the SAMD20
* USB connector.
*
* This LED is controlled by PA14 and the LED can be activated by driving PA14
* to GND.
* This LED is controlled by PA14 and the LED can be activated by driving
* PA14 to GND.
*
* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
* control the LED as follows:
@@ -100,20 +101,26 @@ void board_autoled_on(int led)
switch (led)
{
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF */
/* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF */
/* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF */
break; /* Leave ledstate == true to turn OFF */
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF
* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF
* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF
*/
break; /* Leave ledstate == true to turn OFF */
default:
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C */
/* LED_SIGNAL: In a signal handler STATUS LED=N/C */
/* LED_ASSERTION: An assertion failed STATUS LED=N/C */
return; /* Return to leave STATUS LED unchanged */
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C
* LED_SIGNAL: In a signal handler STATUS LED=N/C
* LED_ASSERTION: An assertion failed STATUS LED=N/C
*/
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
return; /* Return to leave STATUS LED unchanged */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
ledstate = false; /* Set ledstate == false to turn ON */
break;
}
@@ -131,21 +138,25 @@ void board_autoled_off(int led)
/* These should not happen and are ignored */
default:
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF */
/* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF */
/* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF */
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF
* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF
* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF
*/
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
/* These result in no-change */
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C */
/* LED_SIGNAL: In a signal handler STATUS LED=N/C */
/* LED_ASSERTION: An assertion failed STATUS LED=N/C */
return; /* Return to leave STATUS LED unchanged */
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C
* LED_SIGNAL: In a signal handler STATUS LED=N/C
* LED_ASSERTION: An assertion failed STATUS LED=N/C
*/
return; /* Return to leave STATUS LED unchanged */
/* Turn STATUS LED off set driving the output high */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
sam_portwrite(PORT_STATUS_LED, true);
break;
}
@@ -1,5 +1,5 @@
/************************************************************************************
* boards/samd20-xplained/src/sam_boot.c
/****************************************************************************
* boards/arm/samd2l2/samd20-xplained/src/sam_boot.c
*
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -46,31 +46,33 @@
#include "sam_config.h"
#include "samd20-xplained.h"
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Private Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: sam_boardinitialize
*
* Description:
* All SAM3U architectures must provide the following entry point. This entry point
* is called early in the initialization -- after all memory has been configured
* and mapped but before any devices have been initialized.
* All SAM3U architectures must provide the following entry point.
* This entry point is called early in the initialization -- after all
* memory has been configured and mapped but before any devices have been
* initialized.
*
************************************************************************************/
****************************************************************************/
void sam_boardinitialize(void)
{
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
/* Configure SPI chip selects if
* 1) SPI is not disabled, and 2) the weak function
* sam_spidev_initialize() has been brought into the link.
*/
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/samd20-xplained/src/sam_buttons.c
* boards/arm/samd2l2/samd20-xplained/src/sam_buttons.c
*
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -74,16 +74,18 @@ void board_button_initialize(void)
(void)sam_configport(PORT_SW0);
}
/************************************************************************************
/****************************************************************************
* Name: board_buttons
*
* Description:
* After board_button_initialize() has been called, board_buttons() may be called to collect
* the state of all buttons. board_buttons() returns an 32-bit bit set with each bit
* associated with a button. See the BUTTON* definitions above for the meaning of
* After board_button_initialize() has been called, board_buttons()
* may be called to collect the state of all buttons.
* board_buttons() returns an 32-bit bit set with each bit
* associated with a button.
* See the BUTTON* definitions above for the meaning of
* each bit in the returned value.
*
************************************************************************************/
****************************************************************************/
uint32_t board_buttons(void)
{
@@ -1,5 +1,5 @@
/****************************************************************************
* config/samd20-xplained/src/sam_mmcsd.c
* boards/arm/samd2l2/samd20-xplained/src/sam_mmcsd.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -56,6 +56,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifdef CONFIG_DISABLE_MOUNTPOINT
@@ -84,7 +85,8 @@
* - CONFIG_SAMD20_XPLAINED_IOMODULE=y,
* - CONFIG_DISABLE_MOUNTPOINT=n,
* - CONFIG_MMCSD=y, and
* - SAMD2L2_HAVE_SPI0=y (CONFIG_SAMD2L2_SERCOM0 && CONFIG_SAMD2L2_SERCOM0_ISSPI)
* - SAMD2L2_HAVE_SPI0=y
* (CONFIG_SAMD2L2_SERCOM0 && CONFIG_SAMD2L2_SERCOM0_ISSPI)
*
****************************************************************************/
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/samd20-xplained/src/sam_spi.c
* boards/arm/samd2l2/samd20-xplained/src/sam_spi.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -68,20 +68,20 @@
void weak_function sam_spidev_initialize(void)
{
/* 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 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.
*/
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE
/* TODO: enable interrupt on card detect */
sam_configport(PORT_SD_CD); /* Card detect input */
sam_configport(PORT_SD_CS); /* Chip select output */
sam_configport(PORT_SD_CD); /* Card detect input */
sam_configport(PORT_SD_CS); /* Chip select output */
#endif
#ifdef CONFIG_SAMD20_XPLAINED_OLED1MODULE
sam_configport(PORT_OLED_DATA); /* Command/data */
sam_configport(PORT_OLED_CS); /* Card detect input */
sam_configport(PORT_OLED_DATA); /* Command/data */
sam_configport(PORT_OLED_CS); /* Card detect input */
#endif
}
@@ -89,8 +89,8 @@ void weak_function sam_spidev_initialize(void)
* Name: sam_spi[n]select, sam_spi[n]status, and sam_spi[n]cmddata
*
* Description:
* These external functions must be provided by board-specific logic. They
* include:
* These external functions must be provided by board-specific logic.
* They include:
*
* o sam_spi[n]select is a functions to manage the board-specific chip
* selects
@@ -114,8 +114,8 @@ void weak_function sam_spidev_initialize(void)
* the way your board is configured.
* 3. Add a call to sam_spibus_initialize() in your low level application
* initialization logic
* 4. The handle returned by sam_spibus_initialize() may then be used to bind
* the SPI driver to higher level logic (e.g., calling
* 4. The handle returned by sam_spibus_initialize() may then be used to
* bind the SPI driver to higher level logic (e.g., calling
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
* the SPI MMC/SD driver).
*
@@ -1,5 +1,5 @@
/****************************************************************************
* config/samd20-xplained/src/sam_ug2832hsweg04.c
* boards/arm/samd2l2/samd20-xplained/src/sam_ug2832hsweg04.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -125,7 +125,9 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* The pin configurations here require that SPI1 is selected */
#ifndef CONFIG_LCD_SSD1306
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/samd20-xplained/src/sam_userleds.c
* boards/arm/samd2l2/samd20-xplained/src/sam_userleds.c
*
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -32,6 +32,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/* There are three LEDs on board the SAMD20 Xplained Pro board: The EDBG
* controls two of the LEDs, a power LED and a status LED. There is only
* one user controllable LED, a yellow LED labeled STATUS near the SAMD20 USB
@@ -41,8 +42,8 @@
* to GND.
*
* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
* control the LED. Otherwise, the LED can be controlled from user applications
* using the logic in this file.
* control the LED. Otherwise, the LED can be controlled from user
* applications using the logic in this file.
*/
/****************************************************************************
@@ -105,9 +106,10 @@ void board_userled(int led, bool ledon)
*
* Description:
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
* LEDs. If CONFIG_ARCH_LEDS is not defined, then the board_userled_all() is
* available to control the LED from user application logic. NOTE: since
* there is only a single LED on-board, this is function is not very useful.
* LEDs. If CONFIG_ARCH_LEDS is not defined, then the board_userled_all()
* is available to control the LED from user application logic.
* NOTE: since there is only a single LED on-board,
* this is function is not very useful.
*
****************************************************************************/
@@ -1,5 +1,5 @@
/************************************************************************************
* boards/samd20-xplained/src/samd20-xplained.h
/****************************************************************************
* boards/arm/samd2l2/samd20-xplained/src/samd20-xplained.h
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __BOARDS_ARM_SAMD20_XPLAINED_SRC_SAMD20_XPLAINED_H
#define __BOARDS_ARM_SAMD20_XPLAINED_SRC_SAMD20_XPLAINED_H
#ifndef __BOARDS_ARM_SAMD2L2_SAMD20_XPLAINED_SRC_SAMD20_XPLAINED_H
#define __BOARDS_ARM_SAMD2L2_SAMD20_XPLAINED_SRC_SAMD20_XPLAINED_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
@@ -51,16 +51,17 @@
#include "sam_config.h"
#include "sam_pinmap.h"
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* LEDs: There are three LEDs on board the SAMD20 Xplained Pro board: The EDBG
* controls two of the LEDs, a power LED and a status LED. There is only
* one user controllable LED, a yellow LED labelled STATIS near the SAMD20 USB
* connector.
****************************************************************************/
/* LEDs: There are three LEDs on board the SAMD20 Xplained Pro board:
* The EDBG controls two of the LEDs, a power LED and a status LED.
* There is only one user controllable LED, a yellow LED labelled STATIS
* near the SAMD20 USB connector.
*
* This LED is controlled by PA14 and the LED can be activated by driving PA14
* to GND.
* This LED is controlled by PA14 and the LED can be activated by driving
* PA14 to GND.
*
* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
* control the LED as follows:
@@ -87,8 +88,9 @@
/* Mechanical buttons:
*
* The SAMD20 Xplained Pro contains two mechanical buttons. One button is the
* RESET button connected to the SAMD20 reset line and the other is a generic user
* configurable button. When a button is pressed it will drive the I/O line to GND.
* RESET button connected to the SAMD20 reset line and the other is a generic
* user configurable button.
* When a button is pressed it will drive the I/O line to GND.
*
* PA15 SW0
*/
@@ -98,19 +100,22 @@
/* I/O1
*
* Support for the microSD card slot on the I/O1 module. The I/O1 requires
* SPI support and two PORTs. These the PORTs will vary if the I/O1
* is installed on the EXT1 or EXT2 connector:
* Support for the microSD card slot on the I/O1 module.
* The I/O1 requires SPI support and two PORTs.
* These the PORTs will vary if the I/O1 is installed on the EXT1 or
* EXT2 connector:
*
* --- ------------------ ---------------------- -------------------------------
* --- ------------------ ---------------------- --------------------------
* PIN EXT1 EXT2 Description
* --- ------------------ ---------------------- -------------------------------
* 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] Active low chip select OUTPUT,
* SPI SS SPI SS pulled high on board.
* --- ------------------ ---------------------- -------------------------------
* 10 PB05 PORT 10 PB15 PORT Active low card detect INPUT,
* must use internal pull-up.
* --- ------------------ ---------------------- -------------------------------
* --- ------------------ ---------------------- --------------------------
* 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] Active low chip select
* SPI SS SPI SS OUTPUT, pulled high on
* board.
* --- ------------------ ---------------------- --------------------------
* 10 PB05 PORT 10 PB15 PORT Active low card detect
* INPUT, must use internal
* pull-up.
* --- ------------------ ---------------------- --------------------------
*/
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE
@@ -152,13 +157,13 @@
/* OLED1
*
* Support for the microSD card slot on the I/O1 module. The I/O1 requires
* SPI support and three output PORTs. These the PORTs will vary if the OLED1
* is installed on the EXT1 or EXT2 connector:
*
* Support for the microSD card slot on the I/O1 module.
* The I/O1 requires SPI support and three output PORTs.
* These the PORTs will vary if the OLED1is installed on the EXT1 or
* EXT2 connector:
*
* PIN EXT1 EXT2 Description
* --- ------------------- -------------------- -------------------------------------
* --- ------------------- -------------------- ---------------------------
* 5 PB06 PORT PA20 PORT DATA_CMD_SEL
* 10 PB05 PORT PB15 PORT DISPLAY_RESET. Active low.
* 15 PA05 SERCOM0 PAD[1] PA17 SERCOM1 PAD[1] DISPLAY_SS. Active low.
@@ -221,44 +226,45 @@
PORTB | PORT_PIN11) /* REVISIT */
#endif
/************************************************************************************
/****************************************************************************
* Public Types
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Public data
************************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: sam_spidev_initialize
*
* Description:
* Called to configure SPI chip select PORT pins for the SAM3U-EK board.
*
************************************************************************************/
****************************************************************************/
void weak_function sam_spidev_initialize(void);
/************************************************************************************
/****************************************************************************
* Name: sam_sdinitialize
*
* Description:
* Initialize the SPI-based SD card. Requires CONFIG_SAMD20_XPLAINED_IOMODULE=y,
* CONFIG_DISABLE_MOUNTPOINT=n, CONFIG_MMCSD=y, and the appropriate SERCOM SPI
* Initialize the SPI-based SD card.
* Requires CONFIG_SAMD20_XPLAINED_IOMODULE=y,
* CONFIG_DISABLE_MOUNTPOINT=n, CONFIG_MMCSD=y,
* and the appropriate SERCOM SPI
* port enabled.
*
************************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMD20_XPLAINED_IOMODULE
int sam_sdinitialize(int port, int minor);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_SAMD20_XPLAINED_SRC_SAMD20_XPLAINED_H */
#endif /* __BOARDS_ARM_SAMD2L2_SAMD20_XPLAINED_SRC_SAMD20_XPLAINED_H */
@@ -27,8 +27,9 @@ Contents
STATUS/ISSUES
=============
1. See boards/samd20-xplained/README.txt. This port derives from the
SAMD20 Xplained board board and all issues there should apply.
1. See boards/arm/samd2l2/samd20-xplained/README.txt.
This port derives from the SAMD20 Xplained board board and all issues
there should apply.
2. 2015-07-06: The basic NSH configuration is working properly, but
not at 115200 baud which is the default BAUD selection in the
@@ -1,5 +1,5 @@
/************************************************************************************
* boards/samd21-xplained/include/board.h
/****************************************************************************
* boards/arm/samd2l2/samd21-xplained/include/board.h
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __BOARDS_ARM_SAMD21_XPLAINED_INCLUDE_BOARD_H
#define __BOARDS_ARM_SAMD21_XPLAINED_INCLUDE_BOARD_H
#ifndef __BOARDS_ARM_SAMD2L2_SAMD21_XPLAINED_INCLUDE_BOARD_H
#define __BOARDS_ARM_SAMD2L2_SAMD21_XPLAINED_INCLUDE_BOARD_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -49,11 +49,12 @@
# endif
#endif
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Clocking *****************************************************************/
/* Clocking *************************************************************************/
/* Overview
*
* OSC8M Output = 8MHz
@@ -288,9 +289,10 @@
#undef BOARD_GCLK7_OUTPUT_ENABLE
#define BOARD_GCLK7_FREQUENCY (BOARD_OSC8M_FREQUENCY / BOARD_GCLK7_PRESCALER)
/* The source of the main clock is always GCLK_MAIN. Also called GCLKGEN[0], this is
* the clock feeding the Power Manager. The Power Manager, in turn, generates main
* clock which is divided down to produce the CPU, AHB, and APB clocks.
/* The source of the main clock is always GCLK_MAIN. Also called GCLKGEN[0],
* this is the clock feeding the Power Manager.
* The Power Manager, in turn, generates main clock which is divided down to
* produce the CPU, AHB, and APB clocks.
*
* The main clock is initially OSC8M divided by 8.
*/
@@ -343,9 +345,10 @@
# define BOARD_FLASH_WAITSTATES 2
#endif
/* SERCOM definitions ***************************************************************/
/* This is the source clock generator for the GCLK_SERCOM_SLOW clock that is common
* to all SERCOM modules.
/* SERCOM definitions *******************************************************/
/* This is the source clock generator for the GCLK_SERCOM_SLOW clock that is
* common to all SERCOM modules.
*/
#define BOARD_SERCOM05_SLOW_GCLKGEN 0
@@ -469,7 +472,8 @@
#define BOARD_SERCOM5_FREQUENCY BOARD_GCLK0_FREQUENCY
/* USB definitions ******************************************************************/
/* USB definitions **********************************************************/
/* This is the source clock generator for the GCLK_USB clock
*/
@@ -482,14 +486,15 @@
#define BOARD_USB_PADCAL_N 5
#define BOARD_USB_PADCAL_TRIM 3
/* LED definitions ******************************************************************/
/* LED definitions **********************************************************/
/* There are three LEDs on board the SAMD21 Xplained Pro board: The EDBG
* controls two of the LEDs, a power LED and a status LED. There is only
* one user controllable LED, a yellow LED labelled STATUS near the SAMD21 USB
* connector.
* one user controllable LED, a yellow LED labelled STATUS near the SAMD21
* USB connector.
*
* This LED is controlled by PC07 and the LED can be activated by driving the
* PB30 to GND.
* This LED is controlled by PC07 and the LED can be activated by driving
* the PB30 to GND.
*/
/* LED index values for use with board_userled() */
@@ -502,10 +507,10 @@
#define BOARD_STATUS LED_BIT (1 << BOARD_STATUS_LED)
/* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
* control the LED as defined below. Thus if the LED is statically on, NuttX has
* successfully booted and is, apparently, running normally. If the LED is
* flashing at approximately 2Hz, then a fatal error has been detected and the
* system has halted.
* control the LED as defined below. Thus if the LED is statically on, NuttX
* has successfully booted and is, apparently, running normally.
* If the LED is flashing at approximately 2Hz, then a fatal error
* has been detected and the system has halted.
*/
#define LED_STARTED 0 /* STATUS LED=OFF */
@@ -517,12 +522,14 @@
#define LED_ASSERTION 2 /* STATUS LED=no change */
#define LED_PANIC 3 /* STATUS LED=flashing */
/* Button definitions ***************************************************************/
/* Button definitions *******************************************************/
/* Mechanical buttons:
*
* The SAMD21 Xplained Pro contains two mechanical buttons. One button is the
* RESET button connected to the SAMD21 reset line and the other is a generic user
* configurable button. When a button is pressed it will drive the I/O line to GND.
* The SAMD21 Xplained Pro contains two mechanical buttons.
* One button is the RESET button connected to the SAMD21 reset line and the
* other is a generic user configurable button.
* When a button is pressed it will drive the I/O line to GND.
*
* PA15 SW0
*/
@@ -534,4 +541,4 @@
#define BUTTON_SW0_BIT (1 << BUTTON_SW0)
#endif /* __BOARDS_ARM_SAMD21_XPLAINED_INCLUDE_BOARD_H */
#endif /* __BOARDS_ARM_SAMD2L2_SAMD21_XPLAINED_INCLUDE_BOARD_H */
@@ -1,5 +1,5 @@
############################################################################
# boards/samd21-xplained/scripts/Make.defs
# boards/arm/samd2l2/samd21-xplained/scripts/Make.defs
#
# Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/samd21-xplained/scripts/flash.ld
* boards/arm/samd2l2/samd21-xplained/scripts/flash.ld
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -1,5 +1,5 @@
############################################################################
# boards/samd21-xplained/src/Makefile
# boards/arm/samd2l2/samd21-xplained/src/Makefile
#
# Copyright (C) 2015 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
@@ -1,5 +1,5 @@
/****************************************************************************
* config/samd21-xplained/src/sam_appinit.c
* boards/arm/samd2l2/samd21-xplained/src/sam_appinit.c
*
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -50,6 +50,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Some configuration checks */
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE_EXT1
@@ -70,6 +71,7 @@
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE
/* Support for the SD card slot on the I/O1 module */
/* Verify NSH PORT and SLOT settings */
# define SAMD2L2_MMCSDSLOTNO 0 /* There is only one slot */
@@ -123,15 +125,13 @@ int board_app_initialize(uintptr_t arg)
#if defined(SAMD2L2_HAVE_SPI0) && defined(CONFIG_SAMD21_XPLAINED_IOMODULE)
/* Initialize the SPI-based MMC/SD slot */
{
int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n",
ret);
return ret;
}
}
int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n",
ret);
return ret;
}
#endif
return OK;
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/samd21-xplained/src/sam_autoleds.c
* boards/arm/samd2l2/samd21-xplained/src/sam_autoleds.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -32,6 +32,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/* There are three LEDs on board the SAMD21 Xplained Pro board: The EDBG
* controls two of the LEDs, a power LED and a status LED. There is only
* one user controllable LED, a yellow LED labelled STATUS near the SAMD21 USB
@@ -100,19 +101,23 @@ void board_autoled_on(int led)
switch (led)
{
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF */
/* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF */
/* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF */
break; /* Leave ledstate == true to turn OFF */
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF
* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF
* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF
*/
break; /* Leave ledstate == true to turn OFF */
default:
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C */
/* LED_SIGNAL: In a signal handler STATUS LED=N/C */
/* LED_ASSERTION: An assertion failed STATUS LED=N/C */
return; /* Return to leave STATUS LED unchanged */
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C
* LED_SIGNAL: In a signal handler STATUS LED=N/C
* LED_ASSERTION: An assertion failed STATUS LED=N/C
*/
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
return; /* Return to leave STATUS LED unchanged */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
ledstate = false; /* Set ledstate == false to turn ON */
break;
}
@@ -131,21 +136,25 @@ void board_autoled_off(int led)
/* These should not happen and are ignored */
default:
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF */
/* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF */
/* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF */
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF
* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF
* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF
*/
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
/* These result in no-change */
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C */
/* LED_SIGNAL: In a signal handler STATUS LED=N/C */
/* LED_ASSERTION: An assertion failed STATUS LED=N/C */
return; /* Return to leave STATUS LED unchanged */
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C
* LED_SIGNAL: In a signal handler STATUS LED=N/C
* LED_ASSERTION: An assertion failed STATUS LED=N/C
*/
return; /* Return to leave STATUS LED unchanged */
/* Turn STATUS LED off set driving the output high */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
sam_portwrite(PORT_STATUS_LED, true);
break;
}
@@ -1,5 +1,5 @@
/************************************************************************************
* boards/samd21-xplained/src/sam_boot.c
/****************************************************************************
* boards/arm/samd2l2/samd21-xplained/src/sam_boot.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -46,31 +46,34 @@
#include "sam_config.h"
#include "samd21-xplained.h"
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Private Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: sam_boardinitialize
*
* Description:
* All SAM3U architectures must provide the following entry point. This entry point
* is called early in the initialization -- after all memory has been configured
* and mapped but before any devices have been initialized.
* All SAM3U architectures must provide the following entry point.
* This entry point is called early in the initialization -- after all
* memory has been configured and mapped but before any devices have been
* initialized.
*
************************************************************************************/
****************************************************************************/
void sam_boardinitialize(void)
{
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
/* Configure SPI chip selects if
* 1) SPI is not disabled, and
* 2) the weak function
* sam_spidev_initialize() has been brought into the link.
*/
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/samd21-xplained/src/sam_buttons.c
* boards/arm/samd2l2/samd21-xplained/src/sam_buttons.c
*
* Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -74,16 +74,18 @@ void board_button_initialize(void)
(void)sam_configport(PORT_SW0);
}
/************************************************************************************
/****************************************************************************
* Name: board_buttons
*
* Description:
* After board_button_initialize() has been called, board_buttons() may be called to collect
* the state of all buttons. board_buttons() returns an 32-bit bit set with each bit
* associated with a button. See the BUTTON* definitions above for the meaning of
* each bit in the returned value.
* After board_button_initialize() has been called,
* board_buttons() may be called to collect the state of all buttons.
* board_buttons() returns an 32-bit bit set with each bit
* associated with a button.
* See the BUTTON* definitions above for the meaning of each bit
* in the returned value.
*
************************************************************************************/
****************************************************************************/
uint32_t board_buttons(void)
{
@@ -1,5 +1,5 @@
/****************************************************************************
* config/samd21-xplained/src/sam_mmcsd.c
* boards/arm/samd2l2/samd21-xplained/src/sam_mmcsd.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -56,6 +56,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifdef CONFIG_DISABLE_MOUNTPOINT
@@ -84,7 +85,8 @@
* - CONFIG_SAMD21_XPLAINED_IOMODULE=y,
* - CONFIG_DISABLE_MOUNTPOINT=n,
* - CONFIG_MMCSD=y, and
* - SAMD2L2_HAVE_SPI0=y (CONFIG_SAMD2L2_SERCOM0 && CONFIG_SAMD2L2_SERCOM0_ISSPI)
* - SAMD2L2_HAVE_SPI0=y
* (CONFIG_SAMD2L2_SERCOM0 && CONFIG_SAMD2L2_SERCOM0_ISSPI)
*
****************************************************************************/
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/samd21-xplained/src/sam_spi.c
* boards/arm/samd2l2/samd21-xplained/src/sam_spi.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -68,20 +68,20 @@
void weak_function sam_spidev_initialize(void)
{
/* 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 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.
*/
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE
/* TODO: enable interrupt on card detect */
sam_configport(PORT_SD_CD); /* Card detect input */
sam_configport(PORT_SD_CS); /* Chip select output */
sam_configport(PORT_SD_CD); /* Card detect input */
sam_configport(PORT_SD_CS); /* Chip select output */
#endif
#ifdef CONFIG_SAMD21_XPLAINED_OLED1MODULE
sam_configport(PORT_OLED_DATA); /* Command/data */
sam_configport(PORT_OLED_CS); /* Card detect input */
sam_configport(PORT_OLED_DATA); /* Command/data */
sam_configport(PORT_OLED_CS); /* Card detect input */
#endif
}
@@ -114,8 +114,8 @@ void weak_function sam_spidev_initialize(void)
* the way your board is configured.
* 3. Add a call to sam_spibus_initialize() in your low level application
* initialization logic
* 4. The handle returned by sam_spibus_initialize() may then be used to bind
* the SPI driver to higher level logic (e.g., calling
* 4. The handle returned by sam_spibus_initialize() may then be used to
* bind the SPI driver to higher level logic (e.g., calling
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
* the SPI MMC/SD driver).
*
@@ -1,5 +1,5 @@
/****************************************************************************
* config/samd21-xplained/src/sam_ug2832hsweg04.c
* boards/arm/samd2l2/samd21-xplained/src/sam_ug2832hsweg04.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -125,7 +125,9 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* The pin configurations here require that SPI1 is selected */
#ifndef CONFIG_LCD_SSD1306
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/samd21-xplained/src/sam_userleds.c
* boards/arm/samd2l2/samd21-xplained/src/sam_userleds.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -32,6 +32,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/* There are three LEDs on board the SAMD21 Xplained Pro board: The EDBG
* controls two of the LEDs, a power LED and a status LED. There is only
* one user controllable LED, a yellow LED labelled STATUS near the SAMD21 USB
@@ -41,8 +42,8 @@
* to GND.
*
* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
* control the LED. Otherwise, the LED can be controlled from user applications
* using the logic in this file.
* control the LED. Otherwise, the LED can be controlled from user
* applications using the logic in this file.
*/
/****************************************************************************
@@ -105,7 +106,8 @@ void board_userled(int led, bool ledon)
*
* Description:
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
* LEDs. If CONFIG_ARCH_LEDS is not defined, then the board_userled_all() is
* LEDs.
* If CONFIG_ARCH_LEDS is not defined, then the board_userled_all() is
* available to control the LED from user application logic. NOTE: since
* there is only a single LED on-board, this is function is not very useful.
*
@@ -1,5 +1,5 @@
/************************************************************************************
* boards/samd21-xplained/src/samd21-xplained.h
/****************************************************************************
* boards/arm/samd2l2/samd21-xplained/src/samd21-xplained.h
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __BOARDS_ARM_SAMD21_XPLAINED_SRC_SAMD21_XPLAINED_H
#define __BOARDS_ARM_SAMD21_XPLAINED_SRC_SAMD21_XPLAINED_H
#ifndef __BOARDS_ARM_SAMD2L2_SAMD21_XPLAINED_SRC_SAMD21_XPLAINED_H
#define __BOARDS_ARM_SAMD2L2_SAMD21_XPLAINED_SRC_SAMD21_XPLAINED_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
@@ -51,16 +51,18 @@
#include "sam_config.h"
#include "sam_pinmap.h"
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* LEDs: There are three LEDs on board the SAMD21 Xplained Pro board: The EDBG
****************************************************************************/
/* LEDs:
* There are three LEDs on board the SAMD21 Xplained Pro board: The EDBG
* controls two of the LEDs, a power LED and a status LED. There is only
* one user controllable LED, a yellow LED labelled STATIS near the SAMD21 USB
* connector.
* one user controllable LED, a yellow LED labelled STATIS near the SAMD21
* USB connector.
*
* This LED is controlled by PB30 and the LED can be activated by driving PB30
* to GND.
* This LED is controlled by PB30 and the LED can be activated by driving
* PB30 to GND.
*
* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
* control the LED as follows:
@@ -87,8 +89,9 @@
/* Mechanical buttons:
*
* The SAMD21 Xplained Pro contains two mechanical buttons. One button is the
* RESET button connected to the SAMD21 reset line and the other is a generic user
* configurable button. When a button is pressed it will drive the I/O line to GND.
* RESET button connected to the SAMD21 reset line and the other is a generic
* user configurable button.
* When a button is pressed it will drive the I/O line to GND.
*
* PA15 SW0
*/
@@ -102,15 +105,17 @@
* SPI support and two PORTs. These the PORTs will vary if the I/O1
* is installed on the EXT1 or EXT2 connector:
*
* --- ------------------ ---------------------- -------------------------------
* --- ------------------ ---------------------- --------------------------
* PIN EXT1 EXT2 Description
* --- ------------------ ---------------------- -------------------------------
* 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] Active low chip select OUTPUT,
* SPI SS SPI SS pulled high on board.
* --- ------------------ ---------------------- -------------------------------
* 10 PB05 PORT 10 PB15 PORT Active low card detect INPUT,
* must use internal pull-up.
* --- ------------------ ---------------------- -------------------------------
* --- ------------------ ---------------------- --------------------------
* 15 PA05 SERCOM0 PAD[1] 15 PA17 SERCOM1 PAD[1] Active low chip select
* SPI SS SPI SS OUTPUT, pulled high on
* board.
* --- ------------------ ---------------------- --------------------------
* 10 PB05 PORT 10 PB15 PORT Active low card detect
* INPUT, must use internal
* pull-up.
* --- ------------------ ---------------------- --------------------------
*/
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE
@@ -158,7 +163,7 @@
*
*
* PIN EXT1 EXT2 Description
* --- ------------------- -------------------- -------------------------------------
* --- ------------------- -------------------- ---------------------------
* 5 PB06 PORT PA20 PORT DATA_CMD_SEL
* 10 PB05 PORT PB15 PORT DISPLAY_RESET. Active low.
* 15 PA05 SERCOM0 PAD[1] PA17 SERCOM1 PAD[1] DISPLAY_SS. Active low.
@@ -221,44 +226,44 @@
PORTB | PORT_PIN11) /* REVISIT */
#endif
/************************************************************************************
/****************************************************************************
* Public Types
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Public data
************************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: sam_spidev_initialize
*
* Description:
* Called to configure SPI chip select PORT pins for the SAM3U-EK board.
*
************************************************************************************/
****************************************************************************/
void weak_function sam_spidev_initialize(void);
/************************************************************************************
/****************************************************************************
* Name: sam_sdinitialize
*
* Description:
* Initialize the SPI-based SD card. Requires CONFIG_SAMD21_XPLAINED_IOMODULE=y,
* CONFIG_DISABLE_MOUNTPOINT=n, CONFIG_MMCSD=y, and the appropriate SERCOM SPI
* port enabled.
* Initialize the SPI-based SD card.
* Requires CONFIG_SAMD21_XPLAINED_IOMODULE=y,
* CONFIG_DISABLE_MOUNTPOINT=n,
* CONFIG_MMCSD=y, and the appropriate SERCOM SPI port enabled.
*
************************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAMD21_XPLAINED_IOMODULE
int sam_sdinitialize(int port, int minor);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_SAMD21_XPLAINED_SRC_SAMD21_XPLAINED_H */
#endif /* __BOARDS_ARM_SAMD2L2_SAMD21_XPLAINED_SRC_SAMD21_XPLAINED_H */
@@ -1,5 +1,5 @@
/************************************************************************************
* boards/saml21-xplained/include/board.h
/****************************************************************************
* boards/arm/samd2l2/saml21-xplained/include/board.h
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __BOARDS_ARM_SAML21_XPLAINED_INCLUDE_BOARD_H
#define __BOARDS_ARM_SAML21_XPLAINED_INCLUDE_BOARD_H
#ifndef __BOARDS_ARM_SAMD2L2_SAML21_XPLAINED_INCLUDE_BOARD_H
#define __BOARDS_ARM_SAMD2L2_SAML21_XPLAINED_INCLUDE_BOARD_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -49,27 +49,29 @@
# endif
#endif
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/* Clocking *****************************************************************/
/* Clocking *************************************************************************/
/* Overview
*
* Since there is no high speed crystal, we will run from the OSC16M clock source.
* We will use its default, POR frequency of 4MHz to avoid an additional clock
* switch.
* Since there is no high speed crystal, we will run from the OSC16M clock
* source.
* We will use its default, POR frequency of 4MHz to avoid an additional
* clock switch.
*
* OSC16M Output = 4MHz
* `- GCLK1 Input = 4MHz Prescaler = 1 output = 4MHz
* `- DFLL Input = 4MHz Multiplier = 12 output = 48MHz
* `- GCLK0 Input = 48MHz Prescaler = 1 output = 48MHz
* `- MCLK Input = 48Mhz CPU divider = 1 CPU frequency = 48MHz
* APBA divider = 1 APBA frequency = 48MHz
* APBB divider = 1 APBB frequency = 48MHz
* APBC divider = 1 APBC frequency = 48MHz
* APBD divider = 1 APBD frequency = 48MHz
* APBE divider = 1 APBE frequency = 48MHz
* OSC16M Output = 4MHz
* `- GCLK1 Input = 4MHz Prescaler = 1 output = 4MHz
* `- DFLL Input = 4MHz Multiplier = 12 output = 48MHz
* `- GCLK0 Input = 48MHz Prescaler = 1 output = 48MHz
* `- MCLK Input = 48Mhz CPU divider = 1 CPU frequency = 48MHz
* APBA divider = 1 APBA frequency = 48MHz
* APBB divider = 1 APBB frequency = 48MHz
* APBC divider = 1 APBC frequency = 48MHz
* APBD divider = 1 APBD frequency = 48MHz
* APBE divider = 1 APBE frequency = 48MHz
*
* The SAML21 Xplained Pro has one on-board crystal:
*
@@ -154,7 +156,6 @@
* BOARD_OSC16M_RUNINSTANDBY - Boolean (defined / not defined)
*/
#if defined(CONFIG_SAML21_XPLAINED_OSC16M_4MHZ)
# define BOARD_OSC16M_FSEL OSCCTRL_OSC16MCTRL_FSEL_4MHZ
# define BOARD_OSC16M_ONDEMAND 1
@@ -427,9 +428,10 @@
#undef BOARD_GCLK8_OUTPUT_ENABLE
#define BOARD_GCLK8_FREQUENCY (BOARD_OSC16M_FREQUENCY / BOARD_GCLK8_PRESCALER)
/* The source of the main clock is always GCLK_MAIN. Also called GCLKGEN[0], this is
* the clock feeding the Power Manager. The Power Manager, in turn, generates main
* clock which is divided down to produce the CPU, AHB, and APB clocks.
/* The source of the main clock is always GCLK_MAIN. Also called GCLKGEN[0],
* this is the clock feeding the Power Manager.
* The Power Manager, in turn, generates main clock which is divided
* down to produce the CPU, AHB, and APB clocks.
*
* The main clock is initially OSC16M divided by 8.
*/
@@ -483,13 +485,14 @@
# define BOARD_FLASH_WAITSTATES 1
#endif
/* SERCOM definitions ***************************************************************/
/* This is the source clock generator for the GCLK_SERCOM_SLOW clock that is common
* to SERCOM modules 0-4. It will generate clocking on the common SERCOM0-4
* channel.
/* SERCOM definitions *******************************************************/
/* This is the source clock generator for the GCLK_SERCOM_SLOW clock that is
* common to SERCOM modules 0-4.
* It will generate clocking on the common SERCOM0-4 channel.
*
* SERCOM5 uses a different channel and will probably need to use a different GCLK
* generator.
* SERCOM5 uses a different channel and will probably need to use a different
* GCLK generator.
*/
#define BOARD_SERCOM04_SLOW_GCLKGEN 0
@@ -593,7 +596,8 @@
#define BOARD_SERCOM5_FREQUENCY BOARD_GCLK0_FREQUENCY
/* USB definitions ******************************************************************/
/* USB definitions **********************************************************/
/* This is the source clock generator for the GCLK_USB clock
*/
@@ -606,14 +610,15 @@
#define BOARD_USB_PADCAL_N 5
#define BOARD_USB_PADCAL_TRIM 3
/* LED definitions ******************************************************************/
/* LED definitions **********************************************************/
/* There are three LEDs on board the SAML21 Xplained Pro board: The EDBG
* controls two of the LEDs, a power LED and a status LED. There is only
* one user controllable LED, a yellow LED labelled STATUS near the SAML21 USB
* connector.
* one user controllable LED, a yellow LED labelled STATUS near the SAML21
* USB connector.
*
* This LED is controlled by PC07 and the LED can be activated by driving the
* PB10 to GND.
* This LED is controlled by PC07 and the LED can be activated by driving
* the PB10 to GND.
*/
/* LED index values for use with board_userled() */
@@ -626,10 +631,11 @@
#define BOARD_STATUS LED_BIT (1 << BOARD_STATUS_LED)
/* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
* control the LED as defined below. Thus if the LED is statically on, NuttX has
* successfully booted and is, apparently, running normally. If the LED is
* flashing at approximately 2Hz, then a fatal error has been detected and the
* system has halted.
* control the LED as defined below.
* Thus if the LED is statically on, NuttX has successfully booted and is,
* apparently, running normally.
* If the LED is flashing at approximately 2Hz, then a fatal error has been
* detected and the system has halted.
*/
#define LED_STARTED 0 /* STATUS LED=OFF */
@@ -641,12 +647,14 @@
#define LED_ASSERTION 2 /* STATUS LED=no change */
#define LED_PANIC 3 /* STATUS LED=flashing */
/* Button definitions ***************************************************************/
/* Button definitions *******************************************************/
/* Mechanical buttons:
*
* The SAML21 Xplained Pro contains two mechanical buttons. One button is the
* RESET button connected to the SAML21 reset line and the other is a generic user
* configurable button. When a button is pressed it will drive the I/O line to GND.
* The SAML21 Xplained Pro contains two mechanical buttons.
* One button is the RESET button connected to the SAML21 reset line and the
* other is a generic user configurable button.
* When a button is pressed it will drive the I/O line to GND.
*
* PA02 SW0
*/
@@ -658,4 +666,4 @@
#define BUTTON_SW0_BIT (1 << BUTTON_SW0)
#endif /* __BOARDS_ARM_SAML21_XPLAINED_INCLUDE_BOARD_H */
#endif /* __BOARDS_ARM_SAMD2L2_SAML21_XPLAINED_INCLUDE_BOARD_H */
@@ -1,5 +1,5 @@
############################################################################
# boards/saml21-xplained/scripts/Make.defs
# boards/arm/samd2l2/saml21-xplained/scripts/Make.defs
#
# Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/saml21-xplained/scripts/flash.ld
* boards/arm/samd2l2/saml21-xplained/scripts/flash.ld
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -1,5 +1,5 @@
############################################################################
# boards/saml21-xplained/src/Makefile
# boards/arm/samd2l2/saml21-xplained/src/Makefile
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
@@ -1,5 +1,5 @@
/****************************************************************************
* config/saml21-xplained/src/sam_appinit.c
* boards/arm/samd2l2/saml21-xplained/src/sam_appinit.c
*
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -50,6 +50,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Some configuration checks */
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE_EXT1
@@ -70,6 +71,7 @@
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE
/* Support for the SD card slot on the I/O1 module */
/* Verify NSH PORT and SLOT settings */
# define SAMD2L2_MMCSDSLOTNO 0 /* There is only one slot */
@@ -123,15 +125,13 @@ int board_app_initialize(uintptr_t arg)
#if defined(SAMD2L2_HAVE_SPI0) && defined(CONFIG_SAML21_XPLAINED_IOMODULE)
/* Initialize the SPI-based MMC/SD slot */
{
int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n",
ret);
return ret;
}
}
int ret = sam_sdinitialize(SPI_PORTNO, CONFIG_NSH_MMCSDMINOR);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n",
ret);
return ret;
}
#endif
return OK;
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/saml21-xplained/src/sam_autoleds.c
* boards/arm/samd2l2/saml21-xplained/src/sam_autoleds.c
*
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -100,19 +100,23 @@ void board_autoled_on(int led)
switch (led)
{
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF */
/* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF */
/* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF */
break; /* Leave ledstate == true to turn OFF */
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF
* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF
* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF
*/
break; /* Leave ledstate == true to turn OFF */
default:
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C */
/* LED_SIGNAL: In a signal handler STATUS LED=N/C */
/* LED_ASSERTION: An assertion failed STATUS LED=N/C */
return; /* Return to leave STATUS LED unchanged */
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C
* LED_SIGNAL: In a signal handler STATUS LED=N/C
* LED_ASSERTION: An assertion failed STATUS LED=N/C
*/
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
return; /* Return to leave STATUS LED unchanged */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
ledstate = false; /* Set ledstate == false to turn ON */
break;
}
@@ -131,21 +135,25 @@ void board_autoled_off(int led)
/* These should not happen and are ignored */
default:
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF */
/* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF */
/* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF */
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF
* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF
* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF
*/
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
/* These result in no-change */
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C */
/* LED_SIGNAL: In a signal handler STATUS LED=N/C */
/* LED_ASSERTION: An assertion failed STATUS LED=N/C */
return; /* Return to leave STATUS LED unchanged */
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C
* LED_SIGNAL: In a signal handler STATUS LED=N/C
* LED_ASSERTION: An assertion failed STATUS LED=N/C
*/
return; /* Return to leave STATUS LED unchanged */
/* Turn STATUS LED off set driving the output high */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
sam_portwrite(PORT_STATUS_LED, true);
break;
}
@@ -1,5 +1,5 @@
/************************************************************************************
* boards/saml21-xplained/src/sam_boot.c
/****************************************************************************
* boards/arm/samd2l2/saml21-xplained/src/sam_boot.c
*
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -31,11 +31,11 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
@@ -46,31 +46,34 @@
#include "sam_config.h"
#include "saml21-xplained.h"
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Private Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: sam_boardinitialize
*
* Description:
* All SAM3U architectures must provide the following entry point. This entry point
* is called early in the initialization -- after all memory has been configured
* and mapped but before any devices have been initialized.
* All SAM3U architectures must provide the following entry point.
* This entry point is called early in the initialization -- after all
* memory has been configured and mapped but before any devices have been
* initialized.
*
************************************************************************************/
****************************************************************************/
void sam_boardinitialize(void)
{
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
/* Configure SPI chip selects if
* 1) SPI is not disabled, and
* 2) the weak function
* sam_spidev_initialize() has been brought into the link.
*/
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/saml21-xplained/src/sam_buttons.c
* boards/arm/samd2l2/saml21-xplained/src/sam_buttons.c
*
* Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -63,8 +63,8 @@
*
* Description:
* board_button_initialize() must be called to initialize button resources.
* After that, board_buttons() may be called to collect the current state of
* all buttons or board_button_irq() may be called to register button
* After that, board_buttons() may be called to collect the current state
* of all buttons or board_button_irq() may be called to register button
* interrupt handlers.
*
****************************************************************************/
@@ -74,16 +74,17 @@ void board_button_initialize(void)
(void)sam_configport(PORT_SW0);
}
/************************************************************************************
/****************************************************************************
* Name: board_buttons
*
* Description:
* After board_button_initialize() has been called, board_buttons() may be called to collect
* the state of all buttons. board_buttons() returns an 32-bit bit set with each bit
* associated with a button. See the BUTTON* definitions above for the meaning of
* After board_button_initialize() has been called,
* board_buttons() may be called to collect the state of all buttons.
* board_buttons() returns an 32-bit bit set with each bit associated
* with a button. See the BUTTON* definitions above for the meaning of
* each bit in the returned value.
*
************************************************************************************/
****************************************************************************/
uint32_t board_buttons(void)
{
@@ -1,5 +1,5 @@
/****************************************************************************
* config/saml21-xplained/src/sam_mmcsd.c
* boards/arm/samd2l2/saml21-xplained/src/sam_mmcsd.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -56,6 +56,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifdef CONFIG_DISABLE_MOUNTPOINT
@@ -84,7 +85,8 @@
* - CONFIG_SAML21_XPLAINED_IOMODULE=y,
* - CONFIG_DISABLE_MOUNTPOINT=n,
* - CONFIG_MMCSD=y, and
* - SAMD2L2_HAVE_SPI0=y (CONFIG_SAMD2L2_SERCOM0 && CONFIG_SAMD2L2_SERCOM0_ISSPI)
* - SAMD2L2_HAVE_SPI0=y
* (CONFIG_SAMD2L2_SERCOM0 && CONFIG_SAMD2L2_SERCOM0_ISSPI)
*
****************************************************************************/
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/saml21-xplained/src/sam_spi.c
* boards/arm/samd2l2/saml21-xplained/src/sam_spi.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -68,20 +68,20 @@
void weak_function sam_spidev_initialize(void)
{
/* 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 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.
*/
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE
/* TODO: enable interrupt on card detect */
sam_configport(PORT_SD_CD); /* Card detect input */
sam_configport(PORT_SD_CS); /* Chip select output */
sam_configport(PORT_SD_CD); /* Card detect input */
sam_configport(PORT_SD_CS); /* Chip select output */
#endif
#ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE
sam_configport(PORT_OLED_DATA); /* Command/data */
sam_configport(PORT_OLED_CS); /* Card detect input */
sam_configport(PORT_OLED_DATA); /* Command/data */
sam_configport(PORT_OLED_CS); /* Card detect input */
#endif
}
@@ -114,8 +114,8 @@ void weak_function sam_spidev_initialize(void)
* the way your board is configured.
* 3. Add a call to sam_spibus_initialize() in your low level application
* initialization logic
* 4. The handle returned by sam_spibus_initialize() may then be used to bind
* the SPI driver to higher level logic (e.g., calling
* 4. The handle returned by sam_spibus_initialize() may then be used to
* bind the SPI driver to higher level logic (e.g., calling
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
* the SPI MMC/SD driver).
*
@@ -1,5 +1,5 @@
/****************************************************************************
* config/saml21-xplained/src/sam_ug2832hsweg04.c
* boards/arm/samd2l2/saml21-xplained/src/sam_ug2832hsweg04.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -125,7 +125,9 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* The pin configurations here require that SPI1 is selected */
#ifndef CONFIG_LCD_SSD1306
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/saml21-xplained/src/sam_userleds.c
* boards/arm/samd2l2/saml21-xplained/src/sam_userleds.c
*
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -41,8 +41,9 @@
* to GND.
*
* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
* control the LED. Otherwise, the LED can be controlled from user applications
* using the logic in this file.
* control the LED.
* Otherwise, the LED can be controlled from user applications using the
* logic in this file.
*/
/****************************************************************************
@@ -105,7 +106,8 @@ void board_userled(int led, bool ledon)
*
* Description:
* If CONFIG_ARCH_LEDS is defined, then NuttX will control the on-board
* LEDs. If CONFIG_ARCH_LEDS is not defined, then the board_userled_all() is
* LEDs.
* If CONFIG_ARCH_LEDS is not defined, then the board_userled_all() is
* available to control the LED from user application logic. NOTE: since
* there is only a single LED on-board, this is function is not very useful.
*
@@ -1,5 +1,5 @@
/************************************************************************************
* boards/saml21-xplained/src/saml21-xplained.h
/****************************************************************************
* boards/arm/samd2l2/saml21-xplained/src/saml21-xplained.h
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -31,14 +31,14 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __BOARDS_ARM_SAML21_XPLAINED_SRC_SAML21_XPLAINED_H
#define __BOARDS_ARM_SAML21_XPLAINED_SRC_SAML21_XPLAINED_H
#ifndef __BOARDS_ARM_SAMD2L2_SAML21_XPLAINED_SRC_SAML21_XPLAINED_H
#define __BOARDS_ARM_SAMD2L2_SAML21_XPLAINED_SRC_SAML21_XPLAINED_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
@@ -51,16 +51,17 @@
#include "sam_config.h"
#include "sam_pinmap.h"
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
/* LEDs: There are three LEDs on board the SAML21 Xplained Pro board: The EDBG
* controls two of the LEDs, a power LED and a status LED. There is only
* one user controllable LED, a yellow LED labelled STATIS near the SAML21 USB
* connector.
****************************************************************************/
/* LEDs: There are three LEDs on board the SAML21 Xplained Pro board:
* The EDBG controls two of the LEDs, a power LED and a status LED.
* There is only one user controllable LED, a yellow LED labelled STATIS
* near the SAML21 USB connector.
*
* This LED is controlled by PB10 and the LED can be activated by driving PB10
* to GND.
* This LED is controlled by PB10 and the LED can be activated by driving
* PB10 to GND.
*
* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will
* control the LED as follows:
@@ -87,8 +88,9 @@
/* Mechanical buttons:
*
* The SAML21 Xplained Pro contains two mechanical buttons. One button is the
* RESET button connected to the SAML21 reset line and the other is a generic user
* configurable button. When a button is pressed it will drive the I/O line to GND.
* RESET button connected to the SAML21 reset line and the other is a generic
* user configurable button.
* When a button is pressed it will drive the I/O line to GND.
*
* PA02 SW0
*/
@@ -102,14 +104,16 @@
* SPI support and two PORTs. These the PORTs will vary if the I/O1
* is installed on the EXT1 or EXT2 connector:
*
* --- ------------------ ---------------------- -------------------------------
* --- ------------------ ---------------------- --------------------------
* PIN EXT1 EXT2 Description
* --- ------------------ ---------------------- -------------------------------
* 15 PA05 SERCOM0 PAD[1] 15 PA17 GPIO] Active low chip select OUTPUT,
* SPI SS pulled high on board.
* 10 PA02 GPIO 10 PB15 GPIO Active low card detect INPUT,
* must use internal pull-up.
* --- ------------------ ---------------------- -------------------------------
* --- ------------------ ---------------------- --------------------------
* 15 PA05 SERCOM0 PAD[1] 15 PA17 GPIO] Active low chip select
* SPI SS OUTPUT, pulled high on
* board.
* 10 PA02 GPIO 10 PB15 GPIO Active low card detect
* INPUT, must use internal
* pull-up.
* --- ------------------ ---------------------- --------------------------
*/
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE
@@ -151,19 +155,19 @@
/* OLED1
*
* Support for the microSD card slot on the I/O1 module. The I/O1 requires
* SPI support and three output PORTs. These the PORTs will vary if the OLED1
* is installed on the EXT1 or EXT2 connector:
* Support for the microSD card slot on the I/O1 module.
* The I/O1 requires SPI support and three output PORTs.
* These the PORTs will vary if the OLED1 is installed on the EXT1
* or EXT2 connector:
*
*
* --- ------------------- -------------------- -------------------------------------
* --- ------------------- -------------------- ---------------------------
* PIN EXT1 EXT2 Description
* --- ------------------- -------------------- -------------------------------------
* --- ------------------- -------------------- ---------------------------
* 5 PB06 PA02 PA20 PA02 DATA_CMD_SEL
* 10 PA02 PA02 PB15 PA02 DISPLAY_RESET. Active low.
* 15 PA05 SERCOM0 PAD[1] PA17 SERCOM1 PAD[1] DISPLAY_SS. Active low.
* SPI SS SPI SS
* --- ------------------- -------------------- -------------------------------------
* --- ------------------- -------------------- ---------------------------
*/
#ifdef CONFIG_SAML21_XPLAINED_OLED1MODULE
@@ -222,43 +226,44 @@
PORTB | PORT_PIN11) /* REVISIT */
#endif
/************************************************************************************
/****************************************************************************
* Public Types
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Public data
************************************************************************************/
****************************************************************************/
#ifndef __ASSEMBLY__
/************************************************************************************
/****************************************************************************
* Public Functions
************************************************************************************/
****************************************************************************/
/************************************************************************************
/****************************************************************************
* Name: sam_spidev_initialize
*
* Description:
* Called to configure SPI chip select PORT pins for the SAM3U-EK board.
*
************************************************************************************/
****************************************************************************/
void weak_function sam_spidev_initialize(void);
/************************************************************************************
/****************************************************************************
* Name: sam_sdinitialize
*
* Description:
* Initialize the SPI-based SD card. Requires CONFIG_SAML21_XPLAINED_IOMODULE=y,
* CONFIG_DISABLE_MOUNTPOINT=n, CONFIG_MMCSD=y, and the appropriate SERCOM SPI
* port enabled.
* Initialize the SPI-based SD card.
* Requires CONFIG_SAML21_XPLAINED_IOMODULE=y,
* CONFIG_DISABLE_MOUNTPOINT=n, CONFIG_MMCSD=y,
* and the appropriate SERCOM SPI port enabled.
*
************************************************************************************/
****************************************************************************/
#ifdef CONFIG_SAML21_XPLAINED_IOMODULE
int sam_sdinitialize(int port, int minor);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_SAML21_XPLAINED_SRC_SAML21_XPLAINED_H */
#endif /* __BOARDS_ARM_SAMD2L2_SAML21_XPLAINED_SRC_SAML21_XPLAINED_H */
+2 -2
View File
@@ -186,9 +186,9 @@ Unlocking FLASH
into NVM. See https://en.m.wikipedia.org/wiki/SREC_(file_format) for a
description of the Motorola SREC format.
I wrote a small program at boards/metro-m4-scripts/nvm.c that will
I wrote a small program at boards/arm/samd5e5/metro-m4-scripts/nvm.c that will
generate this Motorola SREC file with the correct checksum. The file at
boards/metro-m4-scripts/nvm.c is the output of that program.
boards/arm/samd5e5/metro-m4-scripts/nvm.c is the output of that program.
J-Link>mem8 804000,10
00804000 = 39 92 9A F6 80 FF EC AE FF FF FF FF FF FF FF FF
+36 -28
View File
@@ -1,5 +1,5 @@
/************************************************************************************
* boards/metro-m4/include/board.h
/****************************************************************************
* boards/arm/samd5e5/metro-m4/include/board.h
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -31,20 +31,20 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
****************************************************************************/
#ifndef __BOARDS_ARM_METRO_M4_INCLUDE_BOARD_H
#define __BOARDS_ARM_METRO_M4_INCLUDE_BOARD_H
#ifndef __BOARDS_ARM_SAMD5E5_METRO_M4_INCLUDE_BOARD_H
#define __BOARDS_ARM_SAMD5E5_METRO_M4_INCLUDE_BOARD_H
/************************************************************************************
/****************************************************************************
* Included Files
************************************************************************************/
****************************************************************************/
#include <nuttx/config.h>
/************************************************************************************
/****************************************************************************
* Pre-processor Definitions
************************************************************************************/
****************************************************************************/
#ifndef TRUE
# define TRUE 1
@@ -54,17 +54,19 @@
# define FALSE 0
#endif
/* Clocking *************************************************************************/
/* Clocking *****************************************************************/
/* Overview
*
* Per the schematic Adafruit Metro M4 Pro has one on-board crystal:
*
* X4 32.768KHz XOSC32
*
* However, I have been unsuccessful using it and have fallen back to using OSCULP32K
* (Unless CONFIG_METRO_M4_32KHZXTAL=y)
* However, I have been unsuccessful using it and have fallen back to using
* OSCULP32K(Unless CONFIG_METRO_M4_32KHZXTAL=y)
*
* Since there is no high speed crystal, we will run from the OSC16M clock source.
* Since there is no high speed crystal, we will run from the OSC16M clock
* source.
*
* OSC48M Output = 48Mhz
* |
@@ -360,8 +362,10 @@
#define BOARD_FLASH_WAITSTATES 6
/* LED definitions ******************************************************************/
/* The Adafruit Metro M4 has four LEDs, but only two are controllable by software:
/* LED definitions **********************************************************/
/* The Adafruit Metro M4 has four LEDs, but only two are controllable by
* software:
*
* 1. The red LED on the Arduino D13 pin, and
* 2. A NeoPixel RGB LED.
@@ -390,7 +394,8 @@
*
* ------------------- ---------------------------- ------
* SYMBOL Meaning LED
* ------------------- ---------------------------- ------ */
* ------------------- ---------------------------- ------
*/
#define LED_STARTED 0 /* NuttX has been started OFF */
#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF */
@@ -407,17 +412,19 @@
* 2Hz, then a fatal error has been detected and the system has halted.
*/
/* Alternate function pin selections ************************************************/
/* Alternate function pin selections ****************************************/
/* SERCOM definitions ***************************************************************/
/* The SERCOM bus clock (CLK_SERCOMx_APB) can be enabled and disabled in the Main
* Clock Controller. The SERCOM uses two generic clocks: GCLK_SERCOMn_CORE and
* GCLK_SERCOM_SLOW. The core clock (GCLK_SERCOMx_CORE) is required to clock the
* SERCOM while working as a master. The slow clock (GCLK_SERCOM_SLOW) is only
* required for certain functions and is common to all SERCOM modules.
/* SERCOM definitions *******************************************************/
/* The SERCOM bus clock (CLK_SERCOMx_APB) can be enabled and disabled in the
* Main Clock Controller.
* The SERCOM uses two generic clocks: GCLK_SERCOMn_CORE and GCLK_SERCOM_SLOW.
* The core clock (GCLK_SERCOMx_CORE) is required to clock the SERCOM while
* working as a master. The slow clock (GCLK_SERCOM_SLOW) is only required
* for certain functions and is common to all SERCOM modules.
*
* These clocks must be configured and enabled in the Generic Clock Controller (GCLK)
* before using the SERCOM.
* These clocks must be configured and enabled in the Generic Clock
* Controller (GCLK) before using the SERCOM.
*/
#define BOARD_SERCOM_SLOWGEN 3 /* 32.768KHz, common to all SERCOMS */
@@ -426,8 +433,9 @@
/* SERCOM3
*
* An Arduino compatible serial Shield is assumed (or equivalently, an external
* RS-232 or serial-to-USB adapter connected on Arduino pins D0 and D1):
* An Arduino compatible serial Shield is assumed (or equivalently, an
* external RS-232 or serial-to-USB adapter connected on Arduino pins D0
* and D1):
*
* ------ ----------------- ---------
* SHIELD SAMD5E5 FUNCTION
@@ -457,4 +465,4 @@
#define BOARD_USB_GCLKGEN 1 /* GCLK1, 48MHz */
#endif /* __BOARDS_ARM_METRO_M4_INCLUDE_BOARD_H */
#endif /* __BOARDS_ARM_SAMD5E5_METRO_M4_INCLUDE_BOARD_H */
@@ -1,5 +1,5 @@
############################################################################
# boards/metro-m4/scripts/Make.defs
# boards/arm/samd5e5/metro-m4/scripts/Make.defs
#
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
+1 -1
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/metro-m4/scripts/flash.ld
* boards/arm/samd5e5/metro-m4/scripts/flash.ld
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
+1 -1
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/metro-m4/scripts/sram.ld
* boards/arm/samd5e5/metro-m4/scripts/sram.ld
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
+1 -1
View File
@@ -1,5 +1,5 @@
############################################################################
# boards/metro-m4/src/Makefile
# boards/arm/samd5e5/metro-m4/src/Makefile
#
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
+7 -6
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/metro-m4/src/metro-m4.h
* boards/arm/samd5e5/metro-m4/src/metro-m4.h
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -33,8 +33,8 @@
*
****************************************************************************/
#ifndef __BOARDS_ARM_METRO_M4_SRC_METRO_M4_H
#define __BOARDS_ARM_METRO_M4_SRC_METRO_M4_H
#ifndef __BOARDS_ARM_SAMD5E5_METRO_M4_SRC_METRO_M4_H
#define __BOARDS_ARM_SAMD5E5_METRO_M4_SRC_METRO_M4_H
/****************************************************************************
* Included Files
@@ -50,11 +50,12 @@
/* Configuration ************************************************************/
/* Metro-M4 GPIOs ***********************************************************/
/* LEDs
*
* The Adafruit Metro M4 has four LEDs, but only two are controllable by software:
* The Adafruit Metro M4 has four LEDs, but only two are controllable by
* software:
*
* 1. The red LED on the Arduino D13 pin, and
* 2. A NeoPixel RGB LED.
@@ -113,4 +114,4 @@ void sam_led_pminitialize(void);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_METRO_M4_SRC_METRO_M4_H */
#endif /* __BOARDS_ARM_SAMD5E5_METRO_M4_SRC_METRO_M4_H */
@@ -1,5 +1,5 @@
/****************************************************************************
* config/metro-m4/src/sam_appinit.c
* boards/arm/samd5e5/metro-m4/src/sam_appinit.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
+31 -27
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/metro-m4/src/sam_autoleds.c
* boards/arm/samd5e5/metro-m4/src/sam_autoleds.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@@ -33,7 +33,8 @@
*
****************************************************************************/
/* The Adafruit Metro M4 has four LEDs, but only two are controllable by software:
/* The Adafruit Metro M4 has four LEDs, but only two are controllable by
* software:
*
* 1. The red LED on the Arduino D13 pin, and
* 2. A NeoPixel RGB LED.
@@ -95,7 +96,7 @@
* Private Function Prototypes
****************************************************************************/
/* LED Power Management */
/* LED Power Management */
#ifdef CONFIG_PM
static void led_pm_notify(struct pm_callback_s *cb, int domain,
@@ -138,35 +139,30 @@ static void led_pm_notify(struct pm_callback_s *cb, int domain,
case(PM_NORMAL):
{
/* Restore normal LEDs operation */
}
break;
case(PM_IDLE):
{
/* Entering IDLE mode - Turn leds off */
}
break;
case(PM_STANDBY):
{
/* Entering STANDBY mode - Logic for PM_STANDBY goes here */
}
break;
case(PM_SLEEP):
{
/* Entering SLEEP mode - Logic for PM_SLEEP goes here */
}
break;
default:
{
/* Should not get here */
}
break;
}
@@ -220,19 +216,23 @@ void board_autoled_on(int led)
switch (led)
{
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF */
/* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF */
/* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF */
break; /* Leave ledstate == true to turn OFF */
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF
* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF
* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF
*/
break; /* Leave ledstate == true to turn OFF */
default:
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C */
/* LED_SIGNAL: In a signal handler STATUS LED=N/C */
/* LED_ASSERTION: An assertion failed STATUS LED=N/C */
return; /* Return to leave STATUS LED unchanged */
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C
* LED_SIGNAL: In a signal handler STATUS LED=N/C
* LED_ASSERTION: An assertion failed STATUS LED=N/C
*/
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
return; /* Return to leave STATUS LED unchanged */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
ledstate = false; /* Set ledstate == false to turn ON */
break;
}
@@ -251,21 +251,25 @@ void board_autoled_off(int led)
/* These should not happen and are ignored */
default:
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF */
/* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF */
/* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF */
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
case 0: /* LED_STARTED: NuttX has been started STATUS LED=OFF
* LED_HEAPALLOCATE: Heap has been allocated STATUS LED=OFF
* LED_IRQSENABLED: Interrupts enabled STATUS LED=OFF
*/
case 1: /* LED_STACKCREATED: Idle stack created STATUS LED=ON */
/* These result in no-change */
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C */
/* LED_SIGNAL: In a signal handler STATUS LED=N/C */
/* LED_ASSERTION: An assertion failed STATUS LED=N/C */
return; /* Return to leave STATUS LED unchanged */
case 2: /* LED_INIRQ: In an interrupt STATUS LED=N/C
* LED_SIGNAL: In a signal handler STATUS LED=N/C
* LED_ASSERTION: An assertion failed STATUS LED=N/C
*/
return; /* Return to leave STATUS LED unchanged */
/* Turn STATUS LED off set driving the output high */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
case 3: /* LED_PANIC: The system has crashed STATUS LED=FLASH */
sam_portwrite(PORT_RED_LED, true);
break;
}
+1 -1
View File
@@ -1,5 +1,5 @@
/****************************************************************************
* boards/metro-m4/src/sam_boot.c
* boards/arm/samd5e5/metro-m4/src/sam_boot.c
*
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>

Some files were not shown because too many files have changed in this diff Show More