diff --git a/boards/arm/sam34/arduino-due/include/board.h b/boards/arm/sam34/arduino-due/include/board.h index d009b9283d..6f71b04f47 100644 --- a/boards/arm/sam34/arduino-due/include/board.h +++ b/boards/arm/sam34/arduino-due/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/arduino-due/include/board.h +/**************************************************************************** + * boards/arm/sam34/arduino-due/include/board.h * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_ARDUINO_DUE_INCLUDE_BOARD_H -#define __BOARDS_ARM_ARDUINO_DUE_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_SAM34_ARDUINO_DUE_INCLUDE_BOARD_H +#define __BOARDS_ARM_SAM34_ARDUINO_DUE_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -50,18 +50,19 @@ # endif #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAM3X device is running on a 4MHz internal RC. These - * definitions will configure clocking +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAM3X device is running on a 4MHz internal RC. + * These definitions will configure clocking * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Divider = 1, Multiplier = 14 to generate PLLACK = 168MHz - * Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 84MHz - * CPU clock: 84MHz + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Divider = 1, Multiplier = 14 to generate PLLACK = 168MHz + * Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 84MHz + * CPU clock: 84MHz */ #define BOARD_32KOSC_FREQUENCY (32768) @@ -107,8 +108,8 @@ /* HSMCI clocking * - * Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock (MCK) - * divided by (2*(CLKDIV+1)). + * Multimedia Card Interface clock (MCCK or MCI_CK) is Master Clock + * (MCK) divided by (2*(CLKDIV+1)). * * MCI_SPEED = MCCK / (2*(CLKDIV+1)) * CLKDIV = MCCK / MCI_SPEED / 2 - 1 @@ -116,7 +117,9 @@ * Where CLKDIV has a range of 0-255. */ -/* MCK = 84MHz, CLKDIV = 104, MCI_SPEED = 84MHz / 2 * (104+1) = 400 KHz */ +/* MCK = 84MHz, CLKDIV = 104, + * MCI_SPEED = 84MHz / 2 * (104+1) = 400 KHz + */ #define HSMCI_INIT_CLKDIV (104 << HSMCI_MR_CLKDIV_SHIFT) @@ -143,7 +146,8 @@ #define BOARD_FWS 4 -/* LED definitions ******************************************************************/ +/* LED definitions **********************************************************/ + /* There are three user-controllable LEDs on board the Arduino Due board: * * LED GPIO @@ -178,7 +182,9 @@ * * SYMBOL MEANING LED STATE * L TX RX - * ----------------------- -------------------------- -------- -------- -------- */ + * ----------------------- -------------------------- -------- -------- -------- + */ + #define LED_STARTED 0 /* NuttX has been started OFF OFF OFF */ #define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF OFF */ #define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF OFF */ @@ -195,15 +201,18 @@ * at approximately 2Hz, then a fatal error has been detected and the system */ -/* Button definitions ***************************************************************/ -/* There are no buttons on the Arduino Due board. */ +/* Button definitions *******************************************************/ -/* GPIO pin configurations **********************************************************/ +/* There are no buttons on the Arduino Due board. */ + +/* GPIO pin configurations **************************************************/ #if 1 /* #ifdef CONFIG_ARDUINO_DUE_REV3 works with REV2 as well */ -/* This port was performed on the Arduino Due Rev 2 board. A NuttX user reported - * issues with the serial port on his Aduino Due Rev 3 board. That problem was - * resolved as follows: + +/* This port was performed on the Arduino Due Rev 2 board. + * A NuttX user reported issues with the serial port on his Aduino Due Rev 3 + * board. + * That problem was resolved as follows: * * "... The issue was in my hardware. I found the difference between Arduino * Due shematics (revision R2) and actual PCB layout of my Arduino (revision @@ -223,5 +232,4 @@ # define GPIO_UART0_RXD (GPIO_PERIPHA | GPIO_CFG_DEFAULT | GPIO_PORT_PIOA | \ GPIO_PIN8 | GPIO_CFG_PULLUP) #endif - -#endif /* __BOARDS_ARM_ARDUINO_DUE_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_SAM34_ARDUINO_DUE_INCLUDE_BOARD_H */ diff --git a/boards/arm/sam34/arduino-due/scripts/Make.defs b/boards/arm/sam34/arduino-due/scripts/Make.defs index 7dd1c55942..4e3138c92b 100644 --- a/boards/arm/sam34/arduino-due/scripts/Make.defs +++ b/boards/arm/sam34/arduino-due/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/arduino-due/scripts/Make.defs +# boards/arm/sam34/arduino-due/scripts/Make.defs # # Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/arduino-due/scripts/arduino-due.ld b/boards/arm/sam34/arduino-due/scripts/arduino-due.ld index fab973da79..cefc3d9aa2 100644 --- a/boards/arm/sam34/arduino-due/scripts/arduino-due.ld +++ b/boards/arm/sam34/arduino-due/scripts/arduino-due.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arduino-due/scripts/arduino-due.ld + * boards/arm/sam34/arduino-due/scripts/arduino-due.ld * * Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/arduino-due/src/Makefile b/boards/arm/sam34/arduino-due/src/Makefile index 1c6677f670..3a5cb9bc7d 100644 --- a/boards/arm/sam34/arduino-due/src/Makefile +++ b/boards/arm/sam34/arduino-due/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/arduino-due/src/Makefile +# boards/arm/sam34/arduino-due/src/Makefile # # Copyright (C) 2013, 2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/arduino-due/src/arduino-due.h b/boards/arm/sam34/arduino-due/src/arduino-due.h index 0933527266..addccf8813 100644 --- a/boards/arm/sam34/arduino-due/src/arduino-due.h +++ b/boards/arm/sam34/arduino-due/src/arduino-due.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/arduino-due/src/arduino-due.h +/**************************************************************************** + * boards/arm/sam34/arduino-due/src/arduino-due.h * * Copyright (C) 2013, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_ARDUINO_DUE_SRC_ARDUNO_DUE_H -#define __BOARDS_ARM_ARDUINO_DUE_SRC_ARDUNO_DUE_H +#ifndef __BOARDS_ARM_SAM34_ARDUINO_DUE_SRC_ARDUNO_DUE_H +#define __BOARDS_ARM_SAM34_ARDUINO_DUE_SRC_ARDUNO_DUE_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -50,9 +50,10 @@ #include "hardware/sam_pinmap.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + /* There are three user-controllable LEDs on board the Arduino Due board: * * LED GPIO @@ -113,10 +114,10 @@ * The Arduino 2.4" TFT Touch shield uses the S6D1121 controller , it * supports 8-bit data interface. The touch IC is TSC2046. * - * ---------- --------------------------- ----------- --------------------------- ------------------ + * ---------- --------------------------- ----------- --------------------------- --- * Arduino ATSAM3X Due ITHEAD * Due PIN GPIO FUNCTION SIGNAL PIN SIGNAL NOTES - * ---------- ---- ---------------------- ----------- ---------------- ---------- ------------------ + * ---------- ---- ---------------------- ----------- ---------------- ---------- --- * PWMH * 10 SCL1 PA18 TWCK0/A20/WKUP9 SCL1 --- --- --- SCL not available * 9 SDA1 PA17 TWD0SPCK0 SDA1 --- --- --- SDA not available @@ -138,7 +139,7 @@ * 3 PWM2 PB25 RTS0/TIOA0 PWM2 J3 pin 3 D2 DB10 --- * 2 PWM1 PA9 UTXD/PWMH3 TX J3 pin 2 D1 DB9 UART0 TX * 1 PWM0 PA8 URXD/PWMH0/WKUP4 RX J3 pin 1 D0 DB8 UART0 RX - * ---------- ---- ---------------------- ----------- ---------------- ---------- ------------------ + * ---------- ---- ---------------------- ----------- ---------------- ---------- --- * POWER * 1 --- --- --- --- --- --- --- --- * 2 IOref --- --- IOREF +3V3 --- --- --- --- @@ -157,7 +158,7 @@ * 6 A5 PA4 TCLK1/NWAIT/AD2 AD5 J1 pin 1 A5/D19 TFT_RS --- * 7 A6 PA3 TIOB1/PWMFI1/AD1/WKUP1 AD6 --- --- --- --- * 8 A7 PA2 TIOA1/NANDRDY/AD0 AD7 --- --- --- --- - * ---------- ---- ---------------------- ----------- ---------------- ---------- ------------------ + * ---------- ---- ---------------------- ----------- ---------------- ---------- --- * * NOTES: * @@ -294,21 +295,21 @@ # endif #endif -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_bringup * * Description: @@ -320,39 +321,41 @@ * CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y : * Called from the NSH library * - ************************************************************************************/ + ****************************************************************************/ int sam_bringup(void); -/************************************************************************************ +/**************************************************************************** * Name: sam_sdinitialize * * Description: * Initialize the SPI-based SD card. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ defined(CONFIG_MMCSD_SPI) int sam_sdinitialize(int minor); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_tsc_setup * * Description: - * This function is called by board-bringup logic to configure the touchscreen - * device. This function will register the driver as /dev/inputN where N is the + * This function is called by board-bringup logic to configure the + * touchscreen device. + * This function will register the driver as /dev/inputN where N is the * minor device number. * * Input Parameters: * minor - The input device minor number * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to - * indicate the nature of the failure. + * Zero is returned on success. + * Otherwise, a negated errno value is returned to indicate the nature + * of the failure. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ defined(CONFIG_INPUT_ADS7843E) @@ -360,5 +363,4 @@ int sam_tsc_setup(int minor); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_ARDUINO_DUE_SRC_ARDUNO_DUE_H */ - +#endif /* __BOARDS_ARM_SAM34_ARDUINO_DUE_SRC_ARDUNO_DUE_H */ diff --git a/boards/arm/sam34/arduino-due/src/sam_appinit.c b/boards/arm/sam34/arduino-due/src/sam_appinit.c index c8fcce63c1..ebb99957af 100644 --- a/boards/arm/sam34/arduino-due/src/sam_appinit.c +++ b/boards/arm/sam34/arduino-due/src/sam_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/arduino-due/src/sam_appinit.c + * boards/arm/sam34/arduino-due/src/sam_appinit.c * * Copyright (C) 2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/arduino-due/src/sam_autoleds.c b/boards/arm/sam34/arduino-due/src/sam_autoleds.c index bed96e1281..b32ff4da7f 100644 --- a/boards/arm/sam34/arduino-due/src/sam_autoleds.c +++ b/boards/arm/sam34/arduino-due/src/sam_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arduino-due/src/sam_autoleds.c + * boards/arm/sam34/arduino-due/src/sam_autoleds.c * * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/arduino-due/src/sam_boot.c b/boards/arm/sam34/arduino-due/src/sam_boot.c index 8e588c2b32..b7ecf41c34 100644 --- a/boards/arm/sam34/arduino-due/src/sam_boot.c +++ b/boards/arm/sam34/arduino-due/src/sam_boot.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arduino-due/src/sam_boot.c + * boards/arm/sam34/arduino-due/src/sam_boot.c * * Copyright (C) 2013, 2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/arduino-due/src/sam_bringup.c b/boards/arm/sam34/arduino-due/src/sam_bringup.c index b6d18176dc..23d29af207 100644 --- a/boards/arm/sam34/arduino-due/src/sam_bringup.c +++ b/boards/arm/sam34/arduino-due/src/sam_bringup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/arduino-due/src/sam_bringup.c + * boards/arm/sam34/arduino-due/src/sam_bringup.c * * Copyright (C) 2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -53,7 +53,9 @@ #if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ defined(CONFIG_MMCSD_SPI) + /* Support for the SD card slot on the ITEAD TFT shield */ + /* Verify NSH PORT and SLOT settings */ # define SAM34_MMCSDSLOTNO 0 /* There is only one slot */ @@ -92,30 +94,30 @@ int sam_bringup(void) int ret; #ifdef CONFIG_FS_PROCFS + /* Mount the procfs file system */ ret = mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { - syslog(LOG_ERR,"ERROR: Failed to mount procfs at /proc: %d\n", + syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); } #endif #if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ defined(CONFIG_MMCSD_SPI) + /* Initialize the SPI-based MMC/SD slot */ - { - int ret = sam_sdinitialize(CONFIG_NSH_MMCSDMINOR); - if (ret < 0) - { - syslog(LOG_ERR, - "board_app_initialize: Failed to initialize MMC/SD slot: %d\n", - ret); - return ret; - } - } + int ret = sam_sdinitialize(CONFIG_NSH_MMCSDMINOR); + if (ret < 0) + { + syslog(LOG_ERR, + "board_app_initialize: Failed to initialize MMC/SD slot: %d\n", + ret); + return ret; + } #endif #if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ diff --git a/boards/arm/sam34/arduino-due/src/sam_mmcsd.c b/boards/arm/sam34/arduino-due/src/sam_mmcsd.c index 02332660df..c88a9d446a 100644 --- a/boards/arm/sam34/arduino-due/src/sam_mmcsd.c +++ b/boards/arm/sam34/arduino-due/src/sam_mmcsd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam3u-ek/src/up_mmcsd.c + * boards/arm/sam34/arduino-due/src/up_mmcsd.c * * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -53,8 +53,8 @@ #include "arduino-due.h" -/* In order to use the SD card on the ITEAD shield, you must enable the SPI bit-bang - * driver as well as support for SPI-based MMC/SD cards. +/* In order to use the SD card on the ITEAD shield, you must enable the SPI + * bit-bang driver as well as support for SPI-based MMC/SD cards. */ #if defined(CONFIG_ARDUINO_ITHEAD_TFT) && defined(CONFIG_SPI_BITBANG) && \ @@ -63,6 +63,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifdef CONFIG_DISABLE_MOUNTPOINT @@ -120,6 +121,7 @@ static int spi_cmddata(FAR struct spi_bitbang_s *priv, uint32_t devid, /**************************************************************************** * Private Functions ****************************************************************************/ + /**************************************************************************** * Include the bit-band skeleton logic ****************************************************************************/ diff --git a/boards/arm/sam34/arduino-due/src/sam_touchscreen.c b/boards/arm/sam34/arduino-due/src/sam_touchscreen.c index 71bd3580c0..506bfaa092 100644 --- a/boards/arm/sam34/arduino-due/src/sam_touchscreen.c +++ b/boards/arm/sam34/arduino-due/src/sam_touchscreen.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam3u-ek/src/up_touchscreen.c +/**************************************************************************** + * boards/arm/sam34/arduino-due/src/up_touchscreen.c * * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Included Files @@ -68,6 +68,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifndef CONFIG_SAM34_GPIOC_IRQ @@ -119,6 +120,7 @@ /**************************************************************************** * Private Function Prototypes ****************************************************************************/ + /* Lower-half SPI */ static void spi_select(FAR struct spi_bitbang_s *priv, uint32_t devid, @@ -383,7 +385,9 @@ int sam_tsc_setup(int minor) if (ret < 0) { ierr("ERROR: Failed to register touchscreen device\n"); + /* up_spiuninitialize(dev); */ + return -ENODEV; } diff --git a/boards/arm/sam34/arduino-due/src/sam_userleds.c b/boards/arm/sam34/arduino-due/src/sam_userleds.c index 1a7b0e060a..f9cee77eae 100644 --- a/boards/arm/sam34/arduino-due/src/sam_userleds.c +++ b/boards/arm/sam34/arduino-due/src/sam_userleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/arduino-due/src/sam_userleds.c + * boards/arm/sam34/arduino-due/src/sam_userleds.c * * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/flipnclick-sam3x/include/board.h b/boards/arm/sam34/flipnclick-sam3x/include/board.h index 96ae083f2f..c8c6e1904f 100644 --- a/boards/arm/sam34/flipnclick-sam3x/include/board.h +++ b/boards/arm/sam34/flipnclick-sam3x/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/flipnclick-sam3x/include/board.h +/**************************************************************************** + * boards/arm/sam34/flipnclick-sam3x/include/board.h * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_FLIPNCLICK_SAM3X_INCLUDE_BOARD_H -#define __BOARDS_ARM_FLIPNCLICK_SAM3X_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_SAM34_FLIPNCLICK_SAM3X_INCLUDE_BOARD_H +#define __BOARDS_ARM_SAM34_FLIPNCLICK_SAM3X_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -50,18 +50,19 @@ # endif #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAM3X device is running on a 4MHz internal RC. These - * definitions will configure clocking +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAM3X device is running on a 4MHz internal RC. + * These definitions will configure clocking * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Divider = 1, Multiplier = 14 to generate PLLACK = 168MHz - * Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 84MHz - * CPU clock: 84MHz + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Divider = 1, Multiplier = 14 to generate PLLACK = 168MHz + * Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 84MHz + * CPU clock: 84MHz */ #define BOARD_32KOSC_FREQUENCY (32768) @@ -143,7 +144,8 @@ #define BOARD_FWS 4 -/* LED definitions ******************************************************************/ +/* LED definitions **********************************************************/ + /* There are four LEDs on the top, blue side of the board. Only one can be * controlled by software: * @@ -194,13 +196,16 @@ #endif /* These LEDs are available to the application and are all available to the - * application unless CONFIG_ARCH_LEDS is defined. In that case, the usage by the - * board port is defined in include/board.h and src/sam_autoleds.c. The LEDs are - * used to encode OS-related events as follows: + * application unless CONFIG_ARCH_LEDS is defined. + * In that case, the usage by the board port is defined in include/board.h + * and src/sam_autoleds.c. + * The LEDs are used to encode OS-related events as follows: * * SYMBOL MEANING LED STATE * L A B C D - * ---------------- ----------------------- --- --- --- --- ---*/ + * ---------------- ----------------------- --- --- --- --- --- + */ + #define LED_STARTED 0 /* NuttX has been started OFF ON OFF OFF OFF */ #define LED_HEAPALLOCATE 1 /* Heap has been allocated OFF OFF ON OFF OFF */ #define LED_IRQSENABLED 2 /* Interrupts enabled OFF OFF OFF ON OFF */ @@ -211,46 +216,53 @@ #define LED_PANIC 4 /* The system has crashed 2Hz N/C N/C N/C N/C */ #undef LED_IDLE /* MCU is is sleep mode ---- Not used ----- */ -/* Thus if LED L is faintly glowing and all other LEDs are off (except LED D which - * was left on but is no longer controlled by NuttX and so may be in any state), - * NuttX has successfully booted and is, apparently, running normally and taking - * interrupts. If any of LEDs A-D are statically set, then NuttX failed to boot - * and the LED indicates the initialization phase where the failure occurred. If - * LED L is flashing at approximately 2Hz, then a fatal error has been detected and - * the system has halted. +/* Thus if LED L is faintly glowing and all other LEDs are off + * (except LED D which was left on but is no longer controlled by NuttX and + * so may be in any state), + * NuttX has successfully booted and is, apparently, running normally and + * taking interrupts. + * If any of LEDs A-D are statically set, then NuttX failed to boot and the + * LED indicates the initialization phase where the failure occurred. + * If LED L is flashing at approximately 2Hz, then a fatal error has been + * detected and the system has halted. * * NOTE: After booting, LEDs A-D are no longer used by the system and may be * controlled the application. */ -/* Button definitions ***************************************************************/ +/* Button definitions *******************************************************/ + /* There are no buttons on the Arduino Due board. */ -/* GPIO pin configurations **********************************************************/ +/* GPIO pin configurations **************************************************/ + /* Universal Asynchronous Receiver Transceiver (UART) * * The SAM3X has a UART and 4 USARTS. The Programming port uses a USB-to- - * serial chip connected to the first of the MCU (RX0 and TX0 on PA8 and PA9, - * respectively). The output from that port is visible using the Arduino tool. + * serial chip connected to the first of the MCU (RX0 and TX0 on PA8 and + * PA9, respectively). + * The output from that port is visible using the Arduino tool. * - * Any of UART and USART0-3 may be used as a serial console. By default, - * UART0 is used as the serial console in all configurations. + * Any of UART and USART0-3 may be used as a serial console. + * By default, UART0 is used as the serial console in all configurations. * * There are no alternatives for these pins. */ /* Universal Synchronous Asynchronous Receiver Transmitter (USART) * - * The RX and TX pins are available on the Arduino connector D0 and D1 pins, - * respectively. These are connected to USART0, RXD0 and TXD0 which are PA10 - * and PA11, respectively. + * The RX and TX pins are available on the Arduino connector D0 and D1 + * pins, respectively. + * These are connected to USART0, RXD0 and TXD0 which are PA10 and PA11, + * respectively. * - * There are four Click bus connectors with serial ports available as follows: + * There are four Click bus connectors with serial ports available as + * follows: * - * Click A: USART0 RXD0 and TXD0 which are, again, PA10 and PA11. - * Click B: USART1 RXD1 and TXD1 which are PA12 and PA13, respectively. - * Click C: USART3 RXD3 and TXD3 which are PD5 and PD4, respectively. - * Click D: USART3 RXD3 and TXD3 which are, again, PD5 and PD4. + * Click A: USART0 RXD0 and TXD0 which are, again, PA10 and PA11. + * Click B: USART1 RXD1 and TXD1 which are PA12 and PA13, respectively. + * Click C: USART3 RXD3 and TXD3 which are PD5 and PD4, respectively. + * Click D: USART3 RXD3 and TXD3 which are, again, PD5 and PD4. * * There are no alternatives for these pins. */ @@ -288,7 +300,7 @@ * MOSI SPI0_MOSI PA26 MOSI SPI0_MOSI PA26 * * Chip select pin definitions are provided in - * boards/flipnclick-sam3x/src/flipnclick-3x.h. + * boards/arm/sam34/flipnclick-sam3x/src/flipnclick-3x.h. * * There are no alternative pin selections for SPI0_MISO and SPIO_MOSI. */ @@ -324,4 +336,4 @@ * There are no alternative pin selections for TWI0 and TWI1. */ -#endif /* __BOARDS_ARM_FLIPNCLICK_SAM3X_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_SAM34_FLIPNCLICK_SAM3X_INCLUDE_BOARD_H */ diff --git a/boards/arm/sam34/flipnclick-sam3x/scripts/Make.defs b/boards/arm/sam34/flipnclick-sam3x/scripts/Make.defs index 52334a1f7b..dfd755a15e 100644 --- a/boards/arm/sam34/flipnclick-sam3x/scripts/Make.defs +++ b/boards/arm/sam34/flipnclick-sam3x/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/flipnclick-sam3x/scripts/Make.defs +# boards/arm/sam34/flipnclick-sam3x/scripts/Make.defs # # Copyright (C) 2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/flipnclick-sam3x/scripts/flash.ld b/boards/arm/sam34/flipnclick-sam3x/scripts/flash.ld index 2d80c6e441..2095c0dbe9 100644 --- a/boards/arm/sam34/flipnclick-sam3x/scripts/flash.ld +++ b/boards/arm/sam34/flipnclick-sam3x/scripts/flash.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/flipnclick-sam3x/scripts/flash.ld + * boards/arm/sam34/flipnclick-sam3x/scripts/flash.ld * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/flipnclick-sam3x/src/Makefile b/boards/arm/sam34/flipnclick-sam3x/src/Makefile index 2db639cc81..c3331418b3 100644 --- a/boards/arm/sam34/flipnclick-sam3x/src/Makefile +++ b/boards/arm/sam34/flipnclick-sam3x/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/flipnclick-sam3x/src/Makefile +# boards/arm/sam34/flipnclick-sam3x/src/Makefile # # Copyright (C) 2018 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/flipnclick-sam3x/src/flipnclick-sam3x.h b/boards/arm/sam34/flipnclick-sam3x/src/flipnclick-sam3x.h index c46b289f94..e336aee6f4 100644 --- a/boards/arm/sam34/flipnclick-sam3x/src/flipnclick-sam3x.h +++ b/boards/arm/sam34/flipnclick-sam3x/src/flipnclick-sam3x.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/flipnclick-sam3x/src/flipnclick-sam3x.h +/**************************************************************************** + * boards/arm/sam34/flipnclick-sam3x/src/flipnclick-sam3x.h * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_FLIPNCLICK_SAM3X_SRC_FLIPNCLICK_SAM3X_H -#define __BOARDS_ARM_FLIPNCLICK_SAM3X_SRC_FLIPNCLICK_SAM3X_H +#ifndef __BOARDS_ARM_SAM34_FLIPNCLICK_SAM3X_SRC_FLIPNCLICK_SAM3X_H +#define __BOARDS_ARM_SAM34_FLIPNCLICK_SAM3X_SRC_FLIPNCLICK_SAM3X_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -50,9 +50,10 @@ #include "hardware/sam_pinmap.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + /* Configuration ************************************************************/ #define HAVE_SSD1306 1 @@ -230,19 +231,19 @@ GPIO_PORT_PIOD | GPIO_PIN6) #endif -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Name: sam_bringup @@ -276,5 +277,4 @@ FAR struct lcd_dev_s *sam_graphics_setup(unsigned int devno); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_FLIPNCLICK_SAM3X_SRC_FLIPNCLICK_SAM3X_H */ - +#endif /* __BOARDS_ARM_SAM34_FLIPNCLICK_SAM3X_SRC_FLIPNCLICK_SAM3X_H */ diff --git a/boards/arm/sam34/flipnclick-sam3x/src/sam_appinit.c b/boards/arm/sam34/flipnclick-sam3x/src/sam_appinit.c index bba05ae7d6..fd91fc5d3c 100644 --- a/boards/arm/sam34/flipnclick-sam3x/src/sam_appinit.c +++ b/boards/arm/sam34/flipnclick-sam3x/src/sam_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/flipnclick-sam3x/src/sam_appinit.c + * boards/arm/sam34/flipnclick-sam3x/src/sam_appinit.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -83,10 +83,12 @@ int board_app_initialize(uintptr_t arg) { #ifdef CONFIG_BOARD_LATE_INITIALIZE + /* Board initialization already performed by board_late_initialize() */ return OK; #else + /* Perform board-specific initialization */ return sam_bringup(); diff --git a/boards/arm/sam34/flipnclick-sam3x/src/sam_autoleds.c b/boards/arm/sam34/flipnclick-sam3x/src/sam_autoleds.c index b809d3149f..403eef9b9a 100644 --- a/boards/arm/sam34/flipnclick-sam3x/src/sam_autoleds.c +++ b/boards/arm/sam34/flipnclick-sam3x/src/sam_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/flipnclick-sam3x/src/sam_autoleds.c + * boards/arm/sam34/flipnclick-sam3x/src/sam_autoleds.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,8 +32,9 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ -/* There are four LEDs on the top, blue side of the board. Only one can be - * controlled by software: + +/* There are four LEDs on the top, blue side of the board. + * Only one can be controlled by software: * * LED L - PB27 (PWM13) * diff --git a/boards/arm/sam34/flipnclick-sam3x/src/sam_boot.c b/boards/arm/sam34/flipnclick-sam3x/src/sam_boot.c index a9b3d42ddc..02b5e6c4d1 100644 --- a/boards/arm/sam34/flipnclick-sam3x/src/sam_boot.c +++ b/boards/arm/sam34/flipnclick-sam3x/src/sam_boot.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/flipnclick-sam3x/src/sam_boot.c + * boards/arm/sam34/flipnclick-sam3x/src/sam_boot.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -63,6 +63,7 @@ void sam_boardinitialize(void) { #ifdef CONFIG_ARCH_LEDS + /* Configure on-board LEDs if LED support has been selected. */ board_autoled_initialize(); diff --git a/boards/arm/sam34/flipnclick-sam3x/src/sam_bringup.c b/boards/arm/sam34/flipnclick-sam3x/src/sam_bringup.c index 8ca27df4a0..4b3c9bd493 100644 --- a/boards/arm/sam34/flipnclick-sam3x/src/sam_bringup.c +++ b/boards/arm/sam34/flipnclick-sam3x/src/sam_bringup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/flipnclick-sam3x/src/sam_bringup.c + * boards/arm/sam34/flipnclick-sam3x/src/sam_bringup.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -79,17 +79,18 @@ int sam_bringup(void) ret = mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { - syslog(LOG_ERR,"ERROR: Failed to mount procfs at /proc: %d\n", + syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); } #endif #if defined(HAVE_SSD1306) && !defined(CONFIG_NXSTART_EXTERNINIT) + /* Configure the SSD1306 OLED */ if (sam_graphics_setup(0) == NULL) { - syslog(LOG_ERR,"ERROR: Failed to configure the SSD1306 OLED\n"); + syslog(LOG_ERR, "ERROR: Failed to configure the SSD1306 OLED\n"); } #endif diff --git a/boards/arm/sam34/flipnclick-sam3x/src/sam_spi0.c b/boards/arm/sam34/flipnclick-sam3x/src/sam_spi0.c index 7498975204..48f9da51c5 100644 --- a/boards/arm/sam34/flipnclick-sam3x/src/sam_spi0.c +++ b/boards/arm/sam34/flipnclick-sam3x/src/sam_spi0.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/flipnclick-sam3x/src/sam_spi0.c +/**************************************************************************** + * boards/arm/sam34/flipnclick-sam3x/src/sam_spi0.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -56,17 +56,17 @@ #ifdef CONFIG_SAM34_SPI0 -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the SAM4E-EK board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_spidev_initialize(void) { @@ -82,8 +82,8 @@ void weak_function sam_spidev_initialize(void) * Name: sam_spi0select, sam_spi0status, and sam_spic0mddata * * 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_spi0select is a functions tomanage the board-specific chip selects * o sam_spi0status and sam_spic0mddata: Implementations of the status @@ -95,17 +95,17 @@ void weak_function sam_spidev_initialize(void) * * 1. Provide logic in sam_boardinitialize() to configure SPI chip select * pins. - * 2. Provide sam_spi0select() and sam_spi0status() functions in your board- - * specific logic. These functions will perform chip selection and - * status operations using GPIOs in the way your board is configured. + * 2. Provide sam_spi0select() and sam_spi0status() functions in your + * board- specific logic. These functions will perform chip selection + * and status operations using GPIOs in the way your board is configured. * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide * sam_spic0mddata() functions in your board-specific logic. This * function will perform cmd/data selection operations using GPIOs in * 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). * @@ -213,8 +213,6 @@ int sam_spi0cmddata(FAR struct spi_dev_s *dev, uint32_t devid, bool cmd) #endif return 0; - } #endif - #endif /* CONFIG_SAM34_SPI0 */ diff --git a/boards/arm/sam34/flipnclick-sam3x/src/sam_ssd1306.c b/boards/arm/sam34/flipnclick-sam3x/src/sam_ssd1306.c index f6cfa857e2..62b0489797 100644 --- a/boards/arm/sam34/flipnclick-sam3x/src/sam_ssd1306.c +++ b/boards/arm/sam34/flipnclick-sam3x/src/sam_ssd1306.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/flipnclick-sam3x/src/sam_ssd1306.c + * boards/arm/sam34/flipnclick-sam3x/src/sam_ssd1306.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -35,9 +35,10 @@ /* SSD1306 OLED * - * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C (SPI - * is the default and is what is used here). I have mounted the OLED on a - * proto click board. The OLED is connected as follows: + * The HiletGo is a 128x64 OLED that can be driven either via SPI or I2C + * (SPI is the default and is what is used here). + * I have mounted the OLED on a proto click board. + * The OLED is connected as follows: * * OLED ALIAS DESCRIPTION PROTO CLICK * ----- ----------- ------------- ----------------- @@ -77,6 +78,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifndef CONFIG_SPI_CMDDATA @@ -138,6 +140,7 @@ FAR struct lcd_dev_s *sam_graphics_setup(unsigned int devno) (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER); #if defined(CONFIG_VIDEO_FB) && defined(CONFIG_LCD_FRAMEBUFFER) + /* Initialize and register the simulated framebuffer driver */ ret = fb_register(0, 0); @@ -168,5 +171,4 @@ FAR struct lcd_dev_s *board_graphics_setup(unsigned int devno) return sam_graphics_setup(devno); } #endif - #endif /* HAVE_SSD1306 */ diff --git a/boards/arm/sam34/flipnclick-sam3x/src/sam_userleds.c b/boards/arm/sam34/flipnclick-sam3x/src/sam_userleds.c index b36f6f236d..af852d4eb7 100644 --- a/boards/arm/sam34/flipnclick-sam3x/src/sam_userleds.c +++ b/boards/arm/sam34/flipnclick-sam3x/src/sam_userleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/flipnclick-sam3x/src/sam_userleds.c + * boards/arm/sam34/flipnclick-sam3x/src/sam_userleds.c * * Copyright (C) 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* There are four LEDs on the top, blue side of the board. Only one can be * controlled by software: * diff --git a/boards/arm/sam34/sam3u-ek/include/board.h b/boards/arm/sam34/sam3u-ek/include/board.h index 7ba85b3e73..c79c0012e7 100644 --- a/boards/arm/sam34/sam3u-ek/include/board.h +++ b/boards/arm/sam34/sam3u-ek/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam3u-ek/include/board.h +/**************************************************************************** + * boards/arm/sam34/sam3u-ek/include/board.h * * Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,14 +31,14 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __ARCH_SAM3U_EK_INCLUDE_BOARD_H -#define __ARCH_SAM3U_EK_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_SAM34_SAM3U_EK_INCLUDE_BOARD_H +#define __BOARDS_ARM_SAM34_SAM3U_EK_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,13 +49,14 @@ # endif #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the sam3u device is running on a 4MHz internal RC. These - * definitions will configure clocking +/* Clocking *****************************************************************/ + +/* After power-on reset, the sam3u device is running on a 4MHz internal RC. + * These definitions will configure clocking * * MAINOSC: Frequency = 12MHz (crysta) * PLLA: PLL Divider = 1, Multiplier = 16 to generate PLLACK = 192MHz @@ -139,7 +140,7 @@ #define BOARD_FWS 3 -/* LED definitions ******************************************************************/ +/* LED definitions **********************************************************/ #define LED_STARTED 0 /* LED0=OFF LED1=OFF LED2=OFF */ #define LED_HEAPALLOCATE 1 /* LED0=OFF LED1=OFF LED2=ON */ @@ -151,9 +152,9 @@ #define LED_ASSERTION 6 /* LED0=TOG LED1=XXX LED2=XXX */ #define LED_PANIC 7 /* LED0=TOG LED1=XXX LED2=XXX */ -/* Button definitions ***************************************************************/ +/* Button definitions *******************************************************/ #define BUTTON1 1 /* Bit 0: Button 1 */ #define BUTTON2 2 /* Bit 1: Button 2 */ -#endif /* __ARCH_SAM3U_EK_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_SAM34_SAM3U_EK_INCLUDE_BOARD_H */ diff --git a/boards/arm/sam34/sam3u-ek/kernel/Makefile b/boards/arm/sam34/sam3u-ek/kernel/Makefile index 38a82190e4..d4571cf110 100644 --- a/boards/arm/sam34/sam3u-ek/kernel/Makefile +++ b/boards/arm/sam34/sam3u-ek/kernel/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam3u-ek/kernel/Makefile +# boards/arm/sam34/sam3u-ek/kernel/Makefile # # Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/sam3u-ek/kernel/sam_userspace.c b/boards/arm/sam34/sam3u-ek/kernel/sam_userspace.c index bb8a063f0b..38a31b51d3 100644 --- a/boards/arm/sam34/sam3u-ek/kernel/sam_userspace.c +++ b/boards/arm/sam34/sam3u-ek/kernel/sam_userspace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam3u-ek/kernel/sam_userspace.c + * boards/arm/sam34/sam3u-ek/kernel/sam_userspace.c * * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -50,6 +50,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifndef CONFIG_NUTTX_USERSPACE @@ -64,9 +65,9 @@ * Public Data ****************************************************************************/ -/* These 'addresses' of these values are setup by the linker script. They are - * not actual uint32_t storage locations! They are only used meaningfully in the - * following way: +/* These 'addresses' of these values are setup by the linker script. + * They are not actual uint32_t storage locations! + * They are only used meaningfully in the following way: * * - The linker script defines, for example, the symbol_sdata. * - The declareion extern uint32_t _sdata; makes C happy. C will believe diff --git a/boards/arm/sam34/sam3u-ek/scripts/Make.defs b/boards/arm/sam34/sam3u-ek/scripts/Make.defs index da627b8182..b3c15190b6 100644 --- a/boards/arm/sam34/sam3u-ek/scripts/Make.defs +++ b/boards/arm/sam34/sam3u-ek/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam3u-ek/scripts/Make.defs +# boards/arm/sam34/sam3u-ek/scripts/Make.defs # # Copyright (C) 2010, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/sam3u-ek/scripts/kernel-space.ld b/boards/arm/sam34/sam3u-ek/scripts/kernel-space.ld index 12fc018dd7..e81b7f33b1 100644 --- a/boards/arm/sam34/sam3u-ek/scripts/kernel-space.ld +++ b/boards/arm/sam34/sam3u-ek/scripts/kernel-space.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam3u-ek/scripts/kernel-space.ld + * boards/arm/sam34/sam3u-ek/scripts/kernel-space.ld * * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam3u-ek/scripts/ld.script b/boards/arm/sam34/sam3u-ek/scripts/ld.script index b5eb501f67..ee8a65f025 100644 --- a/boards/arm/sam34/sam3u-ek/scripts/ld.script +++ b/boards/arm/sam34/sam3u-ek/scripts/ld.script @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam3u-ek/scripts/ld.script + * boards/arm/sam34/sam3u-ek/scripts/ld.script * * Copyright (C) 2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam3u-ek/scripts/memory.ld b/boards/arm/sam34/sam3u-ek/scripts/memory.ld index e238ae3bbe..110d240eda 100644 --- a/boards/arm/sam34/sam3u-ek/scripts/memory.ld +++ b/boards/arm/sam34/sam3u-ek/scripts/memory.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam3u-ek/scripts/user-space.ld + * boards/arm/sam34/sam3u-ek/scripts/user-space.ld * * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam3u-ek/scripts/user-space.ld b/boards/arm/sam34/sam3u-ek/scripts/user-space.ld index 4d04ac175f..3a25f6ba41 100644 --- a/boards/arm/sam34/sam3u-ek/scripts/user-space.ld +++ b/boards/arm/sam34/sam3u-ek/scripts/user-space.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam3u-ek/scripts/user-space.ld + * boards/arm/sam34/sam3u-ek/scripts/user-space.ld * * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam3u-ek/src/Makefile b/boards/arm/sam34/sam3u-ek/src/Makefile index 95907b7198..1aa392ad0e 100644 --- a/boards/arm/sam34/sam3u-ek/src/Makefile +++ b/boards/arm/sam34/sam3u-ek/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam3u-ek/src/Makefile +# boards/arm/sam34/sam3u-ek/src/Makefile # # Copyright (C) 2009-2010, 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/sam3u-ek/src/sam3u-ek.h b/boards/arm/sam34/sam3u-ek/src/sam3u-ek.h index a3d416a791..d75fb40aa7 100644 --- a/boards/arm/sam34/sam3u-ek/src/sam3u-ek.h +++ b/boards/arm/sam34/sam3u-ek/src/sam3u-ek.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam3u-ek/src/sam3u-ek.h +/**************************************************************************** + * boards/arm/sam34/sam3u-ek/src/sam3u-ek.h * * Copyright (C) 2009-2011, 2013, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_SAM3U_EK_SRC_SAM3U_EK_H -#define __BOARDS_ARM_SAM3U_EK_SRC_SAM3U_EK_H +#ifndef __BOARDS_ARM_SAM34_SAM3U_EK_SRC_SAM3U_EK_H +#define __BOARDS_ARM_SAM34_SAM3U_EK_SRC_SAM3U_EK_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -50,11 +50,12 @@ #include "hardware/sam_pinmap.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + +/* External Memory Usage ****************************************************/ -/* External Memory Usage ************************************************************/ /* LCD on CS2 */ #define LCD_BASE SAM_EXTCS2_BASE @@ -64,7 +65,7 @@ #define CONFIG_TSC_ADS7843 1 /* ADS7843 present on board */ #define CONFIG_TSC_SPI 0 /* On SPI0 */ -/* SAM3U-EK GPIO Pin Definitions ****************************************************/ +/* SAM3U-EK GPIO Pin Definitions ********************************************/ /* LCD: * LCD Module Pin Out: SAM3U PIO: @@ -144,8 +145,8 @@ * The IRQ is active low and pulled up. * * Pen Interrupt. Open anode output, requires 10kO to 100kO pull-up resistor - * externally. There is a 100KO pull-up on the SAM3U-EK board so no additional - * pull-up should be required. + * externally. There is a 100KO pull-up on the SAM3U-EK board so no + * additional pull-up should be required. * * BUSY is high impedance when CS is high (not selected). When CS is * is low, BUSY is active high. Since the pin is pulled up, it will appear @@ -184,50 +185,53 @@ /* SPI Chip Selects */ -/* Chip select pin connected to the touchscreen controller and to the ZigBee module - * connector. Notice that the touchscreen chip select is implemented as a GPIO - * OUTPUT that must be controlled by board-specific. This is because the ADS7843E - * driver must be able to sample the device BUSY GPIO input between SPI transfers. - * However, the AD7843E will tri-state the BUSY input whenever the chip select is - * de-asserted. So the only option is to control the chip select manually and hold - * it low throughout the SPI transfer. +/* Chip select pin connected to the touchscreen controller and to the ZigBee + * module connector. + * Notice that the touchscreen chip select is implemented as a GPIO OUTPUT + * that must be controlled by board-specific. + * This is because the ADS7843E driver must be able to sample the device BUSY + * GPIO input between SPI transfers. + * However, the AD7843E will tri-state the BUSY input whenever the chip + * select is de-asserted. + * So the only option is to control the chip select manually and hold it low + * throughout the SPI transfer. */ #define GPIO_TSC_NPCS2 (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \ GPIO_PORT_PIOC | GPIO_PIN14) #define TSC_CSNUM 2 -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the SAM3U-EK board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_spidev_initialize(void); -/************************************************************************************ +/**************************************************************************** * Name: sam_hsmciinit * * Description: * Initialize HSMCI support * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAM34_HSMCI int weak_function sam_hsmciinit(void); @@ -235,13 +239,13 @@ int weak_function sam_hsmciinit(void); # define sam_hsmciinit() #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_cardinserted * * Description: * Check if a card is inserted into the selected HSMCI slot * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAM34_HSMCI bool sam_cardinserted(unsigned char slot); @@ -249,13 +253,13 @@ bool sam_cardinserted(unsigned char slot); # define sam_cardinserted(slot) (false) #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_writeprotected * * Description: * Check if a card is inserted into the selected HSMCI slot * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAM34_HSMCI bool sam_writeprotected(unsigned char slot); @@ -263,26 +267,28 @@ bool sam_writeprotected(unsigned char slot); # define sam_writeprotected(slot) (false) #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_tsc_setup * * Description: - * This function is called by board-bringup logic to configure the touchscreen - * device. This function will register the driver as /dev/inputN where N is the + * This function is called by board-bringup logic to configure the + * touchscreen device. + * This function will register the driver as /dev/inputN where N is the * minor device number. * * Input Parameters: * minor - The input device minor number * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to - * indicate the nature of the failure. + * Zero is returned on success. + * Otherwise, a negated errno value is returned to indicate the nature + * of the failure. * - ***********************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_INPUT_ADS7843E int sam_tsc_setup(int minor); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAM3U_EK_SRC_SAM3U_EK_H */ +#endif /* __BOARDS_ARM_SAM34_SAM3U_EK_SRC_SAM3U_EK_H */ diff --git a/boards/arm/sam34/sam3u-ek/src/sam_appinit.c b/boards/arm/sam34/sam3u-ek/src/sam_appinit.c index 3de2d64e61..f3faad6389 100644 --- a/boards/arm/sam34/sam3u-ek/src/sam_appinit.c +++ b/boards/arm/sam34/sam3u-ek/src/sam_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sam3u-ek/src/sam_appinit.c + * boards/arm/sam34/sam3u-ek/src/sam_appinit.c * * Copyright (C) 2010, 2013, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -68,8 +68,8 @@ # undef NSH_HAVE_MMCSD #endif -/* Can't support MMC/SD features if mountpoints are disabled or if SDIO support - * is not enabled. +/* Can't support MMC/SD features if mountpoints are disabled or if SDIO + * support is not enabled. */ #if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_SAM34_HSMCI) @@ -134,6 +134,7 @@ int board_app_initialize(uintptr_t arg) FAR struct sdio_dev_s *sdio; /* Mount the SDIO-based MMC/SD block driver */ + /* First, get an instance of the SDIO interface */ syslog(LOG_INFO, "Initializing SDIO slot %d\n", @@ -155,7 +156,8 @@ int board_app_initialize(uintptr_t arg) ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, sdio); if (ret != OK) { - syslog(LOG_ERR, "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); + syslog(LOG_ERR, + "ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n", ret); return ret; } @@ -163,7 +165,7 @@ int board_app_initialize(uintptr_t arg) /* Then inform the HSMCI driver if there is or is not a card in the slot. */ - sdio_mediachange(sdio, sam_cardinserted(0)); + sdio_mediachange(sdio, sam_cardinserted(0)); #endif #ifdef CONFIG_INPUT diff --git a/boards/arm/sam34/sam3u-ek/src/sam_boot.c b/boards/arm/sam34/sam3u-ek/src/sam_boot.c index e906b74626..76ef7a1f70 100644 --- a/boards/arm/sam34/sam3u-ek/src/sam_boot.c +++ b/boards/arm/sam34/sam3u-ek/src/sam_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam3u-ek/src/sam_boot.c +/**************************************************************************** + * boards/arm/sam34/sam3u-ek/src/sam_boot.c * * Copyright (C) 2009-2011, 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -47,32 +47,33 @@ #include "up_arch.h" #include "sam3u-ek.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 intitialization -- 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 intitialization -- 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 - * sam_spidev_initialize() has been brought into the link. + /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak + * function sam_spidev_initialize() has been brought into the link. */ #ifdef CONFIG_SAM34_SPI0 @@ -90,7 +91,7 @@ void sam_boardinitialize(void) /* Setup SD card-related PIOs if 1) HSMCI is selected and 2) the weak * function sam_hsmciinit() has been brought into the build. - */ + */ #ifdef CONFIG_SAM34_HSMCI if (sam_hsmciinit) diff --git a/boards/arm/sam34/sam3u-ek/src/sam_buttons.c b/boards/arm/sam34/sam3u-ek/src/sam_buttons.c index 252e5120f6..64422d3a40 100644 --- a/boards/arm/sam34/sam3u-ek/src/sam_buttons.c +++ b/boards/arm/sam34/sam3u-ek/src/sam_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam3u-ek/src/up_leds.c + * boards/arm/sam34/sam3u-ek/src/up_leds.c * * Copyright (C) 2010, 2014-2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -109,10 +109,10 @@ static int board_button_irqx(gpio_pinset_t pinset, int irq, xcpt_t irqhandler, * Name: board_button_initialize * * 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 interrupt - * handlers. + * 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 + * interrupt handlers. * ****************************************************************************/ @@ -122,16 +122,17 @@ void board_button_initialize(void) (void)sam_configgpio(GPIO_BUTTON2); } -/************************************************************************************ +/**************************************************************************** * 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) { diff --git a/boards/arm/sam34/sam3u-ek/src/sam_lcd.c b/boards/arm/sam34/sam3u-ek/src/sam_lcd.c index ad2b5514a0..5d245ad792 100644 --- a/boards/arm/sam34/sam3u-ek/src/sam_lcd.c +++ b/boards/arm/sam34/sam3u-ek/src/sam_lcd.c @@ -1,5 +1,5 @@ -/************************************************************************************** - * boards/sam3u-ek/src/sam_lcd.c +/**************************************************************************** + * boards/arm/sam34/sam3u-ek/src/sam_lcd.c * * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,12 +31,13 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - **************************************************************************************/ + ****************************************************************************/ -/************************************************************************************** - * The SAM3U-EK developement board features a TFT/Transmissive color LCD module with - * touch-screen, FTM280C12D, with integratd driver IC HX8346. The LCD display size - * is 2.8 inches, with a native resolution of 240 x 320 pixels. +/**************************************************************************** + * The SAM3U-EK developement board features a TFT/Transmissive color LCD + * module with touch-screen, FTM280C12D, with integratd driver IC HX8346. + * The LCD display size is 2.8 inches, with a native resolution of 240 x 320 + * pixels. * * LCD Module Pin Out: SAM3U PIO: * -------------------------------------------- -------------------------------------- @@ -82,31 +83,32 @@ * 38 NC No connection N/A --- --- --- * 39 K Backlight ground N/A --- --- --- * - * The LCD module gets its reset from NRST. As explained previously, this NRST is - * shared with the JTAG port and the push button BP1. The LCD chip select signal is - * connected to NCS2 (a dedicated jumper can disable it, making NCS2 available for - * other custom usage). + * The LCD module gets its reset from NRST. As explained previously, this + * NRST is shared with the JTAG port and the push button BP1. The LCD chip + * select signal is connected to NCS2 (a dedicated jumper can disable it, + * making NCS2 available for other custom usage). * * The SAM3U4E communicates with the LCD through PIOB where a 16-bit parallel * 8080-like protocol data bus has to be implemented by software. * - * LCD backlight is made of 4 white chip LEDs in parallel, driven by an AAT3194 - * charge pump, MN4. The AAT3194 is controlled by the SAM3U4E through a single line - * Simple Serial Control (S2Cwire) interface, which permits to enable, disable, and - * set the LED drive current (LED brightness control) from a 32-level logarithmic - * scale. Four resistors R93/R94/R95/R96 are implemented for optional current + * LCD backlight is made of 4 white chip LEDs in parallel, driven by an + * AAT3194 charge pump, MN4. The AAT3194 is controlled by the SAM3U4E through + * a single line Simple Serial Control (S2Cwire) interface, which permits to + * enable, disable, and set the LED drive current (LED brightness control) + * from a 32-level logarithmic scale. + * Four resistors R93/R94/R95/R96 are implemented for optional current * limitation. * * The LCD module integrates a 4-wire touch screen panel controlled by - * MN5, ADS7843, which is a slave device on the SAM3U4E SPI bus. The ADS7843 touch - * ADC auxiliary inputs IN3/IN4 are connected to test points for optional function - * extension. + * MN5, ADS7843, which is a slave device on the SAM3U4E SPI bus. + * The ADS7843 touch ADC auxiliary inputs IN3/IN4 are connected to test + * points for optional function extension. * - **************************************************************************************/ + ****************************************************************************/ -/************************************************************************************** +/**************************************************************************** * Included Files - **************************************************************************************/ + ****************************************************************************/ #include @@ -130,11 +132,11 @@ #include "hardware/sam_smc.h" #include "sam3u-ek.h" -/************************************************************************************** +/**************************************************************************** * Pre-processor Definitions - **************************************************************************************/ + ****************************************************************************/ -/* Configuration **********************************************************************/ +/* Configuration ************************************************************/ /* Define the following to enable register-level debug output */ @@ -157,12 +159,13 @@ # error "CONFIG_LCD_MAXCONTRAST must be defined in the range 1 to 31" #endif -/* Graphics Capbilities ***************************************************************/ +/* Graphics Capbilities *****************************************************/ -/* LCD resolution: 320 (columns) by 240 (rows). The physical dimensions of the device - * are really 240 (columns) by 320 (rows), but unless CONFIG_LCD_PORTRAIT is defined, - * we swap rows and columns in setcursor to make things behave nicer (there IS a - * performance hit for this swap!). +/* LCD resolution: 320 (columns) by 240 (rows). + * The physical dimensions of the device are really 240 (columns) by 320 + * (rows), but unless CONFIG_LCD_PORTRAIT is defined, we swap rows and + * columns in setcursor to make things behave nicer (there IS a performance + * hit for this swap!). */ #ifdef CONFIG_LCD_PORTRAIT @@ -178,7 +181,7 @@ #define SAM3UEK_BPP 16 #define SAM3UEK_RGBFMT FB_FMT_RGB16_565 -/* HX834x Definitions ****************************************************************/ +/* HX834x Definitions ******************************************************/ /* HX834x register select */ @@ -274,9 +277,9 @@ #define HX8347_R94H 0x94 #define HX8347_R95H 0x95 -/************************************************************************************** +/**************************************************************************** * Private Type Definition - **************************************************************************************/ + ****************************************************************************/ /* This structure describes the state of this driver */ @@ -291,9 +294,9 @@ struct sam_dev_s uint8_t power; /* The current power setting */ }; -/************************************************************************************** +/**************************************************************************** * Private Function Protototypes - **************************************************************************************/ + ****************************************************************************/ /* Low-level HX834x Register access */ @@ -317,10 +320,12 @@ static void sam_dumpreg(uint8_t startreg, uint8_t endreg); /* LCD Data Transfer Methods */ -static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, - size_t npixels); -static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, - size_t npixels); +static int sam_putrun(fb_coord_t row, fb_coord_t col, + FAR const uint8_t *buffer, + size_t npixels); +static int sam_getrun(fb_coord_t row, fb_coord_t col, + FAR uint8_t *buffer, + size_t npixels); /* LCD Configuration */ @@ -348,9 +353,9 @@ static int sam_setpower(struct lcd_dev_s *dev, int power); static int sam_getcontrast(struct lcd_dev_s *dev); static int sam_setcontrast(struct lcd_dev_s *dev, unsigned int contrast); -/************************************************************************************** +/**************************************************************************** * Private Data - **************************************************************************************/ + ****************************************************************************/ /* This is working memory allocated by the LCD driver for each LCD device * and for each color plane. This memory will hold one raster line of data. @@ -397,6 +402,7 @@ static struct sam_dev_s g_lcddev_s = .getplaneinfo = sam_getplaneinfo, /* LCD RGB Mapping -- Not supported */ + /* Cursor Controls -- Not supported */ /* LCD Specific Controls */ @@ -408,17 +414,17 @@ static struct sam_dev_s g_lcddev_s = }, }; -/************************************************************************************** +/**************************************************************************** * Private Functions - **************************************************************************************/ + ****************************************************************************/ -/************************************************************************************** +/**************************************************************************** * Name: sam_putreg * * Description: * Write to a HX834x register * - **************************************************************************************/ + ****************************************************************************/ static void sam_putreg(uint16_t reg, uint16_t data) { @@ -428,13 +434,13 @@ static void sam_putreg(uint16_t reg, uint16_t data) putreg16(data, LCD_BASE + HX843X_LCD_RS); } -/************************************************************************************** +/**************************************************************************** * Name: sam_getreg * * Description: * Read from a HX834x register * - **************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_DEBUG_LCD_INFO static uint16_t sam_getreg(uint16_t reg) @@ -449,13 +455,13 @@ static uint16_t sam_getreg(uint16_t reg) } #endif -/************************************************************************************** +/**************************************************************************** * Name: sam_setcursor * * Description: * Set the LCD cursor position. * - **************************************************************************************/ + ****************************************************************************/ static void sam_setcursor(fb_coord_t row, fb_coord_t col) { @@ -480,52 +486,52 @@ static void sam_setcursor(fb_coord_t row, fb_coord_t col) sam_putreg(HX8347_R07H, y1); /* row low */ } -/************************************************************************************** +/**************************************************************************** * Name: sam_wrsetup * * Description: * Set up for a GRAM write operation. * - **************************************************************************************/ + ****************************************************************************/ static inline void sam_wrsetup(void) { putreg16(HX8347_R22H, LCD_BASE); } -/************************************************************************************** +/**************************************************************************** * Name: sam_wrram * * Description: * Write to the 16-bit GRAM register * - **************************************************************************************/ + ****************************************************************************/ static inline void sam_wrram(uint16_t color) { putreg16(color, LCD_BASE + HX843X_LCD_RS); } -/************************************************************************************** +/**************************************************************************** * Name: sam_rdram * * Description: * Read from the 16-bit GRAM register * - **************************************************************************************/ + ****************************************************************************/ static inline uint16_t sam_rdram(void) { return getreg16(LCD_BASE + HX843X_LCD_RS); } -/************************************************************************************** +/**************************************************************************** * Name: sam_lcdon * * Description: * Turn the LCD on * - **************************************************************************************/ + ****************************************************************************/ static void sam_lcdon(void) { @@ -541,13 +547,13 @@ static void sam_lcdon(void) sam_putreg(HX8347_R26H, 0x3c); /* GON=1 DTE=1 D=11 */ } -/************************************************************************************** +/**************************************************************************** * Name: sam_lcdoff * * Description: * Turn the LCD off * - **************************************************************************************/ + ****************************************************************************/ static void sam_lcdoff(void) { @@ -556,13 +562,13 @@ static void sam_lcdoff(void) sam_putreg(HX8347_R26H, 0x00); /* GON=0 DTE=0 D=00 */ } -/************************************************************************************** +/**************************************************************************** * Name: sam_dumpreg * * Description: * Dump a range of LCD registers. * - **************************************************************************************/ + ****************************************************************************/ #if 0 /* CONFIG_DEBUG_LCD_INFO */ static void sam_dumpreg(uint8_t startreg, uint8_t endreg) @@ -578,7 +584,7 @@ static void sam_dumpreg(uint8_t startreg, uint8_t endreg) } #endif -/************************************************************************************** +/**************************************************************************** * Name: sam_putrun * * Description: @@ -590,9 +596,10 @@ static void sam_dumpreg(uint8_t startreg, uint8_t endreg) * npixels - The number of pixels to write to the LCD * (range: 0 < npixels <= xres-col) * - **************************************************************************************/ + ****************************************************************************/ -static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, +static int sam_putrun(fb_coord_t row, fb_coord_t col, + FAR const uint8_t *buffer, size_t npixels) { uint16_t *run = (uint16_t*)buffer; @@ -618,16 +625,19 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, sam_wrram(*run++); } #else - /* Write the run to GRAM. Because rows and colums are swapped, we need to reset + /* Write the run to GRAM. + * Because rows and colums are swapped, we need to reset * the cursor position for every pixel. We could do this much faster if we * adapted to the strange device aspect ratio. */ - col = 319-col; + col = 319 - col; for (i = 0; i < npixels; i++) { - /* Set up to write the next pixel. Swapping x and y orientations so that the image - * comes out with the 320x240 aspect ratio (not the native 240x320). That is: + /* Set up to write the next pixel. + * Swapping x and y orientations so that the image + * comes out with the 320x240 aspect ratio (not the native 240x320). + * That is: * * row: 0-239 maps to x: 0-239 * col: 0-319 maps to y: 319-0 @@ -644,7 +654,7 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, return OK; } -/************************************************************************************** +/**************************************************************************** * Name: sam_getrun * * Description: @@ -656,7 +666,7 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, * npixels - The number of pixels to read from the LCD * (range: 0 < npixels <= xres-col) * - **************************************************************************************/ + ****************************************************************************/ static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, size_t npixels) @@ -683,16 +693,19 @@ static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, *run++ = sam_rdram(); } #else - /* Read the run from GRAM Because rows and colums are swapped, we need to reset - * the cursor position for every pixel. We could do this much faster if we - * adapted to the strange device aspect ratio. + /* Read the run from GRAM Because rows and colums are swapped, we need to + * reset the cursor position for every pixel. + * We could do this much faster if we adapted to the strange device aspect + * ratio. */ col = 319 - col; for (i = 0; i < npixels; i++) { - /* Read the next pixel.. Swapping x and y orientations so that the image - * comes out with the 320x240 aspect ratio (not the native 240x320). That is: + /* Read the next pixel.. + * Swapping x and y orientations so that the image comes out with the + * 320x240 aspect ratio (not the native 240x320). + * That is: * * row: 0-239 maps to x: 0-239 * col: 0-319 maps to y: 319-0 @@ -705,31 +718,32 @@ static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, return OK; } -/************************************************************************************** +/**************************************************************************** * Name: sam_getvideoinfo * * Description: * Get information about the LCD video controller configuration. * - **************************************************************************************/ + ****************************************************************************/ static int sam_getvideoinfo(FAR struct lcd_dev_s *dev, FAR struct fb_videoinfo_s *vinfo) { DEBUGASSERT(dev && vinfo); lcdinfo("fmt: %d xres: %d yres: %d nplanes: %d\n", - g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes); + g_videoinfo.fmt, g_videoinfo.xres, + g_videoinfo.yres, g_videoinfo.nplanes); memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s)); return OK; } -/************************************************************************************** +/**************************************************************************** * Name: sam_getplaneinfo * * Description: * Get information about the configuration of each LCD color plane. * - **************************************************************************************/ + ****************************************************************************/ static int sam_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno, FAR struct lcd_planeinfo_s *pinfo) @@ -740,14 +754,15 @@ static int sam_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno, return OK; } -/************************************************************************************** +/**************************************************************************** * Name: sam_getpower * * Description: - * Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on. On - * backlit LCDs, this setting may correspond to the backlight setting. + * Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: + * full on. + * On backlit LCDs, this setting may correspond to the backlight setting. * - **************************************************************************************/ + ****************************************************************************/ static int sam_getpower(struct lcd_dev_s *dev) { @@ -757,20 +772,23 @@ static int sam_getpower(struct lcd_dev_s *dev) return priv->power; } -/************************************************************************************** +/**************************************************************************** * Name: sam_setpower * * Description: - * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On - * backlit LCDs, this setting may correspond to the backlight setting. + * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: + * full on). + * On backlit LCDs, this setting may correspond to the backlight setting. * - * LCD backlight is made of 4 white chip LEDs in parallel, driven by an AAT3194 charge - * pump, MN4. The AAT3194 is controlled by the SAM3U4E through a single line. Simple - * Serial Control (S2Cwire) interface, which permits to enable, disable, and set the - * LED drive current (LED brightness control) from a 32-level logarithmic scale. Four - * resistors R93/R94/R95/R96 are implemented for optional current limitation. + * LCD backlight is made of 4 white chip LEDs in parallel, driven by an + * AAT3194 charge pump, MN4. The AAT3194 is controlled by the SAM3U4E + * through a single line. Simple Serial Control (S2Cwire) interface, + * which permits to enable, disable, and set the LED drive current + * (LED brightness control) from a 32-level logarithmic scale. Four + * resistors R93/R94/R95/R96 are implemented for optional current + * limitation. * - **************************************************************************************/ + ****************************************************************************/ static int sam_setpower(struct lcd_dev_s *dev, int power) { @@ -800,7 +818,9 @@ static int sam_setpower(struct lcd_dev_s *dev, int power) sam_gpiowrite(GPIO_LCD_BKL, true); } - /* This delay seems to be required... perhaps because of the big current jump? */ + /* This delay seems to be required... + * perhaps because of the big current jump? + */ if (power != LCD_FULL_OFF) { @@ -811,13 +831,13 @@ static int sam_setpower(struct lcd_dev_s *dev, int power) return OK; } -/************************************************************************************** +/**************************************************************************** * Name: sam_getcontrast * * Description: * Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST). * - **************************************************************************************/ + ****************************************************************************/ static int sam_getcontrast(struct lcd_dev_s *dev) { @@ -825,13 +845,13 @@ static int sam_getcontrast(struct lcd_dev_s *dev) return -ENOSYS; } -/************************************************************************************** +/**************************************************************************** * Name: sam_getcontrast * * Description: * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST). * - **************************************************************************************/ + ****************************************************************************/ static int sam_setcontrast(struct lcd_dev_s *dev, unsigned int contrast) { @@ -839,19 +859,19 @@ static int sam_setcontrast(struct lcd_dev_s *dev, unsigned int contrast) return -ENOSYS; } -/************************************************************************************** +/**************************************************************************** * Public Functions - **************************************************************************************/ + ****************************************************************************/ -/************************************************************************************** +/**************************************************************************** * Name: board_lcd_initialize * * Description: - * Initialize the LCD video hardware. The initial state of the LCD is fully - * initialized, display memory cleared, and the LCD ready to use, but with the power - * setting at 0 (full off). + * Initialize the LCD video hardware. The initial state of the LCD is + * fully initialized, display memory cleared, and the LCD ready to use, + * but with the power setting at 0 (full off). * - **************************************************************************************/ + ****************************************************************************/ int board_lcd_initialize(void) { @@ -904,20 +924,27 @@ int board_lcd_initialize(void) /* Configure SMC CS2 */ - regval = (4 << SMCCS_SETUP_NWESETUP_SHIFT) | (2 << SMCCS_SETUP_NCSWRSETUP_SHIFT) | - (4 << SMCCS_SETUP_NRDSETUP_SHIFT) | (2 << SMCCS_SETUP_NCSRDSETUP_SHIFT); + regval = (4 << SMCCS_SETUP_NWESETUP_SHIFT) | + (2 << SMCCS_SETUP_NCSWRSETUP_SHIFT) | + (4 << SMCCS_SETUP_NRDSETUP_SHIFT) | + (2 << SMCCS_SETUP_NCSRDSETUP_SHIFT); putreg32(regval, SAM_SMCCS_SETUP(2)); - regval = (5 << SMCCS_PULSE_NWEPULSE_SHIFT) | (18 << SMCCS_PULSE_NCSWRPULSE_SHIFT) | - (5 << SMCCS_PULSE_NRDPULSE_SHIFT) | (18 << SMCCS_PULSE_NCSRDPULSE_SHIFT); + regval = (5 << SMCCS_PULSE_NWEPULSE_SHIFT) | + (18 << SMCCS_PULSE_NCSWRPULSE_SHIFT) | + (5 << SMCCS_PULSE_NRDPULSE_SHIFT) | + (18 << SMCCS_PULSE_NCSRDPULSE_SHIFT); putreg32(regval, SAM_SMCCS_PULSE(2)); - regval = (22 << SMCCS_CYCLE_NWECYCLE_SHIFT) | (22 << SMCCS_CYCLE_NRDCYCLE_SHIFT); + regval = (22 << SMCCS_CYCLE_NWECYCLE_SHIFT) | + (22 << SMCCS_CYCLE_NRDCYCLE_SHIFT); putreg32(regval, SAM_SMCCS_CYCLE(2)); regval = getreg32(SAM_SMCCS_MODE(2)); regval &= ~(SMCCS_MODE_DBW_MASK | SMCCS_MODE_PMEN); - regval |= (SMCCS_MODE_READMODE) | (SMCCS_MODE_WRITEMODE) | (SMCCS_MODE_DBW_16BITS); + regval |= (SMCCS_MODE_READMODE) | + (SMCCS_MODE_WRITEMODE) | + (SMCCS_MODE_DBW_16BITS); putreg32(regval, SAM_SMCCS_MODE(2)); lcdinfo("SMC SETUP[%08x]: %08x PULSE[%08x]: %08x\n", @@ -934,21 +961,24 @@ int board_lcd_initialize(void) lcdinfo("Chip ID: %04x\n", hxregval); if (hxregval != HX8347_CHIPID) { - lcderr("ERROR: Bad chip ID: %04x Expected: %04x\n", hxregval, HX8347_CHIPID); + lcderr("ERROR: Bad chip ID: %04x Expected: %04x\n", + hxregval, HX8347_CHIPID); return -ENODEV; } #endif - /* Initialize LCD controller (HX8347) -- Magic code from Atmel LCD example */ + /* Initialize LCD controller (HX8347) -- + * Magic code from Atmel LCD example + */ /* Start internal OSC */ sam_putreg(HX8347_R19H, 0x49); /* OSCADJ=10 0000 OSD_EN=1 60Hz */ - sam_putreg(HX8347_R93H, 0x0C); /* RADJ=1100 */ + sam_putreg(HX8347_R93H, 0x0c); /* RADJ=1100 */ /* Power on flow */ - sam_putreg(HX8347_R44H, 0x4D); /* VCM=100 1101 */ + sam_putreg(HX8347_R44H, 0x4d); /* VCM=100 1101 */ sam_putreg(HX8347_R45H, 0x11); /* VDV=1 0001 */ sam_putreg(HX8347_R20H, 0x40); /* BT=0100 */ sam_putreg(HX8347_R1DH, 0x07); /* VC1=111 */ @@ -1026,14 +1056,14 @@ int board_lcd_initialize(void) return OK; } -/************************************************************************************** +/**************************************************************************** * Name: board_lcd_getdev * * Description: - * Return a a reference to the LCD object for the specified LCD. This allows - * support for multiple LCD devices. + * Return a a reference to the LCD object for the specified LCD. + * This allows support for multiple LCD devices. * - **************************************************************************************/ + ****************************************************************************/ FAR struct lcd_dev_s *board_lcd_getdev(int lcddev) { @@ -1041,13 +1071,13 @@ FAR struct lcd_dev_s *board_lcd_getdev(int lcddev) return lcddev == 0 ? &g_lcddev_s.dev : NULL; } -/************************************************************************************** +/**************************************************************************** * Name: board_lcd_uninitialize * * Description: * Unitialize the framebuffer support. * - **************************************************************************************/ + ****************************************************************************/ void board_lcd_uninitialize(void) { @@ -1063,5 +1093,3 @@ void board_lcd_uninitialize(void) putreg32((1 << SAM_PID_SMC), SAM_PMC_PCDR); } - - diff --git a/boards/arm/sam34/sam3u-ek/src/sam_leds.c b/boards/arm/sam34/sam3u-ek/src/sam_leds.c index 459c0178db..1ea9d3ab21 100644 --- a/boards/arm/sam34/sam3u-ek/src/sam_leds.c +++ b/boards/arm/sam34/sam3u-ek/src/sam_leds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam3u-ek/src/sam_leds.c + * boards/arm/sam34/sam3u-ek/src/sam_leds.c * * Copyright (C) 2009-2010, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -82,28 +82,28 @@ static const uint8_t g_ledon[8] = { - (LED0_OFF |LED1_OFF |LED2_OFF), /* LED_STARTED */ - (LED0_ON |LED1_OFF |LED2_ON), /* LED_HEAPALLOCATE */ - (LED0_OFF |LED1_ON |LED2_OFF), /* LED_IRQSENABLED */ - (LED0_ON |LED1_ON |LED2_ON), /* LED_STACKCREATED */ + (LED0_OFF | LED1_OFF | LED2_OFF), /* LED_STARTED */ + (LED0_ON | LED1_OFF | LED2_ON), /* LED_HEAPALLOCATE */ + (LED0_OFF | LED1_ON | LED2_OFF), /* LED_IRQSENABLED */ + (LED0_ON | LED1_ON | LED2_ON), /* LED_STACKCREATED */ - (LED0_NOCHANGE|LED1_OFF |LED2_NOCHANGE), /* LED_INIRQ */ - (LED0_NOCHANGE|LED1_NOCHANGE|LED2_OFF), /* LED_SIGNAL */ - (LED0_ON |LED1_NOCHANGE|LED2_NOCHANGE), /* LED_ASSERTION */ - (LED0_ON |LED1_NOCHANGE|LED2_NOCHANGE) /* LED_PANIC */ + (LED0_NOCHANGE | LED1_OFF | LED2_NOCHANGE), /* LED_INIRQ */ + (LED0_NOCHANGE | LED1_NOCHANGE | LED2_OFF), /* LED_SIGNAL */ + (LED0_ON | LED1_NOCHANGE | LED2_NOCHANGE), /* LED_ASSERTION */ + (LED0_ON | LED1_NOCHANGE | LED2_NOCHANGE) /* LED_PANIC */ }; static const uint8_t g_ledoff[8] = { - (LED0_OFF |LED1_OFF |LED2_OFF), /* LED_STARTED (does not happen) */ - (LED0_ON |LED1_OFF |LED2_ON), /* LED_HEAPALLOCATE (does not happen) */ - (LED0_OFF |LED1_ON |LED2_OFF), /* LED_IRQSENABLED (does not happen) */ - (LED0_ON |LED1_ON |LED2_ON), /* LED_STACKCREATED (does not happen) */ + (LED0_OFF | LED1_OFF | LED2_OFF), /* LED_STARTED (does not happen) */ + (LED0_ON | LED1_OFF | LED2_ON), /* LED_HEAPALLOCATE (does not happen) */ + (LED0_OFF | LED1_ON | LED2_OFF), /* LED_IRQSENABLED (does not happen) */ + (LED0_ON | LED1_ON | LED2_ON), /* LED_STACKCREATED (does not happen) */ - (LED0_NOCHANGE|LED1_ON |LED2_NOCHANGE), /* LED_INIRQ */ - (LED0_NOCHANGE|LED1_NOCHANGE|LED2_ON), /* LED_SIGNAL */ - (LED0_OFF |LED1_NOCHANGE|LED2_NOCHANGE), /* LED_ASSERTION */ - (LED0_OFF |LED1_NOCHANGE|LED2_NOCHANGE) /* LED_PANIC */ + (LED0_NOCHANGE | LED1_ON | LED2_NOCHANGE), /* LED_INIRQ */ + (LED0_NOCHANGE | LED1_NOCHANGE | LED2_ON), /* LED_SIGNAL */ + (LED0_OFF | LED1_NOCHANGE | LED2_NOCHANGE), /* LED_ASSERTION */ + (LED0_OFF | LED1_NOCHANGE | LED2_NOCHANGE) /* LED_PANIC */ }; /**************************************************************************** diff --git a/boards/arm/sam34/sam3u-ek/src/sam_mmcsd.c b/boards/arm/sam34/sam3u-ek/src/sam_mmcsd.c index b922286f36..8280f0a9ff 100644 --- a/boards/arm/sam34/sam3u-ek/src/sam_mmcsd.c +++ b/boards/arm/sam34/sam3u-ek/src/sam_mmcsd.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam3u-ek/src/sam_mmcsd.c +/**************************************************************************** + * boards/arm/sam34/sam3u-ek/src/sam_mmcsd.c * * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -47,17 +47,19 @@ #ifdef CONFIG_SAM34_HSMCI -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* This needs to be extended. The card detect GPIO must be configured as an interrupt. - * when the interrupt indicating that a card has been inserted or removed is received, - * this function must call sio_mediachange() to handle that event. See - * arch/arm/src/sam34/sam_hsmci.h for more information. +/* This needs to be extended. + * The card detect GPIO must be configured as an interrupt. + * when the interrupt indicating that a card has been inserted or removed + * is received, this function must call sio_mediachange() to handle that + * event. + * See arch/arm/src/sam34/sam_hsmci.h for more information. * - * Also see the SAMA5D3x-EK implementation of this same logic. The card detect - * interrupt handling should be a drop-in. + * Also see the SAMA5D3x-EK implementation of this same logic. + * The card detect interrupt handling should be a drop-in. */ #ifdef GPIO_MCI_CD @@ -70,22 +72,22 @@ # define OK 0 #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_hsmciinit * * Description: * Initialize HSMCI support. This function is called very early in board * initialization. * - ************************************************************************************/ + ****************************************************************************/ int sam_hsmciinit(void) { @@ -98,13 +100,13 @@ int sam_hsmciinit(void) return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_cardinserted * * Description: * Check if a card is inserted into the selected HSMCI slot * - ************************************************************************************/ + ****************************************************************************/ bool sam_cardinserted(unsigned char slot) { @@ -121,13 +123,13 @@ bool sam_cardinserted(unsigned char slot) return false; } -/************************************************************************************ +/**************************************************************************** * Name: sam_writeprotected * * Description: * Check if a card is inserted into the selected HSMCI slot * - ************************************************************************************/ + ****************************************************************************/ bool sam_writeprotected(unsigned char slot) { diff --git a/boards/arm/sam34/sam3u-ek/src/sam_spi.c b/boards/arm/sam34/sam3u-ek/src/sam_spi.c index 873fe41706..b58afa0fd2 100644 --- a/boards/arm/sam34/sam3u-ek/src/sam_spi.c +++ b/boards/arm/sam34/sam3u-ek/src/sam_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam3u-ek/src/sam_spi.c +/**************************************************************************** + * boards/arm/sam34/sam3u-ek/src/sam_spi.c * * Copyright (C) 2009, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -55,17 +55,17 @@ #ifdef CONFIG_SAM34_SPI0 -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the SAM3U-EK board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_spidev_initialize(void) { @@ -73,10 +73,10 @@ void weak_function sam_spidev_initialize(void) * ZigBee support. */ - /* The touchscreen connects using NPCS2 (PC14). */ + /* The touchscreen connects using NPCS2 (PC14). */ #if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E) - sam_configgpio(GPIO_TSC_NPCS2); + sam_configgpio(GPIO_TSC_NPCS2); #endif } @@ -84,8 +84,8 @@ void weak_function sam_spidev_initialize(void) * Name: sam_spi0select, sam_spi0status, and sam_spic0mddata * * 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_spi0select is a functions tomanage the board-specific chip selects * o sam_spi0status and sam_spic0mddata: Implementations of the status @@ -106,8 +106,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). * diff --git a/boards/arm/sam34/sam3u-ek/src/sam_touchscreen.c b/boards/arm/sam34/sam3u-ek/src/sam_touchscreen.c index 2684a0ecfe..05316c289a 100644 --- a/boards/arm/sam34/sam3u-ek/src/sam_touchscreen.c +++ b/boards/arm/sam34/sam3u-ek/src/sam_touchscreen.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam3u-ek/src/sam_touchscreen.c +/**************************************************************************** + * boards/arm/sam34/sam3u-ek/src/sam_touchscreen.c * * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Included Files @@ -58,6 +58,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifdef CONFIG_INPUT_ADS7843E @@ -264,7 +265,9 @@ int sam_tsc_setup(int minor) if (ret < 0) { ierr("ERROR: Failed to initialize SPI chip select %d\n", TSC_CSNUM); + /* sam_spibus_uninitialize(dev); */ + return -ENODEV; } diff --git a/boards/arm/sam34/sam3u-ek/src/sam_usbdev.c b/boards/arm/sam34/sam3u-ek/src/sam_usbdev.c index f564db2c87..f40b119567 100644 --- a/boards/arm/sam34/sam3u-ek/src/sam_usbdev.c +++ b/boards/arm/sam34/sam3u-ek/src/sam_usbdev.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam3u-ek/src/sam_usbdev.c +/**************************************************************************** + * boards/arm/sam34/sam3u-ek/src/sam_usbdev.c * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -50,28 +50,29 @@ #include "up_arch.h" #include "sam3u-ek.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_usbsuspend * * Description: - * Board logic must provide the sam_usbsuspend logic if the USBDEV driver is - * used. This function is called whenever the USB enters or leaves suspend mode. - * This is an opportunity for the board logic to shutdown clocks, power, etc. - * while the USB is suspended. + * Board logic must provide the sam_usbsuspend logic if the USBDEV driver + * is used. + * This function is called whenever the USB enters or leaves suspend mode. + * This is an opportunity for the board logic to shutdown clocks, power, + * etc. while the USB is suspended. * - ************************************************************************************/ + ****************************************************************************/ void sam_usbsuspend(FAR struct usbdev_s *dev, bool resume) { diff --git a/boards/arm/sam34/sam3u-ek/src/sam_usbmsc.c b/boards/arm/sam34/sam3u-ek/src/sam_usbmsc.c index f644d709f6..312aa5e8e0 100644 --- a/boards/arm/sam34/sam3u-ek/src/sam_usbmsc.c +++ b/boards/arm/sam34/sam3u-ek/src/sam_usbmsc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam3u-ek/src/sam_usbmsc.c + * boards/arm/sam34/sam3u-ek/src/sam_usbmsc.c * * Copyright (C) 2009, 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -116,13 +116,13 @@ int board_usbmsc_initialize(int port) syslog(LOG_INFO, "Successfully bound SDIO to the MMC/SD driver\n"); - /* Then let's guess and say that there is a card in the slot. I need to check to - * see if the SAM3U10E-EVAL board supports a GPIO to detect if there is a card in - * the slot. + /* Then let's guess and say that there is a card in the slot. + * I need to check to see if the SAM3U10E-EVAL board supports a GPIO + * to detect if there is a card in the slot. */ - sdio_mediachange(sdio, true); - return OK; + sdio_mediachange(sdio, true); + return OK; } #endif /* CONFIG_SAM34_HSMCI */ diff --git a/boards/arm/sam34/sam4cmp-db/include/board.h b/boards/arm/sam34/sam4cmp-db/include/board.h index 9692faf08d..35d145101e 100644 --- a/boards/arm/sam34/sam4cmp-db/include/board.h +++ b/boards/arm/sam34/sam4cmp-db/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4cmp-db/include/board.h +/**************************************************************************** + * boards/arm/sam34/sam4cmp-db/include/board.h * * Copyright (C) 2016 Masayuki Ishikawa. All rights reserved. * Author: Masayuki Ishikawa @@ -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_SAM4CMP_DB_INCLUDE_BOARD_H -#define __BOARDS_ARM_SAM4CMP_DB_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_SAM34_SAM4CMP_DB_INCLUDE_BOARD_H +#define __BOARDS_ARM_SAM34_SAM4CMP_DB_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -46,13 +46,15 @@ # include #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the sam3u device is running on a 4MHz internal RC. These - * definitions will configure clocking with MCK = 48MHz, PLLA = 96, and CPU=120MHz. +/* Clocking *****************************************************************/ + +/* After power-on reset, the sam3u device is running on a 4MHz internal RC. + * These definitions will configure clocking with MCK = 48MHz, PLLA = 96, + * and CPU=120MHz. */ /* Main oscillator register settings */ @@ -87,7 +89,6 @@ #define BOARD_CKGR_PLLBR_COUNT (63 << PMC_CKGR_PLLBR_COUNT_SHIFT) #define BOARD_PLLB_FREQUENCY (92160000) - /* PMC master clock register settings */ #define BOARD_PMC_MCKR_CSS PMC_MCKR_CSS_PLLB @@ -139,4 +140,4 @@ #define BOARD_FWS 5 -#endif /* __BOARDS_ARM_SAM4CMP_DB_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_SAM34_SAM4CMP_DB_INCLUDE_BOARD_H */ diff --git a/boards/arm/sam34/sam4cmp-db/scripts/Make.defs b/boards/arm/sam34/sam4cmp-db/scripts/Make.defs index a2d8394036..9aa47e2e9a 100644 --- a/boards/arm/sam34/sam4cmp-db/scripts/Make.defs +++ b/boards/arm/sam34/sam4cmp-db/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam4cmp-db/scripts/Make.defs +# boards/arm/sam34/sam4cmp-db/scripts/Make.defs # # Copyright (C) 2016 Masayuki Ishikawa. All rights reserved. # Author: Masayuki Ishikawa diff --git a/boards/arm/sam34/sam4cmp-db/scripts/sam4cmp-db.ld b/boards/arm/sam34/sam4cmp-db/scripts/sam4cmp-db.ld index fefe55925c..643525f5e2 100644 --- a/boards/arm/sam34/sam4cmp-db/scripts/sam4cmp-db.ld +++ b/boards/arm/sam34/sam4cmp-db/scripts/sam4cmp-db.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4cmp-db/scripts/sam4cmp-db.ld + * boards/arm/sam34/sam4cmp-db/scripts/sam4cmp-db.ld * * Copyright (C) 2016 Masayuki Ishikawa. All rights reserved. * Author: Masayuki Ishikawa diff --git a/boards/arm/sam34/sam4cmp-db/src/Makefile b/boards/arm/sam34/sam4cmp-db/src/Makefile index 47d0310431..d1c6db60b1 100644 --- a/boards/arm/sam34/sam4cmp-db/src/Makefile +++ b/boards/arm/sam34/sam4cmp-db/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam4cmp-db/src/Makefile +# boards/arm/sam34/sam4cmp-db/src/Makefile # # Copyright (C) 2016 Masayuki Ishikawa. All rights reserved. # Author: Masayuki Ishikawa diff --git a/boards/arm/sam34/sam4cmp-db/src/sam4cmp-db.h b/boards/arm/sam34/sam4cmp-db/src/sam4cmp-db.h index b2cafd8a11..da0c1a9506 100644 --- a/boards/arm/sam34/sam4cmp-db/src/sam4cmp-db.h +++ b/boards/arm/sam34/sam4cmp-db/src/sam4cmp-db.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4cmp-db/src/sam4cmp-db.h +/**************************************************************************** + * boards/arm/sam34/sam4cmp-db/src/sam4cmp-db.h * * Copyright (C) 2016 Masayuki Ishikawa. All rights reserved. * Author: Masayuki Ishikawa @@ -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_SAM4CMP_DB_SRC_SAM4CMP_DB_H -#define __BOARDS_ARM_SAM4CMP_DB_SRC_SAM4CMP_DB_H +#ifndef __BOARDS_ARM_SAM34_SAM4CMP_DB_SRC_SAM4CMP_DB_H +#define __BOARDS_ARM_SAM34_SAM4CMP_DB_SRC_SAM4CMP_DB_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -50,31 +50,31 @@ #include "hardware/sam_pinmap.h" -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_bringup * * Description: * Bring up board features * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_LIB_BOARDCTL) || defined(CONFIG_BOARD_LATE_INITIALIZE) int sam_bringup(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAM4CMP_DB_SRC_SAM4CMP_DB_H */ +#endif /* __BOARDS_ARM_SAM34_SAM4CMP_DB_SRC_SAM4CMP_DB_H */ diff --git a/boards/arm/sam34/sam4cmp-db/src/sam_appinit.c b/boards/arm/sam34/sam4cmp-db/src/sam_appinit.c index 60e90c15c7..a545a21a0f 100644 --- a/boards/arm/sam34/sam4cmp-db/src/sam_appinit.c +++ b/boards/arm/sam34/sam4cmp-db/src/sam_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sam4cmp-db/src/sam_appinit.c + * boards/arm/sam34/sam4cmp-db/src/sam_appinit.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4cmp-db/src/sam_boot.c b/boards/arm/sam34/sam4cmp-db/src/sam_boot.c index a9d5330d69..4cb8deab7f 100644 --- a/boards/arm/sam34/sam4cmp-db/src/sam_boot.c +++ b/boards/arm/sam34/sam4cmp-db/src/sam_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4cmp-db/src/sam_boot.c +/**************************************************************************** + * boards/arm/sam34/sam4cmp-db/src/sam_boot.c * * Copyright (C) 2016 Masayuki Ishikawa. All rights reserved. * Author: Masayuki Ishikawa @@ -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 @@ -45,19 +45,20 @@ #include "sam4cmp-db.h" -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_boardinitialize * * Description: - * All SAM3/4 architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All SAM3/4 architectures must provide the following entry point. + * This entry point is called early in the intitialization -- after all + * memory has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void sam_boardinitialize(void) { @@ -69,9 +70,10 @@ void sam_boardinitialize(void) * Description: * If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional * initialization call will be performed in the boot-up sequence to a - * function called board_late_initialize(). board_late_initialize() will be - * called immediately after up_intitialize() is called and just before the - * initial application is started. This additional initialization phase + * function called board_late_initialize(). + * board_late_initialize() will be called immediately after + * up_intitialize() is called and just before the initial application + * is started. This additional initialization phase * may be used, for example, to initialize board-specific device drivers. * ****************************************************************************/ diff --git a/boards/arm/sam34/sam4cmp-db/src/sam_bringup.c b/boards/arm/sam34/sam4cmp-db/src/sam_bringup.c index fbfe1a4106..4e33ca9208 100644 --- a/boards/arm/sam34/sam4cmp-db/src/sam_bringup.c +++ b/boards/arm/sam34/sam4cmp-db/src/sam_bringup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sam4cmp-db/src/sam_bringup.c + * boards/arm/sam34/sam4cmp-db/src/sam_bringup.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4e-ek/include/board.h b/boards/arm/sam34/sam4e-ek/include/board.h index 8695cb1ec5..680ef72daa 100644 --- a/boards/arm/sam34/sam4e-ek/include/board.h +++ b/boards/arm/sam34/sam4e-ek/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4e-ek/include/board.h +/**************************************************************************** + * boards/arm/sam34/sam4e-ek/include/board.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,14 +31,14 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __ARCH_SAM4E_EK_INCLUDE_BOARD_H -#define __ARCH_SAM4E_EK_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_SAM34_SAM4E_EK_INCLUDE_BOARD_H +#define __BOARDS_ARM_SAM34_SAM4E_EK_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -50,25 +50,26 @@ # endif #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAM4E16 device is running out of the Master Clock using - * the Fast RC Oscillator running at 4 MHz. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAM4E16 device is running out of the Master + * Clock using the Fast RC Oscillator running at 4 MHz. * * MAINOSC: Frequency = 12MHz (crystal) * * CONFIG_SAM4EEK_120MHZ - * PLLA: PLL Divider = 1, Multiplier = 20 to generate PLLACK = 240MHz - * Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 120MHz - * CPU clock: 120MHz + * PLLA: PLL Divider = 1, Multiplier = 20 to generate PLLACK = 240MHz + * Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 120MHz + * CPU clock: 120MHz * * CONFIG_SAM4EEK_96MHZ - * PLLA: PLL Divider = 1, Multiplier = 16 to generate PLLACK = 192MHz - * Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 96MHz - * CPU clock: 96MHz + * PLLA: PLL Divider = 1, Multiplier = 16 to generate PLLACK = 192MHz + * Master Clock (MCK): Source = PLLACK, Prescalar = 1 to generate MCK = 96MHz + * CPU clock: 96MHz */ /* Main oscillator register settings. @@ -147,28 +148,42 @@ */ #ifdef CONFIG_SAM4EEK_120MHZ - /* MCK = 120MHz, CLKDIV = 149 w/o CLKODD, MCI_SPEED = 120MHz / (2*149 + 0 + 2) = 400 KHz */ + +/* MCK = 120MHz, CLKDIV = 149 w/o CLKODD, + * MCI_SPEED = 120MHz / (2*149 + 0 + 2) = 400 KHz + */ # define HSMCI_INIT_CLKDIV (149 << HSMCI_MR_CLKDIV_SHIFT) - /* MCK = 120MHz, CLKDIV = 2 w/o CLKODD, MCI_SPEED = 120MHz / (2*2 + 0 + 2) = 20 MHz */ +/* MCK = 120MHz, CLKDIV = 2 w/o CLKODD, + * MCI_SPEED = 120MHz / (2*2 + 0 + 2) = 20 MHz + */ # define HSMCI_MMCXFR_CLKDIV (3 << HSMCI_MR_CLKDIV_SHIFT) - /* MCK = 120MHz, CLKDIV = 1 w/ CLKODD, MCI_SPEED = 120MHz / (2*1 + 1 + 2) = 24 MHz */ +/* MCK = 120MHz, CLKDIV = 1 w/ CLKODD, + * MCI_SPEED = 120MHz / (2*1 + 1 + 2) = 24 MHz + */ # define HSMCI_SDXFR_CLKDIV ((1 << HSMCI_MR_CLKDIV_SHIFT) | HSMCI_MR_CLKODD) #else -/* MCK = 96MHz, CLKDIV = 119, w/o CLKODD, MCI_SPEED = 96MHz / (2 * 119 + 0 + 2) = 400 KHz */ + +/* MCK = 96MHz, CLKDIV = 119, w/o CLKODD, + * MCI_SPEED = 96MHz / (2 * 119 + 0 + 2) = 400 KHz + */ # define HSMCI_INIT_CLKDIV (119 << HSMCI_MR_CLKDIV_SHIFT) -/* MCK = 96MHz, CLKDIV = 1 w/ CLKODD, MCI_SPEED = 96MHz / (2*1 + 1 + 2) = 19.2 MHz */ +/* MCK = 96MHz, CLKDIV = 1 w/ CLKODD, + * MCI_SPEED = 96MHz / (2*1 + 1 + 2) = 19.2 MHz + */ # define HSMCI_MMCXFR_CLKDIV ((3 << HSMCI_MR_CLKDIV_SHIFT) | HSMCI_MR_CLKODD) -/* MCK = 96MHz, CLKDIV = 1 w/o CLKODD, MCI_SPEED = 96MHz / (2*1 + 0 + 2) = 24 MHz */ +/* MCK = 96MHz, CLKDIV = 1 w/o CLKODD, + * MCI_SPEED = 96MHz / (2*1 + 0 + 2) = 24 MHz + */ # define HSMCI_SDXFR_CLKDIV (1 << HSMCI_MR_CLKDIV_SHIFT) #endif @@ -204,7 +219,8 @@ # define BOARD_FWS 4 #endif -/* LED definitions ******************************************************************/ +/* LED definitions **********************************************************/ + /* The SAM4E-EK board has three, user-controllable LEDs labelled D2 (blue), * D3 (amber), and D4 (green) on the board. Usage of these LEDs is defined * in include/board.h and src/up_leds.c. They are encoded as follows: @@ -251,7 +267,8 @@ #define BOARD_LED_D2_BIT (1 << BOARD_LED_D2) #define BOARD_LED_D4_BIT (1 << BOARD_LED_D4) -/* Button definitions ***************************************************************/ +/* Button definitions *******************************************************/ + /* Four buttons for software inputs: * * PA1 BUTTON_SCROLL-UP Grounded @@ -265,9 +282,9 @@ #define BUTTON_WAKU 4 /* Bit 2: Waku button */ #define BUTTON_TAMP 8 /* Bit 3: Tamp button */ -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ @@ -280,20 +297,22 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_lcdclear * * Description: - * This is a non-standard LCD interface just for the SAM4e-EK board. Because - * of the various rotations, clearing the display in the normal way by writing a - * sequences of runs that covers the entire display can be very slow. Here the - * display is cleared by simply setting all GRAM memory to the specified color. + * This is a non-standard LCD interface just for the SAM4e-EK board. + * Because of the various rotations, clearing the display in the normal way + * by writing a sequences of runs that covers the entire display can be + * very slow. + * Here the display is cleared by simply setting all GRAM memory to the + * specified color. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAM4EEK_LCD_RGB565) void sam_lcdclear(uint16_t color); @@ -307,4 +326,4 @@ void sam_lcdclear(uint32_t color); #endif #endif /* __ASSEMBLY__ */ -#endif /* __ARCH_SAM4E_EK_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_SAM34_SAM4E_EK_INCLUDE_BOARD_H */ diff --git a/boards/arm/sam34/sam4e-ek/scripts/Make.defs b/boards/arm/sam34/sam4e-ek/scripts/Make.defs index ac445678d9..5acd2f0672 100644 --- a/boards/arm/sam34/sam4e-ek/scripts/Make.defs +++ b/boards/arm/sam34/sam4e-ek/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam4e-ek/scripts/Make.defs +# boards/arm/sam34/sam4e-ek/scripts/Make.defs # # Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4e-ek/scripts/flash.ld b/boards/arm/sam34/sam4e-ek/scripts/flash.ld index 4e9e16c9b4..267b1139dd 100644 --- a/boards/arm/sam34/sam4e-ek/scripts/flash.ld +++ b/boards/arm/sam34/sam4e-ek/scripts/flash.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4e-ek/scripts/flash.ld + * boards/arm/sam34/sam4e-ek/scripts/flash.ld * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4e-ek/src/Makefile b/boards/arm/sam34/sam4e-ek/src/Makefile index 7f5f57a415..7032e61f82 100644 --- a/boards/arm/sam34/sam4e-ek/src/Makefile +++ b/boards/arm/sam34/sam4e-ek/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam4e-ek/src/Makefile +# boards/arm/sam34/sam4e-ek/src/Makefile # # Copyright (C) 2014 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4e-ek/src/sam4e-ek.h b/boards/arm/sam34/sam4e-ek/src/sam4e-ek.h index 9b9086cd65..cce6333526 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam4e-ek.h +++ b/boards/arm/sam34/sam4e-ek/src/sam4e-ek.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4e-ek/src/sam4e-ek.h +/**************************************************************************** + * boards/arm/sam34/sam4e-ek/src/sam4e-ek.h * * Copyright (C) 2014, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_SAM4E_EK_SRC_SAM4E_EK_H -#define __BOARDS_ARM_SAM4E_EK_SRC_SAM4E_EK_H +#ifndef __BOARDS_ARM_SAM34_SAM4E_EK_SRC_SAM4E_EK_H +#define __BOARDS_ARM_SAM34_SAM4E_EK_SRC_SAM4E_EK_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -50,10 +50,11 @@ #include "hardware/sam_pinmap.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ + ****************************************************************************/ + +/* Configuration ************************************************************/ #define HAVE_HSMCI 1 #define HAVE_AT25 1 @@ -62,6 +63,7 @@ #define HAVE_NETWORK 1 /* HSMCI */ + /* Can't support MMC/SD if the card interface is not enabled */ #if !defined(CONFIG_SAM34_HSMCI) @@ -83,6 +85,7 @@ #endif /* AT25 Serial FLASH */ + /* Can't support the AT25 device if it SPI0 or AT25 support are not enabled */ #if !defined(CONFIG_SAM34_SPI0) || !defined(CONFIG_MTD_AT25) @@ -116,6 +119,7 @@ #endif /* USB Device */ + /* CONFIG_SAM34_UDP and CONFIG_USBDEV must be defined, or there is no USB * device. */ @@ -140,16 +144,17 @@ # undef HAVE_NETWORK #endif -/* SAM4E-EK GPIO Pin Definitions ****************************************************/ +/* SAM4E-EK GPIO Pin Definitions ********************************************/ /* LCD: * - * The SAM4E-EK carries a TFT transmissive LCD module with touch panel, FTM280C34D. - * Its integrated driver IC is ILI9325. The LCD display area is 2.8 inches diagonally - * measured, with a native resolution of 240 x 320 dots. + * The SAM4E-EK carries a TFT transmissive LCD module with touch panel, + * FTM280C34D. + * Its integrated driver IC is ILI9325. The LCD display area is 2.8 inches + * diagonally measured, with a native resolution of 240 x 320 dots. * - * The SAM4E16 communicates with the LCD through PIOC where an 8-bit parallel "8080- - * like" protocol data bus has to be implemented in software. + * The SAM4E16 communicates with the LCD through PIOC where an 8-bit parallel + * "8080-like" protocol data bus has to be implemented in software. * * ---- ----- --------- -------------------------------- * PIN PIO SIGNAL NOTES @@ -198,15 +203,16 @@ * 39 NC * ---- ----- --------- -------------------------------- * - * LCD backlight is made of 4 white chip LEDs in parallel, driven by an AAT3155 - * charge pump, MN4. The AAT3155 is controlled by the SAM3U4E through a single line - * Simple Serial Control (S2Cwire) interface, which permits to enable, disable, and - * set the LED drive current (LED brightness control) from a 32-level logarithmic - * scale. Four resistors R93/R94/R95/R96 are implemented for optional current + * LCD backlight is made of 4 white chip LEDs in parallel, driven by an + * AAT3155 charge pump, MN4. + * The AAT3155 is controlled by the SAM3U4E through a single line + * Simple Serial Control (S2Cwire) interface, which permits to enable, + * disable, and set the LED drive current (LED brightness control) from + * a 32-level logarithmic scale. + * Four resistors R93/R94/R95/R96 are implemented for optional current * limitation. */ - /* LCD Backlight pin definition. */ #define GPIO_LCD_BKL (GPIO_OUTPUT | GPIO_CFG_DEFAULT | GPIO_OUTPUT_CLEAR | \ @@ -215,9 +221,9 @@ /* ADS7843 Touchscreen controller (TSC) * * The LCD module integrates a 4-wire touch screen panel controlled by - * MN5, ADS7843, which is a slave device on the SAM3U4E SPI bus. The ADS7843 touch - * ADC auxiliary inputs IN3/IN4 are connected to test points for optional function - * extension. + * MN5, ADS7843, which is a slave device on the SAM3U4E SPI bus. + * The ADS7843 touch ADC auxiliary inputs IN3/IN4 are connected to test + * points for optional function extension. * * ------ ------- * GPIO PIN @@ -233,8 +239,8 @@ * The IRQ is active low and pulled up. * * Pen Interrupt. Open anode output, requires 10kO to 100kO pull-up resistor - * externally. There is a 100KO pull-up on the SAM4E-EK board so no additional - * pull-up should be required. + * externally. There is a 100KO pull-up on the SAM4E-EK board so no + * additional pull-up should be required. * * BUSY is high impedance when CS is high (not selected). When CS is * is low, BUSY is active high. Since the pin is pulled up, it will appear @@ -333,12 +339,15 @@ * PA17 BUSY * ------ ------- * - * Chip select pin connected to the touchscreen controller and to the ZigBee module - * connector. Notice that the touchscreen chip select is implemented as a GPIO - * OUTPUT that must be controlled by board-specific. This is because the ADS7843E - * driver must be able to sample the device BUSY GPIO input between SPI transfers. - * However, the AD7843E will tri-state the BUSY input whenever the chip select is - * de-asserted. So the only option is to control the chip select manually and hold + * Chip select pin connected to the touchscreen controller and to the ZigBee + * module connector. + * Notice that the touchscreen chip select is implemented as a GPIO + * OUTPUT that must be controlled by board-specific. + * This is because the ADS7843E driver must be able to sample the device BUSY + * GPIO input between SPI transfers. + * However, the AD7843E will tri-state the BUSY input whenever the chip + * select is de-asserted. + * So the only option is to control the chip select manually and hold * it low throughout the SPI transfer. */ @@ -362,37 +371,37 @@ GPIO_PORT_PIOA | GPIO_PIN5) #define FLASH_CSNUM 3 -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the SAM4E-EK board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_spidev_initialize(void); -/************************************************************************************ +/**************************************************************************** * Name: sam_hsmci_initialize * * Description: * Initialize HSMCI support * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_HSMCI int sam_hsmci_initialize(int minor); @@ -400,25 +409,25 @@ int sam_hsmci_initialize(int minor); # define sam_hsmci_initialize(minor) (-ENOSYS) #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_netinitialize * * Description: * Configure board resources to support networking. * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_NETWORK void weak_function sam_netinitialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_cardinserted * * Description: * Check if a card is inserted into the selected HSMCI slot * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_HSMCI bool sam_cardinserted(int slotno); @@ -426,13 +435,13 @@ bool sam_cardinserted(int slotno); # define sam_cardinserted(slotno) (false) #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_writeprotected * * Description: * Check if the card in the MMCSD slot is write protected * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_HSMCI bool sam_writeprotected(int slotno); @@ -440,14 +449,14 @@ bool sam_writeprotected(int slotno); # define sam_writeprotected(slotno) (false) #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_at25_automount * * Description: * Initialize, configure, and mount the AT25 serial FLASH. The FLASH will * be mounted at /dev/at25. * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_AT25 int sam_at25_automount(int minor); @@ -455,26 +464,27 @@ int sam_at25_automount(int minor); # define sam_at25_automount(minor) (-ENOSYS) #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_tsc_setup * * Description: - * This function is called by board-bringup logic to configure the touchscreen - * device. This function will register the driver as /dev/inputN where N is the + * This function is called by board-bringup logic to configure the + * touchscreen device. + * This function will register the driver as /dev/inputN where N is the * minor device number. * * Input Parameters: * minor - The input device minor number * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to - * indicate the nature of the failure. + * Zero is returned on success. Otherwise, a negated errno value is + * returned to indicate the nature of the failure. * - ***********************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_INPUT_ADS7843E int sam_tsc_setup(int minor); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAM4E_EK_SRC_SAM4E_EK_H */ +#endif /* __BOARDS_ARM_SAM34_SAM4E_EK_SRC_SAM4E_EK_H */ diff --git a/boards/arm/sam34/sam4e-ek/src/sam_ads7843e.c b/boards/arm/sam34/sam4e-ek/src/sam_ads7843e.c index 287e566b0d..a94d01efbc 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_ads7843e.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_ads7843e.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4e-ek/src/sam_ads7843e.c +/**************************************************************************** + * boards/arm/sam34/sam4e-ek/src/sam_ads7843e.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Included Files @@ -60,6 +60,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifndef CONFIG_SAM34_SPI0 @@ -261,7 +262,9 @@ int sam_tsc_setup(int minor) if (ret < 0) { ierr("ERROR: Failed to initialize SPI chip select %d\n", TSC_CSNUM); + /* sam_spibus_uninitialize(dev); */ + return -ENODEV; } diff --git a/boards/arm/sam34/sam4e-ek/src/sam_appinit.c b/boards/arm/sam34/sam4e-ek/src/sam_appinit.c index 38c239602f..45753beec7 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_appinit.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sam4e-ek/src/sam_appinit.c + * boards/arm/sam34/sam4e-ek/src/sam_appinit.c * * Copyright (C) 2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4e-ek/src/sam_at25.c b/boards/arm/sam34/sam4e-ek/src/sam_at25.c index 27c61c7c9e..282aa61011 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_at25.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_at25.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sam4e-ek/src/sam_at25.c + * boards/arm/sam34/sam4e-ek/src/sam_at25.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4e-ek/src/sam_boot.c b/boards/arm/sam34/sam4e-ek/src/sam_boot.c index f623131fb8..682394ba48 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_boot.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4e-ek/src/sam_boot.c +/**************************************************************************** + * boards/arm/sam34/sam4e-ek/src/sam_boot.c * * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -47,21 +47,21 @@ #include "up_arch.h" #include "sam4e-ek.h" -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: board_config_usart1 * * Description: - * USART1: To avoid any electrical conflict, the RS232 and RS485 transceiver are - * isolated from the receiving line PA21. + * USART1: To avoid any electrical conflict, the RS232 and RS485 + * transceiver are isolated from the receiving line PA21. * * - Chose RS485 channel: Close 1-2 pins on JP11 and set PA23 to high level * - Chose RS232 channel: Close 2-3 pins on JP11 and set PA23 to low level * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAM34_USART1 static inline void board_config_usart1(void) @@ -76,19 +76,20 @@ static inline void board_config_usart1(void) # define board_config_usart1() #endif -/************************************************************************************ +/**************************************************************************** * 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) { @@ -96,8 +97,8 @@ void sam_boardinitialize(void) board_config_usart1(); - /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function - * sam_spidev_initialize() has been brought into the link. + /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak + * function sam_spidev_initialize() has been brought into the link. */ #ifdef CONFIG_SAM34_SPI0 @@ -107,9 +108,9 @@ void sam_boardinitialize(void) } #endif - /* Configure board resources to support networkingif the 1) networking is enabled, - * 2) the EMAC module is enabled, and 2) the weak function sam_netinitialize() - * has been brought into the build. + /* Configure board resources to support networkingif the 1) networking is + * enabled, 2) the EMAC module is enabled, and 2) the weak function + * sam_netinitialize() has been brought into the build. */ #ifdef HAVE_NETWORK diff --git a/boards/arm/sam34/sam4e-ek/src/sam_buttons.c b/boards/arm/sam34/sam4e-ek/src/sam_buttons.c index 05b489cefd..fe7341383f 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_buttons.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4e-ek/src/sam_buttons.c + * boards/arm/sam34/sam4e-ek/src/sam_buttons.c * * Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -170,16 +170,20 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) switch (id) { case BUTTON_SCROLLUP: - return board_button_irqx(GPIO_SCROLLUP, IRQ_SCROLLUP, irqhandler, arg); + return board_button_irqx(GPIO_SCROLLUP, IRQ_SCROLLUP, + irqhandler, arg); case BUTTON_SCROLLDOWN: - return board_button_irqx(GPIO_SCROLLDWN, IRQ_SCROLLDWN, irqhandler, arg); + return board_button_irqx(GPIO_SCROLLDWN, IRQ_SCROLLDWN, + irqhandler, arg); case BUTTON_WAKU: - return board_button_irqx(GPIO_WAKU, IRQ_WAKU, irqhandler, arg); + return board_button_irqx(GPIO_WAKU, IRQ_WAKU, + irqhandler, arg); case BUTTON_TAMP: - return board_button_irqx(GPIO_TAMP, IRQ_TAMP, irqhandler, arg); + return board_button_irqx(GPIO_TAMP, IRQ_TAMP, + irqhandler, arg); default: return -EINVAL; diff --git a/boards/arm/sam34/sam4e-ek/src/sam_ethernet.c b/boards/arm/sam34/sam4e-ek/src/sam_ethernet.c index 0db8988007..ce22f1be6e 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_ethernet.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_ethernet.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4e-ek/src/sam_ethernet.c +/**************************************************************************** + * boards/arm/sam34/sam4e-ek/src/sam_ethernet.c * * Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -62,13 +62,14 @@ #ifdef HAVE_NETWORK -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #define SAM34_EMAC_DEVNAME "eth0" /* Debug ********************************************************************/ + /* Extra, in-depth debug output that is only available if * CONFIG_NETDEV_PHY_DEBUG us defined. */ @@ -83,13 +84,13 @@ # define phyinfo(x...) #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_emac_phy_enable and sam_gmac_enable - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAM34_GPIOD_IRQ static void sam_emac_phy_enable(bool enable) @@ -106,17 +107,17 @@ static void sam_emac_phy_enable(bool enable) } #endif -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_netinitialize * * Description: * Configure board resources to support networking. * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_netinitialize(void) { @@ -253,5 +254,4 @@ int arch_phy_irq(FAR const char *intf, xcpt_t handler, void *arg, return OK; } #endif /* CONFIG_SAM34_GPIOD_IRQ */ - #endif /* HAVE_NETWORK */ diff --git a/boards/arm/sam34/sam4e-ek/src/sam_hsmci.c b/boards/arm/sam34/sam4e-ek/src/sam_hsmci.c index 92eb8f7ba1..a41dbf9a46 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_hsmci.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_hsmci.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sam4e-ek/src/sam_hsmci.c + * boards/arm/sam34/sam4e-ek/src/sam_hsmci.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -61,6 +61,7 @@ /**************************************************************************** * Private Types ****************************************************************************/ + /* This structure holds static information unique to one HSMCI peripheral */ struct sam_hsmci_state_s @@ -111,7 +112,7 @@ static int sam_hsmci_cardetect(int irq, void *regs, FAR void *arg) sdio_mediachange(g_hsmci.hsmci, inserted); } - return OK; + return OK; } /**************************************************************************** @@ -139,6 +140,7 @@ int sam_hsmci_initialize(int minor) sam_configgpio(GPIO_MCI_CD); /* Mount the SDIO-based MMC/SD block driver */ + /* First, get an instance of the SDIO interface */ g_hsmci.hsmci = sdio_initialize(0); diff --git a/boards/arm/sam34/sam4e-ek/src/sam_ili9325.c b/boards/arm/sam34/sam4e-ek/src/sam_ili9325.c index 006d482d18..467be12484 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_ili9325.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_ili9325.c @@ -1,21 +1,24 @@ -/************************************************************************************ - * boards/sam4e-ek/src/sam_ili9335.c +/**************************************************************************** + * boards/arm/sam34/sam4e-ek/src/sam_ili9335.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: * - This driver is a modification of the Shenzhou ILI9325 LCD driver. - * - ILI9325 Datasheet, Version: V0.43, ILI9325DS_V0.43.pdf, ILI TECHNOLOGY CORP., + * - ILI9325 Datasheet, Version: V0.43, ILI9325DS_V0.43.pdf, + * ILI TECHNOLOGY CORP., * - SAM4Ex Datasheet, Atmel * - Atmel ILI9325 Sample code for the SAM4S * - * Some the LCD and SMC initialization logic comes from Atmel sample code for the - * SAM4S. The Atmel sample code has a BSD-like license with an additional + * Some the LCD and SMC initialization logic comes from Atmel sample code + * for the SAM4S. + * The Atmel sample code has a BSD-like license with an additional * requirement that restricts the code from being used on anything but Atmel * microprocessors. I do not believe that this file "derives" from the Atmel - * sample code nor do I believe that it contains anything but generally available - * ILI9325 and SAM4x logic. Credit, however, needs to go where it is due. + * sample code nor do I believe that it contains anything but generally + * available ILI9325 and SAM4x logic. + * Credit, however, needs to go where it is due. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -44,16 +47,17 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************** +/**************************************************************************** * - * The SAM4E-EK carries a TFT transmissive LCD module with touch panel, FTM280C34D. - * Its integrated driver IC is ILI9325. The LCD display area is 2.8 inches diagonally - * measured, with a native resolution of 240 x 320 dots. + * The SAM4E-EK carries a TFT transmissive LCD module with touch panel, + * FTM280C34D. + * Its integrated driver IC is ILI9325. The LCD display area is 2.8 inches + * diagonally measured, with a native resolution of 240 x 320 dots. * - * The SAM4E16 communicates with the LCD through PIOC where an 8-bit parallel "8080- - * like" protocol data bus has to be implemented in software. + * The SAM4E16 communicates with the LCD through PIOC where an 8-bit parallel + * "8080-like" protocol data bus has to be implemented in software. * * ---- ----- --------- -------------------------------- * PIN PIO SIGNAL NOTES @@ -102,18 +106,20 @@ * 39 NC * ---- ----- --------- -------------------------------- * - * LCD backlight is made of 4 white chip LEDs in parallel, driven by an AAT3155 - * charge pump, MN4. The AAT3155 is controlled by the SAM3U4E through a single line - * Simple Serial Control (S2Cwire) interface, which permits to enable, disable, and - * set the LED drive current (LED brightness control) from a 32-level logarithmic - * scale. Four resistors R93/R94/R95/R96 are implemented for optional current + * LCD backlight is made of 4 white chip LEDs in parallel, driven by an + * AAT3155 charge pump, MN4. + * The AAT3155 is controlled by the SAM3U4E through a single line Simple + * Serial Control (S2Cwire) interface, which permits to enable, disable, and + * set the LED drive current (LED brightness control) from a 32-level + * logarithmic scale. + * Four resistors R93/R94/R95/R96 are implemented for optional current * limitation. * - **************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -142,9 +148,10 @@ #ifdef CONFIG_LCD -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + /* SMC must be selected */ #if !defined(CONFIG_SAM34_SMC) @@ -197,7 +204,8 @@ # define CONFIG_SAM4EEK_LCD_BGCOLOR 0 #endif -/* Display/Color Properties ***********************************************************/ +/* Display/Color Properties *************************************************/ + /* Display Resolution */ #if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE) @@ -233,7 +241,8 @@ # define RGB_BLUE(rgb) ( (rgb) & 0xff) #endif -/* SAM4E-EK LCD Hardware Definitions **************************************************/ +/* SAM4E-EK LCD Hardware Definitions ****************************************/ + /* LCD /CS is CE4, Bank 3 of NOR/SRAM Bank 1~4 */ #define SAM_LCD_BASE ((uintptr_t)SAM_EXTCS1_BASE) @@ -251,11 +260,13 @@ #define BKL_ENABLE_DURATION (128*1024) #define BKL_DISABLE_DURATION (128*1024) -/************************************************************************************ +/**************************************************************************** * Private Type Definition - ************************************************************************************/ + ****************************************************************************/ -/* Type definition for the correct size of one pixel (from the application standpoint). */ +/* Type definition for the correct size of one pixel + * (from the application standpoint). + */ #ifdef CONFIG_SAM4EEK_LCD_RGB565 typedef uint16_t sam_color_t; @@ -285,9 +296,10 @@ struct sam_dev_s bool output; /* True: Configured for output */ }; -/************************************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************************************/ + ****************************************************************************/ + /* Low Level LCD access */ static void sam_write_reg(uint8_t regaddr, uint16_t regval); @@ -305,16 +317,19 @@ static int sam_poweroff(FAR struct sam_dev_s *priv); /* LCD Data Transfer Methods */ -static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, - size_t npixels); -static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, - size_t npixels); +static int sam_putrun(fb_coord_t row, fb_coord_t col, + FAR const uint8_t *buffer, + size_t npixels); +static int sam_getrun(fb_coord_t row, fb_coord_t col, + FAR uint8_t *buffer, + size_t npixels); /* LCD Configuration */ static int sam_getvideoinfo(FAR struct lcd_dev_s *dev, FAR struct fb_videoinfo_s *vinfo); -static int sam_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno, +static int sam_getplaneinfo(FAR struct lcd_dev_s *dev, + unsigned int planeno, FAR struct lcd_planeinfo_s *pinfo); /* LCD RGB Mapping */ @@ -343,9 +358,10 @@ static inline void sam_smc_initialize(void); static void sam_lcd9325_initialize(void); static inline int sam_lcd_initialize(void); -/************************************************************************************ +/**************************************************************************** * Private Data - ************************************************************************************/ + ****************************************************************************/ + /* LCD GPIO configurations */ static const uint32_t g_lcdpin[] = @@ -403,6 +419,7 @@ static struct sam_dev_s g_lcddev = .getplaneinfo = sam_getplaneinfo, /* LCD RGB Mapping -- Not supported */ + /* Cursor Controls -- Not supported */ /* LCD Specific Controls */ @@ -414,17 +431,17 @@ static struct sam_dev_s g_lcddev = }, }; -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_write_reg * * Description: * Write to an LCD register * - ************************************************************************************/ + ****************************************************************************/ static void sam_write_reg(uint8_t regaddr, uint16_t regval) { @@ -437,13 +454,13 @@ static void sam_write_reg(uint8_t regaddr, uint16_t regval) LCD_DATA = (uint8_t)(regval & 0xff); } -/************************************************************************************ +/**************************************************************************** * Name: sam_read_reg * * Description: * Read from an LCD register * - ************************************************************************************/ + ****************************************************************************/ static uint16_t sam_read_reg(uint8_t regaddr) { @@ -460,13 +477,13 @@ static uint16_t sam_read_reg(uint8_t regaddr) return regval; } -/************************************************************************************ +/**************************************************************************** * Name: sam_gram_prepare * * Description: * Setup to read or write multiple pixels to the GRAM memory * - ************************************************************************************/ + ****************************************************************************/ static inline void sam_gram_prepare(void) { @@ -474,13 +491,13 @@ static inline void sam_gram_prepare(void) LCD_INDEX = ILI9325_GRAM_DATA_REG; } -/************************************************************************************ +/**************************************************************************** * Name: sam_gram_write * * Description: * Write one pixel to the GRAM memory * - ************************************************************************************/ + ****************************************************************************/ static inline void sam_gram_write(sam_color_t color) { @@ -489,13 +506,13 @@ static inline void sam_gram_write(sam_color_t color) LCD_DATA = RGB_BLUE(color); } -/************************************************************************************ +/**************************************************************************** * Name: sam_gram_read * * Description: * Read one 16-bit pixel to the GRAM memory * - ************************************************************************************/ + ****************************************************************************/ static inline sam_color_t sam_gram_read(void) { @@ -517,19 +534,20 @@ static inline sam_color_t sam_gram_read(void) /* RRRR RGGG GGGB BBBB -> 0000 0000 RRRR R000 GGGG GG00 BBBB B000 */ return ((value[0] & 0xf8)) | - ((value[0] & 0x07) << 13) | ((value[1] & 0xE0) << 5) | + ((value[0] & 0x07) << 13) | ((value[1] & 0xe0) << 5) | ((value[1] & 0x1f) << 19); #endif } -/************************************************************************************ +/**************************************************************************** * Name: sam_set_cursor * * Description: - * Set the cursor position. In landscape mode, the "column" is actually the physical + * Set the cursor position. + * In landscape mode, the "column" is actually the physical * Y position and the "row" is the physical X position. * - ************************************************************************************/ + ****************************************************************************/ static void sam_set_cursor(uint16_t col, uint16_t row) { @@ -537,7 +555,7 @@ static void sam_set_cursor(uint16_t col, uint16_t row) sam_write_reg(ILI9325_VERTICAL_GRAM_ADDR_SET, col); } -/************************************************************************************ +/**************************************************************************** * Name: sam_dumprun * * Description: @@ -546,12 +564,14 @@ static void sam_set_cursor(uint16_t col, uint16_t row) * run - The buffer in containing the run read to be dumped * npixels - The number of pixels to dump * - ************************************************************************************/ + ****************************************************************************/ #if 0 /* Sometimes useful */ -static void sam_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixels) +static void sam_dumprun(FAR const char *msg, FAR uint16_t *run, + size_t npixels) { - int i, j; + int i; + int j; syslog(LOG_DEBUG, "\n%s:\n", msg); for (i = 0; i < npixels; i += 16) @@ -567,13 +587,13 @@ static void sam_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixels) } #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_disable_backlight * * Description: * Turn the backlight off. * - ************************************************************************************/ + ****************************************************************************/ static void sam_disable_backlight(void) { @@ -583,13 +603,13 @@ static void sam_disable_backlight(void) for (delay = 0; delay < BKL_DISABLE_DURATION; delay++); } -/************************************************************************************ +/**************************************************************************** * Name: sam_set_backlight * * Description: * The the backlight to the level associated with the specified power value. * - ************************************************************************************/ + ****************************************************************************/ static void sam_set_backlight(unsigned int power) { @@ -626,14 +646,15 @@ static void sam_set_backlight(unsigned int power) for (delay = 0; delay < BKL_ENABLE_DURATION; delay++); } -/************************************************************************************ +/**************************************************************************** * Name: sam_poweroff * * Description: - * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On - * backlit LCDs, this setting may correspond to the backlight setting. + * Enable/disable LCD panel power + * (0: full off - CONFIG_LCD_MAXPOWER: full on). On backlit LCDs, + * this setting may correspond to the backlight setting. * - ************************************************************************************/ + ****************************************************************************/ static int sam_poweroff(FAR struct sam_dev_s *priv) { @@ -651,7 +672,7 @@ static int sam_poweroff(FAR struct sam_dev_s *priv) return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_putrun * * Description: @@ -663,10 +684,11 @@ static int sam_poweroff(FAR struct sam_dev_s *priv) * npixels - The number of pixels to write to the LCD * (range: 0 < npixels <= xres-col) * - ************************************************************************************/ + ****************************************************************************/ -static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, - size_t npixels) +static int sam_putrun(fb_coord_t row, fb_coord_t col, + FAR const uint8_t *buffer, + size_t npixels) { #if defined(CONFIG_SAM4EEK_LCD_RGB565) FAR const uint16_t *src = (FAR const uint16_t*)buffer; @@ -689,8 +711,8 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, sam_gram_prepare(); - /* Then transfer the pixels as 3 8-bit transfers, each providing 6 bits of the - * color component in the MS bits. + /* Then transfer the pixels as 3 8-bit transfers, each providing 6 bits of + * the color component in the MS bits. */ #if defined(CONFIG_SAM4EEK_LCD_RGB565) || defined(CONFIG_SAM4EEK_LCD_RGB32) @@ -713,7 +735,7 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_getrun * * Description: @@ -725,7 +747,7 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, * npixels - The number of pixels to read from the LCD * (range: 0 < npixels <= xres-col) * - ************************************************************************************/ + ****************************************************************************/ static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, size_t npixels) @@ -742,8 +764,8 @@ static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, sam_gram_prepare(); - /* Then transfer the pixels, reading RGB565 and converting this to the format - * expected by the caller. + /* Then transfer the pixels, reading RGB565 and converting this to the + * format expected by the caller. */ while (npixels--) @@ -758,11 +780,13 @@ static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, /* Convert and transfer the color to the user buffer */ #if defined(CONFIG_SAM4EEK_LCD_RGB565) + /* Return the raw RGB565 color */ *buffer++ = (sam_color_t)value[0] << 8 | (sam_color_t)value[1]; #elif defined(CONFIG_SAM4EEK_LCD_RGB24) + /* RRRR RGGG GGGB BBBB -> RRRR R000, GGGG GG00, BBBB B000 */ *ptr++ = (value[0] & 0xf8); @@ -770,10 +794,11 @@ static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, *ptr++ = (value[1] & 0x1f) << 3; #else /* if defined(CONFIG_SAM4EEK_LCD_RGB32) */ + /* RRRR RGGG GGGB BBBB -> 0000 0000 RRRR R000 GGGG GG00 BBBB B000 */ *buffer++ = ((value[0] & 0xf8)) | - ((value[0] & 0x07) << 13) | ((value[1] & 0xE0) << 5) | + ((value[0] & 0x07) << 13) | ((value[1] & 0xe0) << 5) | ((value[1] & 0x1f) << 19); #endif } @@ -781,31 +806,32 @@ static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_getvideoinfo * * Description: * Get information about the LCD video controller configuration. * - ************************************************************************************/ + ****************************************************************************/ static int sam_getvideoinfo(FAR struct lcd_dev_s *dev, FAR struct fb_videoinfo_s *vinfo) { DEBUGASSERT(dev && vinfo); lcdinfo("fmt: %d xres: %d yres: %d nplanes: %d\n", - g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes); + g_videoinfo.fmt, g_videoinfo.xres, + g_videoinfo.yres, g_videoinfo.nplanes); memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s)); return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_getplaneinfo * * Description: * Get information about the configuration of each LCD color plane. * - ************************************************************************************/ + ****************************************************************************/ static int sam_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno, FAR struct lcd_planeinfo_s *pinfo) @@ -816,14 +842,15 @@ static int sam_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno, return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_getpower * * Description: - * Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on). On - * backlit LCDs, this setting may correspond to the backlight setting. + * Get the LCD panel power status + * (0: full off - CONFIG_LCD_MAXPOWER: full on). On backlit LCDs, + * this setting may correspond to the backlight setting. * - ************************************************************************************/ + ****************************************************************************/ static int sam_getpower(struct lcd_dev_s *dev) { @@ -833,14 +860,15 @@ static int sam_getpower(struct lcd_dev_s *dev) return priv->power; } -/************************************************************************************ +/**************************************************************************** * Name: sam_setpower * * Description: - * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On - * backlit LCDs, this setting may correspond to the backlight setting. + * Enable/disable LCD panel power + * (0: full off - CONFIG_LCD_MAXPOWER: full on). On backlit LCDs, + * this setting may correspond to the backlight setting. * - ************************************************************************************/ + ****************************************************************************/ static int sam_setpower(struct lcd_dev_s *dev, int power) { @@ -875,13 +903,13 @@ static int sam_setpower(struct lcd_dev_s *dev, int power) return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_getcontrast * * Description: * Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST). * - ************************************************************************************/ + ****************************************************************************/ static int sam_getcontrast(struct lcd_dev_s *dev) { @@ -889,13 +917,13 @@ static int sam_getcontrast(struct lcd_dev_s *dev) return -ENOSYS; } -/************************************************************************************ +/**************************************************************************** * Name: sam_setcontrast * * Description: * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST). * - ************************************************************************************/ + ****************************************************************************/ static int sam_setcontrast(struct lcd_dev_s *dev, unsigned int contrast) { @@ -903,13 +931,13 @@ static int sam_setcontrast(struct lcd_dev_s *dev, unsigned int contrast) return -ENOSYS; } -/************************************************************************************ +/**************************************************************************** * Name: sam_gpio_initialize * * Description: * Configure LCD GPIO pins * - ************************************************************************************/ + ****************************************************************************/ static inline void sam_gpio_initialize(void) { @@ -923,13 +951,13 @@ static inline void sam_gpio_initialize(void) } } -/************************************************************************************ +/**************************************************************************** * Name: sam_smc_initialize * * Description: * Configure LCD SMC interface * - ************************************************************************************/ + ****************************************************************************/ static inline void sam_smc_initialize(void) { @@ -957,26 +985,27 @@ static inline void sam_smc_initialize(void) putreg32(regval, smcbase + SAM_SMCCS_MODE_OFFSET); } -/************************************************************************************ +/**************************************************************************** * Name: sam_lcd9325_initialize * * Description: * Initialize the ILI9325 LCD. * - ************************************************************************************/ + ****************************************************************************/ static void sam_lcd9325_initialize(void) { uint16_t regval; - /* Turn off the LCD ***************************************************************/ + /* Turn off the LCD *******************************************************/ sam_write_reg(ILI9325_DISP_CTRL1, ILI9325_DISP_CTRL1_GON | ILI9325_DISP_CTRL1_DTE | ILI9325_DISP_CTRL1_D(3)); - /* Initial sequence ***************************************************************/ - /* Disable sleep and standby mode*/ + /* Initial sequence *******************************************************/ + + /* Disable sleep and standby mode */ sam_write_reg(ILI9325_POWER_CTRL1, 0); @@ -991,7 +1020,8 @@ static void sam_lcd9325_initialize(void) /* Set 1 line inversion */ sam_write_reg(ILI9325_LCD_DRIVING_CTRL, - ILI9325_LCD_DRIVING_CTRL_BIT10 | ILI9325_LCD_DRIVING_CTRL_EOR | + ILI9325_LCD_DRIVING_CTRL_BIT10 | + ILI9325_LCD_DRIVING_CTRL_EOR | ILI9325_LCD_DRIVING_CTRL_BC0); /* Disable resizing feature */ @@ -1023,7 +1053,8 @@ static void sam_lcd9325_initialize(void) sam_write_reg(ILI9325_RGB_DISP_INTERFACE_CTRL2, 0); - /* Power on sequence **************************************************************/ + /* Power on sequence ******************************************************/ + /* Disable sleep and standby mode */ sam_write_reg(ILI9325_POWER_CTRL1, 0); @@ -1043,7 +1074,8 @@ static void sam_lcd9325_initialize(void) sam_write_reg(ILI9325_POWER_CTRL4, 0); up_mdelay(200); - /* Enable power supply and source driver ******************************************/ + /* Enable power supply and source driver **********************************/ + /* Adjust the constant current and set the factor used in the step-up * circuits. */ @@ -1117,8 +1149,8 @@ static void sam_lcd9325_initialize(void) * 10 = Horizontal decrement, Vertical increment * 11 = Horizontal increment, Vertical increment * - * ORG moves the origin address according to the ID setting when a window address - * area is made. + * ORG moves the origin address according to the ID setting when a window + * address area is made. * 0 = The origin address is not moved. * 1 = The original address moves according to the I/D[1:0] setting. * @@ -1126,49 +1158,55 @@ static void sam_lcd9325_initialize(void) * 0 = Follow the RGB order to write the pixel data. * 1 = Swap the RGB data to BGR in writing into GRAM. * - * TRI = 1: Data are transferred to the internal RAM in 8-bit x 3 transfers mode - * via the 8-bit interface. + * TRI = 1: Data are transferred to the internal RAM in 8-bit x 3 transfers + * mode via the 8-bit interface. * * DFM + TRI: Data is transferred as 3 byte transfers * - * Use the high speed write mode (HWM=1). When TRI = 1, data are transferred to - * the internal RAM in 8-bit x 3 transfers mode via the 8-bit interface. DFM set - * the mode of transferring data to the internal RAM when TRI = 1. - * I/D[1:0] = 11 Horizontal : increment Vertical : increment, AM=0:Horizontal + * Use the high speed write mode (HWM=1). + * When TRI = 1, data are transferred to the internal RAM in 8-bit x 3 + * transfers mode via the 8-bit interface. + * DFM set the mode of transferring data to the internal RAM when TRI = 1. + * I/D[1:0] = 11 Horizontal : increment + * Vertical : increment, AM=0:Horizontal */ #if defined(CONFIG_LCD_LANDSCAPE) - /* Landscape: Horizontal increment/ Vertical decrement, address is update in - * horizontal direction + /* Landscape: Horizontal increment/ Vertical decrement, address is update + * in horizontal direction */ - regval = ILI9325_ENTRY_MODE_ID(1) | ILI9325_ENTRY_MODE_ORG | ILI9325_ENTRY_MODE_HWM | - ILI9325_ENTRY_MODE_BGR | ILI9325_ENTRY_MODE_TRI | ILI9325_ENTRY_MODE_DFM; + regval = ILI9325_ENTRY_MODE_ID(1) | ILI9325_ENTRY_MODE_ORG | + ILI9325_ENTRY_MODE_HWM | ILI9325_ENTRY_MODE_BGR | + ILI9325_ENTRY_MODE_TRI | ILI9325_ENTRY_MODE_DFM; #elif defined(CONFIG_LCD_RLANDSCAPE) - /* Landscape: Horizontal decrement/ Vertical increment, address is update in - * horizontal direction + /* Landscape: Horizontal decrement/ Vertical increment, address is update + * in horizontal direction */ - regval = ILI9325_ENTRY_MODE_ID(2) | ILI9325_ENTRY_MODE_ORG | ILI9325_ENTRY_MODE_HWM | - ILI9325_ENTRY_MODE_BGR | ILI9325_ENTRY_MODE_TRI | ILI9325_ENTRY_MODE_DFM; + regval = ILI9325_ENTRY_MODE_ID(2) | ILI9325_ENTRY_MODE_ORG | + ILI9325_ENTRY_MODE_HWM | ILI9325_ENTRY_MODE_BGR | + ILI9325_ENTRY_MODE_TRI | ILI9325_ENTRY_MODE_DFM; #elif defined(CONFIG_LCD_PORTRAIT) - /* Landscape: Horizontal decrement/ Vertical decrement, address is update in - * vertical direction + /* Landscape: Horizontal decrement/ Vertical decrement, address is update + * in vertical direction */ - regval = ILI9325_ENTRY_MODE_AM | ILI9325_ENTRY_MODE_ID(0) | ILI9325_ENTRY_MODE_ORG | - ILI9325_ENTRY_MODE_HWM | ILI9325_ENTRY_MODE_BGR | ILI9325_ENTRY_MODE_TRI | + regval = ILI9325_ENTRY_MODE_AM | ILI9325_ENTRY_MODE_ID(0) | + ILI9325_ENTRY_MODE_ORG | ILI9325_ENTRY_MODE_HWM | + ILI9325_ENTRY_MODE_BGR | ILI9325_ENTRY_MODE_TRI | ILI9325_ENTRY_MODE_DFM; #else /* if defined(CONFIG_LCD_RPORTRAIT) */ - /* Landscape: Horizontal increment/ Vertical increment, address is update in - * vertical direction + /* Landscape: Horizontal increment/ Vertical increment, address is update + * in vertical direction */ - regval = ILI9325_ENTRY_MODE_AM | ILI9325_ENTRY_MODE_ID(3) | ILI9325_ENTRY_MODE_ORG | - ILI9325_ENTRY_MODE_HWM | ILI9325_ENTRY_MODE_BGR | ILI9325_ENTRY_MODE_TRI | + regval = ILI9325_ENTRY_MODE_AM | ILI9325_ENTRY_MODE_ID(3) | + ILI9325_ENTRY_MODE_ORG | ILI9325_ENTRY_MODE_HWM | + ILI9325_ENTRY_MODE_BGR | ILI9325_ENTRY_MODE_TRI | ILI9325_ENTRY_MODE_DFM; #endif @@ -1195,8 +1233,8 @@ static void sam_lcd9325_initialize(void) sam_write_reg(ILI9325_DRIVER_OUTPUT_CTRL1, regval); - /* Set the number of lines to drive the LCD at an interval of 8 lines. The scan - * direction is from G320 to G1 + /* Set the number of lines to drive the LCD at an interval of 8 lines. + * The scan direction is from G320 to G1 */ regval = ILI9325_DRIVER_OUTPUT_CTRL2_NL((SAM_XRES / 8) - 1); @@ -1209,7 +1247,8 @@ static void sam_lcd9325_initialize(void) sam_write_reg(ILI9325_DRIVER_OUTPUT_CTRL2, regval); - /* Vertical Scrolling *************************************************************/ + /* Vertical Scrolling *****************************************************/ + /* Disable scrolling and enable the grayscale inversion */ sam_write_reg(ILI9325_BASE_IMG_DISP_CTRL, ILI9325_BASE_IMG_DISP_CTRL_REV); @@ -1246,13 +1285,13 @@ static void sam_lcd9325_initialize(void) sam_set_cursor(0, 0); } -/************************************************************************************ +/**************************************************************************** * Name: sam_lcd_initialize * * Description: * Initialize the LCD panel * - ************************************************************************************/ + ****************************************************************************/ static inline int sam_lcd_initialize(void) { @@ -1275,19 +1314,20 @@ static inline int sam_lcd_initialize(void) return OK; } -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: board_lcd_initialize * * Description: - * Initialize the LCD video hardware. The initial state of the LCD is fully - * initialized, display memory cleared, and the LCD ready to use, but with the - * power setting at 0 (full off). + * Initialize the LCD video hardware. + * The initial state of the LCD is fully initialized, display memory + * cleared, and the LCD ready to use, but with the power setting at 0 + * (full off). * - ************************************************************************************/ + ****************************************************************************/ int board_lcd_initialize(void) { @@ -1326,14 +1366,14 @@ int board_lcd_initialize(void) return ret; } -/************************************************************************************ +/**************************************************************************** * Name: board_lcd_getdev * * Description: - * Return a a reference to the LCD object for the specified LCD. This allows - * support for multiple LCD devices. + * Return a a reference to the LCD object for the specified LCD. + * This allows support for multiple LCD devices. * - ************************************************************************************/ + ****************************************************************************/ FAR struct lcd_dev_s *board_lcd_getdev(int lcddev) { @@ -1341,13 +1381,13 @@ FAR struct lcd_dev_s *board_lcd_getdev(int lcddev) return &g_lcddev.dev; } -/************************************************************************************ +/**************************************************************************** * Name: board_lcd_uninitialize * * Description: * Uninitialize the LCD support * - ************************************************************************************/ + ****************************************************************************/ void board_lcd_uninitialize(void) { @@ -1358,16 +1398,17 @@ void board_lcd_uninitialize(void) sam_poweroff(priv); } -/************************************************************************************ +/**************************************************************************** * Name: sam_lcdclear * * Description: - * This is a non-standard LCD interface just for the SAM4E-EK board. Because - * of the various rotations, clearing the display in the normal way by writing a - * sequences of runs that covers the entire display can be very slow. Here the - * display is cleared by simply setting all GRAM memory to the specified color. + * This is a non-standard LCD interface just for the SAM4E-EK board. + * Because of the various rotations, clearing the display in the normal + * way by writing a sequences of runs that covers the entire display can + * be very slow. Here the display is cleared by simply setting all GRAM + * memory to the specified color. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAM4EEK_LCD_RGB565) void sam_lcdclear(uint16_t color) diff --git a/boards/arm/sam34/sam4e-ek/src/sam_ili9341.c b/boards/arm/sam34/sam4e-ek/src/sam_ili9341.c index ba009444a3..ac81684984 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_ili9341.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_ili9341.c @@ -1,20 +1,22 @@ -/************************************************************************************ - * boards/sam4e-ek/src/sam_ili9341.c +/**************************************************************************** + * boards/arm/sam34/sam4e-ek/src/sam_ili9341.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: * - This driver is a modification of the SAMA4E ILI9325 LCD driver. - * - ILI9341 Datasheet, Version: V1.11, ILI9341_DS_V1.11.pdf, ILI TECHNOLOGY CORP., + * - ILI9341 Datasheet, Version: V1.11, ILI9341_DS_V1.11.pdf, + * ILI TECHNOLOGY CORP., * - SAM4Ex Datasheet, Atmel * - Atmel ILI93241 Sample code for the SAM4E * - * Some the LCD and SMC initialization logic comes from Atmel sample code for the - * SAM4E. The Atmel sample code has a BSD-like license with an additional - * requirement that restricts the code from being used on anything but Atmel - * microprocessors. I do not believe that this file "derives" from the Atmel - * sample code nor do I believe that it contains anything but generally available + * Some the LCD and SMC initialization logic comes from Atmel sample code + * for the SAM4E. The Atmel sample code has a BSD-like license with an + * additional requirement that restricts the code from being used on + * anything but Atmel microprocessors. + * I do not believe that this file "derives" from the Atmel sample code + * nor do I believe that it contains anything but generally available * ILI9341 and SAM4x logic. Credit, however, needs to go where it is due. * * Redistribution and use in source and binary forms, with or without @@ -44,16 +46,17 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************** +/**************************************************************************** * - * The SAM4E-EK carries a TFT transmissive LCD module with touch panel, FTM280C34D. - * Its integrated driver IC is ILI9341. The LCD display area is 2.8 inches diagonally - * measured, with a native resolution of 240 x 320 dots. + * The SAM4E-EK carries a TFT transmissive LCD module with touch panel, + * FTM280C34D. + * Its integrated driver IC is ILI9341. The LCD display area is 2.8 inches + * diagonally measured, with a native resolution of 240 x 320 dots. * - * The SAM4E16 communicates with the LCD through PIOC where an 8-bit parallel "8080- - * like" protocol data bus has to be implemented in software. + * The SAM4E16 communicates with the LCD through PIOC where an 8-bit parallel + * "8080-like" protocol data bus has to be implemented in software. * * ---- ----- --------- -------------------------------- * PIN PIO SIGNAL NOTES @@ -102,18 +105,20 @@ * 39 NC * ---- ----- --------- -------------------------------- * - * LCD backlight is made of 4 white chip LEDs in parallel, driven by an AAT3155 - * charge pump, MN4. The AAT3155 is controlled by the SAM3U4E through a single line - * Simple Serial Control (S2Cwire) interface, which permits to enable, disable, and - * set the LED drive current (LED brightness control) from a 32-level logarithmic - * scale. Four resistors R93/R94/R95/R96 are implemented for optional current + * LCD backlight is made of 4 white chip LEDs in parallel, driven by an + * AAT3155 charge pump, MN4. + * The AAT3155 is controlled by the SAM3U4E through a single line + * Simple Serial Control (S2Cwire) interface, which permits to enable, + * disable, and set the LED drive current (LED brightness control) from + * a 32-level logarithmic scale. + * Four resistors R93/R94/R95/R96 are implemented for optional current * limitation. * - **************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -142,9 +147,10 @@ #ifdef CONFIG_LCD -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + /* SMC must be selected */ #if !defined(CONFIG_SAM34_SMC) @@ -198,7 +204,8 @@ # define CONFIG_SAM4EEK_LCD_BGCOLOR 0 #endif -/* Display/Color Properties ***********************************************************/ +/* Display/Color Properties *************************************************/ + /* Display Resolution */ #if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE) @@ -236,7 +243,8 @@ # define RGB_COLOR(r,g,b) RGBTO24(r,g,b) #endif -/* SAM4E-EK LCD Hardware Definitions **************************************************/ +/* SAM4E-EK LCD Hardware Definitions ****************************************/ + /* LCD /CS is CE4, Bank 3 of NOR/SRAM Bank 1~4 */ #define SAM_LCD_BASE ((uintptr_t)SAM_EXTCS1_BASE) @@ -254,11 +262,13 @@ #define BKL_ENABLE_DURATION (128*1024) #define BKL_DISABLE_DURATION (128*1024) -/************************************************************************************ +/**************************************************************************** * Private Type Definition - ************************************************************************************/ + ****************************************************************************/ -/* Type definition for the correct size of one pixel (from the application standpoint). */ +/* Type definition for the correct size of one pixel + * (from the application standpoint). + */ #ifdef CONFIG_SAM4EEK_LCD_RGB565 typedef uint16_t sam_color_t; @@ -288,13 +298,16 @@ struct sam_dev_s bool output; /* True: Configured for output */ }; -/************************************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************************************/ + ****************************************************************************/ + /* Low Level LCD access */ -static void sam_putreg(uint8_t regaddr, FAR const uint8_t *buffer, unsigned int buflen); -static void sam_getreg(uint8_t regaddr, FAR uint8_t *buffer, unsigned int buflen); +static void sam_putreg(uint8_t regaddr, FAR const uint8_t *buffer, + unsigned int buflen); +static void sam_getreg(uint8_t regaddr, FAR uint8_t *buffer, + unsigned int buflen); static void sam_setwindow(sam_color_t row, sam_color_t col, sam_color_t width, sam_color_t height); static inline void sam_gram_wrprepare(void); @@ -310,17 +323,20 @@ static int sam_poweroff(FAR struct sam_dev_s *priv); /* LCD Data Transfer Methods */ -static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, - size_t npixels); -static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, - size_t npixels); +static int sam_putrun(fb_coord_t row, fb_coord_t col, + FAR const uint8_t *buffer, + size_t npixels); +static int sam_getrun(fb_coord_t row, fb_coord_t col, + FAR uint8_t *buffer, + size_t npixels); /* LCD Configuration */ static int sam_getvideoinfo(FAR struct lcd_dev_s *dev, - FAR struct fb_videoinfo_s *vinfo); -static int sam_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno, - FAR struct lcd_planeinfo_s *pinfo); + FAR struct fb_videoinfo_s *vinfo); +static int sam_getplaneinfo(FAR struct lcd_dev_s *dev, + unsigned int planeno, + FAR struct lcd_planeinfo_s *pinfo); /* LCD RGB Mapping */ @@ -348,9 +364,10 @@ static inline void sam_smc_initialize(void); static void sam_lcd9341_initialize(void); static inline int sam_lcd_initialize(void); -/************************************************************************************ +/**************************************************************************** * Private Data - ************************************************************************************/ + ****************************************************************************/ + /* LCD GPIO configurations */ static const uint32_t g_lcdpin[] = @@ -408,6 +425,7 @@ static struct sam_dev_s g_lcddev = .getplaneinfo = sam_getplaneinfo, /* LCD RGB Mapping -- Not supported */ + /* Cursor Controls -- Not supported */ /* LCD Specific Controls */ @@ -419,19 +437,20 @@ static struct sam_dev_s g_lcddev = }, }; -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_putreg * * Description: * Write to a multi-byte ILI9341 register * - ************************************************************************************/ + ****************************************************************************/ -static void sam_putreg(uint8_t regaddr, FAR const uint8_t *buffer, unsigned int buflen) +static void sam_putreg(uint8_t regaddr, FAR const uint8_t *buffer, + unsigned int buflen) { LCD_INDEX = 0; LCD_INDEX = regaddr; @@ -444,15 +463,16 @@ static void sam_putreg(uint8_t regaddr, FAR const uint8_t *buffer, unsigned int } } -/************************************************************************************ +/**************************************************************************** * Name: sam_getreg * * Description: * Read from a multi-byte ILI9341 register * - ************************************************************************************/ + ****************************************************************************/ -static void sam_getreg(uint8_t regaddr, FAR uint8_t *buffer, unsigned int buflen) +static void sam_getreg(uint8_t regaddr, FAR uint8_t *buffer, + unsigned int buflen) { LCD_INDEX = 0; LCD_INDEX = regaddr; @@ -465,13 +485,13 @@ static void sam_getreg(uint8_t regaddr, FAR uint8_t *buffer, unsigned int buflen } } -/************************************************************************************ +/**************************************************************************** * Name: sam_setwindow * * Description: * Setup drawing window * - ************************************************************************************/ + ****************************************************************************/ static void sam_setwindow(sam_color_t row, sam_color_t col, sam_color_t width, sam_color_t height) @@ -497,13 +517,13 @@ static void sam_setwindow(sam_color_t row, sam_color_t col, sam_putreg(ILI9341_PAGE_ADDRESS_SET, buffer, 4); } -/************************************************************************************ +/**************************************************************************** * Name: sam_gram_wrprepare * * Description: * Setup to write multiple pixels to the GRAM memory * - ************************************************************************************/ + ****************************************************************************/ static inline void sam_gram_wrprepare(void) { @@ -514,13 +534,13 @@ static inline void sam_gram_wrprepare(void) LCD_INDEX = ILI9341_WRITE_MEMORY_CONTINUE; } -/************************************************************************************ +/**************************************************************************** * Name: sam_gram_rdprepare * * Description: * Setup to read multiple pixels from the GRAM memory * - ************************************************************************************/ + ****************************************************************************/ static inline void sam_gram_rdprepare(void) { @@ -530,13 +550,13 @@ static inline void sam_gram_rdprepare(void) LCD_INDEX = ILI9341_MEMORY_READ; } -/************************************************************************************ +/**************************************************************************** * Name: sam_gram_write * * Description: * Write one pixel to the GRAM memory * - ************************************************************************************/ + ****************************************************************************/ static inline void sam_gram_write(sam_color_t color) { @@ -545,13 +565,13 @@ static inline void sam_gram_write(sam_color_t color) LCD_DATA = RGB_BLUE(color); } -/************************************************************************************ +/**************************************************************************** * Name: sam_gram_read * * Description: * Read one 16-bit pixel to the GRAM memory * - ************************************************************************************/ + ****************************************************************************/ static inline sam_color_t sam_gram_read(void) { @@ -568,7 +588,7 @@ static inline sam_color_t sam_gram_read(void) (sam_color_t)buffer[2]); } -/************************************************************************************ +/**************************************************************************** * Name: sam_dumprun * * Description: @@ -577,12 +597,14 @@ static inline sam_color_t sam_gram_read(void) * run - The buffer in containing the run read to be dumped * npixels - The number of pixels to dump * - ************************************************************************************/ + ****************************************************************************/ #if 0 /* Sometimes useful */ -static void sam_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixels) +static void sam_dumprun(FAR const char *msg, FAR uint16_t *run, + size_t npixels) { - int i, j; + int i; + int j; syslog(LOG_DEBUG, "\n%s:\n", msg); for (i = 0; i < npixels; i += 16) @@ -599,13 +621,13 @@ static void sam_dumprun(FAR const char *msg, FAR uint16_t *run, size_t npixels) } #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_disable_backlight * * Description: * Turn the backlight off. * - ************************************************************************************/ + ****************************************************************************/ static void sam_disable_backlight(void) { @@ -615,13 +637,14 @@ static void sam_disable_backlight(void) for (delay = 0; delay < BKL_DISABLE_DURATION; delay++); } -/************************************************************************************ +/**************************************************************************** * Name: sam_set_backlight * * Description: - * The the backlight to the level associated with the specified power value. + * The the backlight to the level associated with the specified power + * value. * - ************************************************************************************/ + ****************************************************************************/ static void sam_set_backlight(unsigned int power) { @@ -660,14 +683,15 @@ static void sam_set_backlight(unsigned int power) for (delay = 0; delay < BKL_ENABLE_DURATION; delay++); } -/************************************************************************************ +/**************************************************************************** * Name: sam_poweroff * * Description: - * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On - * backlit LCDs, this setting may correspond to the backlight setting. + * Enable/disable LCD panel power + * (0: full off - CONFIG_LCD_MAXPOWER: full on). On backlit LCDs, + * this setting may correspond to the backlight setting. * - ************************************************************************************/ + ****************************************************************************/ static int sam_poweroff(FAR struct sam_dev_s *priv) { @@ -675,7 +699,7 @@ static int sam_poweroff(FAR struct sam_dev_s *priv) /* Turn the display off */ - sam_putreg(ILI9341_DISPLAY_OFF, NULL, 0); + sam_putreg(ILI9341_DISPLAY_OFF, NULL, 0); /* Disable the backlight */ @@ -687,7 +711,7 @@ static int sam_poweroff(FAR struct sam_dev_s *priv) return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_putrun * * Description: @@ -699,10 +723,11 @@ static int sam_poweroff(FAR struct sam_dev_s *priv) * npixels - The number of pixels to write to the LCD * (range: 0 < npixels <= xres-col) * - ************************************************************************************/ + ****************************************************************************/ -static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, - size_t npixels) +static int sam_putrun(fb_coord_t row, fb_coord_t col, + FAR const uint8_t *buffer, + size_t npixels) { #if defined(CONFIG_SAM4EEK_LCD_RGB565) FAR const uint16_t *src = (FAR const uint16_t*)buffer; @@ -745,7 +770,7 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_getrun * * Description: @@ -757,7 +782,7 @@ static int sam_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, * npixels - The number of pixels to read from the LCD * (range: 0 < npixels <= xres-col) * - ************************************************************************************/ + ****************************************************************************/ static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, size_t npixels) @@ -803,31 +828,32 @@ static int sam_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_getvideoinfo * * Description: * Get information about the LCD video controller configuration. * - ************************************************************************************/ + ****************************************************************************/ static int sam_getvideoinfo(FAR struct lcd_dev_s *dev, FAR struct fb_videoinfo_s *vinfo) { DEBUGASSERT(dev && vinfo); lcdinfo("fmt: %d xres: %d yres: %d nplanes: %d\n", - g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes); + g_videoinfo.fmt, g_videoinfo.xres, + g_videoinfo.yres, g_videoinfo.nplanes); memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s)); return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_getplaneinfo * * Description: * Get information about the configuration of each LCD color plane. * - ************************************************************************************/ + ****************************************************************************/ static int sam_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno, FAR struct lcd_planeinfo_s *pinfo) @@ -838,14 +864,15 @@ static int sam_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno, return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_getpower * * Description: - * Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on). On - * backlit LCDs, this setting may correspond to the backlight setting. + * Get the LCD panel power status + * (0: full off - CONFIG_LCD_MAXPOWER: full on). On backlit LCDs, + * this setting may correspond to the backlight setting. * - ************************************************************************************/ + ****************************************************************************/ static int sam_getpower(struct lcd_dev_s *dev) { @@ -855,14 +882,15 @@ static int sam_getpower(struct lcd_dev_s *dev) return priv->power; } -/************************************************************************************ +/**************************************************************************** * Name: sam_setpower * * Description: - * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On - * backlit LCDs, this setting may correspond to the backlight setting. + * Enable/disable LCD panel power + * (0: full off - CONFIG_LCD_MAXPOWER: full on). On backlit LCDs, + * this setting may correspond to the backlight setting. * - ************************************************************************************/ + ****************************************************************************/ static int sam_setpower(struct lcd_dev_s *dev, int power) { @@ -895,13 +923,13 @@ static int sam_setpower(struct lcd_dev_s *dev, int power) return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_getcontrast * * Description: * Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST). * - ************************************************************************************/ + ****************************************************************************/ static int sam_getcontrast(struct lcd_dev_s *dev) { @@ -909,13 +937,13 @@ static int sam_getcontrast(struct lcd_dev_s *dev) return -ENOSYS; } -/************************************************************************************ +/**************************************************************************** * Name: sam_setcontrast * * Description: * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST). * - ************************************************************************************/ + ****************************************************************************/ static int sam_setcontrast(struct lcd_dev_s *dev, unsigned int contrast) { @@ -923,13 +951,13 @@ static int sam_setcontrast(struct lcd_dev_s *dev, unsigned int contrast) return -ENOSYS; } -/************************************************************************************ +/**************************************************************************** * Name: sam_gpio_initialize * * Description: * Configure LCD GPIO pins * - ************************************************************************************/ + ****************************************************************************/ static inline void sam_gpio_initialize(void) { @@ -943,13 +971,13 @@ static inline void sam_gpio_initialize(void) } } -/************************************************************************************ +/**************************************************************************** * Name: sam_smc_initialize * * Description: * Configure LCD SMC interface * - ************************************************************************************/ + ****************************************************************************/ static inline void sam_smc_initialize(void) { @@ -977,22 +1005,22 @@ static inline void sam_smc_initialize(void) putreg32(regval, smcbase + SAM_SMCCS_MODE_OFFSET); } -/************************************************************************************ +/**************************************************************************** * Name: sam_lcd9341_initialize * * Description: * Initialize the ILI9341 LCD. * - ************************************************************************************/ + ****************************************************************************/ static void sam_lcd9341_initialize(void) { uint8_t buffer[5]; - /* Power control A configuration*/ + /* Power control A configuration */ buffer[0] = 0x39; - buffer[1] = 0x2C; + buffer[1] = 0x2c; buffer[2] = 0x00; buffer[3] = 0x34; buffer[4] = 0x02; @@ -1022,8 +1050,8 @@ static void sam_lcd9341_initialize(void) /* VOM Control 1 configuration */ - buffer[0] = 0x5C; - buffer[1] = 0x4C; + buffer[0] = 0x5c; + buffer[1] = 0x4c; sam_putreg(ILI9341_VCOM_CONTROL_1, buffer, 2); /* VOM control 2 configuration */ @@ -1112,11 +1140,11 @@ static void sam_lcd9341_initialize(void) buffer[3] = 0x00; sam_putreg(ILI9341_DISPLAY_FUNCTION_CTL, buffer, 4); - /* Set window area*/ + /* Set window area */ sam_setwindow(0, 0, SAM_XRES, SAM_YRES); - /* Leave sleep mode*/ + /* Leave sleep mode */ sam_putreg(ILI9341_SLEEP_OUT, buffer, 0); up_mdelay(10); @@ -1126,13 +1154,13 @@ static void sam_lcd9341_initialize(void) sam_putreg(ILI9341_DISPLAY_OFF, buffer, 0); } -/************************************************************************************ +/**************************************************************************** * Name: sam_lcd_initialize * * Description: * Initialize the LCD panel * - ************************************************************************************/ + ****************************************************************************/ static inline int sam_lcd_initialize(void) { @@ -1154,19 +1182,20 @@ static inline int sam_lcd_initialize(void) return OK; } -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: board_lcd_initialize * * Description: - * Initialize the LCD video hardware. The initial state of the LCD is fully - * initialized, display memory cleared, and the LCD ready to use, but with the - * power setting at 0 (full off). + * Initialize the LCD video hardware. + * The initial state of the LCD is fully initialized, display memory + * cleared, and the LCD ready to use, but with the power setting at 0 + * (full off). * - ************************************************************************************/ + ****************************************************************************/ int board_lcd_initialize(void) { @@ -1205,14 +1234,14 @@ int board_lcd_initialize(void) return ret; } -/************************************************************************************ +/**************************************************************************** * Name: board_lcd_getdev * * Description: - * Return a a reference to the LCD object for the specified LCD. This allows - * support for multiple LCD devices. + * Return a a reference to the LCD object for the specified LCD. + * This allows support for multiple LCD devices. * - ************************************************************************************/ + ****************************************************************************/ FAR struct lcd_dev_s *board_lcd_getdev(int lcddev) { @@ -1220,13 +1249,13 @@ FAR struct lcd_dev_s *board_lcd_getdev(int lcddev) return &g_lcddev.dev; } -/************************************************************************************ +/**************************************************************************** * Name: board_lcd_uninitialize * * Description: * Uninitialize the LCD support * - ************************************************************************************/ + ****************************************************************************/ void board_lcd_uninitialize(void) { @@ -1237,16 +1266,18 @@ void board_lcd_uninitialize(void) sam_poweroff(priv); } -/************************************************************************************ +/**************************************************************************** * Name: sam_lcdclear * * Description: - * This is a non-standard LCD interface just for the SAM4E-EK board. Because - * of the various rotations, clearing the display in the normal way by writing a - * sequences of runs that covers the entire display can be very slow. Here the - * display is cleared by simply setting all GRAM memory to the specified color. + * This is a non-standard LCD interface just for the SAM4E-EK board. + * Because of the various rotations, clearing the display in the normal + * way by writing a sequences of runs that covers the entire display can + * be very slow. + * Here the display is cleared by simply setting all GRAM memory to the + * specified color. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAM4EEK_LCD_RGB565) void sam_lcdclear(uint16_t color) diff --git a/boards/arm/sam34/sam4e-ek/src/sam_leds.c b/boards/arm/sam34/sam4e-ek/src/sam_leds.c index 708585e172..9bc15463fd 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_leds.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_leds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4e-ek/src/sam_leds.c + * boards/arm/sam34/sam4e-ek/src/sam_leds.c * * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4e-ek/src/sam_spi.c b/boards/arm/sam34/sam4e-ek/src/sam_spi.c index 3e3b3ebd6c..95a5cd350b 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_spi.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4e-ek/src/sam_spi.c +/**************************************************************************** + * boards/arm/sam34/sam4e-ek/src/sam_spi.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -55,30 +55,30 @@ #if defined(CONFIG_SAM34_SPI0) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_spidev_initialize * * Description: * Called to configure SPI chip select GPIO pins for the SAM4E-EK board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_spidev_initialize(void) { #if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E) - /* The touchscreen connects using NPCS0 (PA11). */ + /* The touchscreen connects using NPCS0 (PA11). */ - sam_configgpio(GPIO_TSC_CS); + sam_configgpio(GPIO_TSC_CS); #endif #if defined(CONFIG_MTD_AT25) - /* The AT25 Serial FLASH connects using NPCS3 (PA5). */ + /* The AT25 Serial FLASH connects using NPCS3 (PA5). */ - sam_configgpio(GPIO_FLASH_CS); + sam_configgpio(GPIO_FLASH_CS); #endif } @@ -108,8 +108,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). * @@ -145,12 +145,14 @@ void sam_spi0select(uint32_t devid, bool selected) switch (devid) { #if defined(CONFIG_INPUT) && defined(CONFIG_INPUT_ADS7843E) - /* The touchscreen chip select is implemented as a GPIO OUTPUT that must - * be controlled by this function. This is because the ADS7843E driver - * must be able to sample the device BUSY GPIO input between SPI transfers. - * However, the AD7843E will tri-state the BUSY input whenever the chip - * select is de-asserted. So the only option is to control the chip select - * manually and hold it low throughout the SPI transfer. + /* The touchscreen chip select is implemented as a GPIO OUTPUT that + * must be controlled by this function. + * This is because the ADS7843E driver must be able to sample the + * device BUSY GPIO input between SPI transfers. + * However, the AD7843E will tri-state the BUSY input whenever the + * chip select is de-asserted. + * So the only option is to control the chip select manually and hold + * it low throughout the SPI transfer. */ case SPIDEV_TOUCHSCREEN(0): diff --git a/boards/arm/sam34/sam4e-ek/src/sam_udp.c b/boards/arm/sam34/sam4e-ek/src/sam_udp.c index 407534305f..1a07ea1060 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_udp.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_udp.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4e-ek/src/sam_udp.c +/**************************************************************************** + * boards/arm/sam34/sam4e-ek/src/sam_udp.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -50,36 +50,39 @@ #include "up_arch.h" #include "sam4e-ek.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_udp_suspend * * Description: * Board logic must provide the sam_udp_suspend logic if the UDP driver is - * used. This function is called whenever the USB enters or leaves suspend mode. + * used. + * This function is called whenever the USB enters or leaves suspend mode. * - * When 'resume' is false, this function call provides an opportunity to perform - * board-specific power-saving actions so that less power is consumed while the - * USB is suspended. + * When 'resume' is false, this function call provides an opportunity to + * perform board-specific power-saving actions so that less power is + * consumed while the USB is suspended. * - * Certain power-saving operations are performed by the UDP driver when it enters - * suspend mode: The USB device peripheral clocks are be switched off. MCK and + * Certain power-saving operations are performed by the UDP driver when + * it enters suspend mode: + * The USB device peripheral clocks are be switched off. MCK and * UDPCK are switched off and the USB transceiver is disabled. * - * When 'resume' is true, normal clocking and operations must all be restored. + * When 'resume' is true, normal clocking and operations must all be + * restored. * - ************************************************************************************/ + ****************************************************************************/ void sam_udp_suspend(FAR struct usbdev_s *dev, bool resume) { diff --git a/boards/arm/sam34/sam4e-ek/src/sam_usbmsc.c b/boards/arm/sam34/sam4e-ek/src/sam_usbmsc.c index 5885b6de15..5d63f1173f 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_usbmsc.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_usbmsc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4e-ek/src/sam_usbmsc.c + * boards/arm/sam34/sam4e-ek/src/sam_usbmsc.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4l-xplained/include/board.h b/boards/arm/sam34/sam4l-xplained/include/board.h index 29fec0e92c..0fb2dd0e43 100644 --- a/boards/arm/sam34/sam4l-xplained/include/board.h +++ b/boards/arm/sam34/sam4l-xplained/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4l-xplained/include/board.h +/**************************************************************************** + * boards/arm/sam34/sam4l-xplained/include/board.h * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_SAM4L_XPLAINED_INCLUDE_BOARD_H -#define __BOARDS_ARM_SAM4L_XPLAINED_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_SAM34_SAM4L_XPLAINED_INCLUDE_BOARD_H +#define __BOARDS_ARM_SAM34_SAM4L_XPLAINED_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,11 +49,11 @@ # endif #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ +/* Clocking *****************************************************************/ /* Select the DFLL as the source of the system clock. * @@ -71,9 +71,10 @@ #define BOARD_SYSCLK_SOURCE_DFLL0 1 -/* Nominal frequencies in on-chip RC oscillators. These are *not* configurable - * but appear here for use in frequency calculations. NOTE: These may frequencies - * may vary with temperature changes. +/* Nominal frequencies in on-chip RC oscillators. + * These are *not* configurable but appear here for use in frequency + * calculations. + * NOTE: These may frequencies may vary with temperature changes. */ #define BOARD_RCSYS_FREQUENCY 115000 /* Nominal frequency of RCSYS (Hz) */ @@ -193,7 +194,8 @@ #define BOARD_USBC_SRC_DFLL 1 /* Source DFLL0 at 48MHz */ #define BOARD_USBC_GCLK_DIV 1 /* Fusb = Fdfll / 1 = 48MHz */ -/* LED definitions ******************************************************************/ +/* LED definitions **********************************************************/ + /* There are three LEDs on board the SAM4L 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 LED0 near the SAM4L USB @@ -215,8 +217,8 @@ /* When CONFIG_ARCH_LEDS is defined in the NuttX configuration, NuttX will * control LED0 as defined below. Thus if LED0 is statically on, NuttX has * successfully booted and is, apparently, running normally. If LED0 is - * flashing at approximately 2Hz, then a fatal error has been detected and the - * system has halted. + * flashing at approximately 2Hz, then a fatal error has been detected and + * the system has halted. */ #define LED_STARTED 0 /* LED0=OFF */ @@ -228,9 +230,10 @@ #define LED_ASSERTION 2 /* LED0=no change */ #define LED_PANIC 3 /* LED0=flashing */ -/* Button definitions ***************************************************************/ -/* QTouch button: The SAM4L Xplained Pro kit has one QTouch button. The connection - * to the SAM4L is: +/* Button definitions *******************************************************/ + +/* QTouch button: The SAM4L Xplained Pro kit has one QTouch button. + * The connection to the SAM4L is: * * PC13 CATB_SENSE15 * PC14 CATB_DIS @@ -238,9 +241,10 @@ /* Mechanical buttons: * - * The SAM4L Xplained Pro contains two mechanical buttons. One button is the - * RESET button connected to the SAM4L 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 SAM4L Xplained Pro contains two mechanical buttons. + * One button is the RESET button connected to the SAM4L 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. * * PC24 SW0 */ @@ -252,7 +256,8 @@ #define BUTTON_SW0_BIT (1 << BUTTON_SW0) -/* Alternate Function Disambiguation ************************************************/ +/* Alternate Function Disambiguation ****************************************/ + /* USART0 is also available on connectors EXT1 and EXT4: * * EXT1 TXT4 GPIO Function @@ -264,10 +269,11 @@ #define GPIO_USART0_RXD GPIO_USART0_RXD_4 #define GPIO_USART0_TXD GPIO_USART0_TXD_4 -/* The SAM4L Xplained Pro contains an Embedded Debugger (EDBG) that can be used to - * program and debug the ATSAM4LC4C using Serial Wire Debug (SWD). The Embedded - * debugger also include a Virtual Com port interface over USART1. Virtual COM - * port connections: +/* The SAM4L Xplained Pro contains an Embedded Debugger (EDBG) that can be + * used to program and debug the ATSAM4LC4C using Serial Wire Debug (SWD). + * The Embedded debugger also include a Virtual Com port interface over + * USART1. + * Virtual COM port connections: * * PC26 USART1 RXD * PC27 USART1 TXD @@ -287,4 +293,4 @@ #define GPIO_SPI0_MOSI GPIO_SPI0_MOSI_1 #define GPIO_SPI0_SPCK GPIO_SPI0_SPCK_4 -#endif /* __BOARDS_ARM_SAM4L_XPLAINED_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_SAM34_SAM4L_XPLAINED_INCLUDE_BOARD_H */ diff --git a/boards/arm/sam34/sam4l-xplained/scripts/Make.defs b/boards/arm/sam34/sam4l-xplained/scripts/Make.defs index 1c4c0800ca..da4b250959 100644 --- a/boards/arm/sam34/sam4l-xplained/scripts/Make.defs +++ b/boards/arm/sam34/sam4l-xplained/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam4l-xplained/scripts/Make.defs +# boards/arm/sam34/sam4l-xplained/scripts/Make.defs # # Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4l-xplained/scripts/sam4l-xplained.ld b/boards/arm/sam34/sam4l-xplained/scripts/sam4l-xplained.ld index a60cf53d13..f428ef2fe9 100644 --- a/boards/arm/sam34/sam4l-xplained/scripts/sam4l-xplained.ld +++ b/boards/arm/sam34/sam4l-xplained/scripts/sam4l-xplained.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4l-xplained/scripts/sam4l-xplained.ld + * boards/arm/sam34/sam4l-xplained/scripts/sam4l-xplained.ld * * Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4l-xplained/src/Makefile b/boards/arm/sam34/sam4l-xplained/src/Makefile index 472ff2ea08..7b80d2d972 100644 --- a/boards/arm/sam34/sam4l-xplained/src/Makefile +++ b/boards/arm/sam34/sam4l-xplained/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam4l-xplained/src/Makefile +# boards/arm/sam34/sam4l-xplained/src/Makefile # # Copyright (C) 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4l-xplained/src/sam4l-xplained.h b/boards/arm/sam34/sam4l-xplained/src/sam4l-xplained.h index 0a4ef1e153..c093e05f70 100644 --- a/boards/arm/sam34/sam4l-xplained/src/sam4l-xplained.h +++ b/boards/arm/sam34/sam4l-xplained/src/sam4l-xplained.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4l-xplained/src/sam4l-xplained.h +/**************************************************************************** + * boards/arm/sam34/sam4l-xplained/src/sam4l-xplained.h * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_SAM4L_XPLAINED_SRC_SAM4L_XPLAINED_H -#define __BOARDS_ARM_SAM4L_XPLAINED_SRC_SAM4L_XPLAINED_H +#ifndef __BOARDS_ARM_SAM34_SAM4L_XPLAINED_SRC_SAM4L_XPLAINED_H +#define __BOARDS_ARM_SAM34_SAM4L_XPLAINED_SRC_SAM4L_XPLAINED_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -50,13 +50,14 @@ #include "hardware/sam_pinmap.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* LEDs: There are three LEDs on board the SAM4L 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 LED0 near the SAM4L USB - * connector. + ****************************************************************************/ + +/* LEDs: There are three LEDs on board the SAM4L 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 LED0 near + * the SAM4L USB connector. * * This LED is controlled by PC07 and LED0 can be activated by driving the * PC07 to GND. @@ -83,8 +84,8 @@ #define GPIO_LED0 (GPIO_OUTPUT | GPIO_PULL_NONE | GPIO_OUTPUT_SET | \ GPIO_PORTC | GPIO_PIN7) -/* QTouch button: The SAM4L Xplained Pro kit has one QTouch button. The connection - * to the SAM4L is: +/* QTouch button: The SAM4L Xplained Pro kit has one QTouch button. + * The connection to the SAM4L is: * * PC13 CATB_SENSE15 * PC14 CATB_DIS @@ -92,9 +93,10 @@ /* Mechanical buttons: * - * The SAM4L Xplained Pro contains two mechanical buttons. One button is the - * RESET button connected to the SAM4L 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 SAM4L Xplained Pro contains two mechanical buttons. + * One button is the RESET button connected to the SAM4L 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. * * PC24 SW0 */ @@ -174,9 +176,10 @@ /* I/O1 * - * Support for the microSD card slot on the I/O1 module. The I/O1 requires - * SPI support and two GPIOs. These the GPIOs 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 GPIOs. + * These the GPIOs will vary if the I/O1 is installed on the EXT1 or EXT2 + * connector: * * * PIN EXT1 EXT2 Description @@ -234,9 +237,10 @@ /* OLED1 * - * Support for the microSD card slot on the I/O1 module. The I/O1 requires - * SPI support and three output GPIOs. These the GPIOs 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 GPIOs. + * These the GPIOs will vary if the OLED1 is installed on the EXT1 or EXT2 + * connector: * * * PIN EXT1 EXT2 Description @@ -308,38 +312,39 @@ GPIO_PORTB | GPIO_PIN11) #endif -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_spidev_initialize * * Description: * Called to configure SPI chip select GPIO 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_SAM4L_XPLAINED_IOMODULE=y, + * Initialize the SPI-based SD card. + * Requires CONFIG_SAM4L_XPLAINED_IOMODULE=y, * CONFIG_DISABLE_MOUNTPOINT=n, CONFIG_MMCSD=y, and CONFIG_SAM34_SPI0=y * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAM34_SPI0) && defined(CONFIG_SAM4L_XPLAINED_IOMODULE) int sam_sdinitialize(int minor); @@ -349,8 +354,8 @@ int sam_sdinitialize(int minor); * Name: sam_slcd_initialize * * Description: - * Initialize the SAM4L Xplained Pro LCD hardware and register the character - * driver as /dev/slcd0. + * Initialize the SAM4L Xplained Pro LCD hardware and register the + * character driver as /dev/slcd0. * ****************************************************************************/ @@ -359,5 +364,5 @@ int sam_slcd_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAM4L_XPLAINED_SRC_SAM4L_XPLAINED_H */ +#endif /* __BOARDS_ARM_SAM34_SAM4L_XPLAINED_SRC_SAM4L_XPLAINED_H */ diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_appinit.c b/boards/arm/sam34/sam4l-xplained/src/sam_appinit.c index b8e0d94201..3d00b3328a 100644 --- a/boards/arm/sam34/sam4l-xplained/src/sam_appinit.c +++ b/boards/arm/sam34/sam4l-xplained/src/sam_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sam4l-xplained/src/sam_appinit.c + * boards/arm/sam34/sam4l-xplained/src/sam_appinit.c * * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -52,6 +52,7 @@ #ifdef CONFIG_SAM4L_XPLAINED_IOMODULE /* Support for the SD card slot on the I/O1 module */ + /* Verify NSH PORT and SLOT settings */ # define SAM34_MMCSDSLOTNO 0 /* There is only one slot */ @@ -105,28 +106,24 @@ int board_app_initialize(uintptr_t arg) #if defined(CONFIG_SAM34_LCDCA) && defined(CONFIG_SAM4L_XPLAINED_SLCD1MODULE) /* Initialize the SLCD and register the SLCD device as /dev/slcd0 */ - { - int ret = sam_slcd_initialize(); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to initialize the LCD: %d\n", - ret); - return ret; - } - } + int ret = sam_slcd_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize the LCD: %d\n", + ret); + return ret; + } #endif #if defined(CONFIG_SAM34_SPI0) && defined(CONFIG_SAM4L_XPLAINED_IOMODULE) /* Initialize the SPI-based MMC/SD slot */ - { - int ret = sam_sdinitialize(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(CONFIG_NSH_MMCSDMINOR); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", + ret); + return ret; + } #endif return OK; diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_autoleds.c b/boards/arm/sam34/sam4l-xplained/src/sam_autoleds.c index c120cb228c..c2f2c67885 100644 --- a/boards/arm/sam34/sam4l-xplained/src/sam_autoleds.c +++ b/boards/arm/sam34/sam4l-xplained/src/sam_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4l-xplained/src/sam_autoleds.c + * boards/arm/sam34/sam4l-xplained/src/sam_autoleds.c * * Copyright (C) 201, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_boot.c b/boards/arm/sam34/sam4l-xplained/src/sam_boot.c index 11845b2070..a3ec55f409 100644 --- a/boards/arm/sam34/sam4l-xplained/src/sam_boot.c +++ b/boards/arm/sam34/sam4l-xplained/src/sam_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4l-xplained/src/sam_boot.c +/**************************************************************************** + * boards/arm/sam34/sam4l-xplained/src/sam_boot.c * * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -45,32 +45,33 @@ #include "sam4l-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 intitialization -- 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 intitialization -- 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 - * sam_spidev_initialize() has been brought into the link. + /* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak + * function sam_spidev_initialize() has been brought into the link. */ #ifdef CONFIG_SAM34_SPI0 diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_buttons.c b/boards/arm/sam34/sam4l-xplained/src/sam_buttons.c index 87dee9474a..02c234239a 100644 --- a/boards/arm/sam34/sam4l-xplained/src/sam_buttons.c +++ b/boards/arm/sam34/sam4l-xplained/src/sam_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4l-xplained/src/sam_buttons.c + * boards/arm/sam34/sam4l-xplained/src/sam_buttons.c * * Copyright (C) 2013-2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_mmcsd.c b/boards/arm/sam34/sam4l-xplained/src/sam_mmcsd.c index 4cd42ab6c2..bb0bf23232 100644 --- a/boards/arm/sam34/sam4l-xplained/src/sam_mmcsd.c +++ b/boards/arm/sam34/sam4l-xplained/src/sam_mmcsd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sam4l-xplained/src/sam_mmcsd.c + * boards/arm/sam34/sam4l-xplained/src/sam_mmcsd.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -55,6 +55,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifdef CONFIG_DISABLE_MOUNTPOINT diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c b/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c index d0abef3873..ce91bde550 100644 --- a/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c +++ b/boards/arm/sam34/sam4l-xplained/src/sam_slcd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4l-xlplained/src/sam_slcd.c + * boards/arm/sam34/sam4l-xlplained/src/sam_slcd.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt @@ -70,6 +70,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifndef CONFIG_LIB_SLCDCODEC @@ -92,6 +93,7 @@ #endif /* LCD **********************************************************************/ + /* LCD characteristics. The logic in this driver is not portable; it is * tailored for the SAM4l Xplained Pro's LED1 module. However, in an effort * to add some reusability to this module, some of the tunable settings are @@ -268,6 +270,7 @@ struct slcd_pixel_s /**************************************************************************** * Private Function Protototypes ****************************************************************************/ + /* Debug */ #ifdef CONFIG_DEBUG_LCD_INFO @@ -298,13 +301,16 @@ static void slcd_action(enum slcdcode_e code, uint8_t count); static ssize_t slcd_read(FAR struct file *, FAR char *, size_t); static ssize_t slcd_write(FAR struct file *, FAR const char *, size_t); static int slcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg); -static int slcd_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); +static int slcd_poll(FAR struct file *filep, FAR struct pollfd *fds, + bool setup); /**************************************************************************** * Private Data ****************************************************************************/ -/* This is the driver state structure (there is no retained state information) */ +/* This is the driver state structure + * (there is no retained state information) + */ static const struct file_operations g_slcdops = { @@ -384,11 +390,17 @@ static void slcd_dumpstate(FAR const char *msg) lcdinfo(" curpos: %d\n", g_slcdstate.curpos); lcdinfo(" Display: [%c%c%c%c%c]\n", - g_slcdstate.buffer[0], g_slcdstate.buffer[1], g_slcdstate.buffer[2], - g_slcdstate.buffer[3], g_slcdstate.buffer[4]); + g_slcdstate.buffer[0], + g_slcdstate.buffer[1], + g_slcdstate.buffer[2], + g_slcdstate.buffer[3], + g_slcdstate.buffer[4]); lcdinfo(" Options: [%d%d%d%d%d]\n", - g_slcdstate.options[0], g_slcdstate.options[1], g_slcdstate.options[2], - g_slcdstate.options[3], g_slcdstate.options[4]); + g_slcdstate.options[0], + g_slcdstate.options[1], + g_slcdstate.options[2], + g_slcdstate.options[3], + g_slcdstate.options[4]); } #endif @@ -541,7 +553,7 @@ static uint8_t slcd_getcontrast(void) * 0000 0020 ffff ffe0 -32 0 */ - scontrast = (int32_t)(ucontrast << (32-6)); + scontrast = (int32_t)(ucontrast << (32 - 6)); scontrast >>= (32 - 6); return scontrast + 32; } @@ -611,7 +623,8 @@ static void slcd_writech(uint8_t ch, uint8_t curpos, uint8_t options) */ segment = g_startseg[curpos]; - putreg32(LCDCA_CMCFG_TDG_14S4C | LCDCA_CMCFG_STSEG(segment), SAM_LCDCA_CMCFG); + putreg32(LCDCA_CMCFG_TDG_14S4C | LCDCA_CMCFG_STSEG(segment), + SAM_LCDCA_CMCFG); putreg32(ch, SAM_LCDCA_CMDR); /* Check if we need to decorate the character with a preceding dot. */ @@ -645,19 +658,22 @@ static void slcd_action(enum slcdcode_e code, uint8_t count) { /* Erasure */ - case SLCDCODE_BACKDEL: /* Backspace (backward delete) N characters */ + case SLCDCODE_BACKDEL: /* Backspace (backward delete) N characters */ { int tmp; - /* If we are at the home position or if the count is zero, then ignore the action */ + /* If we are at the home position or if the count is zero, + * then ignore the action + */ if (g_slcdstate.curpos < 1 || count < 1) { break; } - /* Otherwise, BACKDEL is like moving the cursor back N characters then doing a - * forward deletion. Decrement the cursor position and fall through. + /* Otherwise, BACKDEL is like moving the cursor back N characters + * then doing a forward deletion. + * Decrement the cursor position and fall through. */ tmp = (int)g_slcdstate.curpos - count; @@ -672,7 +688,7 @@ static void slcd_action(enum slcdcode_e code, uint8_t count) g_slcdstate.curpos = tmp; } - case SLCDCODE_FWDDEL: /* DELete (forward delete) N characters moving text */ + case SLCDCODE_FWDDEL: /* DELete (forward delete) N characters moving text */ if (count > 0) { int nchars; @@ -693,8 +709,8 @@ static void slcd_action(enum slcdcode_e code, uint8_t count) for (i = g_slcdstate.curpos + nmove; i < SLCD_NCHARS - 1; i++) { - slcd_writech(g_slcdstate.buffer[i-nmove], i, - g_slcdstate.options[i-nmove]); + slcd_writech(g_slcdstate.buffer[i - nmove], i, + g_slcdstate.options[i - nmove]); } /* Erase the last 'nmove' characters on the display */ @@ -706,7 +722,7 @@ static void slcd_action(enum slcdcode_e code, uint8_t count) } break; - case SLCDCODE_ERASE: /* Erase N characters from the cursor position */ + case SLCDCODE_ERASE: /* Erase N characters from the cursor position */ if (count > 0) { int last; @@ -722,7 +738,9 @@ static void slcd_action(enum slcdcode_e code, uint8_t count) last = SLCD_NCHARS - 1; } - /* Erase N characters after the current cursor position left by one */ + /* Erase N characters after the current cursor position left + * by one + */ for (i = g_slcdstate.curpos; i < last; i++) { @@ -731,20 +749,22 @@ static void slcd_action(enum slcdcode_e code, uint8_t count) } break; - case SLCDCODE_CLEAR: /* Home the cursor and erase the entire display */ + case SLCDCODE_CLEAR: /* Home the cursor and erase the entire display */ { - /* This is like HOME followed by ERASEEOL. Home the cursor and - * fall through. + /* This is like HOME followed by ERASEEOL. + * Home the cursor and fall through. */ g_slcdstate.curpos = 0; } - case SLCDCODE_ERASEEOL: /* Erase from the cursor position to the end of line */ + case SLCDCODE_ERASEEOL: /* Erase from the cursor position to the end of line */ { int i; - /* Erase characters after the current cursor position to the end of the line */ + /* Erase characters after the current cursor position to the end of + * the line + */ for (i = g_slcdstate.curpos; i < SLCD_NCHARS; i++) { @@ -850,6 +870,7 @@ static ssize_t slcd_read(FAR struct file *filep, FAR char *buffer, size_t len) ret++; } } + /* Return the character */ *buffer++ = g_slcdstate.buffer[i]; @@ -914,7 +935,7 @@ static ssize_t slcd_write(FAR struct file *filep, slcd_action(SLCDCODE_HOME, 0); } - /* Ignore dots before control characters (all of them?) */ + /* Ignore dots before control characters (all of them?) */ options = 0; } @@ -982,11 +1003,10 @@ static int slcd_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { switch (cmd) { - /* SLCDIOC_GETATTRIBUTES: Get the attributes of the SLCD * - * argument: Pointer to struct slcd_attributes_s in which values will be - * returned + * argument: Pointer to struct slcd_attributes_s in which values will + * be returned */ case SLCDIOC_GETATTRIBUTES: @@ -1134,7 +1154,7 @@ static int slcd_poll(FAR struct file *filep, FAR struct pollfd *fds, { /* Data is always avaialble to be read / Data can always be written */ - fds->revents |= (fds->events & (POLLIN|POLLOUT)); + fds->revents |= (fds->events & (POLLIN | POLLOUT)); if (fds->revents != 0) { nxsem_post(fds->sem); @@ -1180,10 +1200,10 @@ int sam_slcd_initialize(void) sam_lcdca_enableclk(); - /* Here we require that either CONFIG_SAM34_OSC32K or CONFIG_SAM34_RC32K - * is defined in the configuration. In that case, the source clock was - * initialized during boot up and we can be assured that it is read for - * use now. + /* Here we require that either CONFIG_SAM34_OSC32K or + * CONFIG_SAM34_RC32K is defined in the configuration. + * In that case, the source clock was initialized during boot up + * and we can be assured that it is read for use now. */ /* Disable the LCD controller and frame counters */ diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_spi.c b/boards/arm/sam34/sam4l-xplained/src/sam_spi.c index 497b8b7fb4..6111a659ab 100644 --- a/boards/arm/sam34/sam4l-xplained/src/sam_spi.c +++ b/boards/arm/sam34/sam4l-xplained/src/sam_spi.c @@ -1,5 +1,5 @@ /************************************************************************************ - * boards/sam4l-xplained/src/sam_spi.c + * boards/arm/sam34/sam4l-xplained/src/sam_spi.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_ug2832hsweg04.c b/boards/arm/sam34/sam4l-xplained/src/sam_ug2832hsweg04.c index ccdc29842c..495b3d065b 100644 --- a/boards/arm/sam34/sam4l-xplained/src/sam_ug2832hsweg04.c +++ b/boards/arm/sam34/sam4l-xplained/src/sam_ug2832hsweg04.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sam4l-xplained/src/sam_ug2832hsweg04.c + * boards/arm/sam34/sam4l-xplained/src/sam_ug2832hsweg04.c * * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4l-xplained/src/sam_userleds.c b/boards/arm/sam34/sam4l-xplained/src/sam_userleds.c index d4ededd15d..57364074f6 100644 --- a/boards/arm/sam34/sam4l-xplained/src/sam_userleds.c +++ b/boards/arm/sam34/sam4l-xplained/src/sam_userleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4l-xplained/src/sam_userleds.c + * boards/arm/sam34/sam4l-xplained/src/sam_userleds.c * * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4s-xplained-pro/include/board.h b/boards/arm/sam34/sam4s-xplained-pro/include/board.h index 480f8d0666..eee9dfebf8 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/include/board.h +++ b/boards/arm/sam34/sam4s-xplained-pro/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4s-xplained-pro/include/board.h +/**************************************************************************** + * boards/arm/sam34/sam4s-xplained-pro/include/board.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt @@ -32,14 +32,14 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAM4S_XPLAINED_PRO_INCLUDE_BOARD_H -#define __BOARDS_ARM_SAM4S_XPLAINED_PRO_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_SAM34_SAM4S_XPLAINED_PRO_INCLUDE_BOARD_H +#define __BOARDS_ARM_SAM34_SAM4S_XPLAINED_PRO_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -51,13 +51,15 @@ # endif #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the sam4s device is running on a 4MHz internal RC. These - * definitions will configure clocking with MCK = 120MHz, PLLA = 240, and CPU=120MHz. +/* Clocking *****************************************************************/ + +/* After power-on reset, the sam4s device is running on a 4MHz internal RC. + * These definitions will configure clocking with MCK = 120MHz, PLLA = 240, + * and CPU=120MHz. */ #define BOARD_32KOSC_FREQUENCY (32768) @@ -69,6 +71,7 @@ #define BOARD_CKGR_MOR_MOSCXTST (63 << PMC_CKGR_MOR_MOSCXTST_SHIFT) /* Start-up Time */ #ifdef CONFIG_SAM34_UDP + /* PLLA configuration: * * Source: 12MHz crystall at 12MHz @@ -138,6 +141,7 @@ #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV #ifdef CONFIG_SAM34_UDP + /* The PLL clock (USB_48M or UDPCK) is driven from the output of the PLL, * PLLACK. The PLL clock must be 48MHz. PLLACK can be divided down via the * PMC USB register to provide the PLL clock. So in order to use the USB @@ -191,9 +195,10 @@ #define BOARD_FWS 5 -/* LED definitions ******************************************************************/ -/* There are two LEDs on board the SAM4S Xplained Pro board, One of these can be - * controlled by software in the SAM4S: +/* LED definitions **********************************************************/ + +/* There are two LEDs on board the SAM4S Xplained Pro board, One of these + * can be controlled by software in the SAM4S: * * LED GPIO * ---------------- ----- @@ -212,13 +217,16 @@ #define BOARD_D301_BIT (1 << BOARD_D301) /* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is - * defined. In that case, the usage by the board port is defined in - * include/board.h and src/up_leds.c. The LEDs are used to encode OS-related - * events as follows: + * defined. + * In that case, the usage by the board port is defined in + * include/board.h and src/up_leds.c. + * The LEDs are used to encode OS-related events as follows: * * SYMBOL Val Meaning LED state * D301 - * ----------------------- --- ----------------------- -------------- */ + * ----------------------- --- ----------------------- -------------- + */ + #define LED_STARTED 0 /* NuttX has been started OFF */ #define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF */ #define LED_IRQSENABLED 0 /* Interrupts enabled OFF */ @@ -236,12 +244,14 @@ * apparently, running normally. */ -/* Button definitions ***************************************************************/ +/* Button definitions *******************************************************/ + /* Mechanical buttons: * - * The SAM4S Xplained Pro has two mechanical buttons. One button is the RESET button - * connected to the SAM4S reset line and the other is a generic user configurable - * button labeled SW0. When a button is pressed it will drive the I/O line to GND. + * The SAM4S Xplained Pro has two mechanical buttons. + * One button is the RESET button connected to the SAM4S reset line and the + * other is a generic user configurable button labeled SW0. + * When a button is pressed it will drive the I/O line to GND. * * PA2 SW0 */ @@ -251,4 +261,4 @@ #define BUTTON_SW0_BIT (1 << BUTTON_SW0) -#endif /* __BOARDS_ARM_SAM4S_XPLAINED_PRO_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_SAM34_SAM4S_XPLAINED_PRO_INCLUDE_BOARD_H */ diff --git a/boards/arm/sam34/sam4s-xplained-pro/scripts/Make.defs b/boards/arm/sam34/sam4s-xplained-pro/scripts/Make.defs index bab1de099e..55875e761a 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/scripts/Make.defs +++ b/boards/arm/sam34/sam4s-xplained-pro/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam4s-xplained-pro/scripts/Make.defs +# boards/arm/sam34/sam4s-xplained-pro/scripts/Make.defs # # Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4s-xplained-pro/scripts/sam4s-xplained-pro.ld b/boards/arm/sam34/sam4s-xplained-pro/scripts/sam4s-xplained-pro.ld index 9c346e17ee..a14a3ab589 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/scripts/sam4s-xplained-pro.ld +++ b/boards/arm/sam34/sam4s-xplained-pro/scripts/sam4s-xplained-pro.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4s-xplained-pro/scripts/sam4s-xplained-pro.ld + * boards/arm/sam34/sam4s-xplained-pro/scripts/sam4s-xplained-pro.ld * * Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/Makefile b/boards/arm/sam34/sam4s-xplained-pro/src/Makefile index ec4727eebe..c92a2e68ef 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/Makefile +++ b/boards/arm/sam34/sam4s-xplained-pro/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam4s-xplained-pro/src/Makefile +# boards/arm/sam34/sam4s-xplained-pro/src/Makefile # # Copyright (C) 2014 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam4s-xplained-pro.h b/boards/arm/sam34/sam4s-xplained-pro/src/sam4s-xplained-pro.h index 339ea18afc..a4895d1b68 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam4s-xplained-pro.h +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam4s-xplained-pro.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4s-xplained-pro/src/sam4s-xplained-pro.h +/**************************************************************************** + * boards/arm/sam34/sam4s-xplained-pro/src/sam4s-xplained-pro.h * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt @@ -32,14 +32,14 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAM4S_XPLAINED_SRC_SAM4S_XPLAINED_H -#define __BOARDS_ARM_SAM4S_XPLAINED_SRC_SAM4S_XPLAINED_H +#ifndef __BOARDS_ARM_SAM34_SAM4S_XPLAINED_SRC_SAM4S_XPLAINED_H +#define __BOARDS_ARM_SAM34_SAM4S_XPLAINED_SRC_SAM4S_XPLAINED_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -51,10 +51,11 @@ #include "hardware/sam_pinmap.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ + ****************************************************************************/ + +/* Configuration ************************************************************/ #define HAVE_HSMCI 1 #define HAVE_PROC 1 @@ -62,6 +63,7 @@ #undef HAVE_USBMONITOR /* HSMCI */ + /* Can't support MMC/SD if the card interface is not enabled */ #if !defined(CONFIG_SAM34_HSMCI) @@ -92,6 +94,7 @@ #endif /* USB Device */ + /* CONFIG_SAM34_UDP and CONFIG_USBDEV must be defined, or there is no USB * device. */ @@ -145,9 +148,10 @@ /* Mechanical buttons: * - * The SAM4S Xplained Pro has two mechanical buttons. One button is the RESET button - * connected to the SAM4S reset line and the other is a generic user configurable - * button labeled SW0. When a button is pressed it will drive the I/O line to GND. + * The SAM4S Xplained Pro has two mechanical buttons. + * One button is the RESET button connected to the SAM4S reset line and the + * other is a generic user configurable button labeled SW0. + * When a button is pressed it will drive the I/O line to GND. * * PA2 SW0 */ @@ -161,27 +165,27 @@ #define GPIO_MCI_CD (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_PORT_PIOC | GPIO_PIN12) #define MCI_CD_IRQ SAM_IRQ_PC12 -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_hsmci_initialize * * Description: * Initialize HSMCI support * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_HSMCI int sam_hsmci_initialize(void); @@ -189,25 +193,25 @@ int sam_hsmci_initialize(void); # define sam_hsmci_initialize() #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_cardinserted * * Description: * Check if a card is inserted into the selected HSMCI slot * - ************************************************************************************/ + ****************************************************************************/ #if defined(HAVE_HSMCI) && defined(CONFIG_MMCSD_HAVE_CARDDETECT) bool sam_cardinserted(int slotno); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_writeprotected * * Description: * Check if the card in the MMCSD slot is write protected * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_HSMCI bool sam_writeprotected(int slotno); @@ -232,4 +236,4 @@ bool sam_writeprotected(int slotno); int sam_watchdog_initialize(void); #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAM4S_XPLAINED_SRC_SAM4S_XPLAINED_H */ +#endif /* __BOARDS_ARM_SAM34_SAM4S_XPLAINED_SRC_SAM4S_XPLAINED_H */ diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_appinit.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_appinit.c index 4ed689f4e8..a66f2c0e9a 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_appinit.c +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sam4s-xplained-pro/src/sam_appinit.c + * boards/arm/sam34/sam4s-xplained-pro/src/sam_appinit.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -164,7 +164,8 @@ int board_app_initialize(uintptr_t arg) ret = usbmonitor_start(); if (ret != OK) { - syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d (%d)\n", ret, errno); + syslog(LOG_ERR, + "ERROR: Failed to start USB monitor: %d (%d)\n", ret, errno); return ret; } #endif diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_autoleds.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_autoleds.c index 0752e9df7b..c9f1339a9a 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_autoleds.c +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4s-xplained-pro/src/sam_autoleds.c + * boards/arm/sam34/sam4s-xplained-pro/src/sam_autoleds.c * * Copyright (C) 2014, 2015 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt @@ -113,7 +113,6 @@ void board_autoled_on(int led) default: break; } - } /**************************************************************************** diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_boot.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_boot.c index b27bceee8b..b25c60a7cd 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_boot.c +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4s-xplained-pro/src/sam_boot.c +/**************************************************************************** + * boards/arm/sam34/sam4s-xplained-pro/src/sam_boot.c * * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -46,19 +46,20 @@ #include "sam4s-xplained-pro.h" -/************************************************************************************ +/**************************************************************************** * 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) { @@ -69,7 +70,6 @@ void sam_boardinitialize(void) #endif } - /**************************************************************************** * Name: board_late_initialize * diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_buttons.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_buttons.c index f946f053da..3d8c52d4ec 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_buttons.c +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4s-xplained-pro/src/sam_buttons.c + * boards/arm/sam34/sam4s-xplained-pro/src/sam_buttons.c * * Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_hsmci.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_hsmci.c index dc62e4a569..e5c9f8ea20 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_hsmci.c +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam_hsmci.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sam4s-xplained-pro/src/sam_hsmci.c + * boards/arm/sam34/sam4s-xplained-pro/src/sam_hsmci.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt @@ -62,6 +62,7 @@ /**************************************************************************** * Private Types ****************************************************************************/ + /* This structure holds static information unique to one HSMCI peripheral */ struct sam_hsmci_state_s @@ -116,7 +117,7 @@ static int sam_hsmci_cardetect_int(int irq, void *regs, FAR void *arg) sdio_mediachange(g_hsmci.hsmci, inserted); } - return OK; + return OK; } #endif @@ -142,6 +143,7 @@ int sam_hsmci_initialize(void) if (!g_hsmci.initialized) { /* Mount the SDIO-based MMC/SD block driver */ + /* First, get an instance of the SDIO interface */ g_hsmci.hsmci = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO); diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_udp.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_udp.c index 7fed0d7e7a..8367f4c846 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_udp.c +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam_udp.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4s-xplained-pro/src/sam_udp.c +/**************************************************************************** + * boards/arm/sam34/sam4s-xplained-pro/src/sam_udp.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt @@ -32,11 +32,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -51,36 +51,39 @@ #include "up_arch.h" #include "sam4s-xplained-pro.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_udp_suspend * * Description: * Board logic must provide the sam_udp_suspend logic if the UDP driver is - * used. This function is called whenever the USB enters or leaves suspend mode. + * used. + * This function is called whenever the USB enters or leaves suspend mode. * - * When 'resume' is false, this function call provides an opportunity to perform - * board-specific power-saving actions so that less power is consumed while the - * USB is suspended. + * When 'resume' is false, this function call provides an opportunity to + * perform board-specific power-saving actions so that less power is + * consumed while the USB is suspended. * - * Certain power-saving operations are performed by the UDP driver when it enters - * suspend mode: The USB device peripheral clocks are be switched off. MCK and + * Certain power-saving operations are performed by the UDP driver when + * it enters suspend mode: + * The USB device peripheral clocks are be switched off. MCK and * UDPCK are switched off and the USB transceiver is disabled. * - * When 'resume' is true, normal clocking and operations must all be restored. + * When 'resume' is true, normal clocking and operations must all be + * restored. * - ************************************************************************************/ + ****************************************************************************/ void sam_udp_suspend(FAR struct usbdev_s *dev, bool resume) { diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_userleds.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_userleds.c index 4a49b9b6e0..0e8d013b4d 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_userleds.c +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam_userleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4s-xplained-pro/src/sam_userleds.c + * boards/arm/sam34/sam4s-xplained-pro/src/sam_userleds.c * * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_wdt.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_wdt.c index de576c236f..757d1e5d70 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_wdt.c +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam_wdt.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4s-xplained-pro/src/up_wdt.c + * boards/arm/sam34/sam4s-xplained-pro/src/up_wdt.c * * Copyright (C) 2014, 2016-2018 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt diff --git a/boards/arm/sam34/sam4s-xplained/include/board.h b/boards/arm/sam34/sam4s-xplained/include/board.h index 14517bd690..400eb2facc 100644 --- a/boards/arm/sam34/sam4s-xplained/include/board.h +++ b/boards/arm/sam34/sam4s-xplained/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4s-xplained/include/board.h +/**************************************************************************** + * boards/arm/sam34/sam4s-xplained/include/board.h * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_SAM4L_XPLAINED_INCLUDE_BOARD_H -#define __BOARDS_ARM_SAM4L_XPLAINED_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_SAM34_SAM4S_XPLAINED_INCLUDE_BOARD_H +#define __BOARDS_ARM_SAM34_SAM4S_XPLAINED_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -49,13 +49,15 @@ # endif #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the sam3u device is running on a 4MHz internal RC. These - * definitions will configure clocking with MCK = 48MHz, PLLA = 96, and CPU=120MHz. +/* Clocking *****************************************************************/ + +/* After power-on reset, the sam3u device is running on a 4MHz internal RC. + * These definitions will configure clocking with MCK = 48MHz, PLLA = 96, + * and CPU=120MHz. */ /* Main oscillator register settings */ @@ -149,7 +151,8 @@ #define BOARD_FWS 5 -/* LED definitions ******************************************************************/ +/* LED definitions **********************************************************/ + /* There are four LEDs on board the SAM4S Xplained board, two of these can be * controlled by software in the SAM4S: * @@ -179,7 +182,9 @@ * * SYMBOL Val Meaning LED state * D9 D10 - * ----------------------- --- ----------------------- -------- -------- */ + * ----------------------- --- ----------------------- -------- -------- + */ + #define LED_STARTED 0 /* NuttX has been started OFF OFF */ #define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF */ #define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF */ @@ -195,12 +200,14 @@ * 2Hz, then a fatal error has been detected and the system has halted. */ -/* Button definitions ***************************************************************/ +/* Button definitions *******************************************************/ + /* Mechanical buttons: * - * The SAM4S Xplained has two mechanical buttons. One button is the RESET button - * connected to the SAM4S reset line and the other is a generic user configurable - * button labeled BP2. When a button is pressed it will drive the I/O line to GND. + * The SAM4S Xplained has two mechanical buttons. + * One button is the RESET button connected to the SAM4S reset line and the + * other is a generic user configurable button labeled BP2. + * When a button is pressed it will drive the I/O line to GND. * * PA5 BP2 */ @@ -210,4 +217,4 @@ #define BUTTON_BP2_BIT (1 << BUTTON_BP2) -#endif /* __BOARDS_ARM_SAM4L_XPLAINED_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_SAM34_SAM4S_XPLAINED_INCLUDE_BOARD_H */ diff --git a/boards/arm/sam34/sam4s-xplained/scripts/Make.defs b/boards/arm/sam34/sam4s-xplained/scripts/Make.defs index b8c0faf17f..440a4334dc 100644 --- a/boards/arm/sam34/sam4s-xplained/scripts/Make.defs +++ b/boards/arm/sam34/sam4s-xplained/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam4s-xplained/scripts/Make.defs +# boards/arm/sam34/sam4s-xplained/scripts/Make.defs # # Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4s-xplained/scripts/sam4s-xplained.ld b/boards/arm/sam34/sam4s-xplained/scripts/sam4s-xplained.ld index 08e0e7d825..6c31914337 100644 --- a/boards/arm/sam34/sam4s-xplained/scripts/sam4s-xplained.ld +++ b/boards/arm/sam34/sam4s-xplained/scripts/sam4s-xplained.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4s-xplained/scripts/sam4s-xplained.ld + * boards/arm/sam34/sam4s-xplained/scripts/sam4s-xplained.ld * * Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4s-xplained/src/Makefile b/boards/arm/sam34/sam4s-xplained/src/Makefile index c4ac5d0454..8b565a5a0a 100644 --- a/boards/arm/sam34/sam4s-xplained/src/Makefile +++ b/boards/arm/sam34/sam4s-xplained/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/sam4s-xplained/src/Makefile +# boards/arm/sam34/sam4s-xplained/src/Makefile # # Copyright (C) 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4s-xplained/src/sam4s-xplained.h b/boards/arm/sam34/sam4s-xplained/src/sam4s-xplained.h index cb27370012..b39138f0a8 100644 --- a/boards/arm/sam34/sam4s-xplained/src/sam4s-xplained.h +++ b/boards/arm/sam34/sam4s-xplained/src/sam4s-xplained.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4s-xplained/src/sam4s-xplained.h +/**************************************************************************** + * boards/arm/sam34/sam4s-xplained/src/sam4s-xplained.h * * Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_SAM4S_XPLAINED_SRC_SAM4S_XPLAINED_H #define __BOARDS_ARM_SAM4S_XPLAINED_SRC_SAM4S_XPLAINED_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -50,9 +50,10 @@ #include "hardware/sam_pinmap.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + /* There are four LEDs on board the SAM4S Xplained board, two of these can be * controlled by software in the SAM4S: * @@ -93,9 +94,10 @@ /* Mechanical buttons: * - * The SAM4S Xplained has two mechanical buttons. One button is the RESET button - * connected to the SAM4S reset line and the other is a generic user configurable - * button labeled BP2. When a button is pressed it will drive the I/O line to GND. + * The SAM4S Xplained has two mechanical buttons. + * One button is the RESET button connected to the SAM4S reset line and the + * other is a generic user configurable button labeled BP2. + * When a button is pressed it will drive the I/O line to GND. * * PA5 BP2 */ @@ -109,32 +111,31 @@ #define GPIO_EBI_NLB (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \ GPIO_PORT_PIOC | GPIO_PIN16) -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_sram_initialize * * Description: * Configure and enable SRAM on board the SAM4S Xplained * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAM34_EXTSRAM0 void sam_sram_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAM4S_XPLAINED_SRC_SAM4S_XPLAINED_H */ - +#endif /* __BOARDS_ARM_SAM34_SAM4S_XPLAINED_SRC_SAM4S_XPLAINED_H */ diff --git a/boards/arm/sam34/sam4s-xplained/src/sam_autoleds.c b/boards/arm/sam34/sam4s-xplained/src/sam_autoleds.c index bbd3275cc1..5189d2a7b7 100644 --- a/boards/arm/sam34/sam4s-xplained/src/sam_autoleds.c +++ b/boards/arm/sam34/sam4s-xplained/src/sam_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4s-xplained/src/sam_autoleds.c + * boards/arm/sam34/sam4s-xplained/src/sam_autoleds.c * * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sam34/sam4s-xplained/src/sam_boot.c b/boards/arm/sam34/sam4s-xplained/src/sam_boot.c index e3f1247295..aab2bfa930 100644 --- a/boards/arm/sam34/sam4s-xplained/src/sam_boot.c +++ b/boards/arm/sam34/sam4s-xplained/src/sam_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4s-xplained/src/sam_boot.c +/**************************************************************************** + * boards/arm/sam34/sam4s-xplained/src/sam_boot.c * * Copyright (C) 201, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -45,27 +45,28 @@ #include "sam4s-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 intitialization -- 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 intitialization -- after all + * memory has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void sam_boardinitialize(void) { diff --git a/boards/arm/sam34/sam4s-xplained/src/sam_buttons.c b/boards/arm/sam34/sam4s-xplained/src/sam_buttons.c index bf1fa1e378..0e350487d5 100644 --- a/boards/arm/sam34/sam4s-xplained/src/sam_buttons.c +++ b/boards/arm/sam34/sam4s-xplained/src/sam_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4s-xplained/src/sam_buttons.c + * boards/arm/sam34/sam4s-xplained/src/sam_buttons.c * * Copyright (C) 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -147,5 +147,4 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) return ret; } #endif - #endif /* CONFIG_ARCH_BUTTONS */ diff --git a/boards/arm/sam34/sam4s-xplained/src/sam_sram.c b/boards/arm/sam34/sam4s-xplained/src/sam_sram.c index c3b346c6fa..139aafd1c1 100644 --- a/boards/arm/sam34/sam4s-xplained/src/sam_sram.c +++ b/boards/arm/sam34/sam4s-xplained/src/sam_sram.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sam4s-xplained/src/sam_sram.c +/**************************************************************************** + * boards/arm/sam34/sam4s-xplained/src/sam_sram.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -48,15 +48,15 @@ #ifdef CONFIG_SAM34_EXTSRAM0 -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #define NPINS (3+8+19+1) -/************************************************************************************ +/**************************************************************************** * Private Data - ************************************************************************************/ + ****************************************************************************/ static const gpio_pinset_t g_srampins[NPINS] = { @@ -74,21 +74,21 @@ static const gpio_pinset_t g_srampins[NPINS] = GPIO_EBI_NLB }; -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_sram_initialize * * Description: * Configure and enable SRAM on board the SAM4S Xplained * - ************************************************************************************/ + ****************************************************************************/ void sam_sram_initialize(void) { diff --git a/boards/arm/sam34/sam4s-xplained/src/sam_userleds.c b/boards/arm/sam34/sam4s-xplained/src/sam_userleds.c index a0b69732f9..ebf95fa846 100644 --- a/boards/arm/sam34/sam4s-xplained/src/sam_userleds.c +++ b/boards/arm/sam34/sam4s-xplained/src/sam_userleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sam4s-xplained/src/sam_userleds.c + * boards/arm/sam34/sam4s-xplained/src/sam_userleds.c * * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d2-xult/README.txt b/boards/arm/sama5/sama5d2-xult/README.txt index d37be580bc..728989cbe9 100644 --- a/boards/arm/sama5/sama5d2-xult/README.txt +++ b/boards/arm/sama5/sama5d2-xult/README.txt @@ -56,13 +56,13 @@ REVISIT: Unverified, cloned text from the SAMA5D4-EK README.txt DRAMBOOT, AT25BOOT, SRAMBOOT ---------------------------- - See also boards/sama5d4-ek/README.txt for a description of the DRAMBOOT + See also boards/arm/sama5/sama5d4-xult/README.txt for a description of the DRAMBOOT program. This is a tiny version of NuttX that can run out of internal SRAM. If you put this program on the HSMCI1 microSD card as boot.bin, then it will boot on power up and you can download NuttX directly into DRAM by sending the nuttx.hex file over the serial connection. - The boards/sama5d4-ek/README.txt also describes variants AT25BOOT and + The boards/arm/sama5/sama5d4-xult/README.txt also describes variants AT25BOOT and SRAMBOOT. This have not yet been ported to the SAMA5D2-XULT, but are available if they are usefult too you. diff --git a/boards/arm/sama5/sama5d2-xult/include/board.h b/boards/arm/sama5/sama5d2-xult/include/board.h index 0725a0c6b4..dd813233a4 100644 --- a/boards/arm/sama5/sama5d2-xult/include/board.h +++ b/boards/arm/sama5/sama5d2-xult/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d2-xult/include/board.h +/**************************************************************************** + * boards/arm/sama5/sama5d2-xult/include/board.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_SAMA5D2_XULT_INCLUDE_BOARD_H -#define __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_H +#define __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -47,13 +47,14 @@ # include #endif -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. */ /* On-board crystal frequencies */ @@ -62,22 +63,28 @@ #define BOARD_SLOWCLK_FREQUENCY (32768) /* Slow Clock: 32.768KHz */ #if defined(CONFIG_SAMA5_BOOT_SDRAM) -/* When booting from SDRAM, NuttX is loaded in SDRAM by an intermediate bootloader. +/* When booting from SDRAM, NuttX is loaded in SDRAM by an intermediate + * bootloader. * That bootloader had to have already configured the PLL and SDRAM for proper * operation. * - * In this case, we don not reconfigure the clocking. Rather, we need to query - * the register settings to determine the clock frequencies. We can only assume that - * the Main clock source is the on-board 12MHz crystal. + * In this case, we don not reconfigure the clocking. + * Rather, we need to query the register settings to determine the clock + * frequencies. + * We can only assume that the Main clock source is the on-board 12MHz + * crystal. */ # include #elif defined(CONFIG_SAMA5D2XULT_384MHZ) -/* OHCI Only. This is an alternative slower configuration that will produce a 48MHz - * USB clock with the required accuracy using only PLLA. When PPLA is used to clock - * OHCI, an additional requirement is the PLLACK be a multiple of 48MHz. This setup - * results in a CPU clock of 384MHz. + +/* OHCI Only. + * This is an alternative slower configuration that will produce a 48MHz + * USB clock with the required accuracy using only PLLA. + * When PPLA is used to clock OHCI, an additional requirement is the + * PLLACK be a multiple of 48MHz. + * This setup results in a CPU clock of 384MHz. * * This case is only interesting for experimentation. */ @@ -85,6 +92,7 @@ # include #elif defined(CONFIG_SAMA5D2XULT_528MHZ) + /* This is the configuration results in a CPU clock of 528MHz. * * In this configuration, UPLL is the source of the UHPHS clock (if enabled). @@ -93,8 +101,9 @@ # include #else /* #elif defined(CONFIG_SAMA5D2XULT_396MHZ) */ -/* This is the configuration provided in the Atmel example code. This setup results - * in a CPU clock of 396MHz. + +/* This is the configuration provided in the Atmel example code. + * This setup results in a CPU clock of 396MHz. * * In this configuration, UPLL is the source of the UHPHS clock (if enabled). */ @@ -103,21 +112,24 @@ #endif -/* LED definitions ******************************************************************/ -/* There is an RGB LED on board the SAMA5D2-XULT. The RED component is driven by - * the SDHC_CD pin (PA13) and so will not be used. The LEDs are provided VDD_LED - * and so bringing the LED low will will illuminated the LED. +/* LED definitions **********************************************************/ + +/* There is an RGB LED on board the SAMA5D2-XULT. + * The RED component is driven by the SDHC_CD pin (PA13) and so will not + * be used. The LEDs are provided VDD_LED and so bringing the LED low will + * will illuminated the LED. * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- --------------------- * SAMA5D2 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- --------------------- * PA13 SDHC_CD_PA13 Red LED * PB5 LED_GREEN_PB5 Green LED * PB0 LED_BLUE_PB0 Blue LED - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- --------------------- */ #ifndef CONFIG_ARCH_LEDS + /* LED index values for use with board_userled() */ #define BOARD_GREEN 0 @@ -130,6 +142,7 @@ #define BOARD_BLUE_BIT (1 << BOARD_BLUE) #else + /* LED index values for use with board_userled() */ #define BOARD_BLUE 0 @@ -146,7 +159,9 @@ * events as follows. Note that only the GREEN LED is used in this case * * SYMBOL Val Meaning Green LED - * ----------------- --- ----------------------- ----------- */ + * ----------------- --- ----------------------- ----------- + */ + #define LED_STARTED 0 /* NuttX has been started OFF */ #define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF */ #define LED_IRQSENABLED 0 /* Interrupts enabled OFF */ @@ -157,22 +172,24 @@ #define LED_PANIC 3 /* The system has crashed Flash */ #undef LED_IDLE /* MCU is is sleep mode Not used */ -/* Thus if the Green LED is statically on, NuttX has successfully booted and - * is, apparently, running normally. If LED is flashing at approximately - * 2Hz, then a fatal error has been detected and the system has halted. +/* Thus if the Green LED is statically on, NuttX has successfully booted + * and is, apparently, running normally. + * If LED is flashing at approximately 2Hz, then a fatal error has been + * detected and the system has halted. */ -/* Button definitions ***************************************************************/ +/* Button definitions *******************************************************/ + /* A single button, PB_USER (PB6), is available on the SAMA5D2-XULT * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ---------------------- * SAMA5D2 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ---------------------- * PB6 USER_PB_PB6 PB_USER push button - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ---------------------- * - * Closing PB_USER will bring PB6 to ground so 1) PB6 should have a weak pull-up, - * and 2) when PB_USER is pressed, a low value will be senses. + * Closing PB_USER will bring PB6 to ground so 1) PB6 should have a weak + * pull-up, and 2) when PB_USER is pressed, a low value will be senses. */ #define BUTTON_USER 0 @@ -180,12 +197,14 @@ #define BUTTON_USER_BIT (1 << BUTTON_USER) -/* Pin disambiguation ***************************************************************/ -/* Alternative pin selections are provided with a numeric suffix like _1, _2, etc. - * Drivers, however, will use the pin selection without the numeric suffix. - * Additional definitions are required in this board.h file. For example, if we - * wanted the PCK0on PB26, then the following definition should appear in the - * board.h header file for that board: +/* Pin disambiguation *******************************************************/ + +/* Alternative pin selections are provided with a numeric suffix like _1, _2, + * etc. Drivers, however, will use the pin selection without the numeric + * suffix. + * Additional definitions are required in this board.h file. + * For example, if we wanted the PCK0on PB26, then the following definition + * should appear in the board.h header file for that board: * * #define PIO_PMC_PCK0 PIO_PMC_PCK0_1 * @@ -261,13 +280,13 @@ * ---- ------- ---- -------- */ -/************************************************************************************ +/**************************************************************************** * Assembly Language Macros - ************************************************************************************/ + ****************************************************************************/ #ifdef __ASSEMBLY__ - .macro config_sdram - .endm + .macro config_sdram + .endm #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_H */ diff --git a/boards/arm/sama5/sama5d2-xult/include/board_384mhz.h b/boards/arm/sama5/sama5d2-xult/include/board_384mhz.h index 80372a40aa..7152474796 100644 --- a/boards/arm/sama5/sama5d2-xult/include/board_384mhz.h +++ b/boards/arm/sama5/sama5d2-xult/include/board_384mhz.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d2-xult/include/board_384mhz.h +/**************************************************************************** + * boards/arm/sama5/sama5d2-xult/include/board_384mhz.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,32 +31,35 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_384MHZ_H -#define __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_384MHZ_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_384MHZ_H +#define __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_384MHZ_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. * - * This is an alternative slower configuration that will produce a 48MHz USB clock - * with the required accuracy. When used with OHCI, an additional requirement is - * the PLLACK be a multiple of 48MHz. This setup results in a CPU clock of 384MHz. + * This is an alternative slower configuration that will produce a 48MHz USB + * clock with the required accuracy. + * When used with OHCI, an additional requirement is the PLLACK be a multiple + * of 48MHz. + * This setup results in a CPU clock of 384MHz. * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Multiplier = 64 to generate PLLACK = 768MHz - * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Multiplier = 64 to generate PLLACK = 768MHz + * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate * MCK = 128MHz * CPU clock = 384MHz */ @@ -197,23 +200,24 @@ #define HSMCI_SDXFR_CLKDIV (2 << HSMCI_MR_CLKDIV_SHIFT) #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -221,4 +225,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_384MHZ_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_384MHZ_H */ diff --git a/boards/arm/sama5/sama5d2-xult/include/board_396mhz.h b/boards/arm/sama5/sama5d2-xult/include/board_396mhz.h index 5078b9360c..8c77f64543 100644 --- a/boards/arm/sama5/sama5d2-xult/include/board_396mhz.h +++ b/boards/arm/sama5/sama5d2-xult/include/board_396mhz.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d2-xult/include/board_396mhz.h +/**************************************************************************** + * boards/arm/sama5/sama5d2-xult/include/board_396mhz.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,31 +31,32 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_396MHZ_H -#define __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_396MHZ_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_396MHZ_H +#define __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_396MHZ_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. * - * This is the configuration provided in the Atmel example code. This results in a - * CPU clock of 396MHz: + * This is the configuration provided in the Atmel example code. + * This results in a CPU clock of 396MHz: * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Multiplier = 66 to generate PLLACK = 792MHz - * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Multiplier = 66 to generate PLLACK = 792MHz + * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate * MCK = 132MHz * CPU clock = 396MHz */ @@ -189,23 +190,24 @@ #define HSMCI_SDXFR_CLKDIV (2 << HSMCI_MR_CLKDIV_SHIFT) #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -213,4 +215,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_396MHZ_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_396MHZ_H */ diff --git a/boards/arm/sama5/sama5d2-xult/include/board_528mhz.h b/boards/arm/sama5/sama5d2-xult/include/board_528mhz.h index ca7f112a20..a62cffa446 100644 --- a/boards/arm/sama5/sama5d2-xult/include/board_528mhz.h +++ b/boards/arm/sama5/sama5d2-xult/include/board_528mhz.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d2-xult/include/board_528mhz.h +/**************************************************************************** + * boards/arm/sama5/sama5d2-xult/include/board_528mhz.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,30 +31,31 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_528MHZ_H -#define __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_528MHZ_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_528MHZ_H +#define __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_528MHZ_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. * * This is the configuration results in a CPU clock of 528MHz: * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Multiplier = 43+1 to generate PLLACK = 528MHz - * Master Clock (MCK): Source = PLLACK/1, Prescalar = 1, MDIV = 4 to generate + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Multiplier = 43+1 to generate PLLACK = 528MHz + * Master Clock (MCK): Source = PLLACK/1, Prescalar = 1, MDIV = 4 to generate * MCK = 132MHz * CPU clock = 528MHz */ @@ -188,23 +189,24 @@ #define HSMCI_SDXFR_CLKDIV (2 << HSMCI_MR_CLKDIV_SHIFT) #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -212,4 +214,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_528MHZ_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_528MHZ_H */ diff --git a/boards/arm/sama5/sama5d2-xult/include/board_memorymap.h b/boards/arm/sama5/sama5d2-xult/include/board_memorymap.h index 98757096df..72e2f808fe 100644 --- a/boards/arm/sama5/sama5d2-xult/include/board_memorymap.h +++ b/boards/arm/sama5/sama5d2-xult/include/board_memorymap.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d2-xult/include/board_memorymap.h +/**************************************************************************** + * boards/arm/sama5/sama5d2-xult/include/board_memorymap.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,38 +31,39 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_MEMORYMAP_H -#define __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_MEMORYMAP_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_MEMORYMAP_H +#define __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_MEMORYMAP_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -70,4 +71,4 @@ extern "C" { #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_MEMORYMAP_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_MEMORYMAP_H */ diff --git a/boards/arm/sama5/sama5d2-xult/include/board_sdram.h b/boards/arm/sama5/sama5d2-xult/include/board_sdram.h index 28942b157a..f80a7a9776 100644 --- a/boards/arm/sama5/sama5d2-xult/include/board_sdram.h +++ b/boards/arm/sama5/sama5d2-xult/include/board_sdram.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d2-xult/include/board_sdram.h +/**************************************************************************** + * boards/arm/sama5/sama5d2-xult/include/board_sdram.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,30 +31,34 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_SDRAM_H -#define __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_SDRAM_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_SDRAM_H +#define __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_SDRAM_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include "sam_pmc.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. When - * booting from SDRAM, NuttX is loaded in SDRAM by an intermediate bootloader. That - * bootloader had to have already configured the PLL and SDRAM for proper operation. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * When booting from SDRAM, NuttX is loaded in SDRAM by an intermediate + * bootloader. That bootloader had to have already configured the PLL + * and SDRAM for proper operation. * - * In this case, we do not reconfigure the clocking. Rather, we need to query - * the register settings to determine the clock frequencies. We can only assume that - * the Main clock source is the on-board 12MHz crystal. + * In this case, we do not reconfigure the clocking. + * Rather, we need to query the register settings to determine the clock + * frequencies. + * We can only assume that the Main clock source is the on-board 12MHz + * crystal. */ #define BOARD_MAINCK_FREQUENCY BOARD_MAINOSC_FREQUENCY @@ -150,23 +154,24 @@ #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -174,4 +179,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D2_XULT_INCLUDE_BOARD_SDRAM_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D2_XULT_INCLUDE_BOARD_SDRAM_H */ diff --git a/boards/arm/sama5/sama5d2-xult/scripts/Make.defs b/boards/arm/sama5/sama5d2-xult/scripts/Make.defs index 0b79eb063f..ed5431759a 100644 --- a/boards/arm/sama5/sama5d2-xult/scripts/Make.defs +++ b/boards/arm/sama5/sama5d2-xult/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/sama5d2-xult/scripts/Make.defs +# boards/arm/sama5/sama5d2-xult/scripts/Make.defs # # Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d2-xult/scripts/dramboot.ld b/boards/arm/sama5/sama5d2-xult/scripts/dramboot.ld index 2771fa2868..c9f7717764 100644 --- a/boards/arm/sama5/sama5d2-xult/scripts/dramboot.ld +++ b/boards/arm/sama5/sama5d2-xult/scripts/dramboot.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d2-xult/scripts/dramboot.ld + * boards/arm/sama5/sama5d2-xult/scripts/dramboot.ld * * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d2-xult/scripts/gnu-elf.ld b/boards/arm/sama5/sama5d2-xult/scripts/gnu-elf.ld index e7eadbff35..06ba36ed39 100644 --- a/boards/arm/sama5/sama5d2-xult/scripts/gnu-elf.ld +++ b/boards/arm/sama5/sama5d2-xult/scripts/gnu-elf.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d2-xult/scripts/gnu-elf.ld + * boards/arm/sama5/sama5d2-xult/scripts/gnu-elf.ld * * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d2-xult/scripts/isram.ld b/boards/arm/sama5/sama5d2-xult/scripts/isram.ld index 44c80d6e84..5e1955aa5f 100644 --- a/boards/arm/sama5/sama5d2-xult/scripts/isram.ld +++ b/boards/arm/sama5/sama5d2-xult/scripts/isram.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d2-xult/scripts/isram.ld + * boards/arm/sama5/sama5d2-xult/scripts/isram.ld * * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d2-xult/scripts/uboot.ld b/boards/arm/sama5/sama5d2-xult/scripts/uboot.ld index 22932ac2ca..7b84abf55f 100644 --- a/boards/arm/sama5/sama5d2-xult/scripts/uboot.ld +++ b/boards/arm/sama5/sama5d2-xult/scripts/uboot.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d2-xult/scripts/uboot.ld + * boards/arm/sama5/sama5d2-xult/scripts/uboot.ld * * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d2-xult/src/Makefile b/boards/arm/sama5/sama5d2-xult/src/Makefile index 64e9839526..0c20cab6c9 100644 --- a/boards/arm/sama5/sama5d2-xult/src/Makefile +++ b/boards/arm/sama5/sama5d2-xult/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/sama5d2-xult/src/Makefile +# boards/arm/sama5/sama5d2-xult/src/Makefile # # Copyright (C) 2015 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d2-xult/src/sam_appinit.c b/boards/arm/sama5/sama5d2-xult/src/sam_appinit.c index 1d2125d4f8..7a6363990c 100644 --- a/boards/arm/sama5/sama5d2-xult/src/sam_appinit.c +++ b/boards/arm/sama5/sama5d2-xult/src/sam_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d2-xult/src/sam_appinit.c + * boards/arm/sama5/sama5d2-xult/src/sam_appinit.c * * Copyright (C) 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d2-xult/src/sam_autoleds.c b/boards/arm/sama5/sama5d2-xult/src/sam_autoleds.c index 77b7767bb4..0d7311f0d0 100644 --- a/boards/arm/sama5/sama5d2-xult/src/sam_autoleds.c +++ b/boards/arm/sama5/sama5d2-xult/src/sam_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d2-xult/src/sam_autoleds.c + * boards/arm/sama5/sama5d2-xult/src/sam_autoleds.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* There is an RGB LED on board the SAMA5D2-XULT. The RED component is * driven by the SDHC_CD pin (PA13) and so will not be used. The LEDs are * provided VDD_LED and so bringing the LED low will will illuminated the diff --git a/boards/arm/sama5/sama5d2-xult/src/sam_boot.c b/boards/arm/sama5/sama5d2-xult/src/sam_boot.c index 9c40084c58..34720525b3 100644 --- a/boards/arm/sama5/sama5d2-xult/src/sam_boot.c +++ b/boards/arm/sama5/sama5d2-xult/src/sam_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d2-xult/src/sam_boot.c +/**************************************************************************** + * boards/arm/sama5/sama5d2-xult/src/sam_boot.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -45,27 +45,28 @@ #include "sama5d2-xult.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_boardinitialize * * Description: - * All SAMA5 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 SAMA5 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) { @@ -82,7 +83,7 @@ void sam_boardinitialize(void) * Description: * If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional * initialization call will be performed in the boot-up sequence to a - * function called board_late_initialize(). board_late_initialize() will be + * function called board_late_initialize(). board_late_initialize() will be * called immediately after up_initialize() is called and just before the * initial application is started. This additional initialization phase * may be used, for example, to initialize board-specific device drivers. @@ -97,4 +98,3 @@ void board_late_initialize(void) (void)sam_bringup(); } #endif /* CONFIG_BOARD_LATE_INITIALIZE */ - diff --git a/boards/arm/sama5/sama5d2-xult/src/sam_bringup.c b/boards/arm/sama5/sama5d2-xult/src/sam_bringup.c index 6d758e5f8a..6d683cf133 100644 --- a/boards/arm/sama5/sama5d2-xult/src/sam_bringup.c +++ b/boards/arm/sama5/sama5d2-xult/src/sam_bringup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d2-xult/src/sam_bringup.c + * boards/arm/sama5/sama5d2-xult/src/sam_bringup.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d2-xult/src/sam_buttons.c b/boards/arm/sama5/sama5d2-xult/src/sam_buttons.c index 23d7f3db12..b7e6b5a584 100644 --- a/boards/arm/sama5/sama5d2-xult/src/sam_buttons.c +++ b/boards/arm/sama5/sama5d2-xult/src/sam_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d2-xult/src/sam_buttons.c + * boards/arm/sama5/sama5d2-xult/src/sam_buttons.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* A single button, PB_USER (PB6), is available on the SAMA5D2-XULT * * ------------------------------ ------------------- ---------------------- @@ -156,5 +157,4 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg) return ret; } #endif - #endif /* CONFIG_ARCH_BUTTONS */ diff --git a/boards/arm/sama5/sama5d2-xult/src/sam_userleds.c b/boards/arm/sama5/sama5d2-xult/src/sam_userleds.c index 7a5b557667..548df6340f 100644 --- a/boards/arm/sama5/sama5d2-xult/src/sam_userleds.c +++ b/boards/arm/sama5/sama5d2-xult/src/sam_userleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d2-xult/src/sam_userleds.c + * boards/arm/sama5/sama5d2-xult/src/sam_userleds.c * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* There is an RGB LED on board the SAMA5D2-XULT. The RED component is * driven by the SDHC_CD pin (PA13) and so will not be used. The LEDs are * provided VDD_LED and so bringing the LED low will will illuminated the diff --git a/boards/arm/sama5/sama5d2-xult/src/sama5d2-xult.h b/boards/arm/sama5/sama5d2-xult/src/sama5d2-xult.h index ea9cafd158..8d944fe393 100644 --- a/boards/arm/sama5/sama5d2-xult/src/sama5d2-xult.h +++ b/boards/arm/sama5/sama5d2-xult/src/sama5d2-xult.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d2-xult/src/sama5d2-xult.h +/**************************************************************************** + * boards/arm/sama5/sama5d2-xult/src/sama5d2-xult.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_SAMA5D2_XULT_SRC_SAMA5D2_XULT_H -#define __BOARDS_ARM_SAMA5D2_XULT_SRC_SAMA5D2_XULT_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D2_XULT_SRC_SAMA5D2_XULT_H +#define __BOARDS_ARM_SAMA5_SAMA5D2_XULT_SRC_SAMA5D2_XULT_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -51,10 +51,12 @@ #include "hardware/sam_pinmap.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ + ****************************************************************************/ + +/* Configuration ************************************************************/ + /* procfs File System */ #ifdef CONFIG_FS_PROCFS @@ -65,18 +67,21 @@ # endif #endif -/* LEDs *****************************************************************************/ -/* There is an RGB LED on board the SAMA5D2-XULT. The RED component is driven by - * the SDHC_CD pin (PA13) and so will not be used. The LEDs are provided VDD_LED - * and so bringing the LED low will illuminated the LED. +/* LEDs *********************************************************************/ + +/* There is an RGB LED on board the SAMA5D2-XULT. + * The RED component is driven by the SDHC_CD pin (PA13) and so will not + * be used. + * The LEDs are provided VDD_LED and so bringing the LED low will illuminate + * the LED. * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- --------------------- * SAMA5D2 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- --------------------- * PA13 SDHC_CD_PA13 Red LED * PB5 LED_GREEN_PB5 Green LED * PB0 LED_BLUE_PB0 Blue LED - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- --------------------- */ #define PIO_LED_GREEN (PIO_OUTPUT | PIO_CFG_DEFAULT | PIO_OUTPUT_SET | \ @@ -84,37 +89,37 @@ #define PIO_LED_BLUE (PIO_OUTPUT | PIO_CFG_DEFAULT | PIO_OUTPUT_SET | \ PIO_PORT_PIOB | PIO_PIN0) -/* Buttons **************************************************************************/ +/* Buttons ******************************************************************/ + /* A single button, PB_USER (PB6), is available on the SAMA5D2-XULT * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ---------------------- * SAMA5D2 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ---------------------- * PB6 USER_PB_PB6 PB_USER push button - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ---------------------- * - * Closing PB_USER will bring PB6 to ground so 1) PB6 should have a weak pull-up, - * and 2) when PB_USER is pressed, a low value will be senses. + * Closing PB_USER will bring PB6 to ground so 1) PB6 should have a weak + * pull-up, and 2) when PB_USER is pressed, a low value will be senses. */ #define PIO_BTN_USER (PIO_INPUT | PIO_CFG_PULLUP | PIO_CFG_DEGLITCH | \ PIO_INT_BOTHEDGES | PIO_PORT_PIOB | PIO_PIN6) #define IRQ_BTN_USER SAM_IRQ_PB6 - -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Name: sam_bringup @@ -127,5 +132,4 @@ int sam_bringup(void); #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D2_XULT_SRC_SAMA5D2_XULT_H */ - +#endif /* __BOARDS_ARM__SAMA5SAMA5D2_XULT_SRC_SAMA5D2_XULT_H */ diff --git a/boards/arm/sama5/sama5d3-xplained/README.txt b/boards/arm/sama5/sama5d3-xplained/README.txt index f439b7e15c..24daaebbca 100644 --- a/boards/arm/sama5/sama5d3-xplained/README.txt +++ b/boards/arm/sama5/sama5d3-xplained/README.txt @@ -976,7 +976,7 @@ Networking prototyped in the nuttx/include/nuttx/arch.h, and (2) it must select CONFIG_ARCH_PHY_INTERRUPT in the board configuration file to advertise that it supports arch_phy_irq(). This logic can be found at - nuttx/boards/sama5d3-xplained/src/sam_ethernet.c. + nuttx/boards/arm/sama5/sama5d3-xplained/src/sam_ethernet.c. - One other thing: UDP support is required (CONFIG_NET_UDP). @@ -1197,7 +1197,8 @@ Auto-Mounter CONFIG_FS_AUTOMOUNTER=y However, to use the automounter you will to provide some additional - board-level support. See boards/sama5d4-ek for and example of how + board-level support. + See boards/arm/sama5/sama5d4-xplaned for and example of how you might do this. WARNING: SD cards should never be removed without first unmounting @@ -2310,7 +2311,7 @@ SAMA5 PWM Support B PB13 --- GMAC -----+---+---+----+-------------------- - See boards/sama5d3-xplained/include/board.h for all of the default PWM + See boards/arm/sama5/sama5d3-xplained/include/board.h for all of the default PWM pin selections. I used PWM channel 0, pins PA20 and PA21 for testing. Clocking is addressed in the next paragraph. diff --git a/boards/arm/sama5/sama5d3-xplained/include/board.h b/boards/arm/sama5/sama5d3-xplained/include/board.h index ab98e704a8..0155148337 100644 --- a/boards/arm/sama5/sama5d3-xplained/include/board.h +++ b/boards/arm/sama5/sama5d3-xplained/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/include/board.h +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/include/board.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,25 +31,26 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_H -#define __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_H +#define __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include -/************************************************************************************ +/***************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. */ /* On-board crystal frequencies */ @@ -58,22 +59,29 @@ #define BOARD_SLOWCLK_FREQUENCY (32768) /* Slow Clock: 32.768KHz */ #if defined(CONFIG_SAMA5_BOOT_SDRAM) -/* When booting from SDRAM, NuttX is loaded in SDRAM by an intermediate bootloader. - * That bootloader had to have already configured the PLL and SDRAM for proper - * operation. + +/* When booting from SDRAM, NuttX is loaded in SDRAM by an intermediate + * bootloader. + * That bootloader had to have already configured the PLL and SDRAM for + * proper operation. * - * In this case, we don not reconfigure the clocking. Rather, we need to query - * the register settings to determine the clock frequencies. We can only assume that - * the Main clock source is the on-board 12MHz crystal. + * In this case, we don not reconfigure the clocking. + * Rather, we need to query the register settings to determine the clock + * frequencies. + * We can only assume that the Main clock source is the on-board 12MHz + * crystal. */ # include #elif defined(CONFIG_SAMA5D3XPLAINED_384MHZ) -/* OHCI Only. This is an alternative slower configuration that will produce a 48MHz - * USB clock with the required accuracy using only PLLA. When PPLA is used to clock - * OHCI, an additional requirement is the PLLACK be a multiple of 48MHz. This setup - * results in a CPU clock of 384MHz. + +/* OHCI Only. + * This is an alternative slower configuration that will produce a 48MHz + * USB clock with the required accuracy using only PLLA. + * When PPLA is used to clock OHCI, an additional requirement is the + * PLLACK be a multiple of 48MHz. + * This setup results in a CPU clock of 384MHz. * * This case is only interesting for experimentation. */ @@ -81,6 +89,7 @@ # include #elif defined(CONFIG_SAMA5D3XPLAINED_528MHZ) + /* This is the configuration results in a CPU clock of 528MHz. * * In this configuration, UPLL is the source of the UHPHS clock (if enabled). @@ -89,8 +98,9 @@ # include #else /* #elif defined(CONFIG_SAMA5D3XPLAINED_396MHZ) */ -/* This is the configuration provided in the Atmel example code. This setup results - * in a CPU clock of 396MHz. + +/* This is the configuration provided in the Atmel example code. + * This setup results in a CPU clock of 396MHz. * * In this configuration, UPLL is the source of the UHPHS clock (if enabled). */ @@ -99,7 +109,8 @@ #endif -/* LED definitions ******************************************************************/ +/* LED definitions **********************************************************/ + /* There are two LEDs on the SAMA5D3 series-CM board that can be controlled * by software. A blue LED is controlled via PIO pins. A red LED normally * provides an indication that power is supplied to the board but can also @@ -132,7 +143,9 @@ * * SYMBOL Val Meaning LED state * Blue Red - * ----------------- --- ----------------------- -------- -------- */ + * ----------------- --- ----------------------- -------- -------- + */ + #define LED_STARTED 0 /* NuttX has been started OFF OFF */ #define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF */ #define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF */ @@ -149,7 +162,8 @@ * has halted. */ -/* Button definitions ***************************************************************/ +/* Button definitions *******************************************************/ + /* The following push buttons switches are available: * * 1. One board reset button (BP2). When pressed and released, this push @@ -172,25 +186,29 @@ #define BUTTON_USER_BIT (1 << BUTTON_USER) -/* NAND *****************************************************************************/ +/* NAND *********************************************************************/ -/* Address for transferring command bytes to the nandflash, CLE A22*/ +/* Address for transferring command bytes to the nandflash, CLE A22 */ #define BOARD_EBICS3_NAND_CMDADDR 0x60400000 -/* Address for transferring address bytes to the nandflash, ALE A21*/ +/* Address for transferring address bytes to the nandflash, ALE A21 */ #define BOARD_EBICS3_NAND_ADDRADDR 0x60200000 -/* Address for transferring data bytes to the nandflash.*/ +/* Address for transferring data bytes to the nandflash. */ #define BOARD_EBICS3_NAND_DATAADDR 0x60000000 -/* PIO configuration ****************************************************************/ -/* PWM. There are no dedicated PWM output pins available to the user for PWM - * testing. Care must be taken because all PWM output pins conflict with some other - * usage of the pin by other devices. Furthermore, many of these pins have not been - * brought out to an external connector: +/* PIO configuration ********************************************************/ + +/* PWM. + * There are no dedicated PWM output pins available to the user for PWM + * testing. + * Care must be taken because all PWM output pins conflict with some other + * usage of the pin by other devices. + * Furthermore, many of these pins have not been brought out to an external + * connector: * * -----+---+---+----+------+---------------- * PWM PIN PER PIO I/O CONFLICTS @@ -224,11 +242,11 @@ /* PWM channel 0: * - * PA20 and PA21 can be used if the LCDC or ISI are not selected. These outputs are - * available on J1, pins 14 and 16, respectively. + * PA20 and PA21 can be used if the LCDC or ISI are not selected. + * These outputs are available on J1, pins 14 and 16, respectively. * - * If the GMAC is not selected, then PB0 and PB1 could also be used. However, - * these pins are not available at the I/O expansion connectors. + * If the GMAC is not selected, then PB0 and PB1 could also be used. + * However, these pins are not available at the I/O expansion connectors. */ #if !defined(CONFIG_SAMA5_LCDC) && !defined(CONFIG_SAMA5_ISI) @@ -241,14 +259,15 @@ /* PWM channel 1: * - * PA22 and PA23 can be used if the LCDC or ISI are not selected. These outputs are - * available on J1, pins 18 and 20, respectively. + * PA22 and PA23 can be used if the LCDC or ISI are not selected. + * These outputs are available on J1, pins 18 and 20, respectively. * - * PE31 can be used if the ISI is not selected (and the HDMI is not being used). + * PE31 can be used if the ISI is not selected + * (and the HDMI is not being used). * That signal is available at J3 pin 20. * - * If the GMAC is not selected, then PB4 and PB5 could also be used. However, - * these pins are not available at the I/O expansion connectors. + * If the GMAC is not selected, then PB4 and PB5 could also be used. + * However, these pins are not available at the I/O expansion connectors. */ #if !defined(CONFIG_SAMA5_LCDC) && !defined(CONFIG_SAMA5_ISI) @@ -281,8 +300,10 @@ /* PWM channel 3: * - * If the GMAC is not selected, then PB12 can used and is available at J3 pin 7. - * None of the other output pins are accessible at the I/O expansion connectors. + * If the GMAC is not selected, + * then PB12 can used and is available at J3 pin 7. + * None of the other output pins are accessible at the + * I/O expansion connectors. */ #if !defined(CONFIG_SAMA5_GMAC) @@ -293,13 +314,13 @@ # define PIO_PWM3_L PIO_PWM3_L_1 #endif -/************************************************************************************ +/**************************************************************************** * Assembly Language Macros - ************************************************************************************/ + ****************************************************************************/ #ifdef __ASSEMBLY__ - .macro config_sdram - .endm + .macro config_sdram + .endm #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_H */ diff --git a/boards/arm/sama5/sama5d3-xplained/include/board_384mhz.h b/boards/arm/sama5/sama5d3-xplained/include/board_384mhz.h index 290419ca17..0d859eea36 100644 --- a/boards/arm/sama5/sama5d3-xplained/include/board_384mhz.h +++ b/boards/arm/sama5/sama5d3-xplained/include/board_384mhz.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/include/board_384mhz.h +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/include/board_384mhz.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,32 +31,34 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_384MHZ_H -#define __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_384MHZ_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_384MHZ_H +#define __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_384MHZ_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. * - * This is an alternative slower configuration that will produce a 48MHz USB clock - * with the required accuracy. When used with OHCI, an additional requirement is - * the PLLACK be a multiple of 48MHz. This setup results in a CPU clock of 384MHz. + * This is an alternative slower configuration that will produce a 48MHz USB + * clock with the required accuracy. + * When used with OHCI, an additional requirement is the PLLACK be a multiple + * of 48MHz. This setup results in a CPU clock of 384MHz. * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Divider = 1, Multiplier = 64 to generate PLLACK = 768MHz - * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Divider = 1, Multiplier = 64 to generate PLLACK = 768MHz + * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate * MCK = 128MHz * CPU clock = 384MHz */ @@ -184,36 +186,43 @@ * Where CLKDIV has a range of 0-255. */ -/* MCK = 128MHz, CLKDIV = 159, MCI_SPEED = 128MHz / (2*159 + 0 + 2) = 400 KHz */ +/* MCK = 128MHz, CLKDIV = 159, + * MCI_SPEED = 128MHz / (2*159 + 0 + 2) = 400 KHz + */ #define HSMCI_INIT_CLKDIV (159 << HSMCI_MR_CLKDIV_SHIFT) -/* MCK = 128MHz, CLKDIV = 2 w/CLOCKODD, MCI_SPEED = 128MHz /(2*2 + 1 + 2) = 18.3 MHz */ +/* MCK = 128MHz, CLKDIV = 2 w/CLOCKODD, + * MCI_SPEED = 128MHz /(2*2 + 1 + 2) = 18.3 MHz + */ #define HSMCI_MMCXFR_CLKDIV ((2 << HSMCI_MR_CLKDIV_SHIFT) | HSMCI_MR_CLKODD) -/* MCK = 128MHz, CLKDIV = 2, MCI_SPEED = 128MHz /(2*2 + 0 + 2) = 21.3 MHz */ +/* MCK = 128MHz, CLKDIV = 2, + * MCI_SPEED = 128MHz /(2*2 + 0 + 2) = 21.3 MHz + */ #define HSMCI_SDXFR_CLKDIV (2 << HSMCI_MR_CLKDIV_SHIFT) #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -221,4 +230,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_384MHZ_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_384MHZ_H */ diff --git a/boards/arm/sama5/sama5d3-xplained/include/board_396mhz.h b/boards/arm/sama5/sama5d3-xplained/include/board_396mhz.h index 49a40ca02a..73c98bacc7 100644 --- a/boards/arm/sama5/sama5d3-xplained/include/board_396mhz.h +++ b/boards/arm/sama5/sama5d3-xplained/include/board_396mhz.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/include/board_396mhz.h +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/include/board_396mhz.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,31 +31,32 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_396MHZ_H -#define __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_396MHZ_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_396MHZ_H +#define __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_396MHZ_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. * - * This is the configuration provided in the Atmel example code. This results in a - * CPU clock of 396MHz: + * This is the configuration provided in the Atmel example code. + * This results in a CPU clock of 396MHz: * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Divider = 1, Multiplier = 66 to generate PLLACK = 792MHz - * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Divider = 1, Multiplier = 66 to generate PLLACK = 792MHz + * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate * MCK = 132MHz * CPU clock = 396MHz */ @@ -181,36 +182,43 @@ * Where CLKDIV has a range of 0-255. */ -/* MCK = 132MHz, CLKDIV = 164, MCI_SPEED = 132MHz / (2*164 + 0 + 2) = 400 KHz */ +/* MCK = 132MHz, CLKDIV = 164, + * MCI_SPEED = 132MHz / (2*164 + 0 + 2) = 400 KHz + */ #define HSMCI_INIT_CLKDIV (164 << HSMCI_MR_CLKDIV_SHIFT) -/* MCK = 132MHz, CLKDIV = 2 w/CLOCKODD, MCI_SPEED = 132MHz /(2*2 + 1 + 2) = 18.9 MHz */ +/* MCK = 132MHz, CLKDIV = 2 w/CLOCKODD, + * MCI_SPEED = 132MHz /(2*2 + 1 + 2) = 18.9 MHz + */ #define HSMCI_MMCXFR_CLKDIV ((2 << HSMCI_MR_CLKDIV_SHIFT) | HSMCI_MR_CLKODD) -/* MCK = 132MHz, CLKDIV = 2, MCI_SPEED = 132MHz /(2*2 + 0 + 2) = 22 MHz */ +/* MCK = 132MHz, CLKDIV = 2, + * MCI_SPEED = 132MHz /(2*2 + 0 + 2) = 22 MHz + */ #define HSMCI_SDXFR_CLKDIV (2 << HSMCI_MR_CLKDIV_SHIFT) #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -218,4 +226,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_396MHZ_H */ +#endif /* __BOARDS_ARM__SAMA5SAMA5D3_XPLAINED_INCLUDE_BOARD_396MHZ_H */ diff --git a/boards/arm/sama5/sama5d3-xplained/include/board_528mhz.h b/boards/arm/sama5/sama5d3-xplained/include/board_528mhz.h index 2780c358b8..8739e10b5d 100644 --- a/boards/arm/sama5/sama5d3-xplained/include/board_528mhz.h +++ b/boards/arm/sama5/sama5d3-xplained/include/board_528mhz.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/include/board_528mhz.h +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/include/board_528mhz.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,30 +31,31 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_528MHZ_H -#define __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_528MHZ_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_528MHZ_H +#define __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_528MHZ_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. * * This is the configuration results in a CPU clock of 528MHz: * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Divider = 1, Multiplier = 43+1 to generate PLLACK = 528MHz - * Master Clock (MCK): Source = PLLACK/1, Prescalar = 1, MDIV = 4 to generate + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Divider = 1, Multiplier = 43+1 to generate PLLACK = 528MHz + * Master Clock (MCK): Source = PLLACK/1, Prescalar = 1, MDIV = 4 to generate * MCK = 132MHz * CPU clock = 528MHz */ @@ -180,36 +181,43 @@ * Where CLKDIV has a range of 0-255. */ -/* MCK = 132MHz, CLKDIV = 164, MCI_SPEED = 132MHz / (2*164 + 0 + 2) = 400 KHz */ +/* MCK = 132MHz, CLKDIV = 164, + * MCI_SPEED = 132MHz / (2*164 + 0 + 2) = 400 KHz + */ #define HSMCI_INIT_CLKDIV (164 << HSMCI_MR_CLKDIV_SHIFT) -/* MCK = 132MHz, CLKDIV = 2 w/CLOCKODD, MCI_SPEED = 132MHz /(2*2 + 1 + 2) = 18.9 MHz */ +/* MCK = 132MHz, CLKDIV = 2 w/CLOCKODD, + * MCI_SPEED = 132MHz /(2*2 + 1 + 2) = 18.9 MHz + */ #define HSMCI_MMCXFR_CLKDIV ((2 << HSMCI_MR_CLKDIV_SHIFT) | HSMCI_MR_CLKODD) -/* MCK = 132MHz, CLKDIV = 2, MCI_SPEED = 132MHz /(2*2 + 0 + 2) = 22 MHz */ +/* MCK = 132MHz, CLKDIV = 2, + * MCI_SPEED = 132MHz /(2*2 + 0 + 2) = 22 MHz + */ #define HSMCI_SDXFR_CLKDIV (2 << HSMCI_MR_CLKDIV_SHIFT) #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -217,4 +225,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_528MHZ_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_528MHZ_H */ diff --git a/boards/arm/sama5/sama5d3-xplained/include/board_memorymap.h b/boards/arm/sama5/sama5d3-xplained/include/board_memorymap.h index 68423e77a7..d086323546 100644 --- a/boards/arm/sama5/sama5d3-xplained/include/board_memorymap.h +++ b/boards/arm/sama5/sama5d3-xplained/include/board_memorymap.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/include/board_memorymap.h +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/include/board_memorymap.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,38 +31,39 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_MEMORYMAP_H -#define __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_MEMORYMAP_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_MEMORYMAP_H +#define __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_MEMORYMAP_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -70,4 +71,4 @@ extern "C" { #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_MEMORYMAP_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_MEMORYMAP_H */ diff --git a/boards/arm/sama5/sama5d3-xplained/include/board_sdram.h b/boards/arm/sama5/sama5d3-xplained/include/board_sdram.h index 97cc07b0a4..d995a1def5 100644 --- a/boards/arm/sama5/sama5d3-xplained/include/board_sdram.h +++ b/boards/arm/sama5/sama5d3-xplained/include/board_sdram.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/include/board_sdram.h +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/include/board_sdram.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,30 +31,35 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_SDRAM_H -#define __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_SDRAM_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_SDRAM_H +#define __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_SDRAM_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include "sam_pmc.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. When - * booting from SDRAM, NuttX is loaded in SDRAM by an intermediate bootloader. That - * bootloader had to have already configured the PLL and SDRAM for proper operation. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * When booting from SDRAM, NuttX is loaded in SDRAM by an intermediate + * bootloader. + * That bootloader had to have already configured the PLL and SDRAM for + * proper operation. * - * In this case, we do not reconfigure the clocking. Rather, we need to query - * the register settings to determine the clock frequencies. We can only assume that - * the Main clock source is the on-board 12MHz crystal. + * In this case, we do not reconfigure the clocking. + * Rather, we need to query the register settings to determine the clock + * frequencies. + * We can only assume that the Main clock source is the on-board 12MHz + * crystal. */ #define BOARD_MAINCK_FREQUENCY BOARD_MAINOSC_FREQUENCY @@ -153,23 +158,24 @@ #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -177,4 +183,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3_XPLAINED_INCLUDE_BOARD_SDRAM_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_INCLUDE_BOARD_SDRAM_H */ diff --git a/boards/arm/sama5/sama5d3-xplained/scripts/Make.defs b/boards/arm/sama5/sama5d3-xplained/scripts/Make.defs index 4a6708c575..60c9c592c7 100644 --- a/boards/arm/sama5/sama5d3-xplained/scripts/Make.defs +++ b/boards/arm/sama5/sama5d3-xplained/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/sama5d3-xplained/scripts/Make.defs +# boards/arm/sama5/sama5d3-xplained/scripts/Make.defs # # Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3-xplained/scripts/ddram.ld b/boards/arm/sama5/sama5d3-xplained/scripts/ddram.ld index db47643b96..3bcae2aef5 100644 --- a/boards/arm/sama5/sama5d3-xplained/scripts/ddram.ld +++ b/boards/arm/sama5/sama5d3-xplained/scripts/ddram.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3-xplained/scripts/ddram.ld + * boards/arm/sama5/sama5d3-xplained/scripts/ddram.ld * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3-xplained/scripts/gnu-elf.ld b/boards/arm/sama5/sama5d3-xplained/scripts/gnu-elf.ld index 187e634cc4..2dd62eff31 100644 --- a/boards/arm/sama5/sama5d3-xplained/scripts/gnu-elf.ld +++ b/boards/arm/sama5/sama5d3-xplained/scripts/gnu-elf.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3-xplained/scripts/gnu-elf.ld + * boards/arm/sama5/sama5d3-xplained/scripts/gnu-elf.ld * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3-xplained/scripts/isram.ld b/boards/arm/sama5/sama5d3-xplained/scripts/isram.ld index 0d584b479a..8f10c94a6f 100644 --- a/boards/arm/sama5/sama5d3-xplained/scripts/isram.ld +++ b/boards/arm/sama5/sama5d3-xplained/scripts/isram.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3-xplained/scripts/isram.ld + * boards/arm/sama5/sama5d3-xplained/scripts/isram.ld * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3-xplained/src/Makefile b/boards/arm/sama5/sama5d3-xplained/src/Makefile index db6d933d87..df381ce180 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/Makefile +++ b/boards/arm/sama5/sama5d3-xplained/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/sama5d3-xplained/src/Makefile +# boards/arm/sama5/sama5d3-xplained/src/Makefile # # Copyright (C) 2014 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_adc.c b/boards/arm/sama5/sama5d3-xplained/src/sam_adc.c index d0aeee3191..0205bf590b 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_adc.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_adc.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/src/sam_adc.c +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/src/sam_adc.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -50,17 +50,17 @@ #ifdef CONFIG_SAMA5_ADC -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_adc_setup * * Description: * Initialize ADC and register the ADC driver. * - ************************************************************************************/ + ****************************************************************************/ int sam_adc_setup(void) { diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_ajoystick.c b/boards/arm/sama5/sama5d3-xplained/src/sam_ajoystick.c index aee8c29547..cb065f812e 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_ajoystick.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_ajoystick.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3-xplained/src/sam_ajoystick.c + * boards/arm/sama5/sama5d3-xplained/src/sam_ajoystick.c * * Copyright (C) 2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -57,6 +57,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Check for pre-requisites and pin conflicts */ #ifdef CONFIG_AJOYSTICK @@ -112,6 +113,7 @@ static int ajoy_interrupt(int irq, FAR void *context, FAR void *arg); /**************************************************************************** * Private Data ****************************************************************************/ + /* Pin configuration for each Itead joystick button. Index using AJOY_* * button definitions in include/nuttx/input/ajoystick.h. */ @@ -239,7 +241,6 @@ static int ajoy_sample(FAR const struct ajoy_lowerhalf_s *lower, return -EIO; } - /* Sample the discrete button inputs */ sample->as_buttons = ajoy_buttons(lower); @@ -319,20 +320,20 @@ static void ajoy_enable(FAR const struct ajoy_lowerhalf_s *lower, for (i = 0; i < AJOY_NGPIOS; i++) { - /* Enable interrupts on each pin that has either a press or - * release event associated with it. - */ + /* Enable interrupts on each pin that has either a press or + * release event associated with it. + */ - bit = (1 << i); - if ((either & bit) != 0) - { - /* REVISIT: It would be better if we reconfigured for - * the edges of interest so that we do not get spurious - * interrupts. - */ + bit = (1 << i); + if ((either & bit) != 0) + { + /* REVISIT: It would be better if we reconfigured for + * the edges of interest so that we do not get spurious + * interrupts. + */ sam_pioirqenable(g_joyirq[i]); - } + } } } @@ -405,6 +406,7 @@ int sam_ajoy_initialization(void) int i; /* NOTE: The ADC driver was initialized earlier in the bring-up sequence. */ + /* Open the ADC driver for reading. */ ret = file_open(&g_adcfile, "/dev/adc0", O_RDONLY); diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_appinit.c b/boards/arm/sama5/sama5d3-xplained/src/sam_appinit.c index c50b057e1c..5ed720e5b2 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_appinit.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d3-xplained/src/sam_appinit.c + * boards/arm/sama5/sama5d3-xplained/src/sam_appinit.c * * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -149,6 +149,7 @@ int board_app_initialize(uintptr_t arg) #endif #ifdef HAVE_USBMONITOR + /* Start the USB Monitor */ ret = usbmonitor_start(); @@ -159,6 +160,7 @@ int board_app_initialize(uintptr_t arg) #endif #ifdef CONFIG_ADC + /* Initialize ADC and register the ADC driver. */ ret = sam_adc_setup(); @@ -169,6 +171,7 @@ int board_app_initialize(uintptr_t arg) #endif #ifdef CONFIG_AJOYSTICK + /* Initialize and register the joystick driver */ ret = sam_ajoy_initialization(); @@ -182,6 +185,7 @@ int board_app_initialize(uintptr_t arg) #endif #ifdef CONFIG_PWM + /* Initialize PWM and register the PWM device. */ ret = sam_pwm_setup(); @@ -203,6 +207,7 @@ int board_app_initialize(uintptr_t arg) #endif #ifdef CONFIG_FS_PROCFS + /* Mount the procfs file system */ ret = mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_at25.c b/boards/arm/sama5/sama5d3-xplained/src/sam_at25.c index 6e83029119..c0b7518979 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_at25.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_at25.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d3-xplained/src/sam_at25.c + * boards/arm/sama5/sama5d3-xplained/src/sam_at25.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -101,6 +101,7 @@ int sam_at25_automount(int minor) } #if defined(CONFIG_SAMA5D3XPLAINED_AT25_FTL) + /* And finally, use the FTL layer to wrap the MTD driver as a block driver */ ret = ftl_initialize(AT25_MINOR, mtd); @@ -111,6 +112,7 @@ int sam_at25_automount(int minor) } #elif defined(CONFIG_SAMA5D3XPLAINED_AT25_NXFFS) + /* Initialize to provide NXFFS on the MTD interface */ ret = nxffs_initialize(mtd); @@ -129,6 +131,7 @@ int sam_at25_automount(int minor) return ret; } #endif + /* Now we are initializeed */ initialized = true; diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_autoleds.c b/boards/arm/sama5/sama5d3-xplained/src/sam_autoleds.c index 4949533b41..fba4006779 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_autoleds.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3-xplained/src/sam_autoleds.c + * boards/arm/sama5/sama5d3-xplained/src/sam_autoleds.c * * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_boot.c b/boards/arm/sama5/sama5d3-xplained/src/sam_boot.c index 1a752268d6..8e61e35f30 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_boot.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/src/sam_boot.c +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/src/sam_boot.c * * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -46,27 +46,28 @@ #include "sam_sckc.h" #include "sama5d3-xplained.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_boardinitialize * * Description: - * All SAMA5 architectures must provide the following entry point. This entry - * point is called early in the intitialization -- after all memory has been - * configured and mapped but before any devices have been initialized. + * All SAMA5 architectures must provide the following entry point. + * This entry point is called early in the intitialization -- after all + * memory has been configured and mapped but before any devices have been + * initialized. * - ************************************************************************************/ + ****************************************************************************/ void sam_boardinitialize(void) { @@ -76,8 +77,8 @@ void sam_boardinitialize(void) sam_sckc_enable(true); #endif - /* Configure SPI chip selects if 1) SPI is enable, and 2) the weak function - * sam_spidev_initialize() has been brought into the link. + /* Configure SPI chip selects if 1) SPI is enable, and 2) the weak + * function sam_spidev_initialize() has been brought into the link. */ #if defined(CONFIG_SAMA5_SPI0) || defined(CONFIG_SAMA5_SPI1) @@ -89,10 +90,10 @@ void sam_boardinitialize(void) #if defined(CONFIG_SAMA5_DDRCS) && !defined(CONFIG_SAMA5_BOOT_SDRAM) - /* Configure SDRAM if (1) SDRAM has been enalbled in the NuttX configuration and - * (2) if we are not currently running out of SDRAM. If we are now running out - * of SDRAM then we have to assume that some second level bootloader has properly - * configured SDRAM for our use. + /* Configure SDRAM if (1) SDRAM has been enalbled in the NuttX + * configuration and (2) if we are not currently running out of SDRAM. + * If we are now running out of SDRAM then we have to assume that some + * second level bootloader has properly configured SDRAM for our use. */ sam_sdram_config(); @@ -100,9 +101,9 @@ void sam_boardinitialize(void) #endif /* Initialize USB if the 1) the HS host or device controller is in the - * configuration and 2) the weak function sam_usbinitialize() has been brought - * into the build. Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also - * selected. + * configuration and 2) the weak function sam_usbinitialize() has been + * brought into the build. + * Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also selected. */ #if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS) @@ -112,8 +113,8 @@ void sam_boardinitialize(void) } #endif - /* Configure board resources to support networkingif the 1) networking is enabled, - * 2) the EMAC or GMAC module is enabled, and 2) the weak function + /* Configure board resources to support networkingif the 1) networking is + * enabled, 2) the EMAC or GMAC module is enabled, and 2) the weak function * sam_netinitialize() has been brought into the build. */ diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_buttons.c b/boards/arm/sama5/sama5d3-xplained/src/sam_buttons.c index c8a0d0b4ef..3232cb2fde 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_buttons.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3-xplained/src/sam_buttons.c + * boards/arm/sama5/sama5d3-xplained/src/sam_buttons.c * * Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,6 +32,7 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* There are five push button switches on the SAMA5D3-Xplained base board: * * 1. One Reset, board reset (BP1) diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_can.c b/boards/arm/sama5/sama5d3-xplained/src/sam_can.c index d194c1349a..29f36be2d5 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_can.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_can.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/src/sam_can.c +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/src/sam_can.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -53,10 +53,11 @@ #ifdef CONFIG_CAN -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ + ****************************************************************************/ + +/* Configuration ************************************************************/ #if defined(CONFIG_SAMA5_CAN0) && defined(CONFIG_SAMA5_CAN1) # warning "Both CAN0 and CAN1 are enabled. Assuming only CAN0." @@ -69,17 +70,17 @@ # define CAN_PORT 1 #endif -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_can_setup * * Description: * Initialize CAN and register the CAN device * - ************************************************************************************/ + ****************************************************************************/ int sam_can_setup(void) { @@ -103,7 +104,7 @@ int sam_can_setup(void) { canerr("ERROR: can_register failed: %d\n", ret); return ret; - } + } return OK; #else diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_ethernet.c b/boards/arm/sama5/sama5d3-xplained/src/sam_ethernet.c index 6745c70dfd..6d76f714fc 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_ethernet.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_ethernet.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/src/sam_ethernet.c +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/src/sam_ethernet.c * * Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -62,9 +62,9 @@ #ifdef HAVE_NETWORK -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #ifndef CONFIG_SAMA5_EMACA # undef CONFIG_SAMA5_EMAC_ISETH0 @@ -79,6 +79,7 @@ #endif /* Debug ********************************************************************/ + /* Extra, in-depth debug output that is only available if * CONFIG_NETDEV_PHY_DEBUG us defined. */ @@ -93,13 +94,13 @@ # define phyinfo(x...) #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_emac_phy_enable and sam_gmac_enable - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAMA5_PIOE_IRQ #ifdef CONFIG_SAMA5_EMACA @@ -134,28 +135,29 @@ static void sam_gmac_phy_enable(bool enable) #endif #endif -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_netinitialize * * Description: * Configure board resources to support networking. * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_netinitialize(void) { #ifdef CONFIG_SAMA5_EMACA /* Ethernet 10/100 (EMAC A) Port * - * The main board contains a MICREL PHY device (KSZ8051) operating at 10/100 Mbps. - * The board supports MII and RMII interface modes. + * The main board contains a MICREL PHY device (KSZ8051) operating at + * 10/100 Mbps. The board supports MII and RMII interface modes. * - * The two independent PHY devices embedded on CM and MB boards are connected to - * independent RJ-45 connectors with built-in magnetic and status LEDs. + * The two independent PHY devices embedded on CM and MB boards are + * connected to independent RJ-45 connectors with built-in magnetic + * and status LEDs. * * At the De-Assertion of Reset: * PHY ADD[2:0]:001 @@ -166,7 +168,7 @@ void weak_function sam_netinitialize(void) * Nway Auto-Negotiation:Enable * * The KSZ8051 PHY interrupt is available on PE30 INT_ETH1 - */ + */ phyinfo("Configuring %08x\n", PIO_INT_ETH1); sam_configpio(PIO_INT_ETH1); @@ -175,12 +177,13 @@ void weak_function sam_netinitialize(void) #ifdef CONFIG_SAMA5_GMAC /* Tri-Speed Ethernet PHY * - * The SAMA5D3 series-CM board is equipped with a MICREL PHY devices (MICREL - * KSZ9021/31) operating at 10/100/1000 Mbps. The board supports RGMII interface - * mode. The Ethernet interface consists of 4 pairs of low voltage differential + * The SAMA5D3 series-CM board is equipped with a MICREL PHY devices + * (MICREL KSZ9021/31) operating at 10/100/1000 Mbps. + * The board supports RGMII interface mode. + * The Ethernet interface consists of 4 pairs of low voltage differential * pair signals designated from GRXą and GTxą plus control signals for link - * activity indicators. These signals can be used to connect to a 10/100/1000 - * BaseT RJ45 connector integrated on the main board. + * activity indicators. These signals can be used to connect to a + * 10/100/1000 BaseT RJ45 connector integrated on the main board. * * The KSZ9021/31 interrupt is available on PB35 INT_GETH0 */ diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_hsmci.c b/boards/arm/sama5/sama5d3-xplained/src/sam_hsmci.c index d32f6ab26b..df7d5b30cd 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_hsmci.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_hsmci.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d3-xplained/src/sam_hsmci.c + * boards/arm/sama5/sama5d3-xplained/src/sam_hsmci.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,8 +32,10 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ -/* The SAMA5D3-Xplained provides a two SD memory card slots: (1) a full size SD card - * slot (J10), and (2) a microSD memory card slot (J11). + +/* The SAMA5D3-Xplained provides a two SD memory card slots: + * (1) a full size SD card slot (J10), and + * (2) a microSD memory card slot (J11). * * The full size SD card slot connects via HSMCI0. The card detect discrete * is available on PB17 (pulled high). The write protect descrete is tied to @@ -89,6 +91,7 @@ /**************************************************************************** * Private Types ****************************************************************************/ + /* This structure holds static information unique to one HSMCI peripheral */ struct sam_hsmci_state_s @@ -181,7 +184,7 @@ static int sam_hsmci_cardetect(struct sam_hsmci_state_s *state) sdio_mediachange(state->hsmci, cd); } - return OK; + return OK; } #ifdef CONFIG_SAMA5_HSMCI0 @@ -262,6 +265,7 @@ int sam_hsmci_initialize(int slotno, int minor) sam_configpio(state->pincfg); /* Mount the SDIO-based MMC/SD block driver */ + /* First, get an instance of the SDIO interface */ state->hsmci = sdio_initialize(slotno); diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_i2schar.c b/boards/arm/sama5/sama5d3-xplained/src/sam_i2schar.c index 3e37ef792e..9322cd9471 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_i2schar.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_i2schar.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/src/sam_i2schar.c +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/src/sam_i2schar.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -51,9 +51,9 @@ #if defined(CONFIG_AUDIO_I2SCHAR) && \ (defined(CONFIG_SAMA5_SSC0) || defined(CONFIG_SAMA5_SSC1)) -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #ifndef CONFIG_SAMA5D3XPLAINED_SSC_PORT # if defined(CONFIG_SAMA5_SSC0) @@ -67,22 +67,22 @@ # define CONFIG_SAMA5D3XPLAINED_I2SCHAR_MINOR 0 #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: i2schar_devinit * * Description: - * All architectures must provide the following interface in order to work with - * apps/examples/i2schar. + * All architectures must provide the following interface in order to work + * with apps/examples/i2schar. * - ************************************************************************************/ + ****************************************************************************/ int i2schar_devinit(void) { @@ -94,7 +94,9 @@ int i2schar_devinit(void) if (!initialized) { - /* Call sam_ssc_initialize() to get an instance of the SSC/I2S interface */ + /* Call sam_ssc_initialize() to get an instance of the SSC/I2S + * interface + */ i2s = sam_ssc_initialize(CONFIG_SAMA5D3XPLAINED_SSC_PORT); if (!i2s) diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_nandflash.c b/boards/arm/sama5/sama5d3-xplained/src/sam_nandflash.c index 653a9356ac..c4d56336ae 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_nandflash.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_nandflash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3-xplained/src/sam_nandflash.c + * boards/arm/sama5/sama5d3-xplained/src/sam_nandflash.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -104,9 +104,10 @@ int board_nandflash_config(int cs) uint32_t regval; /* The Embest and Ronetix CM boards and one Hynix NAND HY27UF(08/16)2G2B - * Series NAND (MT29F2G08ABAEAWP). This part has a capacity of 256Mx8bit - * () with spare 8Mx8 bit capacity. The device contains 2048 blocks, composed - * by 64 x 2112 byte pages. The effective size is approximately 256MiB. + * Series NAND (MT29F2G08ABAEAWP). + * This part has a capacity of 256Mx8bit () with spare 8Mx8 bit capacity. + * The device contains 2048 blocks, composed by 64 x 2112 byte pages. + * The effective size is approximately 256MiB. * * NAND is available on CS3. */ diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_ostest.c b/boards/arm/sama5/sama5d3-xplained/src/sam_ostest.c index e4ee0f41f6..dac0ef19de 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_ostest.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_ostest.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/src/sam_ostest.c +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/src/sam_ostest.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -51,10 +51,11 @@ #include "up_internal.h" #include "sama5d3-xplained.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ + ****************************************************************************/ + +/* Configuration ************************************************************/ #undef HAVE_FPU #if defined(CONFIG_ARCH_FPU) && !defined(CONFIG_TESTING_OSTEST_FPUTESTDISABLE) && \ @@ -68,21 +69,22 @@ # error "CONFIG_TESTING_OSTEST_FPUSIZE has the wrong size" #endif -/************************************************************************************ +/**************************************************************************** * Private Data - ************************************************************************************/ + ****************************************************************************/ static uint32_t g_saveregs[XCPTCONTEXT_REGS]; -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ -/* Given an array of size CONFIG_TESTING_OSTEST_FPUSIZE, this function will return - * the current FPU registers. + ****************************************************************************/ + +/* Given an array of size CONFIG_TESTING_OSTEST_FPUSIZE, this function will + * return the current FPU registers. */ void arch_getfpu(FAR uint32_t *fpusave) diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_pwm.c b/boards/arm/sama5/sama5d3-xplained/src/sam_pwm.c index ff7bab058d..f1db885fb9 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_pwm.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_pwm.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/src/sam_pwm.c +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/src/sam_pwm.c * * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -51,12 +51,16 @@ #include "sam_pwm.h" #include "sama5d3-xplained.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ -/* PWM. There are no dedicated PWM output pins available to the user for PWM - * testing. Care must be taken because all PWM output pins conflict with some other + ****************************************************************************/ + +/* Configuration ************************************************************/ + +/* PWM. + * There are no dedicated PWM output pins available to the user for PWM + * testing. + * Care must be taken because all PWM output pins conflict with some other * usage of the pin by other devices: * * -----+---+---+----+-------------------- @@ -107,17 +111,17 @@ #if defined(CONFIG_PWM) && defined(CONFIG_SAMA5_PWM) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_pwm_setup * * Description: * Initialize PWM and register the PWM device. * - ************************************************************************************/ + ****************************************************************************/ int sam_pwm_setup(void) { diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_sdram.c b/boards/arm/sama5/sama5d3-xplained/src/sam_sdram.c index dc64b1e0b9..d8c7ce541f 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_sdram.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_sdram.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3-xplained/src/sam_sdram.c + * boards/arm/sama5/sama5d3-xplained/src/sam_sdram.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -69,6 +69,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* SDRAM differences */ #if defined(CONFIG_SAMA5D3XPLAINED_MT47H128M16RT) @@ -146,21 +147,23 @@ static inline void sam_sdram_delay(unsigned int loops) } } -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_sdram_config * * Description: * Configures DDR2 (MT47H128M16RT 128MB or, optionally, MT47H64M16HR) * - * Per the SAMA5D3-Xplained User guide: "Two DDR2/SDRAM (MT47H64M16HR) used as - * main system memory (256 MByte). The board includes 2 Gbits of on-board soldered - * DDR2 (double data rate) SDRAM. The footprints can also host two DDR2 - * (MT47H128M16RT) from MicronŽ for a total of 512 MBytes of DDR2 memory. The - * memory bus is 32 bits wide and operates with a frequency of up to 166 MHz." + * Per the SAMA5D3-Xplained User guide: + * "Two DDR2/SDRAM (MT47H64M16HR) used as main system memory (256 MByte). + * The board includes 2 Gbits of on-board soldered DDR2 (double data rate) + * SDRAM. The footprints can also host two DDR2(MT47H128M16RT) from MicronŽ + * for a total of 512 MBytes of DDR2 memory. + * The memory bus is 32 bits wide and operates with a frequency of up + * to 166 MHz." * * From the Atmel Code Example: * MT47H64M16HR : 8 Meg x 16 x 8 banks @@ -179,7 +182,7 @@ static inline void sam_sdram_delay(unsigned int loops) * we complete initialization of SDRAM and it is ready for use, we will * make DRAM into normal memory. * - ************************************************************************************/ + ****************************************************************************/ void sam_sdram_config(void) { @@ -314,41 +317,55 @@ void sam_sdram_config(void) /* Configure the Timing Parameter 0 Register */ - regval = MPDDRC_TPR0_TRAS(6) | /* Active to Precharge Delay: 6 * 7.5 = 45 ns */ - MPDDRC_TPR0_TRCD(2) | /* Row to Column Delay: 2 * 7.5 = 15 ns */ - MPDDRC_TPR0_TWR(2) | /* Write Recovery Delay: 3 * 7.5 = 22.5 ns */ - MPDDRC_TPR0_TRC(8) | /* Row Cycle Delay: 8 * 7.5 = 60 ns */ - MPDDRC_TPR0_TRP(2) | /* Row Precharge Delay: 2 * 7.5 = 15 ns */ - MPDDRC_TPR0_TRRD(1) | /* Active BankA to Active BankB: 2 * 7.5 = 15 ns */ - MPDDRC_TPR0_TWTR(2) | /* Internal Write to Read Delay: 2 clock cycle */ - MPDDRC_TPR0_TMRD(2); /* Load Mode Register Command to - * Activate or Refresh Command: 2 clock cycles */ + regval = MPDDRC_TPR0_TRAS(6) | /* Active to Precharge Delay: 6 * 7.5 = 45 ns */ + MPDDRC_TPR0_TRCD(2) | /* Row to Column Delay: 2 * 7.5 = 15 ns */ + MPDDRC_TPR0_TWR(2) | /* Write Recovery Delay: 3 * 7.5 = 22.5 ns */ + MPDDRC_TPR0_TRC(8) | /* Row Cycle Delay: 8 * 7.5 = 60 ns */ + MPDDRC_TPR0_TRP(2) | /* Row Precharge Delay: 2 * 7.5 = 15 ns */ + MPDDRC_TPR0_TRRD(1) | /* Active BankA to Active BankB: 2 * 7.5 = 15 ns */ + MPDDRC_TPR0_TWTR(2) | /* Internal Write to Read Delay: 2 clock cycle */ + MPDDRC_TPR0_TMRD(2); /* Load Mode Register Command to + * Activate or Refresh Command: 2 clock + * cycles + */ putreg32(regval, SAM_MPDDRC_TPR0); /* Configure the Timing Parameter 1 Register */ regval = MPDDRC_TPR1_TRFC(14) | /* Row Cycle Delay: - * 18 * 7.5 = 135 ns (min 127.5 ns for 1Gb DDR) */ + * 18 * 7.5 = 135 ns + * (min 127.5 ns for 1Gb DDR) + */ MPDDRC_TPR1_TXSNR(16) | /* Exit Self Refresh Delay to Non Read Command: * 20 * 7.5 > 142.5ns TXSNR: Exit self refresh - * delay to non read command */ + * delay to non read command + */ MPDDRC_TPR1_TXSRD(208) | /* Exit Self Refresh Delay to Read Command: * min 200 clock cycles, TXSRD: Exit self refresh - * delay to Read command */ + * delay to Read command + */ MPDDRC_TPR1_TXP(2); /* Exit Power-down Delay to First Command: - * 2 * 7.5 = 15 ns */ + * 2 * 7.5 = 15 ns + */ putreg32(regval, SAM_MPDDRC_TPR1); /* Configure the Timing Parameter 2 Register */ - regval = MPDDRC_TPR2_TXARD(7) | /* Exit Active Power Down Delay to Read Command in Mode 'Fast Exit': - * min 2 clock cycles */ - MPDDRC_TPR2_TXARDS(7) | /* Exit Active Power Down Delay to Read Command in Mode 'Slow Exit': - * min 7 clock cycles */ + regval = MPDDRC_TPR2_TXARD(7) | /* Exit Active Power Down Delay to + * Read Command in Mode 'Fast Exit': + * min 2 clock cycles + */ + MPDDRC_TPR2_TXARDS(7) | /* Exit Active Power Down Delay to + * Read Command in Mode 'Slow Exit': + * min 7 clock cycles + */ MPDDRC_TPR2_TRPA(2) | /* Row Precharge All Delay: - * min 18ns */ + * min 18ns + */ MPDDRC_TPR2_TRTP(2) | /* Four Active Windows: - * 2 * 7.5 = 15 ns (min 7.5ns) */ + * 2 * 7.5 = 15 ns + * (min 7.5ns) + */ MPDDRC_TPR2_TFAW(10); putreg32(regval, SAM_MPDDRC_TPR2); @@ -386,11 +403,14 @@ void sam_sdram_config(void) putreg32(MPDDRC_MR_MODE_NOP, SAM_MPDDRC_MR); - /* Perform a write access to any DDR2-SDRAM address to acknowledge this command.*/ + /* Perform a write access to any DDR2-SDRAM address to + * acknowledge this command. + */ *ddr = 0; - /* Now CKE is driven high.*/ + /* Now CKE is driven high. */ + /* Wait 400 ns min */ sam_sdram_delay(NSEC_TO_COUNT(400)); @@ -399,7 +419,9 @@ void sam_sdram_config(void) putreg32(MPDDRC_MR_MODE_PRCGALL, SAM_MPDDRC_MR); - /* Perform a write access to any DDR2-SDRAM address to acknowledge this command.*/ + /* Perform a write access to any DDR2-SDRAM address to + * acknowledge this command. + */ *ddr = 0; @@ -435,9 +457,11 @@ void sam_sdram_config(void) sam_sdram_delay(100 /* CYCLES_TO_COUNT(2) */); - /* Step 8: An Extended Mode Register set (EMRS1) cycle is issued to enable DLL. + /* Step 8: An Extended Mode Register set (EMRS1) cycle + * is issued to enable DLL. * - * The write address must be chosen so that BA[1] is set to 0 and BA[0] is set to 1. + * The write address must be chosen so that BA[1] is set to + * 0 and BA[0] is set to 1. */ putreg32(MPDDRC_MR_MODE_EXTLMR, SAM_MPDDRC_MR); @@ -447,7 +471,7 @@ void sam_sdram_config(void) sam_sdram_delay(10000 /* CYCLES_TO_COUNT(200) */); - /* Step 9: Program DLL field into the Configuration Register.*/ + /* Step 9: Program DLL field into the Configuration Register. */ regval = getreg32(SAM_MPDDRC_CR); regval |= MPDDRC_CR_DLL; @@ -494,7 +518,8 @@ void sam_sdram_config(void) /* Configure 2nd CBR. * - * Perform a write access to any DDR2-SDRAM address to acknowledge this command. + * Perform a write access to any DDR2-SDRAM address to + * acknowledge this command. */ putreg32(MPDDRC_MR_MODE_RFSH, SAM_MPDDRC_MR); @@ -594,11 +619,13 @@ void sam_sdram_config(void) */ /* ((64 x 10(^-3))/8192) x133 x (10^6) */ + /* Set Refresh timer 7.8125 us */ - putreg32( MPDDRC_RTR_COUNT(300), SAM_MPDDRC_RTR); + putreg32(MPDDRC_RTR_COUNT(300), SAM_MPDDRC_RTR); /* OK now we are ready to work on the DDRSDR */ + /* Wait for end of calibration */ sam_sdram_delay(500); diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_spi.c b/boards/arm/sama5/sama5d3-xplained/src/sam_spi.c index 06e1d2f442..9167aa05a3 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_spi.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/src/sam_spi.c +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/src/sam_spi.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -55,17 +55,18 @@ #if defined(CONFIG_SAMA5_SPI0) || defined(CONFIG_SAMA5_SPI1) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_spidev_initialize * * Description: - * Called to configure SPI chip select PIO pins for the SAMA5D3-Xplained board. + * Called to configure SPI chip select PIO pins for the SAMA5D3-Xplained + * board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_spidev_initialize(void) { @@ -73,7 +74,7 @@ void weak_function sam_spidev_initialize(void) #ifdef CONFIG_MTD_AT25 /* The AT25 serial FLASH connects using NPCS0 */ - sam_configpio(PIO_AT25_NPCS0); + sam_configpio(PIO_AT25_NPCS0); #endif #endif @@ -85,30 +86,33 @@ void weak_function sam_spidev_initialize(void) * Name: sam_spi[0|1]select, sam_spi[0|1]status, and sam_spi[0|1]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[0|1]select is a functions tomanage the board-specific chip selects - * o sam_spi[0|1]status and sam_spi[0|1]cmddata: Implementations of the status - * and cmddata methods of the SPI interface defined by struct spi_ops_ - * (see include/nuttx/spi/spi.h). All other methods including - * sam_spibus_initialize()) are provided by common SAM3/4 logic. + * o sam_spi[0|1]select is a functions tomanage the board-specific chip + * selects + * o sam_spi[0|1]status and sam_spi[0|1]cmddata: + * Implementations of the status and cmddata methods of the SPI interface + * defined by struct spi_ops_(see include/nuttx/spi/spi.h). + * All other methods including sam_spibus_initialize()) are provided by + * common SAM3/4 logic. * * To use this common SPI logic on your board: * * 1. Provide logic in sam_boardinitialize() to configure SPI chip select * pins. - * 2. Provide sam_spi[0|1]select() and sam_spi[0|1]status() functions in your board- - * specific logic. These functions will perform chip selection and - * status operations using PIOs in the way your board is configured. + * 2. Provide sam_spi[0|1]select() and sam_spi[0|1]status() functions in + * your board-specific logic. + * These functions will perform chip selection and status operations + * using PIOs in the way your board is configured. * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide * sam_spi[0|1]cmddata() functions in your board-specific logic. This * function will perform cmd/data selection operations using PIOs in * 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). * diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_usb.c b/boards/arm/sama5/sama5d3-xplained/src/sam_usb.c index e83d9c5083..2fa6d92654 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_usb.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_usb.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/src/sam_usb.c +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/src/sam_usb.c * * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -61,9 +61,9 @@ #if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS) -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #ifndef CONFIG_SAMA5D3XPLAINED_USBHOST_PRIO # define CONFIG_SAMA5D3XPLAINED_USBHOST_PRIO 50 @@ -77,9 +77,10 @@ # undef CONFIG_SAMA5_UHPHS_RHPORT1 #endif -/************************************************************************************ +/**************************************************************************** * Private Data - ************************************************************************************/ + ****************************************************************************/ + /* Retained device driver handles */ #ifdef CONFIG_SAMA5_OHCI @@ -95,21 +96,22 @@ static struct usbhost_connection_s *g_ehciconn; static xcpt_t g_ochandler; #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: usbhost_waiter * * Description: * Wait for USB devices to be connected to either the OHCI or EHCI hub. * - ************************************************************************************/ + ****************************************************************************/ #if HAVE_USBHOST #ifdef CONFIG_DEBUG_USB -static int usbhost_waiter(struct usbhost_connection_s *dev, const char *hcistr) +static int usbhost_waiter(struct usbhost_connection_s *dev, + const char *hcistr) #else static int usbhost_waiter(struct usbhost_connection_s *dev) #endif @@ -117,7 +119,7 @@ static int usbhost_waiter(struct usbhost_connection_s *dev) struct usbhost_hubport_s *hport; uinfo("Running\n"); - for (;;) + for (; ; ) { /* Wait for the device to change state */ @@ -140,13 +142,13 @@ static int usbhost_waiter(struct usbhost_connection_s *dev) } #endif -/************************************************************************************ +/**************************************************************************** * Name: ohci_waiter * * Description: * Wait for USB devices to be connected to the OHCI hub. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAMA5_OHCI static int ohci_waiter(int argc, char *argv[]) @@ -159,13 +161,13 @@ static int ohci_waiter(int argc, char *argv[]) } #endif -/************************************************************************************ +/**************************************************************************** * Name: ehci_waiter * * Description: * Wait for USB devices to be connected to the EHCI hub. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAMA5_EHCI static int ehci_waiter(int argc, char *argv[]) @@ -178,16 +180,16 @@ static int ehci_waiter(int argc, char *argv[]) } #endif -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_usbinitialize * * Description: - * Called from sam_usbinitialize very early in inialization to setup USB-related - * GPIO pins for the SAMA5D3-Xplained board. + * Called from sam_usbinitialize very early in inialization to setup + * USB-related GPIO pins for the SAMA5D3-Xplained board. * * USB Ports * The SAMA5D3 series-MB features three USB communication ports: @@ -209,7 +211,7 @@ static int ehci_waiter(int argc, char *argv[]) * Port A * * PIO Signal Name Function - * ---- ----------- ------------------------------------------------------- + * ---- ----------- ----------------------------------------------------- * PE9 VBUS_SENSE VBus detection * * Note: No VBus power switch enable on port A. I think that this limits @@ -219,21 +221,21 @@ static int ehci_waiter(int argc, char *argv[]) * Port B * * PIO Signal Name Function - * ---- ----------- ------------------------------------------------------- + * ---- ----------- ----------------------------------------------------- * PE4 EN5V_USBB VBus power enable (via MN3 power switch). To the A1 * pin of J19 Dual USB A connector * * Port C * * PIO Signal Name Function - * ---- ----------- ------------------------------------------------------- + * ---- ----------- ----------------------------------------------------- * PE3 EN5V_USBC VBus power enable (via MN3 power switch). To the B1 * pin of J19 Dual USB A connector * * Both Ports B and C * * PIO Signal Name Function - * ---- ----------- ------------------------------------------------------- + * ---- ----------- ----------------------------------------------------- * PE5 OVCUR_USB Combined over-current indication from port A and B * * That offers a lot of flexibility. However, here we enable the ports only @@ -243,7 +245,7 @@ static int ehci_waiter(int argc, char *argv[]) * Port B -- EHCI host * Port C -- OHCI host * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_usbinitialize(void) { @@ -253,6 +255,7 @@ void weak_function sam_usbinitialize(void) sam_configpio(PIO_USBA_VBUS_SENSE); /* VBUS sense */ /* TODO: Configure an interrupt on VBUS sense */ + #endif #ifdef HAVE_USBHOST @@ -284,15 +287,16 @@ void weak_function sam_usbinitialize(void) #endif /* HAVE_USBHOST */ } -/*********************************************************************************** +/**************************************************************************** * Name: sam_usbhost_initialize * * Description: - * Called at application startup time to initialize the USB host functionality. + * Called at application startup time to initialize the USB host + * functionality. * This function will start a thread that will monitor for device * connection/disconnection events. * - ***********************************************************************************/ + ****************************************************************************/ #if HAVE_USBHOST int sam_usbhost_initialize(void) @@ -394,29 +398,30 @@ int sam_usbhost_initialize(void) } #endif -/*********************************************************************************** +/**************************************************************************** * Name: sam_usbhost_vbusdrive * * Description: - * Enable/disable driving of VBUS 5V output. This function must be provided by - * each platform that implements the OHCI or EHCI host interface + * Enable/disable driving of VBUS 5V output. + * This function must be provided by each platform that implements the + * OHCI or EHCI host interface * * Input Parameters: - * rhport - Selects root hub port to be powered host interface. See SAM_RHPORT_* - * definitions above. + * rhport - Selects root hub port to be powered host interface. + * See SAM_RHPORT_* definitions above. * enable - true: enable VBUS power; false: disable VBUS power * * Returned Value: * None * - ***********************************************************************************/ + ****************************************************************************/ #if HAVE_USBHOST void sam_usbhost_vbusdrive(int rhport, bool enable) { pio_pinset_t pinset = 0; - uinfo("RHPort%d: enable=%d\n", rhport+1, enable); + uinfo("RHPort%d: enable=%d\n", rhport + 1, enable); /* Pick the PIO configuration associated with the selected root hub port */ @@ -456,7 +461,7 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) #endif default: - uerr("ERROR: RHPort%d is not supported\n", rhport+1); + uerr("ERROR: RHPort%d is not supported\n", rhport + 1); return; } @@ -477,15 +482,15 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) } #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_setup_overcurrent * * Description: - * Setup to receive an interrupt-level callback if an overcurrent condition is - * detected on port B or C. + * Setup to receive an interrupt-level callback if an overcurrent condition + * is detected on port B or C. * - * REVISIT: Since this is a common signal, we will need to come up with some way - * to inform both EHCI and OHCI drivers when this error occurs. + * REVISIT: Since this is a common signal, we will need to come up with + * some way to inform both EHCI and OHCI drivers when this error occurs. * * Input Parameters: * handler - New overcurrent interrupt handler @@ -493,7 +498,7 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) * Returned Value: * Old overcurrent interrupt handler * - ************************************************************************************/ + ****************************************************************************/ #if HAVE_USBHOST xcpt_t sam_setup_overcurrent(xcpt_t handler) @@ -533,16 +538,17 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler) } #endif /* CONFIG_SAMA5_PIOD_IRQ ... */ -/************************************************************************************ +/**************************************************************************** * Name: sam_usbsuspend * * Description: - * Board logic must provide the sam_usbsuspend logic if the USBDEV driver is - * used. This function is called whenever the USB enters or leaves suspend mode. - * This is an opportunity for the board logic to shutdown clocks, power, etc. - * while the USB is suspended. + * Board logic must provide the sam_usbsuspend logic if the USBDEV driver + * is used. + * This function is called whenever the USB enters or leaves suspend mode. + * This is an opportunity for the board logic to shutdown clocks, power, + * etc. while the USB is suspended. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_USBDEV void sam_usbsuspend(FAR struct usbdev_s *dev, bool resume) @@ -550,5 +556,4 @@ void sam_usbsuspend(FAR struct usbdev_s *dev, bool resume) uinfo("resume: %d\n", resume); } #endif - #endif /* CONFIG_SAMA5_UHPHS || CONFIG_SAMA5_UDPHS */ diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_usbmsc.c b/boards/arm/sama5/sama5d3-xplained/src/sam_usbmsc.c index a962b615bb..61e94272cf 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_usbmsc.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_usbmsc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3-xplained/src/sam_usbmsc.c + * boards/arm/sama5/sama5d3-xplained/src/sam_usbmsc.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_userleds.c b/boards/arm/sama5/sama5d3-xplained/src/sam_userleds.c index 8e858713ca..7b0d14258f 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_userleds.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_userleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3-xplained/src/sam_userleds.c + * boards/arm/sama5/sama5d3-xplained/src/sam_userleds.c * * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3-xplained/src/sama5d3-xplained.h b/boards/arm/sama5/sama5d3-xplained/src/sama5d3-xplained.h index 5ec0a8767f..cf9cb49c1c 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sama5d3-xplained.h +++ b/boards/arm/sama5/sama5d3-xplained/src/sama5d3-xplained.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3-xplained/src/sama5d3-xplained.h +/**************************************************************************** + * boards/arm/sama5/sama5d3-xplained/src/sama5d3-xplained.h * * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_SAMA5D3_XPLAINED_SRC_SAMA5D3_XPLAINED_H -#define __BOARDS_ARM_SAMA5D3_XPLAINED_SRC_SAMA5D3_XPLAINED_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_SRC_SAMA5D3_XPLAINED_H +#define __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_SRC_SAMA5D3_XPLAINED_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -50,9 +50,10 @@ #include "hardware/sam_pinmap.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + /* Configuration ************************************************************/ #define HAVE_HSMCI 1 @@ -64,6 +65,7 @@ #define HAVE_NETWORK 1 /* HSMCI */ + /* Can't support MMC/SD if the card interface(s) are not enable */ #if !defined(CONFIG_SAMA5_HSMCI0) && !defined(CONFIG_SAMA5_HSMCI1) @@ -85,6 +87,7 @@ #endif /* NAND FLASH */ + /* Can't support the NAND device if NAND flash is not configured on EBI CS3 */ #ifndef CONFIG_SAMA5_EBICS3_NAND @@ -130,6 +133,7 @@ #endif /* AT25 Serial FLASH */ + /* Can't support the AT25 device if it SPI0 or AT25 support are not enabled */ #if !defined(CONFIG_SAMA5_SPI0) || !defined(CONFIG_MTD_AT25) @@ -203,8 +207,9 @@ #endif /* USB Host / USB Device */ -/* Either CONFIG_SAMA5_UHPHS or CONFIG_SAMA5_UDPHS must be defined, or there is - * no USB of any kind. + +/* Either CONFIG_SAMA5_UHPHS or CONFIG_SAMA5_UDPHS must be defined, + * or there is no USB of any kind. */ #if !defined(CONFIG_SAMA5_UHPHS) @@ -269,7 +274,8 @@ # endif #endif -/* LEDs *****************************************************************************/ +/* LEDs *********************************************************************/ + /* There are two LEDs on the SAMA5D3 series-CM board that can be controlled * by software. A blue LED is controlled via PIO pins. A red LED normally * provides an indication that power is supplied to the board but can also @@ -289,7 +295,8 @@ #define PIO_RED (PIO_OUTPUT | PIO_CFG_PULLUP | PIO_OUTPUT_CLEAR | \ PIO_PORT_PIOE | PIO_PIN24) -/* Buttons **************************************************************************/ +/* Buttons ******************************************************************/ + /* There are five push button switches on the SAMA5D3-Xplained base board: * * 1. One Reset, board reset (BP1) @@ -310,9 +317,11 @@ PIO_INT_BOTHEDGES | PIO_PORT_PIOE | PIO_PIN29) #define IRQ_USER SAM_IRQ_PE29 -/* HSMCI Card Slots *****************************************************************/ -/* The SAMA5D3-Xplained provides a two SD memory card slots: (1) a full size SD card - * slot (J10), and (2) a microSD memory card slot (J11). +/* HSMCI Card Slots *********************************************************/ + +/* The SAMA5D3-Xplained provides a two SD memory card slots: + * (1) a full size SD card slot (J10), and + * (2) a microSD memory card slot (J11). * * The full size SD card slot connects via HSMCI0. The card detect discrete * is available on PD17 (pulled high). The write protect descrete is tied to @@ -353,7 +362,8 @@ PIO_INT_BOTHEDGES | PIO_PORT_PIOD | PIO_PIN18) #define IRQ_MCI1_CD SAM_IRQ_PD18 -/* USB Ports ************************************************************************/ +/* USB Ports ****************************************************************/ + /* The SAMA5D3 series-MB features three USB communication ports: * * 1. Port A Host High Speed (EHCI) and Full Speed (OHCI) multiplexed with @@ -438,11 +448,12 @@ #ifdef CONFIG_SAMA5_EMACA /* ETH1: Ethernet 10/100 (EMAC A) Port * - * The main board contains a MICREL PHY device (KSZ8051) operating at 10/100 Mbps. - * The board supports MII and RMII interface modes. + * The main board contains a MICREL PHY device (KSZ8051) operating at + * 10/100 Mbps. The board supports MII and RMII interface modes. * - * The two independent PHY devices embedded on CM and MB boards are connected to - * independent RJ-45 connectors with built-in magnetic and status LEDs. + * The two independent PHY devices embedded on CM and MB boards are + * connected to independent RJ-45 connectors with built-in magnetic + * and status LEDs. * * At the De-Assertion of Reset: * PHY ADD[2:0]:001 @@ -466,11 +477,12 @@ /* ETH0: Tri-Speed Ethernet PHY * * The SAMA5D3 series-CM board is equipped with a MICREL PHY devices (MICREL - * KSZ9021/31) operating at 10/100/1000 Mbps. The board supports RGMII interface - * mode. The Ethernet interface consists of 4 pairs of low voltage differential + * KSZ9021/31) operating at 10/100/1000 Mbps. + * The board supports RGMII interface mode. + * The Ethernet interface consists of 4 pairs of low voltage differential * pair signals designated from GRXą and GTxą plus control signals for link - * activity indicators. These signals can be used to connect to a 10/100/1000 - * BaseT RJ45 connector integrated on the main board. + * activity indicators. These signals can be used to connect to a + * 10/100/1000 BaseT RJ45 connector integrated on the main board. * * The KSZ9021/31 interrupt is available on PB35 INT_GETH0. The sense of * the interrupt is configurable but is, by default, active low. @@ -482,7 +494,8 @@ #endif -/* SPI Chip Selects *****************************************************************/ +/* SPI Chip Selects *********************************************************/ + /* Both the Ronetix and Embest versions of the SAMAD3x CPU modules include an * Atmel AT25DF321A, 32-megabit, 2.7-volt SPI serial flash. The SPI * connection is as follows: @@ -590,42 +603,44 @@ #define PIO_JUMP PIO_BUTTON_3 #define IRQ_JUMP IRQ_BUTTON_3 -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_spidev_initialize * * Description: - * Called to configure SPI chip select PIO pins for the SAMA5D3-Xplained board. + * Called to configure SPI chip select PIO pins for the SAMA5D3-Xplained + * board. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAMA5_SPI0) || defined(CONFIG_SAMA5_SPI1) void weak_function sam_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_sdram_config * * Description: * Configures DDR2 (MT47H128M16RT 128MB or, optionally, MT47H64M16HR) * - * Per the SAMA5D3-Xplained User guide: "Two SDRAM/DDR2 used as main system memory. - * MT47H128M16 - 2 Gb - 16 Meg x 16 x 8 banks, the board provides up to 2 Gb on- - * board, soldered DDR2 SDRAM. The memory bus is 32 bits wide and operates with - * up to 166 MHz." + * Per the SAMA5D3-Xplained User guide: + * "Two SDRAM/DDR2 used as main system memory. + * MT47H128M16 - 2 Gb - 16 Meg x 16 x 8 banks, the board provides up to + * 2 Gb on-board, soldered DDR2 SDRAM. + * The memory bus is 32 bits wide and operates with up to 166 MHz." * * From the Atmel Code Example: * MT47H64M16HR : 8 Meg x 16 x 8 banks @@ -640,11 +655,11 @@ void weak_function sam_spidev_initialize(void); * None * * Assumptions: - * The DDR memory regions is configured as strongly ordered memory. When we - * complete initialization of SDRAM and it is ready for use, we will make DRAM - * into normal memory. + * The DDR memory regions is configured as strongly ordered memory. + * When we complete initialization of SDRAM and it is ready for use, + * we will make DRAM into normal memory. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAMA5_DDRCS) && !defined(CONFIG_SAMA5_BOOT_SDRAM) void sam_sdram_config(void); @@ -688,105 +703,105 @@ int sam_at25_automount(int minor); int sam_hsmci_initialize(int slotno, int minor); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_cardinserted * * Description: * Check if a card is inserted into the selected HSMCI slot * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_HSMCI bool sam_cardinserted(int slotno); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_writeprotected * * Description: * Check if the card in the MMCSD slot is write protected * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_HSMCI bool sam_writeprotected(int slotno); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_usbinitialize * * Description: - * Called from sam_usbinitialize very early in initialization to setup USB-related - * PIO pins for the SAMA5D3-Xplained board. + * Called from sam_usbinitialize very early in initialization to setup + * USB-related PIO pins for the SAMA5D3-Xplained board. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS) void weak_function sam_usbinitialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: stm32_usbhost_initialize * * Description: - * Called at application startup time to initialize the USB host functionality. - * This function will start a thread that will monitor for device connection/ - * disconnection events. + * Called at application startup time to initialize the USB host + * functionality. + * This function will start a thread that will monitor for device + * connection/disconnection events. * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_USBHOST int sam_usbhost_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_pwm_setup * * Description: * Initialize PWM and register the PWM device. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_PWM int sam_pwm_setup(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_adc_setup * * Description: * Initialize ADC and register the ADC driver. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ADC int sam_adc_setup(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_can_setup * * Description: * Initialize CAN and register the CAN device * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_CAN int sam_can_setup(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_netinitialize * * Description: * Configure board resources to support networking. * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_NETWORK void weak_function sam_netinitialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3_XPLAINED_SRC_SAMA5D3_XPLAINED_H */ - +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3_XPLAINED_SRC_SAMA5D3_XPLAINED_H */ diff --git a/boards/arm/sama5/sama5d3x-ek/README.txt b/boards/arm/sama5/sama5d3x-ek/README.txt index 4c99e91c7d..4ebddbebfd 100644 --- a/boards/arm/sama5/sama5d3x-ek/README.txt +++ b/boards/arm/sama5/sama5d3x-ek/README.txt @@ -535,13 +535,13 @@ Boot sequence DRAMBOOT -------- - See also boards/sama5d4-ek/README.txt for a description of the DRAMBOOT + See also boards/arm/sama5/sama5d4-ek/README.txt for a description of the DRAMBOOT program. This is a tiny version of NuttX that can run out of internal SRAM. If you put this program on the HSMCI1 microSD card as boot.bin, then it will boot on power up and you can download NuttX directly into DRAM by sending the nuttx.hex file over the serial connection. - The boards/sama5d4-ek/README.txt also describes variants AT25BOOT and + The boards/arm/sama5/sama5d4-ek/README.txt also describes variants AT25BOOT and SRAMBOOT. This have not been ported to the SAMA5D3x-EK, but are available if they are usefult too you. @@ -1145,7 +1145,7 @@ Networking prototyped in the nuttx/include/nuttx/arch.h, and (2) it must select CONFIG_ARCH_PHY_INTERRUPT in the board configuration file to advertise that it supports arch_phy_irq(). This logic can be found at - nuttx/boards/sama5d3x-ek/src/sam_ethernet.c. + nuttx/boards/arm/sama5/sama5d3x-ek/src/sam_ethernet.c. - One other thing: UDP support is required (CONFIG_NET_UDP). @@ -1373,7 +1373,7 @@ Auto-Mounter CONFIG_FS_AUTOMOUNTER=y However, to use the automounter you will to provide some additional - board-level support. See boards/sama5d4-ek for and example of how + board-level support. See boards/arm/sama5/sama5d4-ek for and example of how you might do this. WARNING: SD cards should never be removed without first unmounting @@ -2589,7 +2589,7 @@ SAMA5 PWM Support B PB13 --- GMAC -----+---+---+----+-------------------- - See boards/sama5d3x-ek/include/board.h for all of the default PWM + See boards/arm/sama5/sama5d3x-ek/include/board.h for all of the default PWM pin selections. I used PWM channel 0, pins PA20 and PA21 for testing. Clocking is addressed in the next paragraph. diff --git a/boards/arm/sama5/sama5d3x-ek/include/board.h b/boards/arm/sama5/sama5d3x-ek/include/board.h index dbb3f4c2f9..105d65af9a 100644 --- a/boards/arm/sama5/sama5d3x-ek/include/board.h +++ b/boards/arm/sama5/sama5d3x-ek/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/include/board.h +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/include/board.h * * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,25 +31,26 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_H -#define __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_H +#define __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. */ /* On-board crystal frequencies */ @@ -58,22 +59,26 @@ #define BOARD_SLOWCLK_FREQUENCY (32768) /* Slow Clock: 32.768KHz */ #if defined(CONFIG_SAMA5_BOOT_SDRAM) -/* When booting from SDRAM, NuttX is loaded in SDRAM by an intermediate bootloader. - * That bootloader had to have already configured the PLL and SDRAM for proper - * operation. +/* When booting from SDRAM, NuttX is loaded in SDRAM by an intermediate + * bootloader. + * That bootloader had to have already configured the PLL and SDRAM for + * proper operation. * - * In this case, we don not reconfigure the clocking. Rather, we need to query - * the register settings to determine the clock frequencies. We can only assume that - * the Main clock source is the on-board 12MHz crystal. + * In this case, we don not reconfigure the clocking. + * Rather, we need to query the register settings to determine the clock + * frequencies. We can only assume that the Main clock source is the + * on-board 12MHz crystal. */ # include #elif defined(CONFIG_SAMA5D3xEK_384MHZ) -/* OHCI Only. This is an alternative slower configuration that will produce a 48MHz - * USB clock with the required accuracy using only PLLA. When PPLA is used to clock - * OHCI, an additional requirement is the PLLACK be a multiple of 48MHz. This setup - * results in a CPU clock of 384MHz. +/* OHCI Only. + * This is an alternative slower configuration that will produce a 48MHz + * USB clock with the required accuracy using only PLLA. + * When PPLA is used to clock OHCI, an additional requirement is the PLLACK + * be a multiple of 48MHz. + * This setup results in a CPU clock of 384MHz. * * This case is only interesting for experimentation. */ @@ -89,8 +94,8 @@ # include #else /* #elif defined(CONFIG_SAMA5D3xEK_396MHZ) */ -/* This is the configuration provided in the Atmel example code. This setup results - * in a CPU clock of 396MHz. +/* This is the configuration provided in the Atmel example code. + * This setup results in a CPU clock of 396MHz. * * In this configuration, UPLL is the source of the UHPHS clock (if enabled). */ @@ -120,7 +125,8 @@ #define BOARD_LCDC_PWMPS LCDC_LCDCFG6_PWMPS_DIV1 #define BOARD_LCDC_PWMPOL LCDC_LCDCFG6_PWMPOL -/* LED definitions ******************************************************************/ +/* LED definitions **********************************************************/ + /* There are two LEDs on the SAMA5D3 series-CM board that can be controlled * by software. A blue LED is controlled via PIO pins. A red LED normally * provides an indication that power is supplied to the board but can also @@ -159,7 +165,9 @@ * * SYMBOL Val Meaning LED state * Blue Red - * ----------------- --- ----------------------- -------- -------- */ + * ----------------- --- ----------------------- -------- -------- + */ + #define LED_STARTED 0 /* NuttX has been started OFF OFF */ #define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF */ #define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF */ @@ -180,7 +188,8 @@ * has halted. */ -/* Button definitions ***************************************************************/ +/* Button definitions *******************************************************/ + /* There are five push button switches on the SAMA5D3X-EK base board: * * 1. One Reset, board reset (BP1) @@ -202,21 +211,22 @@ #define BUTTON_USER1_BIT (1 << BUTTON_USER1) -/* NAND *****************************************************************************/ +/* NAND *********************************************************************/ -/* Address for transferring command bytes to the nandflash, CLE A22*/ +/* Address for transferring command bytes to the nandflash, CLE A22 */ #define BOARD_EBICS3_NAND_CMDADDR 0x60400000 -/* Address for transferring address bytes to the nandflash, ALE A21*/ +/* Address for transferring address bytes to the nandflash, ALE A21 */ #define BOARD_EBICS3_NAND_ADDRADDR 0x60200000 -/* Address for transferring data bytes to the nandflash.*/ +/* Address for transferring data bytes to the nandflash. */ #define BOARD_EBICS3_NAND_DATAADDR 0x60000000 -/* PIO configuration ****************************************************************/ +/* PIO configuration ********************************************************/ + /* LCDC */ #define PIO_LCD_DAT16 PIO_LCD_DAT16_2 @@ -228,10 +238,12 @@ #define PIO_LCD_DAT22 PIO_LCD_DAT22_1 #define PIO_LCD_DAT23 PIO_LCD_DAT23_1 -/* PWM. There are no dedicated PWM output pins available to the user for PWM - * testing. Care must be taken because all PWM output pins conflict with some other - * usage of the pin by other devices. Furthermore, many of these pins have not been - * brought out to an external connector: +/* PWM. + * There are no dedicated PWM output pins available to the user for PWM + * testing. + * Care must be taken because all PWM output pins conflict with some other + * usage of the pin by other devices. Furthermore, many of these pins have + * not been brought out to an external connector: * * -----+---+---+----+------+---------------- * PWM PIN PER PIO I/O CONFLICTS @@ -265,11 +277,11 @@ /* PWM channel 0: * - * PA20 and PA21 can be used if the LCDC or ISI are not selected. These outputs are - * available on J1, pins 14 and 16, respectively. + * PA20 and PA21 can be used if the LCDC or ISI are not selected. + * These outputs are available on J1, pins 14 and 16, respectively. * - * If the GMAC is not selected, then PB0 and PB1 could also be used. However, - * these pins are not available at the I/O expansion connectors. + * If the GMAC is not selected, then PB0 and PB1 could also be used. + * However, these pins are not available at the I/O expansion connectors. */ #if !defined(CONFIG_SAMA5_LCDC) && !defined(CONFIG_SAMA5_ISI) @@ -282,14 +294,15 @@ /* PWM channel 1: * - * PA22 and PA23 can be used if the LCDC or ISI are not selected. These outputs are - * available on J1, pins 18 and 20, respectively. + * PA22 and PA23 can be used if the LCDC or ISI are not selected. + * These outputs are available on J1, pins 18 and 20, respectively. * - * PE31 can be used if the ISI is not selected (and the HDMI is not being used). + * PE31 can be used if the ISI is not selected + * (and the HDMI is not being used). * That signal is available at J3 pin 20. * - * If the GMAC is not selected, then PB4 and PB5 could also be used. However, - * these pins are not available at the I/O expansion connectors. + * If the GMAC is not selected, then PB4 and PB5 could also be used. + * However, these pins are not available at the I/O expansion connectors. */ #if !defined(CONFIG_SAMA5_LCDC) && !defined(CONFIG_SAMA5_ISI) @@ -322,8 +335,10 @@ /* PWM channel 3: * - * If the GMAC is not selected, then PB12 can used and is available at J3 pin 7. - * None of the other output pins are accessible at the I/O expansion connectors. + * If the GMAC is not selected, then PB12 can used and is available at + * J3 pin 7. + * None of the other output pins are accessible at the I/O expansion + * connectors. */ #if !defined(CONFIG_SAMA5_GMAC) @@ -334,13 +349,13 @@ # define PIO_PWM3_L PIO_PWM3_L_1 #endif -/************************************************************************************ +/**************************************************************************** * Assembly Language Macros - ************************************************************************************/ + ****************************************************************************/ #ifdef __ASSEMBLY__ - .macro config_sdram - .endm + .macro config_sdram + .endm #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_H */ diff --git a/boards/arm/sama5/sama5d3x-ek/include/board_384mhz.h b/boards/arm/sama5/sama5d3x-ek/include/board_384mhz.h index 0aea9f1f2f..efd72993f3 100644 --- a/boards/arm/sama5/sama5d3x-ek/include/board_384mhz.h +++ b/boards/arm/sama5/sama5d3x-ek/include/board_384mhz.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/include/board_384mhz.h +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/include/board_384mhz.h * * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,32 +31,35 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_384MHZ_H -#define __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_384MHZ_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_384MHZ_H +#define __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_384MHZ_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. * - * This is an alternative slower configuration that will produce a 48MHz USB clock - * with the required accuracy. When used with OHCI, an additional requirement is - * the PLLACK be a multiple of 48MHz. This setup results in a CPU clock of 384MHz. + * This is an alternative slower configuration that will produce a 48MHz USB + * clock with the required accuracy. + * When used with OHCI, an additional requirement is the PLLACK be a multiple + * of 48MHz. + * This setup results in a CPU clock of 384MHz. * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Divider = 1, Multiplier = 64 to generate PLLACK = 768MHz - * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Divider = 1, Multiplier = 64 to generate PLLACK = 768MHz + * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate * MCK = 128MHz * CPU clock = 384MHz */ @@ -197,23 +200,24 @@ #define HSMCI_SDXFR_CLKDIV (2 << HSMCI_MR_CLKDIV_SHIFT) #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -221,4 +225,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_384MHZ_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_384MHZ_H */ diff --git a/boards/arm/sama5/sama5d3x-ek/include/board_396mhz.h b/boards/arm/sama5/sama5d3x-ek/include/board_396mhz.h index 0bbaf3e4cc..71113c4990 100644 --- a/boards/arm/sama5/sama5d3x-ek/include/board_396mhz.h +++ b/boards/arm/sama5/sama5d3x-ek/include/board_396mhz.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/include/board_396mhz.h +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/include/board_396mhz.h * * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,31 +31,32 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_396MHZ_H -#define __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_396MHZ_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_396MHZ_H +#define __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_396MHZ_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. * - * This is the configuration provided in the Atmel example code. This results in a - * CPU clock of 396MHz: + * This is the configuration provided in the Atmel example code. + * This results in a CPU clock of 396MHz: * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Divider = 1, Multiplier = 66 to generate PLLACK = 792MHz - * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Divider = 1, Multiplier = 66 to generate PLLACK = 792MHz + * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate * MCK = 132MHz * CPU clock = 396MHz */ @@ -194,23 +195,24 @@ #define HSMCI_SDXFR_CLKDIV (2 << HSMCI_MR_CLKDIV_SHIFT) #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -218,4 +220,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_396MHZ_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_396MHZ_H */ diff --git a/boards/arm/sama5/sama5d3x-ek/include/board_528mhz.h b/boards/arm/sama5/sama5d3x-ek/include/board_528mhz.h index 4bf3e1fb5e..ac94986c16 100644 --- a/boards/arm/sama5/sama5d3x-ek/include/board_528mhz.h +++ b/boards/arm/sama5/sama5d3x-ek/include/board_528mhz.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/include/board_528mhz.h +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/include/board_528mhz.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,30 +31,31 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_528MHZ_H -#define __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_528MHZ_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_528MHZ_H +#define __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_528MHZ_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. * * This is the configuration results in a CPU clock of 528MHz: * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Divider = 1, Multiplier = 43+1 to generate PLLACK = 528MHz - * Master Clock (MCK): Source = PLLACK/1, Prescalar = 1, MDIV = 4 to generate + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Divider = 1, Multiplier = 43+1 to generate PLLACK = 528MHz + * Master Clock (MCK): Source = PLLACK/1, Prescalar = 1, MDIV = 4 to generate * MCK = 132MHz * CPU clock = 528MHz */ @@ -193,23 +194,24 @@ #define HSMCI_SDXFR_CLKDIV (2 << HSMCI_MR_CLKDIV_SHIFT) #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -217,4 +219,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_528MHZ_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_528MHZ_H */ diff --git a/boards/arm/sama5/sama5d3x-ek/include/board_memorymap.h b/boards/arm/sama5/sama5d3x-ek/include/board_memorymap.h index 9d7d6daa5a..e858a4bb7b 100644 --- a/boards/arm/sama5/sama5d3x-ek/include/board_memorymap.h +++ b/boards/arm/sama5/sama5d3x-ek/include/board_memorymap.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/include/board_memorymap.h +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/include/board_memorymap.h * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,38 +31,39 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_MEMORYMAP_H -#define __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_MEMORYMAP_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_MEMORYMAP_H +#define __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_MEMORYMAP_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -70,4 +71,4 @@ extern "C" { #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_MEMORYMAP_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_MEMORYMAP_H */ diff --git a/boards/arm/sama5/sama5d3x-ek/include/board_sdram.h b/boards/arm/sama5/sama5d3x-ek/include/board_sdram.h index d97bd85afe..8c3666e33f 100644 --- a/boards/arm/sama5/sama5d3x-ek/include/board_sdram.h +++ b/boards/arm/sama5/sama5d3x-ek/include/board_sdram.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/include/board_sdram.h +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/include/board_sdram.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,30 +31,34 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_SDRAM_H -#define __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_SDRAM_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_SDRAM_H +#define __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_SDRAM_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include "sam_pmc.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. When - * booting from SDRAM, NuttX is loaded in SDRAM by an intermediate bootloader. That - * bootloader had to have already configured the PLL and SDRAM for proper operation. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * When booting from SDRAM, NuttX is loaded in SDRAM by an intermediate + * bootloader. + * That bootloader had to have already configured the PLL and SDRAM for + * proper operation. * - * In this case, we do not reconfigure the clocking. Rather, we need to query - * the register settings to determine the clock frequencies. We can only assume that - * the Main clock source is the on-board 12MHz crystal. + * In this case, we do not reconfigure the clocking. + * Rather, we need to query the register settings to determine the clock + * frequencies. We can only assume that the Main clock source is the + * on-board 12MHz crystal. */ #define BOARD_MAINCK_FREQUENCY BOARD_MAINOSC_FREQUENCY @@ -153,23 +157,24 @@ #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -177,4 +182,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3X_EK_INCLUDE_BOARD_SDRAM_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3X_EK_INCLUDE_BOARD_SDRAM_H */ diff --git a/boards/arm/sama5/sama5d3x-ek/scripts/Make.defs b/boards/arm/sama5/sama5d3x-ek/scripts/Make.defs index 2d69c42c75..e91d83d924 100644 --- a/boards/arm/sama5/sama5d3x-ek/scripts/Make.defs +++ b/boards/arm/sama5/sama5d3x-ek/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/sama5d3x-ek/scripts/Make.defs +# boards/arm/sama5/sama5d3x-ek/scripts/Make.defs # # Copyright (C) 2013-2014, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/scripts/ddram.ld b/boards/arm/sama5/sama5d3x-ek/scripts/ddram.ld index 011eed546d..8a6ae27915 100644 --- a/boards/arm/sama5/sama5d3x-ek/scripts/ddram.ld +++ b/boards/arm/sama5/sama5d3x-ek/scripts/ddram.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/scripts/ddram.ld + * boards/arm/sama5/sama5d3x-ek/scripts/ddram.ld * * Copyright (C) 2013-2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/scripts/gnu-elf.ld b/boards/arm/sama5/sama5d3x-ek/scripts/gnu-elf.ld index 43c62b1a02..1b7f2af238 100644 --- a/boards/arm/sama5/sama5d3x-ek/scripts/gnu-elf.ld +++ b/boards/arm/sama5/sama5d3x-ek/scripts/gnu-elf.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/scripts/gnu-elf.ld + * boards/arm/sama5/sama5d3x-ek/scripts/gnu-elf.ld * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/scripts/isram.ld b/boards/arm/sama5/sama5d3x-ek/scripts/isram.ld index 22b4bb13c8..2df580e71c 100644 --- a/boards/arm/sama5/sama5d3x-ek/scripts/isram.ld +++ b/boards/arm/sama5/sama5d3x-ek/scripts/isram.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/scripts/isram.ld + * boards/arm/sama5/sama5d3x-ek/scripts/isram.ld * * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/scripts/nor-ddram.ld b/boards/arm/sama5/sama5d3x-ek/scripts/nor-ddram.ld index 7aa537b0fd..da1ac5dc9f 100644 --- a/boards/arm/sama5/sama5d3x-ek/scripts/nor-ddram.ld +++ b/boards/arm/sama5/sama5d3x-ek/scripts/nor-ddram.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/scripts/nor-ddram.ld + * boards/arm/sama5/sama5d3x-ek/scripts/nor-ddram.ld * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/scripts/nor-isram.ld b/boards/arm/sama5/sama5d3x-ek/scripts/nor-isram.ld index 5a15f0802c..2720641929 100644 --- a/boards/arm/sama5/sama5d3x-ek/scripts/nor-isram.ld +++ b/boards/arm/sama5/sama5d3x-ek/scripts/nor-isram.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/scripts/nor-isram.ld + * boards/arm/sama5/sama5d3x-ek/scripts/nor-isram.ld * * Copyright (C) 2013-2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/scripts/pg-sram.ld b/boards/arm/sama5/sama5d3x-ek/scripts/pg-sram.ld index 315e4ccea9..0223c4b988 100644 --- a/boards/arm/sama5/sama5d3x-ek/scripts/pg-sram.ld +++ b/boards/arm/sama5/sama5d3x-ek/scripts/pg-sram.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/scripts/pg-isram.ld + * boards/arm/sama5/sama5d3x-ek/scripts/pg-isram.ld * * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/src/Makefile b/boards/arm/sama5/sama5d3x-ek/src/Makefile index 54a3530cf3..9b5556b80f 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/Makefile +++ b/boards/arm/sama5/sama5d3x-ek/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/sama5d3x-ek/src/Makefile +# boards/arm/sama5/sama5d3x-ek/src/Makefile # # Copyright (C) 2013-2014, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/src/nor_main.c b/boards/arm/sama5/sama5d3x-ek/src/nor_main.c index 8881415135..647777711e 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/nor_main.c +++ b/boards/arm/sama5/sama5d3x-ek/src/nor_main.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/src/nor_main.c + * boards/arm/sama5/sama5d3x-ek/src/nor_main.c * * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -100,7 +100,8 @@ int nor_main(int argc, char *argv) static volatile uint32_t wait = NOR_BOOT_MODE; - printf("Configuring NOR FLASH on CS0 and %s\n", wait ? "waiting" : "booting"); + printf("Configuring NOR FLASH on CS0 and %s\n", + wait ? "waiting" : "booting"); /* Make sure that the SMC peripheral is enabled (But of course it is... we * are executing from NOR FLASH now). @@ -134,10 +135,10 @@ int nor_main(int argc, char *argv) HSMC_MODE_TDFCYCLES(1); putreg32(regval, SAM_HSMC_MODE(HSMC_CS0)); - /* Interrupts must be disabled through the following. In this configuration, - * there should only be timer interrupts. Your NuttX configuration must use - * CONFIG_SERIAL_LOWCONSOLE=y or printf() will hang when the interrupts - * are disabled! + /* Interrupts must be disabled through the following. + * In this configuration, there should only be timer interrupts. + * Your NuttX configuration must use CONFIG_SERIAL_LOWCONSOLE=y or printf() + * will hang when the interrupts are disabled! */ (void)up_irq_save(); diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_adc.c b/boards/arm/sama5/sama5d3x-ek/src/sam_adc.c index 723b596c43..4d16c8c578 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_adc.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_adc.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/src/sam_adc.c +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/src/sam_adc.c * * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -50,17 +50,17 @@ #ifdef CONFIG_ADC -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_adc_setup * * Description: * Initialize ADC and register the ADC driver. * - ************************************************************************************/ + ****************************************************************************/ int sam_adc_setup(void) { diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_appinit.c b/boards/arm/sama5/sama5d3x-ek/src/sam_appinit.c index 5da376d042..b794722a71 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_appinit.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d3x-ek/src/sam_appinit.c + * boards/arm/sama5/sama5d3x-ek/src/sam_appinit.c * * Copyright (C) 2013-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_at24.c b/boards/arm/sama5/sama5d3x-ek/src/sam_at24.c index cd8b8cade7..07052a69bf 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_at24.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_at24.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d3x-ek/src/sam_at24.c + * boards/arm/sama5/sama5d3x-ek/src/sam_at24.c * * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -124,7 +124,8 @@ int sam_at24_automount(int minor) #if defined(CONFIG_SAMA5D3xEK_AT24_FTL) /* And finally, use the FTL layer to wrap the MTD driver as a block driver */ - finfo("Initialize the FTL layer to create /dev/mtdblock%d\n", AT24_MINOR); + finfo("Initialize the FTL layer to create /dev/mtdblock%d\n", + AT24_MINOR); ret = ftl_initialize(AT24_MINOR, mtd); if (ret < 0) { diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_at25.c b/boards/arm/sama5/sama5d3x-ek/src/sam_at25.c index 8c86d3ccaa..564bd4fc7c 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_at25.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_at25.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d3x-ek/src/sam_at25.c + * boards/arm/sama5/sama5d3x-ek/src/sam_at25.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_autoleds.c b/boards/arm/sama5/sama5d3x-ek/src/sam_autoleds.c index 55c97dbde8..f0581d3b7f 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_autoleds.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/src/sam_autoleds.c + * boards/arm/sama5/sama5d3x-ek/src/sam_autoleds.c * * Copyright (C) 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_boot.c b/boards/arm/sama5/sama5d3x-ek/src/sam_boot.c index 2ccadbd7a8..63f6d83aee 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_boot.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/src/sam_boot.c +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/src/sam_boot.c * * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -46,27 +46,28 @@ #include "sam_sckc.h" #include "sama5d3x-ek.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_boardinitialize * * Description: - * All SAMA5 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 SAMA5 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) { @@ -89,20 +90,22 @@ void sam_boardinitialize(void) #if defined(CONFIG_SAMA5_DDRCS) && !defined(CONFIG_SAMA5_BOOT_SDRAM) - /* Configure SDRAM if (1) SDRAM has been enabled in the NuttX configuration and - * (2) if we are not currently running out of SDRAM. If we are now running out - * of SDRAM then we have to assume that some second level bootloader has properly - * configured SDRAM for our use. + /* Configure SDRAM if + * (1) SDRAM has been enabled in the NuttX configuration and + * (2) if we are not currently running out of SDRAM. + * If we are now running out of SDRAM then we have to assume that some + * second level bootloader has properly configured SDRAM for our use. */ sam_sdram_config(); #endif - /* Initialize USB if the 1) the HS host or device controller is in the - * configuration and 2) the weak function sam_usbinitialize() has been brought - * into the build. Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also - * selected. + /* Initialize USB if the + * 1) the HS host or device controller is in the configuration and + * 2) the weak function sam_usbinitialize() has been brought + * into the build. + * Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also selected. */ #if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS) @@ -112,8 +115,10 @@ void sam_boardinitialize(void) } #endif - /* Configure board resources to support networking if the 1) networking is enabled, - * 2) the EMAC or GMAC module is enabled, and 2) the weak function + /* Configure board resources to support networking if the + * 1) networking is enabled, + * 2) the EMAC or GMAC module is enabled, and + * 2) the weak function * sam_netinitialize() has been brought into the build. */ diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_buttons.c b/boards/arm/sama5/sama5d3x-ek/src/sam_buttons.c index 4b8879ecff..217f74726a 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_buttons.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/src/sam_buttons.c + * boards/arm/sama5/sama5d3x-ek/src/sam_buttons.c * * Copyright (C) 2013, 2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_can.c b/boards/arm/sama5/sama5d3x-ek/src/sam_can.c index f3be675907..92481e44c3 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_can.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_can.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/src/sam_can.c +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/src/sam_can.c * * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -53,10 +53,11 @@ #ifdef CONFIG_CAN -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ + ****************************************************************************/ + +/* Configuration ************************************************************/ #if defined(CONFIG_SAMA5_CAN0) && defined(CONFIG_SAMA5_CAN1) # warning "Both CAN0 and CAN1 are enabled. Assuming only CAN0." @@ -69,17 +70,17 @@ # define CAN_PORT 1 #endif -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_can_setup * * Description: * Initialize CAN and register the CAN device * - ************************************************************************************/ + ****************************************************************************/ int sam_can_setup(void) { diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_ethernet.c b/boards/arm/sama5/sama5d3x-ek/src/sam_ethernet.c index a67494fe7e..c32a54f90d 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_ethernet.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_ethernet.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/src/sam_ethernet.c +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/src/sam_ethernet.c * * Copyright (C) 2013-2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -62,9 +62,9 @@ #ifdef HAVE_NETWORK -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #ifndef CONFIG_SAMA5_EMACA # undef CONFIG_SAMA5_EMAC_ISETH0 @@ -79,6 +79,7 @@ #endif /* Debug ********************************************************************/ + /* Extra, in-depth debug output that is only available if * CONFIG_NETDEV_PHY_DEBUG us defined. */ @@ -93,13 +94,13 @@ # define phyinfo(x...) #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_emac_phy_enable and sam_gmac_enable - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAMA5_PIOE_IRQ #ifdef CONFIG_SAMA5_EMACA @@ -134,28 +135,29 @@ static void sam_gmac_phy_enable(bool enable) #endif #endif -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_netinitialize * * Description: * Configure board resources to support networking. * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_netinitialize(void) { #ifdef CONFIG_SAMA5_EMACA /* Ethernet 10/100 (EMAC A) Port * - * The main board contains a MICREL PHY device (KSZ8051) operating at 10/100 Mbps. - * The board supports MII and RMII interface modes. + * The main board contains a MICREL PHY device (KSZ8051) operating at + * 10/100 Mbps. The board supports MII and RMII interface modes. * - * The two independent PHY devices embedded on CM and MB boards are connected to - * independent RJ-45 connectors with built-in magnetic and status LEDs. + * The two independent PHY devices embedded on CM and MB boards are + * connected to independent RJ-45 connectors with built-in magnetic + * and status LEDs. * * At the De-Assertion of Reset: * PHY ADD[2:0]:001 @@ -175,12 +177,13 @@ void weak_function sam_netinitialize(void) #ifdef CONFIG_SAMA5_GMAC /* Tri-Speed Ethernet PHY * - * The SAMA5D3 series-CM board is equipped with a MICREL PHY devices (MICREL - * KSZ9021/31) operating at 10/100/1000 Mbps. The board supports RGMII interface - * mode. The Ethernet interface consists of 4 pairs of low voltage differential + * The SAMA5D3 series-CM board is equipped with a MICREL PHY devices + * (MICREL KSZ9021/31) operating at 10/100/1000 Mbps. + * The board supports RGMII interface mode. + * The Ethernet interface consists of 4 pairs of low voltage differential * pair signals designated from GRXą and GTxą plus control signals for link - * activity indicators. These signals can be used to connect to a 10/100/1000 - * BaseT RJ45 connector integrated on the main board. + * activity indicators. These signals can be used to connect to a + * 10/100/1000 BaseT RJ45 connector integrated on the main board. * * The KSZ9021/31 interrupt is available on PB35 INT_GETH0 */ diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_hsmci.c b/boards/arm/sama5/sama5d3x-ek/src/sam_hsmci.c index aedd81d085..a1f53003bd 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_hsmci.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_hsmci.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d3x-ek/src/sam_hsmci.c + * boards/arm/sama5/sama5d3x-ek/src/sam_hsmci.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,14 +32,17 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ -/* The SAMA5D3x-EK provides a two SD memory card slots: (1) a full size SD card - * slot (J7 labeled MCI0), and (2) a microSD memory card slot (J6 labeled MCI1). + +/* The SAMA5D3x-EK provides a two SD memory card slots: + * (1) a full size SD card slot (J7 labeled MCI0), and + * (2) a microSD memory card slot (J6 labeled MCI1). * - * The full size SD card slot connects via HSMCI0. The card detect discrete - * is available on PB17 (pulled high). The write protect descrete is tied to - * ground (via PP6) and not available to software. The slot supports 8-bit - * wide transfer mode, but the NuttX driver currently uses only the 4-bit - * wide transfer mode + * The full size SD card slot connects via HSMCI0. + * The card detect discrete is available on PB17 (pulled high). + * The write protect descrete is tied to ground (via PP6) and not available + * to software. + * The slot supports 8-bit wide transfer mode, but the NuttX driver + * currently uses only the 4-bit wide transfer mode * * PD17 MCI0_CD * PD1 MCI0_DA0 @@ -53,8 +56,8 @@ * PD9 MCI0_CK * PD0 MCI0_CDA * - * The microSD connects vi HSMCI1. The card detect discrete is available on - * PB18 (pulled high): + * The microSD connects vi HSMCI1. + * The card detect discrete is available on PB18 (pulled high): * * PD18 MCI1_CD * PB20 MCI1_DA0 @@ -89,6 +92,7 @@ /**************************************************************************** * Private Types ****************************************************************************/ + /* This structure holds static information unique to one HSMCI peripheral */ struct sam_hsmci_state_s @@ -181,7 +185,7 @@ static int sam_hsmci_cardetect(struct sam_hsmci_state_s *state) sdio_mediachange(state->hsmci, cd); } - return OK; + return OK; } #ifdef CONFIG_SAMA5_HSMCI0 @@ -262,6 +266,7 @@ int sam_hsmci_initialize(int slotno, int minor) sam_configpio(state->pincfg); /* Mount the SDIO-based MMC/SD block driver */ + /* First, get an instance of the SDIO interface */ state->hsmci = sdio_initialize(slotno); diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_i2schar.c b/boards/arm/sama5/sama5d3x-ek/src/sam_i2schar.c index d1f7a1be79..8577624c6e 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_i2schar.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_i2schar.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/src/sam_i2schar.c +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/src/sam_i2schar.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -51,9 +51,9 @@ #if defined(CONFIG_AUDIO_I2SCHAR) && \ (defined(CONFIG_SAMA5_SSC0) || defined(CONFIG_SAMA5_SSC1)) -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #ifndef CONFIG_SAMA5D3xEK_SSC_PORT # if defined(CONFIG_SAMA5_SSC0) @@ -67,22 +67,22 @@ # define CONFIG_SAMA5D3xEK_I2SCHAR_MINOR 0 #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: i2schar_devinit * * Description: - * All architectures must provide the following interface in order to work with - * apps/examples/i2schar. + * All architectures must provide the following interface in order to work + * with apps/examples/i2schar. * - ************************************************************************************/ + ****************************************************************************/ int i2schar_devinit(void) { @@ -94,7 +94,9 @@ int i2schar_devinit(void) if (!initialized) { - /* Call sam_ssc_initialize() to get an instance of the SSC/I2S interface */ + /* Call sam_ssc_initialize() to get an instance of the + * SSC/I2S interface + */ i2s = sam_ssc_initialize(CONFIG_SAMA5D3xEK_SSC_PORT); if (!i2s) diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_nandflash.c b/boards/arm/sama5/sama5d3x-ek/src/sam_nandflash.c index 8f8b4a14b2..4a7d4e1b66 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_nandflash.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_nandflash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/src/sam_nandflash.c + * boards/arm/sama5/sama5d3x-ek/src/sam_nandflash.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -104,9 +104,10 @@ int board_nandflash_config(int cs) uint32_t regval; /* The Embest and Ronetix CM boards and one Hynix NAND HY27UF(08/16)2G2B - * Series NAND (MT29F2G08ABAEAWP). This part has a capacity of 256Mx8bit - * () with spare 8Mx8 bit capacity. The device contains 2048 blocks, composed - * by 64 x 2112 byte pages. The effective size is approximately 256MiB. + * Series NAND (MT29F2G08ABAEAWP). + * This part has a capacity of 256Mx8bit () with spare 8Mx8 bit capacity. + * The device contains 2048 blocks, composed by 64 x 2112 byte pages. + * The effective size is approximately 256MiB. * * NAND is available on CS3. */ diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_norflash.c b/boards/arm/sama5/sama5d3x-ek/src/sam_norflash.c index 4ee58493f0..eca22f692e 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_norflash.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_norflash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/src/sam_norflash.c + * boards/arm/sama5/sama5d3x-ek/src/sam_norflash.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_ostest.c b/boards/arm/sama5/sama5d3x-ek/src/sam_ostest.c index d6ca3e0b55..d7b39cd103 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_ostest.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_ostest.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/src/sam_ostest.c +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/src/sam_ostest.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -51,10 +51,11 @@ #include "up_internal.h" #include "sama5d3x-ek.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ + ****************************************************************************/ + +/* Configuration ************************************************************/ #undef HAVE_FPU #if defined(CONFIG_ARCH_FPU) && !defined(CONFIG_TESTING_OSTEST_FPUTESTDISABLE) && \ @@ -68,21 +69,21 @@ # error "CONFIG_TESTING_OSTEST_FPUSIZE has the wrong size" #endif -/************************************************************************************ +/**************************************************************************** * Private Data - ************************************************************************************/ + ****************************************************************************/ static uint32_t g_saveregs[XCPTCONTEXT_REGS]; -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ -/* Given an array of size CONFIG_TESTING_OSTEST_FPUSIZE, this function will return - * the current FPU registers. + ****************************************************************************/ +/* Given an array of size CONFIG_TESTING_OSTEST_FPUSIZE, this function will + * return the current FPU registers. */ void arch_getfpu(FAR uint32_t *fpusave) diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_ov2640.c b/boards/arm/sama5/sama5d3x-ek/src/sam_ov2640.c index f45986393c..71203e4ef2 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_ov2640.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_ov2640.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/src/sam_ov2640.c + * boards/arm/sama5/sama5d3x-ek/src/sam_ov2640.c * * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -62,6 +62,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Typical OV2640 XVCLK is 24MHz */ #define OV2640_FREQUENCY 24000000 @@ -111,7 +112,7 @@ static inline FAR struct fb_vtable_s *ov2640_lcd_initialize(void) * * SAMA5D3x PIN SAMA5D3x-EK OV2640 * PIO PER SIGNAL ISI Socket J11 - * ---- --- ------------- --- ------------ ---------------------------------------- + * ---- --- ------------- --- ------------ -------------------------------- * --- 1 VDDISI --- * --- 2 GND --- * --- 3 VDDISI --- @@ -156,7 +157,7 @@ static inline int ov2640_camera_initialize(void) uint32_t actual; int ret; - /* Get the I2C driver that interfaces with the camers (OV2640_BUS)*/ + /* Get the I2C driver that interfaces with the camers (OV2640_BUS) */ i2c = sam_i2cbus_initialize(OV2640_BUS); if (!i2c) @@ -203,6 +204,7 @@ static inline int ov2640_camera_initialize(void) sam_pck_enable(PCK1, true); /* Configure the ISI peripheral */ + #warning Missing Logic /* Initialize the OV2640 camera */ @@ -217,17 +219,17 @@ static inline int ov2640_camera_initialize(void) return EXIT_FAILURE; } -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: ov2640_main * * Description: * Entry point for the OV2640 Camera Demo * - ************************************************************************************/ + ****************************************************************************/ int ov2640_main(int argc, char *argv[]) { diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_pwm.c b/boards/arm/sama5/sama5d3x-ek/src/sam_pwm.c index 02cd3553a4..729ade5238 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_pwm.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_pwm.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/src/sam_pwm.c +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/src/sam_pwm.c * * Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -51,12 +51,16 @@ #include "sam_pwm.h" #include "sama5d3x-ek.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ -/* PWM. There are no dedicated PWM output pins available to the user for PWM - * testing. Care must be taken because all PWM output pins conflict with some other + ****************************************************************************/ + +/* Configuration ************************************************************/ + +/* PWM. + * There are no dedicated PWM output pins available to the user for PWM + * testing. + * Care must be taken because all PWM output pins conflict with some other * usage of the pin by other devices: * * -----+---+---+----+-------------------- @@ -107,17 +111,17 @@ #if defined(CONFIG_PWM) && defined(CONFIG_SAMA5_PWM) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_pwm_setup * * Description: * Initialize PWM and register the PWM device. * - ************************************************************************************/ + ****************************************************************************/ int sam_pwm_setup(void) { diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_sdram.c b/boards/arm/sama5/sama5d3x-ek/src/sam_sdram.c index 6096aedc49..6dfd036321 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_sdram.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_sdram.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/src/sam_sdram.c + * boards/arm/sama5/sama5d3x-ek/src/sam_sdram.c * * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -69,6 +69,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* SDRAM differences */ #if defined(CONFIG_SAMA5D3xEK_MT47H128M16RT) @@ -146,20 +147,21 @@ static inline void sam_sdram_delay(unsigned int loops) } } -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_sdram_config * * Description: * Configures DDR2 (MT47H128M16RT 128MB or, optionally, MT47H64M16HR) * - * Per the SAMA5D3x-EK User guide: "Two SDRAM/DDR2 used as main system memory. - * MT47H128M16 - 2 Gb - 16 Meg x 16 x 8 banks, the board provides up to 2 Gb on- - * board, soldered DDR2 SDRAM. The memory bus is 32 bits wide and operates with - * up to 166 MHz." + * Per the SAMA5D3x-EK User guide: + * "Two SDRAM/DDR2 used as main system memory. + * MT47H128M16 - 2 Gb - 16 Meg x 16 x 8 banks, the board provides up to + * 2 Gb on-board, soldered DDR2 SDRAM. + * The memory bus is 32 bits wide and operates with up to 166 MHz." * * From the Atmel Code Example: * MT47H64M16HR : 8 Meg x 16 x 8 banks @@ -174,11 +176,11 @@ static inline void sam_sdram_delay(unsigned int loops) * devtype - Either DDRAM_MT47H128M16RT or DDRAM_MT47H64M16HR * * Assumptions: - * The DDR memory regions is configured as strongly ordered memory. When - * we complete initialization of SDRAM and it is ready for use, we will - * make DRAM into normal memory. + * The DDR memory regions is configured as strongly ordered memory. + * When we complete initialization of SDRAM and it is ready for use, + * we will make DRAM into normal memory. * - ************************************************************************************/ + ****************************************************************************/ void sam_sdram_config(void) { @@ -321,33 +323,42 @@ void sam_sdram_config(void) MPDDRC_TPR0_TRRD(1) | /* Active BankA to Active BankB: 2 * 7.5 = 15 ns */ MPDDRC_TPR0_TWTR(2) | /* Internal Write to Read Delay: 2 clock cycle */ MPDDRC_TPR0_TMRD(2); /* Load Mode Register Command to - * Activate or Refresh Command: 2 clock cycles */ + * Activate or Refresh Command: 2 clock cycles + */ putreg32(regval, SAM_MPDDRC_TPR0); /* Configure the Timing Parameter 1 Register */ regval = MPDDRC_TPR1_TRFC(14) | /* Row Cycle Delay: - * 18 * 7.5 = 135 ns (min 127.5 ns for 1Gb DDR) */ + * 18 * 7.5 = 135 ns (min 127.5 ns for 1Gb DDR) + */ MPDDRC_TPR1_TXSNR(16) | /* Exit Self Refresh Delay to Non Read Command: * 20 * 7.5 > 142.5ns TXSNR: Exit self refresh - * delay to non read command */ + * delay to non read command + */ MPDDRC_TPR1_TXSRD(208) | /* Exit Self Refresh Delay to Read Command: * min 200 clock cycles, TXSRD: Exit self refresh - * delay to Read command */ + * delay to Read command + */ MPDDRC_TPR1_TXP(2); /* Exit Power-down Delay to First Command: - * 2 * 7.5 = 15 ns */ + * 2 * 7.5 = 15 ns + */ putreg32(regval, SAM_MPDDRC_TPR1); /* Configure the Timing Parameter 2 Register */ regval = MPDDRC_TPR2_TXARD(7) | /* Exit Active Power Down Delay to Read Command in Mode 'Fast Exit': - * min 2 clock cycles */ + * min 2 clock cycles + */ MPDDRC_TPR2_TXARDS(7) | /* Exit Active Power Down Delay to Read Command in Mode 'Slow Exit': - * min 7 clock cycles */ + * min 7 clock cycles + */ MPDDRC_TPR2_TRPA(2) | /* Row Precharge All Delay: - * min 18ns */ + * min 18ns + */ MPDDRC_TPR2_TRTP(2) | /* Four Active Windows: - * 2 * 7.5 = 15 ns (min 7.5ns) */ + * 2 * 7.5 = 15 ns (min 7.5ns) + */ MPDDRC_TPR2_TFAW(10); putreg32(regval, SAM_MPDDRC_TPR2); @@ -385,20 +396,27 @@ void sam_sdram_config(void) putreg32(MPDDRC_MR_MODE_NOP, SAM_MPDDRC_MR); - /* Perform a write access to any DDR2-SDRAM address to acknowledge this command.*/ + /* Perform a write access to any DDR2-SDRAM address to + * acknowledge this command. + */ *ddr = 0; - /* Now CKE is driven high.*/ + /* Now CKE is driven high. */ + /* Wait 400 ns min */ sam_sdram_delay(NSEC_TO_COUNT(400)); - /* Step 5: An all banks precharge command is issued to the DDR2-SDRAM. */ + /* Step 5: An all banks precharge command is issued to + * the DDR2-SDRAM. + */ putreg32(MPDDRC_MR_MODE_PRCGALL, SAM_MPDDRC_MR); - /* Perform a write access to any DDR2-SDRAM address to acknowledge this command.*/ + /* Perform a write access to any DDR2-SDRAM address to + * acknowledge this command. + */ *ddr = 0; @@ -434,9 +452,11 @@ void sam_sdram_config(void) sam_sdram_delay(100 /* CYCLES_TO_COUNT(2) */); - /* Step 8: An Extended Mode Register set (EMRS1) cycle is issued to enable DLL. + /* Step 8: + * An Extended Mode Register set (EMRS1) cycle is issued to enable DLL. * - * The write address must be chosen so that BA[1] is set to 0 and BA[0] is set to 1. + * The write address must be chosen so that BA[1] is set to 0 and BA[0] + * is set to 1. */ putreg32(MPDDRC_MR_MODE_EXTLMR, SAM_MPDDRC_MR); @@ -446,7 +466,7 @@ void sam_sdram_config(void) sam_sdram_delay(10000 /* CYCLES_TO_COUNT(200) */); - /* Step 9: Program DLL field into the Configuration Register.*/ + /* Step 9: Program DLL field into the Configuration Register. */ regval = getreg32(SAM_MPDDRC_CR); regval |= MPDDRC_CR_DLL; @@ -493,7 +513,8 @@ void sam_sdram_config(void) /* Configure 2nd CBR. * - * Perform a write access to any DDR2-SDRAM address to acknowledge this command. + * Perform a write access to any DDR2-SDRAM address to + * acknowledge this command. */ putreg32(MPDDRC_MR_MODE_RFSH, SAM_MPDDRC_MR); @@ -593,14 +614,15 @@ void sam_sdram_config(void) */ /* ((64 x 10(^-3))/8192) x133 x (10^6) */ + /* Set Refresh timer 7.8125 us */ - putreg32( MPDDRC_RTR_COUNT(300), SAM_MPDDRC_RTR); + putreg32(MPDDRC_RTR_COUNT(300), SAM_MPDDRC_RTR); /* OK now we are ready to work on the DDRSDR */ + /* Wait for end of calibration */ sam_sdram_delay(500); } - #endif /* CONFIG_SAMA5_DDRCS && !CONFIG_SAMA5_BOOT_SDRAM */ diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_spi.c b/boards/arm/sama5/sama5d3x-ek/src/sam_spi.c index b0d0d2fa76..ea8f0f35aa 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_spi.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/src/sam_spi.c +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/src/sam_spi.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -55,17 +55,17 @@ #if defined(CONFIG_SAMA5_SPI0) || defined(CONFIG_SAMA5_SPI1) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_spidev_initialize * * Description: * Called to configure SPI chip select PIO pins for the SAMA5D3x-EK board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_spidev_initialize(void) { @@ -73,7 +73,7 @@ void weak_function sam_spidev_initialize(void) #ifdef CONFIG_MTD_AT25 /* The AT25 serial FLASH connects using NPCS0 */ - sam_configpio(PIO_AT25_NPCS0); + sam_configpio(PIO_AT25_NPCS0); #endif #endif @@ -88,27 +88,30 @@ void weak_function sam_spidev_initialize(void) * These external functions must be provided by board-specific logic. They * include: * - * o sam_spi[0|1]select is a functions tomanage the board-specific chip selects - * o sam_spi[0|1]status and sam_spi[0|1]cmddata: Implementations of the status - * and cmddata methods of the SPI interface defined by struct spi_ops_ - * (see include/nuttx/spi/spi.h). All other methods including - * sam_spibus_initialize()) are provided by common SAM3/4 logic. + * o sam_spi[0|1]select is a functions tomanage the board-specific chip + * selects + * o sam_spi[0|1]status and sam_spi[0|1]cmddata: + * Implementations of the status and cmddata methods of the SPI interface + * defined by struct spi_ops_ (see include/nuttx/spi/spi.h). + * All other methods including sam_spibus_initialize()) are provided + * by common SAM3/4 logic. * * To use this common SPI logic on your board: * * 1. Provide logic in sam_boardinitialize() to configure SPI chip select * pins. - * 2. Provide sam_spi[0|1]select() and sam_spi[0|1]status() functions in your board- - * specific logic. These functions will perform chip selection and - * status operations using PIOs in the way your board is configured. + * 2. Provide sam_spi[0|1]select() and sam_spi[0|1]status() functions in + * your board-specific logic. + * These functions will perform chip selection and status operations + * using PIOs in the way your board is configured. * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide * sam_spi[0|1]cmddata() functions in your board-specific logic. This * function will perform cmd/data selection operations using PIOs in * 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). * diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c b/boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c index 985517817a..d2b4f6d0cc 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/src/sam_touchscreen.c +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/src/sam_touchscreen.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Included Files @@ -54,6 +54,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifndef CONFIG_INPUT diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_usb.c b/boards/arm/sama5/sama5d3x-ek/src/sam_usb.c index d53463e918..33d71c4ada 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_usb.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_usb.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/src/sam_usb.c +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/src/sam_usb.c * * Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -61,9 +61,9 @@ #if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS) -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #ifndef CONFIG_SAMA5D3xEK_USBHOST_PRIO # define CONFIG_SAMA5D3xEK_USBHOST_PRIO 50 @@ -77,9 +77,10 @@ # undef CONFIG_SAMA5_UHPHS_RHPORT1 #endif -/************************************************************************************ +/**************************************************************************** * Private Data - ************************************************************************************/ + ****************************************************************************/ + /* Retained device driver handles */ #ifdef CONFIG_SAMA5_OHCI @@ -95,21 +96,22 @@ static struct usbhost_connection_s *g_ehciconn; static xcpt_t g_ochandler; #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: usbhost_waiter * * Description: * Wait for USB devices to be connected to either the OHCI or EHCI hub. * - ************************************************************************************/ + ****************************************************************************/ #if HAVE_USBHOST #ifdef CONFIG_DEBUG_USB -static int usbhost_waiter(struct usbhost_connection_s *dev, const char *hcistr) +static int usbhost_waiter(struct usbhost_connection_s *dev, + const char *hcistr) #else static int usbhost_waiter(struct usbhost_connection_s *dev) #endif @@ -117,7 +119,7 @@ static int usbhost_waiter(struct usbhost_connection_s *dev) struct usbhost_hubport_s *hport; uinfo("Running\n"); - for (;;) + for (; ; ) { /* Wait for the device to change state */ @@ -140,13 +142,13 @@ static int usbhost_waiter(struct usbhost_connection_s *dev) } #endif -/************************************************************************************ +/**************************************************************************** * Name: ohci_waiter * * Description: * Wait for USB devices to be connected to the OHCI hub. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAMA5_OHCI static int ohci_waiter(int argc, char *argv[]) @@ -159,13 +161,13 @@ static int ohci_waiter(int argc, char *argv[]) } #endif -/************************************************************************************ +/**************************************************************************** * Name: ehci_waiter * * Description: * Wait for USB devices to be connected to the EHCI hub. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAMA5_EHCI static int ehci_waiter(int argc, char *argv[]) @@ -178,62 +180,62 @@ static int ehci_waiter(int argc, char *argv[]) } #endif -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_usbinitialize * * Description: - * Called from sam_usbinitialize very early in inialization to setup USB-related - * GPIO pins for the SAMA5D3x-EK board. + * Called from sam_usbinitialize very early in inialization to setup + * USB-related GPIO pins for the SAMA5D3x-EK board. * * USB Ports * The SAMA5D3 series-MB features three USB communication ports: * - * 1. Port A Host High Speed (EHCI) and Full Speed (OHCI) multiplexed with - * USB Device High Speed Micro AB connector, J20 + * 1. Port A Host High Speed (EHCI) and Full Speed (OHCI) multiplexed + * with USB Device High Speed Micro AB connector, J20 * - * 2. Port B Host High Speed (EHCI) and Full Speed (OHCI) standard type A - * connector, J19 upper port + * 2. Port B Host High Speed (EHCI) and Full Speed (OHCI) standard + * type A connector, J19 upper port * - * 3. Port C Host Full Speed (OHCI) only standard type A connector, J19 - * lower port + * 3. Port C Host Full Speed (OHCI) only standard type A connector, + * J19 lower port * * All three USB host ports are equipped with 500 mA high-side power switch - * for self-powered and buspowered applications. The USB device port feature - * VBUS inserts detection function. + * for self-powered and buspowered applications. + * The USB device port feature VBUS inserts detection function. * * Port A * * PIO Signal Name Function - * ---- ----------- ------------------------------------------------------- + * ---- ----------- ----------------------------------------------------- * PD29 VBUS_SENSE VBus detection - * PD25 EN5V_USBA VBus power enable (via MN15 AIC1526 Dual USB High-Side - * Power Switch. The other channel of the switch is for - * the LCD) + * PD25 EN5V_USBA VBus power enable (via MN15 AIC1526 Dual USB + * High-Side Power Switch. + * The other channel of the switch is for the LCD) * * Port B * * PIO Signal Name Function - * ---- ----------- ------------------------------------------------------- - * PD26 EN5V_USBB VBus power enable (via MN14 AIC1526 Dual USB High-Side - * Power Switch). To the A1 pin of J19 Dual USB A - * connector + * ---- ----------- ----------------------------------------------------- + * PD26 EN5V_USBB VBus power enable (via MN14 AIC1526 Dual USB + * High-Side Power Switch). + * To the A1 pin of J19 Dual USB A connector * * Port C * * PIO Signal Name Function - * ---- ----------- ------------------------------------------------------- - * PD27 EN5V_USBC VBus power enable (via MN14 AIC1526 Dual USB High-Side - * Power Switch). To the B1 pin of J19 Dual USB A - * connector + * ---- ----------- ----------------------------------------------------- + * PD27 EN5V_USBC VBus power enable (via MN14 AIC1526 Dual USB + * High-Side Power Switch). + * To the B1 pin of J19 Dual USB A connector * * Both Ports B and C * * PIO Signal Name Function - * ---- ----------- ------------------------------------------------------- + * ---- ----------- ----------------------------------------------------- * PD28 OVCUR_USB Combined overrcurrent indication from port A and B * * That offers a lot of flexibility. However, here we enable the ports only @@ -243,7 +245,7 @@ static int ehci_waiter(int argc, char *argv[]) * Port B -- EHCI host * Port C -- OHCI host * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_usbinitialize(void) { @@ -253,6 +255,7 @@ void weak_function sam_usbinitialize(void) sam_configpio(PIO_USBA_VBUS_SENSE); /* VBUS sense */ /* TODO: Configure an interrupt on VBUS sense */ + #endif #ifdef HAVE_USBHOST @@ -282,15 +285,16 @@ void weak_function sam_usbinitialize(void) #endif /* HAVE_USBHOST */ } -/*********************************************************************************** +/**************************************************************************** * Name: sam_usbhost_initialize * * Description: - * Called at application startup time to initialize the USB host functionality. + * Called at application startup time to initialize the USB host + * functionality. * This function will start a thread that will monitor for device * connection/disconnection events. * - ***********************************************************************************/ + ****************************************************************************/ #if HAVE_USBHOST int sam_usbhost_initialize(void) @@ -356,7 +360,8 @@ int sam_usbhost_initialize(void) /* Start a thread to handle device connection. */ - pid = kthread_create("OHCI Monitor", CONFIG_SAMA5D3xEK_USBHOST_PRIO, + pid = kthread_create("OHCI Monitor", + CONFIG_SAMA5D3xEK_USBHOST_PRIO, CONFIG_SAMA5D3xEK_USBHOST_STACKSIZE, (main_t)ohci_waiter, (FAR char * const *)NULL); if (pid < 0) @@ -392,29 +397,30 @@ int sam_usbhost_initialize(void) } #endif -/*********************************************************************************** +/**************************************************************************** * Name: sam_usbhost_vbusdrive * * Description: - * Enable/disable driving of VBUS 5V output. This function must be provided by - * each platform that implements the OHCI or EHCI host interface + * Enable/disable driving of VBUS 5V output. + * This function must be provided by each platform that implements the OHCI + * or EHCI host interface * * Input Parameters: - * rhport - Selects root hub port to be powered host interface. See SAM_RHPORT_* - * definitions above. + * rhport - Selects root hub port to be powered host interface. + * See SAM_RHPORT_* definitions above. * enable - true: enable VBUS power; false: disable VBUS power * * Returned Value: * None * - ***********************************************************************************/ + ****************************************************************************/ #if HAVE_USBHOST void sam_usbhost_vbusdrive(int rhport, bool enable) { pio_pinset_t pinset = 0; - uinfo("RHPort%d: enable=%d\n", rhport+1, enable); + uinfo("RHPort%d: enable=%d\n", rhport + 1, enable); /* Pick the PIO configuration associated with the selected root hub port */ @@ -448,7 +454,7 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) #endif default: - uerr("ERROR: RHPort%d is not supported\n", rhport+1); + uerr("ERROR: RHPort%d is not supported\n", rhport + 1); return; } @@ -469,15 +475,15 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) } #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_setup_overcurrent * * Description: - * Setup to receive an interrupt-level callback if an overcurrent condition is - * detected on port B or C. + * Setup to receive an interrupt-level callback if an overcurrent condition + * is detected on port B or C. * - * REVISIT: Since this is a common signal, we will need to come up with some way - * to inform both EHCI and OHCI drivers when this error occurs. + * REVISIT: Since this is a common signal, we will need to come up with + * some way to inform both EHCI and OHCI drivers when this error occurs. * * Input Parameters: * handler - New overcurrent interrupt handler @@ -485,7 +491,7 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) * Returned Value: * Old overcurrent interrupt handler * - ************************************************************************************/ + ****************************************************************************/ #if HAVE_USBHOST xcpt_t sam_setup_overcurrent(xcpt_t handler) @@ -525,16 +531,17 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler) } #endif /* CONFIG_SAMA5_PIOD_IRQ ... */ -/************************************************************************************ +/**************************************************************************** * Name: sam_usbsuspend * * Description: * Board logic must provide the sam_usbsuspend logic if the USBDEV driver is - * used. This function is called whenever the USB enters or leaves suspend mode. - * This is an opportunity for the board logic to shutdown clocks, power, etc. - * while the USB is suspended. + * used. + * This function is called whenever the USB enters or leaves suspend mode. + * This is an opportunity for the board logic to shutdown clocks, power, + * etc. while the USB is suspended. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_USBDEV void sam_usbsuspend(FAR struct usbdev_s *dev, bool resume) diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_usbmsc.c b/boards/arm/sama5/sama5d3x-ek/src/sam_usbmsc.c index 942b468aa4..d418c91e3f 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_usbmsc.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_usbmsc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/src/sam_usbmsc.c + * boards/arm/sama5/sama5d3x-ek/src/sam_usbmsc.c * * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_userleds.c b/boards/arm/sama5/sama5d3x-ek/src/sam_userleds.c index 6827aec7aa..533233643d 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_userleds.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_userleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d3x-ek/src/sam_userleds.c + * boards/arm/sama5/sama5d3x-ek/src/sam_userleds.c * * Copyright (C) 2013-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_wm8904.c b/boards/arm/sama5/sama5d3x-ek/src/sam_wm8904.c index 9850070d50..09ab0eb403 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_wm8904.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_wm8904.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/src/sam_wm8904.c +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/src/sam_wm8904.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Included Files @@ -153,8 +153,9 @@ static int wm8904_attach(FAR const struct wm8904_lower_s *lower, { if (isr) { - /* Just save the address of the handler and its argument for now. The - * new handler will called via wm8904_interrupt() when the interrupt occurs. + /* Just save the address of the handler and its argument for now. + * The new handler will called via wm8904_interrupt() when the + * interrupt occurs. */ audinfo("Attaching %p\n", isr); @@ -288,13 +289,14 @@ int sam_wm8904_initialize(int minor) goto errout_with_i2c; } - /* Configure the DAC master clock. This clock is provided by PCK0 (PD30) + /* Configure the DAC master clock. + * This clock is provided by PCK0 (PD30) * that is connected to the WM8904 MCLK. */ #ifdef CONFIG_SAMA5D3xEK_WM8904_SRCSCK - /* Drive the DAC with the slow clock (32.768 KHz). The slow clock was - * enabled in sam_boot.c if needed. + /* Drive the DAC with the slow clock (32.768 KHz). + * The slow clock was enabled in sam_boot.c if needed. */ (void)sam_pck_configure(PCK0, PCKSRC_SCK, BOARD_SLOWCLK_FREQUENCY); @@ -355,7 +357,8 @@ int sam_wm8904_initialize(int minor) ret = audio_register(devname, pcm); if (ret < 0) { - auderr("ERROR: Failed to register /dev/%s device: %d\n", devname, ret); + auderr("ERROR: Failed to register /dev/%s device: %d\n", + devname, ret); goto errout_with_pcm; } diff --git a/boards/arm/sama5/sama5d3x-ek/src/sama5d3x-ek.h b/boards/arm/sama5/sama5d3x-ek/src/sama5d3x-ek.h index 43a155a017..fd759eddf4 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sama5d3x-ek.h +++ b/boards/arm/sama5/sama5d3x-ek/src/sama5d3x-ek.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d3x-ek/src/sama5d3x-ek.h +/**************************************************************************** + * boards/arm/sama5/sama5d3x-ek/src/sama5d3x-ek.h * * Copyright (C) 2013-2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_SAMA5D3X_EK_SRC_SAMA5D3X_EK_H -#define __BOARDS_ARM_SAMA5D3X_EK_SRC_SAMA5D3X_EK_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D3X_EK_SRC_SAMA5D3X_EK_H +#define __BOARDS_ARM_SAMA5_SAMA5D3X_EK_SRC_SAMA5D3X_EK_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -50,9 +50,10 @@ #include "hardware/sam_pinmap.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + /* Configuration ************************************************************/ #define HAVE_HSMCI 1 @@ -67,6 +68,7 @@ #define HAVE_WM8904 1 /* HSMCI */ + /* Can't support MMC/SD if the card interface(s) are not enable */ #if !defined(CONFIG_SAMA5_HSMCI0) && !defined(CONFIG_SAMA5_HSMCI1) @@ -88,6 +90,7 @@ #endif /* NAND FLASH */ + /* Can't support the NAND device if NAND flash is not configured on EBI CS3 */ #ifndef CONFIG_SAMA5_EBICS3_NAND @@ -133,6 +136,7 @@ #endif /* AT25 Serial FLASH */ + /* Can't support the AT25 device if it SPI0 or AT25 support are not enabled */ #if !defined(CONFIG_SAMA5_SPI0) || !defined(CONFIG_MTD_AT25) @@ -263,8 +267,9 @@ #endif /* USB Host / USB Device */ -/* Either CONFIG_SAMA5_UHPHS or CONFIG_SAMA5_UDPHS must be defined, or there is - * no USB of any kind. + +/* Either CONFIG_SAMA5_UHPHS or CONFIG_SAMA5_UDPHS must be defined, + * or there is no USB of any kind. */ #if !defined(CONFIG_SAMA5_UHPHS) @@ -320,6 +325,7 @@ #endif /* Audio */ + /* PCM/WM8904 driver */ #ifndef CONFIG_AUDIO_WM8904 @@ -387,7 +393,8 @@ # endif #endif -/* LEDs *****************************************************************************/ +/* LEDs *********************************************************************/ + /* There are two LEDs on the SAMA5D3 series-CM board that can be controlled * by software. A blue LED is controlled via PIO pins. A red LED normally * provides an indication that power is supplied to the board but can also @@ -414,7 +421,8 @@ PIO_PORT_PIOE | PIO_PIN24) #endif -/* Buttons **************************************************************************/ +/* Buttons ******************************************************************/ + /* There are five push button switches on the SAMA5D3X-EK base board: * * 1. One Reset, board reset (BP1) @@ -435,9 +443,11 @@ PIO_INT_BOTHEDGES | PIO_PORT_PIOE | PIO_PIN27) #define IRQ_USER1 SAM_IRQ_PE27 -/* HSMCI Card Slots *****************************************************************/ -/* The SAMA5D3x-EK provides a two SD memory card slots: (1) a full size SD card - * slot (J7 labeled MCI0), and (2) a microSD memory card slot (J6 labeled MCI1). +/* HSMCI Card Slots *********************************************************/ + +/* The SAMA5D3x-EK provides a two SD memory card slots: + * (1) a full size SD card slot (J7 labeled MCI0), and + * (2) a microSD memory card slot (J6 labeled MCI1). * * The full size SD card slot connects via HSMCI0. The card detect discrete * is available on PB17 (pulled high). The write protect descrete is tied to @@ -478,7 +488,8 @@ PIO_INT_BOTHEDGES | PIO_PORT_PIOD | PIO_PIN18) #define IRQ_MCI1_CD SAM_IRQ_PD18 -/* USB Ports ************************************************************************/ +/* USB Ports ****************************************************************/ + /* The SAMA5D3 series-MB features three USB communication ports: * * 1. Port A Host High Speed (EHCI) and Full Speed (OHCI) multiplexed with @@ -558,11 +569,12 @@ #ifdef CONFIG_SAMA5_EMACA /* ETH1: Ethernet 10/100 (EMAC A) Port * - * The main board contains a MICREL PHY device (KSZ8051) operating at 10/100 Mbps. - * The board supports MII and RMII interface modes. + * The main board contains a MICREL PHY device (KSZ8051) operating at + * 10/100 Mbps. The board supports MII and RMII interface modes. * - * The two independent PHY devices embedded on CM and MB boards are connected to - * independent RJ-45 connectors with built-in magnetic and status LEDs. + * The two independent PHY devices embedded on CM and MB boards are + * connected to independent RJ-45 connectors with built-in magnetic + * and status LEDs. * * At the De-Assertion of Reset: * PHY ADD[2:0]:001 @@ -572,8 +584,9 @@ * Speed Mode:100Mbps * Nway Auto-Negotiation:Enable * - * The KSZ8051 PHY interrupt is available on PE30 INT_ETH1. The sense of - * the interrupt is configurable but is, by default, active low. + * The KSZ8051 PHY interrupt is available on PE30 INT_ETH1. + * The sense of the interrupt is configurable but is, by default, + * active low. */ #define PIO_INT_ETH1 (PIO_INPUT | PIO_CFG_PULLUP | PIO_CFG_DEGLITCH | \ @@ -585,15 +598,17 @@ #ifdef CONFIG_SAMA5_GMAC /* ETH0: Tri-Speed Ethernet PHY * - * The SAMA5D3 series-CM board is equipped with a MICREL PHY devices (MICREL - * KSZ9021/31) operating at 10/100/1000 Mbps. The board supports RGMII interface - * mode. The Ethernet interface consists of 4 pairs of low voltage differential - * pair signals designated from GRXą and GTxą plus control signals for link - * activity indicators. These signals can be used to connect to a 10/100/1000 - * BaseT RJ45 connector integrated on the main board. + * The SAMA5D3 series-CM board is equipped with a MICREL PHY devices + * (MICREL KSZ9021/31) operating at 10/100/1000 Mbps. + * The board supports RGMII interface mode. The Ethernet interface + * consists of 4 pairs of low voltage differential pair signals + * designated from GRXą and GTxą plus control signals for link + * activity indicators. These signals can be used to connect to a + * 10/100/1000 BaseT RJ45 connector integrated on the main board. * - * The KSZ9021/31 interrupt is available on PB35 INT_GETH0. The sense of - * the interrupt is configurable but is, by default, active low. + * The KSZ9021/31 interrupt is available on PB35 INT_GETH0. + * The sense of the interrupt is configurable but is, by default, + * active low. */ #define PIO_INT_ETH0 (PIO_INPUT | PIO_CFG_PULLUP | PIO_CFG_DEGLITCH | \ @@ -602,7 +617,8 @@ #endif -/* WM8904 Audio Codec ***************************************************************/ +/* WM8904 Audio Codec *******************************************************/ + /* SAMA5D3-EK Interface * ------------- ---------------- ----------------- * WM8904 SAMA5D3 NuttX Pin Name @@ -638,7 +654,8 @@ #define WM8904_SSC_BUS 0 -/* SPI Chip Selects *****************************************************************/ +/* SPI Chip Selects *********************************************************/ + /* Both the Ronetix and Embest versions of the SAMAD3x CPU modules include an * Atmel AT25DF321A, 32-megabit, 2.7-volt SPI serial flash. The SPI * connection is as follows: @@ -660,42 +677,43 @@ PIO_PORT_PIOD | PIO_PIN13) #define AT25_PORT SPI0_CS0 -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_spidev_initialize * * Description: * Called to configure SPI chip select PIO pins for the SAMA5D3x-EK board. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAMA5_SPI0) || defined(CONFIG_SAMA5_SPI1) void weak_function sam_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_sdram_config * * Description: * Configures DDR2 (MT47H128M16RT 128MB or, optionally, MT47H64M16HR) * - * Per the SAMA5D3x-EK User guide: "Two SDRAM/DDR2 used as main system memory. - * MT47H128M16 - 2 Gb - 16 Meg x 16 x 8 banks, the board provides up to 2 Gb on- - * board, soldered DDR2 SDRAM. The memory bus is 32 bits wide and operates with - * up to 166 MHz." + * Per the SAMA5D3x-EK User guide: + * "Two SDRAM/DDR2 used as main system memory. + * MT47H128M16 - 2 Gb - 16 Meg x 16 x 8 banks, + * the board provides up to 2 Gb on-board, soldered DDR2 SDRAM. + * The memory bus is 32 bits wide and operates with up to 166 MHz." * * From the Atmel Code Example: * MT47H64M16HR : 8 Meg x 16 x 8 banks @@ -710,11 +728,11 @@ void weak_function sam_spidev_initialize(void); * None * * Assumptions: - * The DDR memory regions is configured as strongly ordered memory. When we - * complete initialization of SDRAM and it is ready for use, we will make DRAM - * into normal memory. + * The DDR memory regions is configured as strongly ordered memory. + * When we complete initialization of SDRAM and it is ready for use, + * we will make DRAM into normal memory. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAMA5_DDRCS) && !defined(CONFIG_SAMA5_BOOT_SDRAM) void sam_sdram_config(void); @@ -770,127 +788,130 @@ int sam_at24_automount(int minor); int sam_hsmci_initialize(int slotno, int minor); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_cardinserted * * Description: * Check if a card is inserted into the selected HSMCI slot * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_HSMCI bool sam_cardinserted(int slotno); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_writeprotected * * Description: * Check if the card in the MMCSD slot is write protected * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_HSMCI bool sam_writeprotected(int slotno); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_usbinitialize * * Description: - * Called from sam_usbinitialize very early in inialization to setup USB-related - * PIO pins for the SAMA5D3x-EK board. + * Called from sam_usbinitialize very early in inialization to setup + * USB-related PIO pins for the SAMA5D3x-EK board. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS) void weak_function sam_usbinitialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: stm32_usbhost_initialize * * Description: - * Called at application startup time to initialize the USB host functionality. - * This function will start a thread that will monitor for device connection/ - * disconnection events. + * Called at application startup time to initialize the USB host + * functionality. + * This function will start a thread that will monitor for device + * connection/disconnection events. * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_USBHOST int sam_usbhost_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_netinitialize * * Description: * Configure board resources to support networking. * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_NETWORK void weak_function sam_netinitialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_tsc_setup * * Description: - * This function is called by board-bringup logic to configure the touchscreen - * device. This function will register the driver as /dev/inputN where N is the + * This function is called by board-bringup logic to configure the + * touchscreen device. + * This function will register the driver as /dev/inputN where N is the * minor device number. * * Input Parameters: * minor - The input device minor number * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to - * indicate the nature of the failure. + * Zero is returned on success. + * Otherwise, a negated errno value is returned to indicate the nature + * of the failure. * - ***********************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAMA5_TSD int sam_tsc_setup(int minor); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_pwm_setup * * Description: * Initialize PWM and register the PWM device. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_PWM int sam_pwm_setup(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_adc_setup * * Description: * Initialize ADC and register the ADC driver. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ADC int sam_adc_setup(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_can_setup * * Description: * Initialize CAN and register the CAN device * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_CAN int sam_can_setup(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_wm8904_initialize * * Description: @@ -905,12 +926,11 @@ int sam_can_setup(void); * Zero is returned on success. Otherwise, a negated errno value is * returned to indicate the nature of the failure. * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_WM8904 int sam_wm8904_initialize(int minor); #endif /* HAVE_WM8904 */ #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D3X_EK_SRC_SAMA5D3X_EK_H */ - +#endif /* __BOARDS_ARM_SAMA5_SAMA5D3X_EK_SRC_SAMA5D3X_EK_H */ diff --git a/boards/arm/sama5/sama5d4-ek/README.txt b/boards/arm/sama5/sama5d4-ek/README.txt index a895480fef..f063cea81e 100644 --- a/boards/arm/sama5/sama5d4-ek/README.txt +++ b/boards/arm/sama5/sama5d4-ek/README.txt @@ -1507,7 +1507,7 @@ Networking prototyped in the nuttx/include/nuttx/arch.h, and (2) it must select CONFIG_ARCH_PHY_INTERRUPT in the board configuration file to advertise that it supports arch_phy_irq(). This logic can be found at - nuttx/boards/sama5d4-ek/src/sam_ethernet.c. + nuttx/boards/arm/sama5/sama5d4-ek/src/sam_ethernet.c. - One other thing: UDP support is required (CONFIG_NET_UDP). @@ -2768,7 +2768,7 @@ SAMA5 PWM Support B PB13 --- GMAC -----+---+---+----+-------------------- - See boards/sama5d4-ek/include/board.h for all of the default PWM + See boards/arm/sama5/sama5d4-ek/include/board.h for all of the default PWM pin selections. I used PWM channel 0, pins PA20 and PA21 for testing. Clocking is addressed in the next paragraph. @@ -3074,7 +3074,7 @@ TM7000 LCD/Touchscreen described in the tm7000.pdf file: That document claims that the hardware interface to the LCD is 18-bit RGB666; but the one that I have is certainly 24-bit RGB888. If you have LCD issues, you may - need to tweak some of the settings in boards/sama5d4-ek/include/board.h. + need to tweak some of the settings in boards/arm/sama5/sama5d4-ek/include/board.h. Jumper JP2 selects either the EMAC1 or the LCD by controlling the the LCD_ETH1_CONFIG signal on the board. @@ -4194,7 +4194,7 @@ Configurations $ tools/configure.sh sama5d4-ek:knsh : Establish this configuration $ export PATH=???:$PATH : Set up the PATH variable - $ touch boards/sama5d4-ek/include/boot_romfsimg.h + $ touch boards/arm/sama5/sama5d4-ek/include/boot_romfsimg.h $ make : Build the kernel with a dummy ROMFS image : This should create the nuttx ELF @@ -4213,7 +4213,7 @@ Configurations D. Create the ROMFS file system image $ tools/mkromfsimg.sh : Create the real ROMFS image - $ mv boot_romfsimg.h ../nuttx/boards/sama5d4-ek/include/boot_romfsimg.h + $ mv boot_romfsimg.h ../nuttx/boards/arm/sama5/sama5d4-ek/include/boot_romfsimg.h E. Rebuild NuttX with the new file system image @@ -4235,7 +4235,7 @@ Configurations configuration). In any a event, this has stopped testing for the moment. - Also, the mount() in boards/sama5d4x-ek/src/sam_bringup.c will fail + Also, the mount() in boards/arm/sama5/sama5d4x-ek/src/sam_bringup.c will fail unless you add a delay between the HSMCI initialization and the mount. No idea why (and there they is now delay in the baseline code... one has to be added). @@ -4451,9 +4451,9 @@ Configurations CONFIG_NSH_ROMFSMOUNTPT="/etc" : Mount at /etc CONFIG_NSH_ROMFSDEVNO=0 : Device is /dev/ram0 CONFIG_NSH_ARCHROMFS=y : ROMFS image is at - boards/sama5d4-ek/include/nsh_romfsimg.h + boards/arm/sama5/sama5d4-ek/include/nsh_romfsimg.h The content of /etc/init.d/rcS can be see in the file rcS.template that - can be found at: boards/sama5d4-ek/include/rcS.template: + can be found at: boards/arm/sama5/sama5d4-ek/include/rcS.template: # Mount the procfs file system at /proc diff --git a/boards/arm/sama5/sama5d4-ek/include/board.h b/boards/arm/sama5/sama5d4-ek/include/board.h index ee1d713d7f..6f5862d38a 100644 --- a/boards/arm/sama5/sama5d4-ek/include/board.h +++ b/boards/arm/sama5/sama5d4-ek/include/board.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/include/board.h +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/include/board.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,25 +31,26 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_H -#define __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_H +#define __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. */ /* On-board crystal frequencies */ @@ -58,22 +59,26 @@ #define BOARD_SLOWCLK_FREQUENCY (32768) /* Slow Clock: 32.768KHz */ #if defined(CONFIG_SAMA5_BOOT_SDRAM) -/* When booting from SDRAM, NuttX is loaded in SDRAM by an intermediate bootloader. - * That bootloader had to have already configured the PLL and SDRAM for proper - * operation. +/* When booting from SDRAM, NuttX is loaded in SDRAM by an intermediate + * bootloader. + * That bootloader had to have already configured the PLL and SDRAM for + * proper operation. * - * In this case, we don not reconfigure the clocking. Rather, we need to query - * the register settings to determine the clock frequencies. We can only assume that - * the Main clock source is the on-board 12MHz crystal. + * In this case, we don not reconfigure the clocking. + * Rather, we need to query the register settings to determine the clock + * frequencies. We can only assume that the Main clock source is the on-board + * 12MHz crystal. */ # include #elif defined(CONFIG_SAMA5D4EK_384MHZ) -/* OHCI Only. This is an alternative slower configuration that will produce a 48MHz - * USB clock with the required accuracy using only PLLA. When PPLA is used to clock - * OHCI, an additional requirement is the PLLACK be a multiple of 48MHz. This setup - * results in a CPU clock of 384MHz. +/* OHCI Only. + * This is an alternative slower configuration that will produce a 48MHz + * USB clock with the required accuracy using only PLLA. + * When PPLA is used to clock OHCI, an additional requirement is the PLLACK + * be a multiple of 48MHz. + * This setup results in a CPU clock of 384MHz. * * This case is only interesting for experimentation. */ @@ -89,8 +94,8 @@ # include #else /* #elif defined(CONFIG_SAMA5D4EK_396MHZ) */ -/* This is the configuration provided in the Atmel example code. This setup results - * in a CPU clock of 396MHz. +/* This is the configuration provided in the Atmel example code. + * This setup results in a CPU clock of 396MHz. * * In this configuration, UPLL is the source of the UHPHS clock (if enabled). */ @@ -99,24 +104,26 @@ #endif -/* LED definitions ******************************************************************/ +/* LED definitions **********************************************************/ + /* There are 3 LEDs on the SAMA5D4-EK: * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * SAMA5D4 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * PE28/NWAIT/RTS4/A19 1Wire_PE28 1-WIRE ROM, LCD, D8 (green) * PE8/A8/TCLK3/PWML3 LED_USER_PE8 LED_USER (D10) * PE9/A9/TIOA2 LED_POWER_PE9 LED_POWER (D9, Red) - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * - * - D8: D8 is shared with other functions and cannot be used if the 1-Wire ROM - * is used. I am not sure of the LCD function, but the LED may not be available - * if the LCD is used either. We will avoid using D8 just for simplicity. + * - D8: D8 is shared with other functions and cannot be used if the 1-Wire + * ROM is used. + * I am not sure of the LCD function, but the LED may not be available if + * the LCD is used either. We will avoid using D8 just for simplicity. * - D10: Nothing special here. A low output illuminates. - * - D9: The Power ON LED. Connects to the via an IRLML2502 MOSFET. This LED will - * be on when power is applied but otherwise a low output value will turn it - * off. + * - D9: The Power ON LED. Connects to the via an IRLML2502 MOSFET. + * This LED will be on when power is applied but otherwise a low output + * value will turn it off. */ /* LED index values for use with board_userled() */ @@ -137,7 +144,9 @@ * * SYMBOL Val Meaning LED state * Blue Red - * ----------------- --- ----------------------- -------- -------- */ + * ----------------- --- ----------------------- -------- -------- + */ + #define LED_STARTED 0 /* NuttX has been started OFF OFF */ #define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF */ #define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF */ @@ -154,17 +163,19 @@ * has halted. */ -/* Button definitions ***************************************************************/ +/* Button definitions *******************************************************/ + /* A single button, PB_USER1 (PB2), is available on the SAMA5D4-EK: * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * SAMA5D4 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * PE13/A13/TIOB1/PWML2 PB_USER1_PE13 PB_USER1 - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * - * Closing JP2 will bring PE13 to ground so 1) PE13 should have a weak pull-up, - * and 2) when PB2 is pressed, a low value will be senses. + * Closing JP2 will bring PE13 to ground so + * 1) PE13 should have a weak pull-up, and + * 2) when PB2 is pressed, a low value will be senses. */ #define BUTTON_USER 0 @@ -172,16 +183,20 @@ #define BUTTON_USER_BIT (1 << BUTTON_USER) -/* LCD Interface, Geometry and Timing ***********************************************/ -/* This configuration applies only to the TM7000 LCD/Touchscreen module. Other LCDs - * will require changes. +/* LCD Interface, Geometry and Timing ***************************************/ + +/* This configuration applies only to the TM7000 LCD/Touchscreen module. + * Other LCDs will require changes. * - * NOTE: The TM7000 user manual claims that the hardware interface is 18-bit RGB666. - * If you select that, you will get a very pink display (because the upper, "red" - * bits floating high). By trial and error, the 24-bit select was found to produce - * the correct color output. + * NOTE: + * The TM7000 user manual claims that the hardware interface is 18-bit RGB666. + * If you select that, you will get a very pink display (because the upper, + * "red" bits floating high). + * By trial and error, the 24-bit select was found to produce the correct + * color output. * - * NOTE: Timings come from the smaller SAMA5D3x-EK LCD and have not been optimized + * NOTE: + * Timings come from the smaller SAMA5D3x-EK LCD and have not been optimized * for this display. */ @@ -213,26 +228,28 @@ #define BOARD_LCDC_PWMPS LCDC_LCDCFG6_PWMPS_DIV1 #define BOARD_LCDC_PWMPOL LCDC_LCDCFG6_PWMPOL -/* NAND *****************************************************************************/ +/* NAND *********************************************************************/ -/* Address for transferring command bytes to the nandflash, CLE A22*/ +/* Address for transferring command bytes to the nandflash, CLE A22 */ #define BOARD_EBICS3_NAND_CMDADDR 0x60400000 -/* Address for transferring address bytes to the nandflash, ALE A21*/ +/* Address for transferring address bytes to the nandflash, ALE A21 */ #define BOARD_EBICS3_NAND_ADDRADDR 0x60200000 -/* Address for transferring data bytes to the nandflash.*/ +/* Address for transferring data bytes to the nandflash. */ #define BOARD_EBICS3_NAND_DATAADDR 0x60000000 -/* Pin disambiguation ***************************************************************/ -/* Alternative pin selections are provided with a numeric suffix like _1, _2, etc. +/* Pin disambiguation *******************************************************/ + +/* Alternative pin selections are provided with a numeric suffix like _1, _2, + * etc. * Drivers, however, will use the pin selection without the numeric suffix. - * Additional definitions are required in this board.h file. For example, if we - * wanted the PCK0on PB26, then the following definition should appear in the - * board.h header file for that board: + * Additional definitions are required in this board.h file. For example, + * if we wanted the PCK0on PB26, then the following definition should appear + * in the board.h header file for that board: * * #define PIO_PMC_PCK0 PIO_PMC_PCK0_1 * @@ -247,16 +264,17 @@ #define PIO_PMC_PCK2 PIO_PMC_PCK2_1 -/* PCK0 and PCK1 are not currently used, but the PCK logic wants these definitions - * anyway. The assignments here are arbitrary and will not be used (at least not +/* PCK0 and PCK1 are not currently used, but the PCK logic wants these + * definitions anyway. + * The assignments here are arbitrary and will not be used (at least not * until we implement ISI of HDMI). * * PIO_PMC_PCK0_1: PB26 is used by I2S with the WM8904 (AUDIO_RK0_PB26) * PIO_PMC_PCK0_2: PD8 is the HDMI MCLK (HDMI_MCK_PD8) * PIO_PMC_PCK0_3: PA24 is used for the LCD backlight (LCD_PWM_PA24) * - * PIO_PMC_PCK1_1: PD31 goes to the expansion interface and is not used on-board - * (EXP_PD31). + * PIO_PMC_PCK1_1: PD31 goes to the expansion interface and is not used + * on-board (EXP_PD31). * PIO_PMC_PCK1_2: PC24 is used for ISI data (ISI_D5) * PIO_PMC_PCK1_3: PC4 is ISI_MCK_PC4, MCI0_CK_PC4, EXP_PC4 */ @@ -264,13 +282,13 @@ #define PIO_PMC_PCK0 PIO_PMC_PCK0_2 #define PIO_PMC_PCK1 PIO_PMC_PCK1_1 -/************************************************************************************ +/**************************************************************************** * Assembly Language Macros - ************************************************************************************/ + ****************************************************************************/ #ifdef __ASSEMBLY__ - .macro config_sdram - .endm + .macro config_sdram + .endm #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_H */ diff --git a/boards/arm/sama5/sama5d4-ek/include/board_384mhz.h b/boards/arm/sama5/sama5d4-ek/include/board_384mhz.h index 15570e19fc..eb89b83abb 100644 --- a/boards/arm/sama5/sama5d4-ek/include/board_384mhz.h +++ b/boards/arm/sama5/sama5d4-ek/include/board_384mhz.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/include/board_384mhz.h +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/include/board_384mhz.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,32 +31,35 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_384MHZ_H -#define __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_384MHZ_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_384MHZ_H +#define __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_384MHZ_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. * - * This is an alternative slower configuration that will produce a 48MHz USB clock - * with the required accuracy. When used with OHCI, an additional requirement is - * the PLLACK be a multiple of 48MHz. This setup results in a CPU clock of 384MHz. + * This is an alternative slower configuration that will produce a 48MHz USB + * clock with the required accuracy. + * When used with OHCI, an additional requirement is the PLLACK be a multiple + * of 48MHz. + * This setup results in a CPU clock of 384MHz. * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Multiplier = 64 to generate PLLACK = 768MHz - * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Multiplier = 64 to generate PLLACK = 768MHz + * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate * MCK = 128MHz * CPU clock = 384MHz */ @@ -196,23 +199,24 @@ #define HSMCI_SDXFR_CLKDIV (2 << HSMCI_MR_CLKDIV_SHIFT) #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -220,4 +224,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_384MHZ_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_384MHZ_H */ diff --git a/boards/arm/sama5/sama5d4-ek/include/board_396mhz.h b/boards/arm/sama5/sama5d4-ek/include/board_396mhz.h index c806075d8b..6c940f332f 100644 --- a/boards/arm/sama5/sama5d4-ek/include/board_396mhz.h +++ b/boards/arm/sama5/sama5d4-ek/include/board_396mhz.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/include/board_396mhz.h +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/include/board_396mhz.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,31 +31,32 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_396MHZ_H -#define __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_396MHZ_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_396MHZ_H +#define __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_396MHZ_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. * - * This is the configuration provided in the Atmel example code. This results in a - * CPU clock of 396MHz: + * This is the configuration provided in the Atmel example code. + * This results in a CPU clock of 396MHz: * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Multiplier = 66 to generate PLLACK = 792MHz - * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Multiplier = 66 to generate PLLACK = 792MHz + * Master Clock (MCK): Source = PLLACK/2, Prescalar = 1, MDIV = 3 to generate * MCK = 132MHz * CPU clock = 396MHz */ @@ -188,23 +189,24 @@ #define HSMCI_SDXFR_CLKDIV (2 << HSMCI_MR_CLKDIV_SHIFT) #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -212,4 +214,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_396MHZ_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_396MHZ_H */ diff --git a/boards/arm/sama5/sama5d4-ek/include/board_528mhz.h b/boards/arm/sama5/sama5d4-ek/include/board_528mhz.h index de55002fbe..589b618900 100644 --- a/boards/arm/sama5/sama5d4-ek/include/board_528mhz.h +++ b/boards/arm/sama5/sama5d4-ek/include/board_528mhz.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/include/board_528mhz.h +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/include/board_528mhz.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,30 +31,31 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_528MHZ_H -#define __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_528MHZ_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_528MHZ_H +#define __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_528MHZ_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. These - * definitions will configure operational clocking. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * These definitions will configure operational clocking. * * This is the configuration results in a CPU clock of 528MHz: * - * MAINOSC: Frequency = 12MHz (crystal) - * PLLA: PLL Multiplier = 43+1 to generate PLLACK = 528MHz - * Master Clock (MCK): Source = PLLACK/1, Prescalar = 1, MDIV = 4 to generate + * MAINOSC: Frequency = 12MHz (crystal) + * PLLA: PLL Multiplier = 43+1 to generate PLLACK = 528MHz + * Master Clock (MCK): Source = PLLACK/1, Prescalar = 1, MDIV = 4 to generate * MCK = 132MHz * CPU clock = 528MHz */ @@ -187,23 +188,24 @@ #define HSMCI_SDXFR_CLKDIV (2 << HSMCI_MR_CLKDIV_SHIFT) #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -211,4 +213,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_528MHZ_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_528MHZ_H */ diff --git a/boards/arm/sama5/sama5d4-ek/include/board_memorymap.h b/boards/arm/sama5/sama5d4-ek/include/board_memorymap.h index b0ed47d48f..6beca27516 100644 --- a/boards/arm/sama5/sama5d4-ek/include/board_memorymap.h +++ b/boards/arm/sama5/sama5d4-ek/include/board_memorymap.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/include/board_memorymap.h +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/include/board_memorymap.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,38 +31,39 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_MEMORYMAP_H -#define __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_MEMORYMAP_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_MEMORYMAP_H +#define __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_MEMORYMAP_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -70,4 +71,4 @@ extern "C" { #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_MEMORYMAP_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_MEMORYMAP_H */ diff --git a/boards/arm/sama5/sama5d4-ek/include/board_sdram.h b/boards/arm/sama5/sama5d4-ek/include/board_sdram.h index 0d6a153041..9aa5d6432c 100644 --- a/boards/arm/sama5/sama5d4-ek/include/board_sdram.h +++ b/boards/arm/sama5/sama5d4-ek/include/board_sdram.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/include/board_sdram.h +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/include/board_sdram.h * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,30 +31,34 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -#ifndef __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_SDRAM_H -#define __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_SDRAM_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_SDRAM_H +#define __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_SDRAM_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include "sam_pmc.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Clocking *************************************************************************/ -/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. When - * booting from SDRAM, NuttX is loaded in SDRAM by an intermediate bootloader. That - * bootloader had to have already configured the PLL and SDRAM for proper operation. +/* Clocking *****************************************************************/ + +/* After power-on reset, the SAMA5 device is running on a 12MHz internal RC. + * When booting from SDRAM, NuttX is loaded in SDRAM by an intermediate + * bootloader. + * That bootloader had to have already configured the PLL and SDRAM for + * proper operation. * - * In this case, we do not reconfigure the clocking. Rather, we need to query - * the register settings to determine the clock frequencies. We can only assume that - * the Main clock source is the on-board 12MHz crystal. + * In this case, we do not reconfigure the clocking. + * Rather, we need to query the register settings to determine the clock + * frequencies. We can only assume that the Main clock source is the + * on-board 12MHz crystal. */ #define BOARD_MAINCK_FREQUENCY BOARD_MAINOSC_FREQUENCY @@ -149,23 +153,24 @@ #define HSMCI_SDWIDEXFR_CLKDIV HSMCI_SDXFR_CLKDIV -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ #undef EXTERN #if defined(__cplusplus) @@ -173,4 +178,4 @@ extern "C" { #endif #endif /* !__ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D4_EK_INCLUDE_BOARD_SDRAM_H */ +#endif /* __BOARDS_ARM_SAMA5_SAMA5D4_EK_INCLUDE_BOARD_SDRAM_H */ diff --git a/boards/arm/sama5/sama5d4-ek/scripts/Make.defs b/boards/arm/sama5/sama5d4-ek/scripts/Make.defs index df1b099995..a291fa9f18 100644 --- a/boards/arm/sama5/sama5d4-ek/scripts/Make.defs +++ b/boards/arm/sama5/sama5d4-ek/scripts/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# boards/sama5d4-ek/scripts/Make.defs +# boards/arm/sama5/sama5d4-ek/scripts/Make.defs # # Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d4-ek/scripts/dramboot.ld b/boards/arm/sama5/sama5d4-ek/scripts/dramboot.ld index 912fcabe3d..452c28a667 100644 --- a/boards/arm/sama5/sama5d4-ek/scripts/dramboot.ld +++ b/boards/arm/sama5/sama5d4-ek/scripts/dramboot.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/scripts/dramboot.ld + * boards/arm/sama5/sama5d4-ek/scripts/dramboot.ld * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d4-ek/scripts/gnu-elf.ld b/boards/arm/sama5/sama5d4-ek/scripts/gnu-elf.ld index 554f67851a..e941450169 100644 --- a/boards/arm/sama5/sama5d4-ek/scripts/gnu-elf.ld +++ b/boards/arm/sama5/sama5d4-ek/scripts/gnu-elf.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/scripts/gnu-elf.ld + * boards/arm/sama5/sama5d4-ek/scripts/gnu-elf.ld * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d4-ek/scripts/isram.ld b/boards/arm/sama5/sama5d4-ek/scripts/isram.ld index f34a233f35..7584df46a5 100644 --- a/boards/arm/sama5/sama5d4-ek/scripts/isram.ld +++ b/boards/arm/sama5/sama5d4-ek/scripts/isram.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/scripts/isram.ld + * boards/arm/sama5/sama5d4-ek/scripts/isram.ld * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d4-ek/scripts/uboot.ld b/boards/arm/sama5/sama5d4-ek/scripts/uboot.ld index 07b39d1304..3ff397773c 100644 --- a/boards/arm/sama5/sama5d4-ek/scripts/uboot.ld +++ b/boards/arm/sama5/sama5d4-ek/scripts/uboot.ld @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/scripts/uboot.ld + * boards/arm/sama5/sama5d4-ek/scripts/uboot.ld * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d4-ek/src/Makefile b/boards/arm/sama5/sama5d4-ek/src/Makefile index 41a8d876bb..c64617abc4 100644 --- a/boards/arm/sama5/sama5d4-ek/src/Makefile +++ b/boards/arm/sama5/sama5d4-ek/src/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# boards/sama5d4-ek/src/Makefile +# boards/arm/sama5/sama5d4-ek/src/Makefile # # Copyright (C) 2014 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d4-ek/src/at25_main.c b/boards/arm/sama5/sama5d4-ek/src/at25_main.c index 8f78335c44..f1a53f6ec3 100644 --- a/boards/arm/sama5/sama5d4-ek/src/at25_main.c +++ b/boards/arm/sama5/sama5d4-ek/src/at25_main.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/src/at25_main.c + * boards/arm/sama5/sama5d4-ek/src/at25_main.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -57,6 +57,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifndef HAVE_AT25 diff --git a/boards/arm/sama5/sama5d4-ek/src/dram_main.c b/boards/arm/sama5/sama5d4-ek/src/dram_main.c index 5d5a887569..4d86740d44 100644 --- a/boards/arm/sama5/sama5d4-ek/src/dram_main.c +++ b/boards/arm/sama5/sama5d4-ek/src/dram_main.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/src/dram_main.c + * boards/arm/sama5/sama5d4-ek/src/dram_main.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_adc.c b/boards/arm/sama5/sama5d4-ek/src/sam_adc.c index 07823fe006..5d236034c2 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_adc.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_adc.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/src/sam_adc.c +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/src/sam_adc.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -50,17 +50,17 @@ #ifdef CONFIG_ADC -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_adc_setup * * Description: * Initialize ADC and register the ADC driver. * - ************************************************************************************/ + ****************************************************************************/ int sam_adc_setup(void) { diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_appinit.c b/boards/arm/sama5/sama5d4-ek/src/sam_appinit.c index 5aa7292b68..dff8ae492d 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_appinit.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d4-ek/src/sam_appinit.c + * boards/arm/sama5/sama5d4-ek/src/sam_appinit.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_at25.c b/boards/arm/sama5/sama5d4-ek/src/sam_at25.c index d2d8824b9a..4f7ef1a1c1 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_at25.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_at25.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d4-ek/src/sam_at25.c + * boards/arm/sama5/sama5d4-ek/src/sam_at25.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_audio_null.c b/boards/arm/sama5/sama5d4-ek/src/sam_audio_null.c index 3212da1d0b..30f58116ce 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_audio_null.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_audio_null.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/src/sam_audio_null.c +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/src/sam_audio_null.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Included Files @@ -144,7 +144,8 @@ int sam_audio_null_initialize(int minor) ret = audio_register(devname, pcm); if (ret < 0) { - auderr("ERROR: Failed to register /dev/%s device: %d\n", devname, ret); + auderr("ERROR: Failed to register /dev/%s device: %d\n", + devname, ret); goto errout_with_pcm; } diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_autoleds.c b/boards/arm/sama5/sama5d4-ek/src/sam_autoleds.c index 4f770fb9db..d57539e6b8 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_autoleds.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_autoleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/src/sam_autoleds.c + * boards/arm/sama5/sama5d4-ek/src/sam_autoleds.c * * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,23 +32,25 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* There are 3 LEDs on the SAMA5D4-EK: * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * SAMA5D4 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * PE28/NWAIT/RTS4/A19 1Wire_PE28 1-WIRE ROM, LCD, D8 (green) * PE8/A8/TCLK3/PWML3 LED_USER_PE8 LED_USER (D10) * PE9/A9/TIOA2 LED_POWER_PE9 LED_POWER (D9, Red) - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * - * - D8: D8 is shared with other functions and cannot be used if the 1-Wire ROM - * is used. I am not sure of the LCD function, but the LED may not be available + * - D8: D8 is shared with other functions and cannot be used if the + * 1-Wire ROM is used. + * I am not sure of the LCD function, but the LED may not be available * if the LCD is used either. We will avoid using D8 just for simplicity. * - D10: Nothing special here. A low output illuminates. - * - D9: The Power ON LED. Connects to the via an IRLML2502 MOSFET. This LED will - * be on when power is applied but otherwise a low output value will turn it - * off. + * - D9: The Power ON LED. Connects to the via an IRLML2502 MOSFET. + * This LED will be on when power is applied but otherwise a low output + * value will turn it off. * * These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is * defined. In that case, the usage by the board port is defined in diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_automount.c b/boards/arm/sama5/sama5d4-ek/src/sam_automount.c index 3c740cad06..66a5601027 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_automount.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_automount.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/src/sam_automount.c +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/src/sam_automount.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -53,9 +53,9 @@ #ifdef HAVE_AUTOMOUNTER -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #ifndef NULL # define NULL (FAR void *)0 @@ -65,9 +65,10 @@ # define OK 0 #endif -/************************************************************************************ +/**************************************************************************** * Private Types - ************************************************************************************/ + ****************************************************************************/ + /* This structure represents the changeable state of the automounter */ struct sam_automount_state_s @@ -82,8 +83,8 @@ struct sam_automount_state_s struct sam_automount_config_s { - /* This must be first thing in structure so that we can simply cast from struct - * automount_lower_s to struct sam_automount_config_s + /* This must be first thing in structure so that we can simply cast from + * struct automount_lower_s to struct sam_automount_config_s */ struct automount_lower_s lower; /* Publicly visible part */ @@ -91,18 +92,19 @@ struct sam_automount_config_s FAR struct sam_automount_state_s *state; /* Changeable state */ }; -/************************************************************************************ +/**************************************************************************** * Private Function Prototypes - ************************************************************************************/ + ****************************************************************************/ static int sam_attach(FAR const struct automount_lower_s *lower, automount_handler_t isr, FAR void *arg); -static void sam_enable(FAR const struct automount_lower_s *lower, bool enable); +static void sam_enable(FAR const struct automount_lower_s *lower, + bool enable); static bool sam_inserted(FAR const struct automount_lower_s *lower); -/************************************************************************************ +/**************************************************************************** * Private Data - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAMA5D4EK_HSMCI0_AUTOMOUNT static struct sam_automount_state_s g_hsmci0state; @@ -144,11 +146,11 @@ static const struct sam_automount_config_s g_hsmci1config = }; #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_attach * * Description: @@ -162,7 +164,7 @@ static const struct sam_automount_config_s g_hsmci1config = * Returned Value: * Always returns OK * - ************************************************************************************/ + ****************************************************************************/ static int sam_attach(FAR const struct automount_lower_s *lower, automount_handler_t isr, FAR void *arg) @@ -188,7 +190,7 @@ static int sam_attach(FAR const struct automount_lower_s *lower, return OK; } -/************************************************************************************ +/**************************************************************************** * Name: sam_enable * * Description: @@ -201,7 +203,7 @@ static int sam_attach(FAR const struct automount_lower_s *lower, * Returned Value: * None * - ************************************************************************************/ + ****************************************************************************/ static void sam_enable(FAR const struct automount_lower_s *lower, bool enable) { @@ -239,7 +241,7 @@ static void sam_enable(FAR const struct automount_lower_s *lower, bool enable) leave_critical_section(flags); } -/************************************************************************************ +/**************************************************************************** * Name: sam_inserted * * Description: @@ -251,7 +253,7 @@ static void sam_enable(FAR const struct automount_lower_s *lower, bool enable) * Returned Value: * True if the card is inserted; False otherwise * - ************************************************************************************/ + ****************************************************************************/ static bool sam_inserted(FAR const struct automount_lower_s *lower) { @@ -263,11 +265,11 @@ static bool sam_inserted(FAR const struct automount_lower_s *lower) return sam_cardinserted(config->hsmci); } -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_automount_initialize * * Description: @@ -279,7 +281,7 @@ static bool sam_inserted(FAR const struct automount_lower_s *lower) * Returned Value: * None * - ************************************************************************************/ + ****************************************************************************/ void sam_automount_initialize(void) { @@ -308,20 +310,22 @@ void sam_automount_initialize(void) #endif } -/************************************************************************************ +/**************************************************************************** * Name: sam_automount_event * * Description: - * The HSMCI card detection logic has detected an insertion or removal event. It - * has already scheduled the MMC/SD block driver operations. Now we need to - * schedule the auto-mount event which will occur with a substantial delay to make - * sure that everything has settle down. + * The HSMCI card detection logic has detected an insertion or removal + * event. + * It has already scheduled the MMC/SD block driver operations. + * Now we need to schedule the auto-mount event which will occur with a + * substantial delay to make sure that everything has settle down. * * Input Parameters: - * slotno - Identifies the HSMCI0 slot: HSMCI0_SLOTNO or HSMCI1_SLOTNO. There is a - * terminology problem here: Each HSMCI supports two slots, slot A and slot B. - * Only slot A is used. So this is not a really a slot, but an HSCMI peripheral - * number. + * slotno - Identifies the HSMCI0 slot: HSMCI0_SLOTNO or HSMCI1_SLOTNO. + * There is a terminology problem here: Each HSMCI supports two slots, + * slot A and slot B. + * Only slot A is used. So this is not a really a slot, but an HSCMI + * peripheral number. * inserted - True if the card is inserted in the slot. False otherwise. * * Returned Value: @@ -330,7 +334,7 @@ void sam_automount_initialize(void) * Assumptions: * Interrupts are disabled. * - ************************************************************************************/ + ****************************************************************************/ void sam_automount_event(int slotno, bool inserted) { diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_boot.c b/boards/arm/sama5/sama5d4-ek/src/sam_boot.c index 6bda369606..1909b4bd4b 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_boot.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_boot.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/src/sam_boot.c +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/src/sam_boot.c * * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -46,27 +46,28 @@ #include "sam_sckc.h" #include "sama5d4-ek.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_boardinitialize * * Description: - * All SAMA5 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 SAMA5 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) { @@ -90,20 +91,22 @@ void sam_boardinitialize(void) #if defined(CONFIG_SAMA5_DDRCS) && !defined(CONFIG_SAMA5_BOOT_SDRAM) - /* Configure SDRAM if (1) SDRAM has been enalbled in the NuttX configuration and - * (2) if we are not currently running out of SDRAM. If we are now running out - * of SDRAM then we have to assume that some second level bootloader has properly - * configured SDRAM for our use. + /* Configure SDRAM if + * (1) SDRAM has been enalbled in the NuttX configuration and + * (2) if we are not currently running out of SDRAM. + * If we are now running out of SDRAM then we have to assume that some + * second level bootloader has properly configured SDRAM for our use. */ sam_sdram_config(); #endif - /* Initialize USB if the 1) the HS host or device controller is in the - * configuration and 2) the weak function sam_usbinitialize() has been brought - * into the build. Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is also - * selected. + /* Initialize USB if the + * 1) the HS host or device controller is in the configuration and + * 2) the weak function sam_usbinitialize() has been brought + * into the build. Presumeably either CONFIG_USBDEV or CONFIG_USBHOST is + * also selected. */ #if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS) @@ -113,7 +116,8 @@ void sam_boardinitialize(void) } #endif - /* Configure board resources to support networkingif the 1) networking is enabled, + /* Configure board resources to support networkingif the + * 1) networking is enabled, * 2) the EMAC or GMAC module is enabled, and 2) the weak function * sam_netinitialize() has been brought into the build. */ diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_bringup.c b/boards/arm/sama5/sama5d4-ek/src/sam_bringup.c index daec55e211..d5617d1c3a 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_bringup.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_bringup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d4-ek/src/sam_bringup.c + * boards/arm/sama5/sama5d4-ek/src/sam_bringup.c * * Copyright (C) 2014, 2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -185,7 +185,10 @@ int sam_bringup(void) #ifdef CONFIG_SAMA5D4EK_HSMCI0_MOUNT else { - /* REVISIT: A delay seems to be required here or the mount will fail. */ + /* REVISIT: + * A delay seems to be required here or the mount will fail. + */ + /* Mount the volume on HSMCI0 */ ret = mount(CONFIG_SAMA5D4EK_HSMCI0_MOUNT_BLKDEV, @@ -216,6 +219,7 @@ int sam_bringup(void) else { /* REVISIT: A delay seems to be required here or the mount will fail. */ + /* Mount the volume on HSMCI1 */ ret = mount(CONFIG_SAMA5D4EK_HSMCI1_MOUNT_BLKDEV, diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_buttons.c b/boards/arm/sama5/sama5d4-ek/src/sam_buttons.c index fb5cb95850..3ac0eb6bf6 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_buttons.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_buttons.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/src/sam_buttons.c + * boards/arm/sama5/sama5d4-ek/src/sam_buttons.c * * Copyright (C) 2014-2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_ethernet.c b/boards/arm/sama5/sama5d4-ek/src/sam_ethernet.c index a27bc07ff7..de2249f18f 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_ethernet.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_ethernet.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/src/sam_ethernet.c +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/src/sam_ethernet.c * * Copyright (C) 2014, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -63,9 +63,9 @@ #ifdef HAVE_NETWORK -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #ifndef CONFIG_SAMA5_EMAC0 # undef CONFIG_SAMA5_EMAC0_ISETH0 @@ -80,6 +80,7 @@ #endif /* Debug ********************************************************************/ + /* Extra, in-depth debug output that is only available if * CONFIG_NETDEV_PHY_DEBUG us defined. */ @@ -94,13 +95,13 @@ # define phyinfo(x...) #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_emac0/1_phy_enable - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAMA5_PIOE_IRQ #ifdef CONFIG_SAMA5_EMAC0 @@ -135,17 +136,17 @@ static void sam_emac1_phy_enable(bool enable) #endif #endif -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_netinitialize * * Description: * Configure board resources to support networking. * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_netinitialize(void) { diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_hsmci.c b/boards/arm/sama5/sama5d4-ek/src/sam_hsmci.c index 2f23d9b798..3b0cdf53b0 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_hsmci.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_hsmci.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sama5d4-ek/src/sam_hsmci.c + * boards/arm/sama5/sama5d4-ek/src/sam_hsmci.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -42,9 +42,9 @@ * transfer mode, but the NuttX driver currently uses only the 4-bit wide * transfer mode * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * SAMA5D4 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * PC4/SPI0_NPCS1/MCI0_CK/PCK1 PC4 MCI0_CK, ISI_MCK, EXP * PC5/D0/MCI0_CDA PC5 MCI0_CDA, NAND_IO0 * PC6/D1/MCI0_DA0 PC6 MCI0_DA0, NAND_IO1 @@ -56,15 +56,15 @@ * PC12/D7/MCI0_DA6 PC12 MCI0_DA6, NAND_IO7 * PC13/NRD/NANDOE/MCI0_DA7 PC13 MCI0_DA7, NAND_RE * PE5/A5/CTS3 MCI0_CD_PE5 MCI0_CD - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * * The microSD connects vi HSMCI1. The card detect discrete is available on * PE6 (pulled high): * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * SAMA5D4 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- - * PE14/A14/TCLK1/PWMH3 MCI1_CD_PE14 MCI1_CD ??? + * ------------------------------ ------------------- ----------------------- + * PE14/A14/TCLK1/PWMH3 MCI1_CD_PE14 MCI1_CD ??? * PE15/A15/SCK3/TIOA0 MCI1_PWR_PE15 MCI1_PWR * PE18/A18/TIOA5/MCI1_CK PE18 MCI1_CK, EXP * PE19/A19/TIOB5/MCI1_CDA PE19 MCI1_CDA, EXP @@ -73,7 +73,7 @@ * PE22/A24/TIOB4/MCI1_DA2 PE22 MCI1_DA2, EXP * PE23/A25/TCLK4/MCI1_DA3 PE23 MCI1_DA3, EXP * PE6/A6/TIOA3 MCI1_CD_PE6 MCI1_CD - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- */ /**************************************************************************** @@ -104,6 +104,7 @@ /**************************************************************************** * Private Types ****************************************************************************/ + /* This structure holds static information unique to one HSMCI peripheral */ struct sam_hsmci_state_s @@ -198,7 +199,7 @@ static int sam_hsmci_cardetect(struct sam_hsmci_state_s *state) sdio_mediachange(state->hsmci, cd); } - return OK; + return OK; } #ifdef CONFIG_SAMA5_HSMCI0 @@ -316,6 +317,7 @@ int sam_hsmci_initialize(int slotno, int minor) } /* Mount the SDIO-based MMC/SD block driver */ + /* First, get an instance of the SDIO interface */ state->hsmci = sdio_initialize(slotno); diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_maxtouch.c b/boards/arm/sama5/sama5d4-ek/src/sam_maxtouch.c index 993c010f28..d9d971b07d 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_maxtouch.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_maxtouch.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/src/sam_maxtouch.c +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/src/sam_maxtouch.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Included Files @@ -61,6 +61,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ #ifndef CONFIG_SAMA5D4EK_MXT_I2CFREQUENCY @@ -159,8 +160,9 @@ static int mxt_attach(FAR const struct mxt_lower_s *lower, mxt_handler_t isr, { if (isr) { - /* Just save the address of the handler and its argument for now. The - * new handler will called via mxt_interrupt() when the interrupt occurs. + /* Just save the address of the handler and its argument for now. + * The new handler will called via mxt_interrupt() when the interrupt + * occurs. */ iinfo("Attaching %p\n", isr); @@ -268,7 +270,9 @@ int sam_tsc_setup(int minor) { ierr("ERROR: Failed to register touchscreen device\n"); irq_detach(IRQ_CHG_MXT); + /* sam_i2cbus_uninitialize(i2c); */ + return -ENODEV; } diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_nandflash.c b/boards/arm/sama5/sama5d4-ek/src/sam_nandflash.c index 9e9cdabd54..30d9750366 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_nandflash.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_nandflash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/src/sam_nandflash.c + * boards/arm/sama5/sama5d4-ek/src/sam_nandflash.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -104,9 +104,10 @@ int board_nandflash_config(int cs) uint32_t regval; /* The Embest and Ronetix CM boards and one Hynix NAND HY27UF(08/16)2G2B - * Series NAND (MT29F2G08ABAEAWP). This part has a capacity of 256Mx8bit - * () with spare 8Mx8 bit capacity. The device contains 2048 blocks, composed - * by 64 x 2112 byte pages. The effective size is approximately 256MiB. + * Series NAND (MT29F2G08ABAEAWP). + * This part has a capacity of 256Mx8bit () with spare 8Mx8 bit capacity. + * The device contains 2048 blocks, composed by 64 x 2112 byte pages. + * The effective size is approximately 256MiB. * * NAND is available on CS3. */ diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_ostest.c b/boards/arm/sama5/sama5d4-ek/src/sam_ostest.c index 24dd7d9895..fdadec6b63 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_ostest.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_ostest.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/src/sam_ostest.c +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/src/sam_ostest.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -51,10 +51,11 @@ #include "up_internal.h" #include "sama5d4-ek.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ + ****************************************************************************/ + +/* Configuration ************************************************************/ #undef HAVE_FPU #if defined(CONFIG_ARCH_FPU) && !defined(CONFIG_TESTING_OSTEST_FPUTESTDISABLE) && \ @@ -68,21 +69,22 @@ # error "CONFIG_TESTING_OSTEST_FPUSIZE has the wrong size" #endif -/************************************************************************************ +/**************************************************************************** * Private Data - ************************************************************************************/ + ****************************************************************************/ static uint32_t g_saveregs[XCPTCONTEXT_REGS]; -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ -/* Given an array of size CONFIG_TESTING_OSTEST_FPUSIZE, this function will return - * the current FPU registers. + ****************************************************************************/ + +/* Given an array of size CONFIG_TESTING_OSTEST_FPUSIZE, this function will + * return the current FPU registers. */ void arch_getfpu(FAR uint32_t *fpusave) diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_pmic.c b/boards/arm/sama5/sama5d4-ek/src/sam_pmic.c index d06f184c38..4c7497f54f 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_pmic.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_pmic.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/src/sam_pmic.c + * boards/arm/sama5/sama5d4-ek/src/sam_pmic.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -103,7 +103,7 @@ void sam_pmic_initialize(void) buffer[0] = 0x03; buffer[1] = 0x0f; (void)i2c_write(i2c, &config, buffer, 2); - } + } } #endif /* HAVE_PMIC */ diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_pwm.c b/boards/arm/sama5/sama5d4-ek/src/sam_pwm.c index 45c73c8168..f9e6f1e372 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_pwm.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_pwm.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/src/sam_pwm.c +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/src/sam_pwm.c * * Copyright (C) 2014-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -51,12 +51,16 @@ #include "sam_pwm.h" #include "sama5d4-ek.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ -/* Configuration ********************************************************************/ -/* PWM. There are no dedicated PWM output pins available to the user for PWM - * testing. Care must be taken because all PWM output pins conflict with some other + ****************************************************************************/ + +/* Configuration ************************************************************/ + +/* PWM. + * There are no dedicated PWM output pins available to the user for PWM + * testing. + * Care must be taken because all PWM output pins conflict with some other * usage of the pin by other devices: * * -----+---+---+----+-------------------- @@ -107,17 +111,17 @@ #if defined(CONFIG_PWM) && defined(CONFIG_SAMA5_PWM) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_pwm_setup * * Description: * Initialize PWM and register the PWM device. * - ************************************************************************************/ + ****************************************************************************/ int sam_pwm_setup(void) { diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_sdram.c b/boards/arm/sama5/sama5d4-ek/src/sam_sdram.c index 88a3589a0f..868827533f 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_sdram.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_sdram.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/src/sam_sdram.c + * boards/arm/sama5/sama5d4-ek/src/sam_sdram.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -166,6 +166,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* SDRAM differences */ #if defined(CONFIG_SAMA5D4EK_MT47H128M16RT) @@ -278,21 +279,22 @@ static void sam_config_slaveddr(void) } } -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_sdram_config * * Description: * Configures DDR2 (MT47H128M16RT 128MB or, optionally, MT47H64M16HR) * - * Per the SAMA5D3-EK User guide: "Two DDR2/SDRAM (MT47H64M16HR) used as - * main system memory (256 MByte). The board includes 2 Gbits of on-board soldered - * DDR2 (double data rate) SDRAM. The footprints can also host two DDR2 - * (MT47H128M16RT) from MicronŽ for a total of 512 MBytes of DDR2 memory. The - * memory bus is 32 bits wide and operates with a frequency of up to 166 MHz." + * Per the SAMA5D3-EK User guide: + * "Two DDR2/SDRAM (MT47H64M16HR) used as main system memory (256 MByte). + * The board includes 2 Gbits of on-board solderedDDR2 (double data rate) + * SDRAM. The footprints can also host two DDR2 (MT47H128M16RT) from MicronŽ + * for a total of 512 MBytes of DDR2 memory. The memory bus is 32 bits wide + * and operates with a frequency of up to 166 MHz." * * From the Atmel Code Example: * MT47H64M16HR : 8 Meg x 16 x 8 banks @@ -307,11 +309,11 @@ static void sam_config_slaveddr(void) * None * * Assumptions: - * The DDR memory regions is configured as strongly ordered memory. When - * we complete initialization of SDRAM and it is ready for use, we will - * make DRAM into normal memory. + * The DDR memory regions is configured as strongly ordered memory. + * When we complete initialization of SDRAM and it is ready for use, + * we will make DRAM into normal memory. * - ************************************************************************************/ + ****************************************************************************/ void sam_sdram_config(void) { @@ -376,6 +378,7 @@ void sam_sdram_config(void) putreg32(regval, SAM_MPDDRC_IO_CALIBR); /* Step 2: Program the features of DDR2-SDRAM device into the Timing Register */ + #if defined(CONFIG_SAMA5D4EK_MT47H128M16RT) /* For MT47H128M16RT @@ -481,7 +484,8 @@ void sam_sdram_config(void) *ddr = 0; - /* Now CKE is driven high.*/ + /* Now CKE is driven high. */ + /* Wait 400 ns min */ sam_sdram_delay(NSEC_TO_COUNT(400)); @@ -540,9 +544,9 @@ void sam_sdram_config(void) /* An additional 200 cycles of clock are required for locking DLL */ - sam_sdram_delay(10000 /* CYCLES_TO_COUNT(200) */); + sam_sdram_delay(10000); /* CYCLES_TO_COUNT(200) */ - /* Step 9: Program DLL field into the Configuration Register.*/ + /* Step 9: Program DLL field into the Configuration Register. */ regval = getreg32(SAM_MPDDRC_CR); regval |= MPDDRC_CR_DLL; diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_spi.c b/boards/arm/sama5/sama5d4-ek/src/sam_spi.c index 78c7fc54d5..1a33a30257 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_spi.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_spi.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/src/sam_spi.c +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/src/sam_spi.c * * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -55,17 +55,17 @@ #if defined(CONFIG_SAMA5_SPI0) || defined(CONFIG_SAMA5_SPI1) -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_spidev_initialize * * Description: * Called to configure SPI chip select PIO pins for the SAMA5D4-EK board. * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_spidev_initialize(void) { @@ -73,7 +73,7 @@ void weak_function sam_spidev_initialize(void) #ifdef CONFIG_MTD_AT25 /* The AT25 serial FLASH connects using NPCS0 */ - sam_configpio(PIO_AT25_NPCS0); + sam_configpio(PIO_AT25_NPCS0); #endif #endif @@ -85,30 +85,33 @@ void weak_function sam_spidev_initialize(void) * Name: sam_spi[0|1]select, sam_spi[0|1]status, and sam_spi[0|1]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[0|1]select is a functions tomanage the board-specific chip selects - * o sam_spi[0|1]status and sam_spi[0|1]cmddata: Implementations of the status - * and cmddata methods of the SPI interface defined by struct spi_ops_ - * (see include/nuttx/spi/spi.h). All other methods including - * sam_spibus_initialize()) are provided by common SAM3/4 logic. + * o sam_spi[0|1]select is a functions tomanage the board-specific chip + * selects + * o sam_spi[0|1]status and sam_spi[0|1]cmddata: + * Implementations of the status and cmddata methods of the SPI + * interface defined by struct spi_ops_ (see include/nuttx/spi/spi.h). + * All other methods including sam_spibus_initialize()) are + * provided by common SAM3/4 logic. * * To use this common SPI logic on your board: * * 1. Provide logic in sam_boardinitialize() to configure SPI chip select * pins. - * 2. Provide sam_spi[0|1]select() and sam_spi[0|1]status() functions in your board- - * specific logic. These functions will perform chip selection and - * status operations using PIOs in the way your board is configured. + * 2. Provide sam_spi[0|1]select() and sam_spi[0|1]status() functions in + * your board-specific logic. + * These functions will perform chip selection and status operations + * using PIOs in the way your board is configured. * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide * sam_spi[0|1]cmddata() functions in your board-specific logic. This * function will perform cmd/data selection operations using PIOs in * 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). * diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_usb.c b/boards/arm/sama5/sama5d4-ek/src/sam_usb.c index 4f55d43eac..93d36b6db0 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_usb.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_usb.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/src/sam_usb.c +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/src/sam_usb.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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 @@ -61,9 +61,9 @@ #if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS) -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ #ifndef CONFIG_SAMA5D4EK_USBHOST_PRIO # define CONFIG_SAMA5D4EK_USBHOST_PRIO 50 @@ -77,9 +77,10 @@ # undef CONFIG_SAMA5_UHPHS_RHPORT1 #endif -/************************************************************************************ +/**************************************************************************** * Private Data - ************************************************************************************/ + ****************************************************************************/ + /* Retained device driver handles */ #ifdef CONFIG_SAMA5_OHCI @@ -95,21 +96,22 @@ static struct usbhost_connection_s *g_ehciconn; static xcpt_t g_ochandler; #endif -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: usbhost_waiter * * Description: * Wait for USB devices to be connected to either the OHCI or EHCI hub. * - ************************************************************************************/ + ****************************************************************************/ #if HAVE_USBHOST #ifdef CONFIG_DEBUG_USB -static int usbhost_waiter(struct usbhost_connection_s *dev, const char *hcistr) +static int usbhost_waiter(struct usbhost_connection_s *dev, + const char *hcistr) #else static int usbhost_waiter(struct usbhost_connection_s *dev) #endif @@ -117,7 +119,7 @@ static int usbhost_waiter(struct usbhost_connection_s *dev) struct usbhost_hubport_s *hport; uinfo("Running\n"); - for (;;) + for (; ; ) { /* Wait for the device to change state */ @@ -140,13 +142,13 @@ static int usbhost_waiter(struct usbhost_connection_s *dev) } #endif -/************************************************************************************ +/**************************************************************************** * Name: ohci_waiter * * Description: * Wait for USB devices to be connected to the OHCI hub. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAMA5_OHCI static int ohci_waiter(int argc, char *argv[]) @@ -159,13 +161,13 @@ static int ohci_waiter(int argc, char *argv[]) } #endif -/************************************************************************************ +/**************************************************************************** * Name: ehci_waiter * * Description: * Wait for USB devices to be connected to the EHCI hub. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_SAMA5_EHCI static int ehci_waiter(int argc, char *argv[]) @@ -178,22 +180,22 @@ static int ehci_waiter(int argc, char *argv[]) } #endif -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_usbinitialize * * Description: - * Called from sam_usbinitialize very early in initialization to setup USB-related - * GPIO pins for the SAMA5D4-EK board. + * Called from sam_usbinitialize very early in initialization to setup + * USB-related GPIO pins for the SAMA5D4-EK board. * * USB Ports * The SAMA5D4 series-MB features three USB communication ports: * - * 1. Port A Host High Speed (EHCI) and Full Speed (OHCI) multiplexed with - * USB Device High Speed Micro AB connector, J20 + * 1. Port A Host High Speed (EHCI) and Full Speed (OHCI) multiplexed + * with USB Device High Speed Micro AB connector, J20 * * 2. Port B Host High Speed (EHCI) and Full Speed (OHCI) standard type A * connector, J19 upper port @@ -209,7 +211,7 @@ static int ehci_waiter(int argc, char *argv[]) * Port A * * PIO Signal Name Function - * ---- ----------- ------------------------------------------------------- + * ---- ----------- ----------------------------------------------------- * PE9 VBUS_SENSE VBus detection * * Note: No VBus power switch enable on port A. I think that this limits @@ -219,21 +221,21 @@ static int ehci_waiter(int argc, char *argv[]) * Port B * * PIO Signal Name Function - * ---- ----------- ------------------------------------------------------- + * ---- ----------- ----------------------------------------------------- * PE4 EN5V_USBB VBus power enable (via MN3 power switch). To the A1 * pin of J19 Dual USB A connector * * Port C * * PIO Signal Name Function - * ---- ----------- ------------------------------------------------------- + * ---- ----------- ----------------------------------------------------- * PE3 EN5V_USBC VBus power enable (via MN3 power switch). To the B1 * pin of J19 Dual USB A connector * * Both Ports B and C * * PIO Signal Name Function - * ---- ----------- ------------------------------------------------------- + * ---- ----------- ----------------------------------------------------- * PE5 OVCUR_USB Combined over-current indication from port A and B * * That offers a lot of flexibility. However, here we enable the ports only @@ -243,7 +245,7 @@ static int ehci_waiter(int argc, char *argv[]) * Port B -- EHCI host * Port C -- OHCI host * - ************************************************************************************/ + ****************************************************************************/ void weak_function sam_usbinitialize(void) { @@ -253,6 +255,7 @@ void weak_function sam_usbinitialize(void) sam_configpio(PIO_USBA_VBUS_SENSE); /* VBUS sense */ /* TODO: Configure an interrupt on VBUS sense */ + #endif #ifdef HAVE_USBHOST @@ -283,15 +286,15 @@ void weak_function sam_usbinitialize(void) #endif /* HAVE_USBHOST */ } -/*********************************************************************************** +/**************************************************************************** * Name: sam_usbhost_initialize * * Description: - * Called at application start-up time to initialize the USB host functionality. - * This function will start a thread that will monitor for device - * connection/disconnection events. + * Called at application start-up time to initialize the USB host + * functionality. This function will start a thread that will monitor + * for device connection/disconnection events. * - ***********************************************************************************/ + ****************************************************************************/ #if HAVE_USBHOST int sam_usbhost_initialize(void) @@ -393,29 +396,30 @@ int sam_usbhost_initialize(void) } #endif -/*********************************************************************************** +/**************************************************************************** * Name: sam_usbhost_vbusdrive * * Description: - * Enable/disable driving of VBUS 5V output. This function must be provided by - * each platform that implements the OHCI or EHCI host interface + * Enable/disable driving of VBUS 5V output. + * This function must be provided by each platform that implements the OHCI + * or EHCI host interface * * Input Parameters: - * rhport - Selects root hub port to be powered host interface. See SAM_RHPORT_* - * definitions above. + * rhport - Selects root hub port to be powered host interface. + * See SAM_RHPORT_* definitions above. * enable - true: enable VBUS power; false: disable VBUS power * * Returned Value: * None * - ***********************************************************************************/ + ****************************************************************************/ #if HAVE_USBHOST void sam_usbhost_vbusdrive(int rhport, bool enable) { pio_pinset_t pinset = 0; - uinfo("RHPort%d: enable=%d\n", rhport+1, enable); + uinfo("RHPort%d: enable=%d\n", rhport + 1, enable); /* Pick the PIO configuration associated with the selected root hub port */ @@ -449,7 +453,7 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) #endif default: - uerr("ERROR: RHPort%d is not supported\n", rhport+1); + uerr("ERROR: RHPort%d is not supported\n", rhport + 1); return; } @@ -470,14 +474,15 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) } #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_setup_overcurrent * * Description: - * Setup to receive an interrupt-level callback if an over-current condition is - * detected on port B or C. + * Setup to receive an interrupt-level callback if an over-current + * condition is detected on port B or C. * - * REVISIT: Since this is a common signal, we will need to come up with some way + * REVISIT: + * Since this is a common signal, we will need to come up with some way * to inform both EHCI and OHCI drivers when this error occurs. * * Input Parameters: @@ -486,7 +491,7 @@ void sam_usbhost_vbusdrive(int rhport, bool enable) * Returned Value: * Old over-current interrupt handler * - ************************************************************************************/ + ****************************************************************************/ #if HAVE_USBHOST xcpt_t sam_setup_overcurrent(xcpt_t handler) @@ -526,16 +531,17 @@ xcpt_t sam_setup_overcurrent(xcpt_t handler) } #endif /* CONFIG_SAMA5_PIOD_IRQ ... */ -/************************************************************************************ +/**************************************************************************** * Name: sam_usbsuspend * * Description: - * Board logic must provide the sam_usbsuspend logic if the USBDEV driver is - * used. This function is called whenever the USB enters or leaves suspend mode. - * This is an opportunity for the board logic to shutdown clocks, power, etc. - * while the USB is suspended. + * Board logic must provide the sam_usbsuspend logic if the USBDEV driver + * is used. + * This function is called whenever the USB enters or leaves suspend mode. + * This is an opportunity for the board logic to shutdown clocks, power, + * etc. while the USB is suspended. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_USBDEV void sam_usbsuspend(FAR struct usbdev_s *dev, bool resume) diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_usbmsc.c b/boards/arm/sama5/sama5d4-ek/src/sam_usbmsc.c index 08b4cf5eb9..9b153f79ef 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_usbmsc.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_usbmsc.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/src/sam_usbmsc.c + * boards/arm/sama5/sama5d4-ek/src/sam_usbmsc.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_userleds.c b/boards/arm/sama5/sama5d4-ek/src/sam_userleds.c index 97cd913141..ae5e4d1a10 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_userleds.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_userleds.c @@ -1,5 +1,5 @@ /**************************************************************************** - * boards/sama5d4-ek/src/sam_userleds.c + * boards/arm/sama5/sama5d4-ek/src/sam_userleds.c * * Copyright (C) 2014-2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -32,22 +32,25 @@ * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ + /* There are 3 LEDs on the SAMA5D4-EK: * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * SAMA5D4 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * PE28/NWAIT/RTS4/A19 1Wire_PE28 1-WIRE ROM, LCD, D8 (green) * PE8/A8/TCLK3/PWML3 LED_USER_PE8 LED_USER (D10) * PE9/A9/TIOA2 LED_POWER_PE9 LED_POWER (D9, Red) - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * - * - D8: D8 is shared with other functions and cannot be used if the 1-Wire ROM - * is used. I am not sure of the LCD function, but the LED may not be available + * - D8: D8 is shared with other functions and cannot be used if the + * 1-Wire ROM is used. + * I am not sure of the LCD function, but the LED may not be available * if the LCD is used either. We will avoid using D8 just for simplicity. * - D10: Nothing special here. A low output illuminates. - * - D9: The Power ON LED. Connects to the via an IRLML2502 MOSFET. This LED will - * be on when power is applied but otherwise, I think it works like D10. + * - D9: The Power ON LED. Connects to the via an IRLML2502 MOSFET. + * This LED will be on when power is applied but otherwise, + * I think it works like D10. */ /**************************************************************************** diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_wm8904.c b/boards/arm/sama5/sama5d4-ek/src/sam_wm8904.c index 7c67b8581e..6e40649934 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_wm8904.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_wm8904.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/src/sam_wm8904.c +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/src/sam_wm8904.c * * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Included Files diff --git a/boards/arm/sama5/sama5d4-ek/src/sama5d4-ek.h b/boards/arm/sama5/sama5d4-ek/src/sama5d4-ek.h index 3005eeb8d6..ca754e27cf 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sama5d4-ek.h +++ b/boards/arm/sama5/sama5d4-ek/src/sama5d4-ek.h @@ -1,5 +1,5 @@ -/************************************************************************************ - * boards/sama5d4-ek/src/sama5d4-ek.h +/**************************************************************************** + * boards/arm/sama5/sama5d4-ek/src/sama5d4-ek.h * * Copyright (C) 2014-2016, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -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_SAMA5D4_EK_SRC_SAMA5D4_EK_H -#define __BOARDS_ARM_SAMA5D4_EK_SRC_SAMA5D4_EK_H +#ifndef __BOARDS_ARM_SAMA5_SAMA5D4_EK_SRC_SAMA5D4_EK_H +#define __BOARDS_ARM_SAMA5_SAMA5D4_EK_SRC_SAMA5D4_EK_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include #include @@ -51,9 +51,10 @@ #include "hardware/sam_pinmap.h" -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ + /* Configuration ************************************************************/ #define HAVE_HSMCI 1 @@ -73,6 +74,7 @@ #define HAVE_I2CTOOL 1 /* HSMCI */ + /* Can't support MMC/SD if the card interface(s) are not enable */ #if !defined(CONFIG_SAMA5_HSMCI0) && !defined(CONFIG_SAMA5_HSMCI1) @@ -94,6 +96,7 @@ #endif /* NAND FLASH */ + /* Can't support the NAND device if NAND flash is not configured on EBI CS3 */ #ifndef CONFIG_SAMA5_EBICS3_NAND @@ -139,6 +142,7 @@ #endif /* AT25 Serial FLASH */ + /* Can't support the AT25 device if it SPI0 or AT25 support are not enabled */ #if !defined(CONFIG_SAMA5_SPI0) || !defined(CONFIG_MTD_AT25) @@ -294,8 +298,9 @@ #endif /* USB Host / USB Device */ -/* Either CONFIG_SAMA5_UHPHS or CONFIG_SAMA5_UDPHS must be defined, or there is - * no USB of any kind. + +/* Either CONFIG_SAMA5_UHPHS or CONFIG_SAMA5_UDPHS must be defined, + * or there is no USB of any kind. */ #if !defined(CONFIG_SAMA5_UHPHS) @@ -392,6 +397,7 @@ #endif /* Audio */ + /* PCM/WM8904 driver */ #ifndef CONFIG_AUDIO_WM8904 @@ -488,24 +494,26 @@ # endif #endif -/* LEDs *****************************************************************************/ +/* LEDs *********************************************************************/ + /* There are 3 LEDs on the SAMA5D4-EK: * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * SAMA5D4 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * PE28/NWAIT/RTS4/A19 1Wire_PE28 1-WIRE ROM, LCD, D8 (green) * PE8/A8/TCLK3/PWML3 LED_USER_PE8 LED_USER (D10) * PE9/A9/TIOA2 LED_POWER_PE9 LED_POWER (D9, Red) - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * - * - D8: D8 is shared with other functions and cannot be used if the 1-Wire ROM - * is used. I am not sure of the LCD function, but the LED may not be available + * - D8: D8 is shared with other functions and cannot be used if the + * 1-Wire ROM is used. + * I am not sure of the LCD function, but the LED may not be available * if the LCD is used either. We will avoid using D8 just for simplicity. * - D10: Nothing special here. A low output illuminates. - * - D9: The Power ON LED. Connects to the via an IRLML2502 MOSFET. This LED will - * be on when power is applied but otherwise; a low output value will turn it - * off. + * - D9: The Power ON LED. Connects to the via an IRLML2502 MOSFET. + * This LED will be on when power is applied but otherwise; + * a low output value will turn it off. */ #define PIO_LED_USER (PIO_OUTPUT | PIO_CFG_PULLUP | PIO_OUTPUT_SET | \ @@ -513,24 +521,27 @@ #define PIO_LED_POWER (PIO_OUTPUT | PIO_CFG_PULLUP | PIO_OUTPUT_CLEAR | \ PIO_PORT_PIOE | PIO_PIN9) -/* Buttons **************************************************************************/ +/* Buttons ******************************************************************/ + /* A single button, PB_USER1 (PB2), is available on the SAMA5D4-EK: * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * SAMA5D4 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * PE13/A13/TIOB1/PWML2 PB_USER1_PE13 PB_USER1 - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * - * Closing JP2 will bring PE13 to ground so 1) PE13 should have a weak pull-up, - * and 2) when PB2 is pressed, a low value will be senses. + * Closing JP2 will bring PE13 to ground so + * 1) PE13 should have a weak pull-up, and + * 2) when PB2 is pressed, a low value will be senses. */ #define PIO_BTN_USER (PIO_INPUT | PIO_CFG_PULLUP | PIO_CFG_DEGLITCH | \ PIO_INT_BOTHEDGES | PIO_PORT_PIOE | PIO_PIN13) #define IRQ_BTN_USER SAM_IRQ_PE13 -/* TM7000 LCD/Touchscreen ***********************************************************/ +/* TM7000 LCD/Touchscreen ***************************************************/ + /* The TM7000 LCD is available for the SAMA5D4-EK. See documentation * available on the Precision Design Associates website: * http://www.pdaatl.com/doc/tm7000.pdf @@ -572,7 +583,8 @@ #define MXT_TWI_BUS 0 #define MXT_I2C_ADDRESS 0x4c -/* HSMCI Card Slots *****************************************************************/ +/* HSMCI Card Slots *********************************************************/ + /* The SAMA5D4-EK provides a two SD memory card slots: (1) a full size SD * card slot (J10), and (2) a microSD memory card slot (J11). * @@ -582,9 +594,9 @@ * transfer mode, but the NuttX driver currently uses only the 4-bit wide * transfer mode * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * SAMA5D4 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * PC4/SPI0_NPCS1/MCI0_CK/PCK1 PC4 MCI0_CK, ISI_MCK, EXP * PC5/D0/MCI0_CDA PC5 MCI0_CDA, NAND_IO0 * PC6/D1/MCI0_DA0 PC6 MCI0_DA0, NAND_IO1 @@ -596,7 +608,7 @@ * PC12/D7/MCI0_DA6 PC12 MCI0_DA6, NAND_IO7 * PC13/NRD/NANDOE/MCI0_DA7 PC13 MCI0_DA7, NAND_RE * PE5/A5/CTS3 MCI0_CD_PE5 MCI0_CD - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- */ #define PIO_MCI0_CD (PIO_INPUT | PIO_CFG_DEFAULT | PIO_CFG_DEGLITCH | \ @@ -607,10 +619,10 @@ * PE6 (pulled high) NOTE that PE15 must be controlled to provide power * to the HSMCI1 slot (the HSMCI0 slot is always powered). * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * SAMA5D4 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- - * PE14/A14/TCLK1/PWMH3 MCI1_CD_PE14 MCI1_CD ??? + * ------------------------------ ------------------- ----------------------- + * PE14/A14/TCLK1/PWMH3 MCI1_CD_PE14 MCI1_CD ??? * PE15/A15/SCK3/TIOA0 MCI1_PWR_PE15 MCI1_PWR * PE18/A18/TIOA5/MCI1_CK PE18 MCI1_CK, EXP * PE19/A19/TIOB5/MCI1_CDA PE19 MCI1_CDA, EXP @@ -619,7 +631,7 @@ * PE22/A24/TIOB4/MCI1_DA2 PE22 MCI1_DA2, EXP * PE23/A25/TCLK4/MCI1_DA3 PE23 MCI1_DA3, EXP * PE6/A6/TIOA3 MCI1_CD_PE6 MCI1_CD - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- */ #define PIO_MCI1_CD (PIO_INPUT | PIO_CFG_DEFAULT | PIO_CFG_DEGLITCH | \ @@ -629,7 +641,8 @@ #define IRQ_MCI1_PWR (PIO_OUTPUT | PIO_CFG_DEFAULT | PIO_OUTPUT_SET | \ PIO_PORT_PIOE | PIO_PIN15) -/* USB Ports ************************************************************************/ +/* USB Ports ****************************************************************/ + /* The SAMA5D4-EK features three USB communication ports: * * * Port A Host High Speed (EHCI) and Full Speed (OHCI) multiplexed with @@ -650,10 +663,11 @@ * ------ * * PIO Signal Name Function - * ---- -------------- ------------------------------------------------------- - * PE10 USBA_EN5V_PE10 VBus power enable (via MN2 power switch) to VBus pin of - * the OTG connector (host) - * PE31 USBA_VBUS_PE31 VBus sensing from the VBus pin of the OTG connector (device) + * ---- -------------- ---------------------------------------------------- + * PE10 USBA_EN5V_PE10 VBus power enable (via MN2 power switch) to VBus pin + * of the OTG connector (host) + * PE31 USBA_VBUS_PE31 VBus sensing from the VBus pin of the OTG connector + * (device) */ #ifdef CONFIG_SAMA5_UHPHS_RHPORT1 @@ -674,7 +688,7 @@ * ------ * * PIO Signal Name Function - * ---- -------------- ------------------------------------------------------- + * ---- -------------- ---------------------------------------------------- * PE11 USBB_EN5V_PE11 VBus power enable (via MN4 power switch). To the A1 * pin of J5 Dual USB A connector */ @@ -689,7 +703,7 @@ * ------ * * PIO Signal Name Function - * ---- -------------- ------------------------------------------------------- + * ---- -------------- ---------------------------------------------------- * PE12 USBC_EN5V_PE12 VBus power enable (via MN4 power switch). To the B1 * pin of J5 Dual USB A connector */ @@ -704,7 +718,7 @@ * ------------------ * * PIO Signal Name Function - * ---- ------------- ------------------------------------------------------- + * ---- ------------- ----------------------------------------------------- * PD9 USB_OVCUR_PD9 Combined over-current indication from port A and B */ @@ -725,9 +739,9 @@ * configuration options. The SAMA5D44 supports two different 10/100Base-T * Ethernet MAC peripherals. * - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * SAMA5D4 PIO SIGNAL USAGE - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * PB0/G0_TXCK PB0 G0_TXCK, EXP * PB1/G0_RXCK/SCK2/ISI_PCK ISI_PCK_PB1 ISI_PCK * PB2/G0_TXEN PB2 G0_TXEN,EXP @@ -747,7 +761,7 @@ * PB16/G0_MDC PB16 G0_MDC, EXP * PB17/G0_MDIO PB17 G0_MDIO, EXP * PE1/A1/MCI0_DB0 G0_IRQ_PE1 G0_IRQ - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * PA2/LCDDAT2/G1_TXCK PA LCDDAT2, G1_TXCK * PA3/LCDDAT3/G1_RXCK PA3 LCDDAT3 * PA4/LCDDAT4/G1_TXEN PA4 LCDDAT4, G1_TXEN @@ -767,20 +781,21 @@ * PA22/LCDDAT22/G1_MDC PA22 LCDDAT22, G1_MDC * PA23/LCDDAT23/G1_MDIO PA23 LCDDAT23, G1_MDIO * PE2/A2/MCI0_DB1 G1_IRQ_PE2 G1_IRQ - * ------------------------------ ------------------- ------------------------- + * ------------------------------ ------------------- ----------------------- * * EMAC2 connects (directly) to a KSZ8081RNB PHY (U10) and is available at * the ETH0 connector. * - * EMAC1 connects (indirectly) to another KSZ8081RNB PHY (U7) and is available - * at the ETH1 connector. The ETH1 signals go through a line driver that is - * enabled via LCD_ETH1_CONFIG when an LCD is detected: + * EMAC1 connects (indirectly) to another KSZ8081RNB PHY (U7) and is + * available at the ETH1 connector. + * The ETH1 signals go through a line driver that is enabled via + * LCD_ETH1_CONFIG when an LCD is detected: * * - LCD_ETH1_CONFIG = 0: LCD 5v disable * - LCD_ETH1_CONFIG = 1 & LCD_DETECT# =0: LCD 5v enable. * - * The sense of KSZ8081 interrupt is configurable but is, by default, active - * low. + * The sense of KSZ8081 interrupt is configurable but is, by default, + * active low. */ #ifdef CONFIG_SAMA5_EMAC0 @@ -796,11 +811,12 @@ #endif #endif -/* WM8904 Audio Codec ***************************************************************/ +/* WM8904 Audio Codec *******************************************************/ + /* SAMA5D4 Interface - * ---- ------------------ ---------------- ---------- ------------------------------ + * ---- ------------------ ---------------- ---------- ---------------------- * PIO USAGE BOARD SIGNAL WM8904 PIN NOTE - * ---- ------------------ ---------------- ---------- ------------------------------ + * ---- ------------------ ---------------- ---------- ---------------------- * PA30 TWD0 AUDIO_TWD0_PA30 SDA Pulled up, See J23 note below * PA31 TWCK0 AUDIO_TWCK0_PA31 SCLK Pulled up * PB10 AUDIO_PCK2/EXP AUDIO_PCK2_PB10 MCLK @@ -811,7 +827,7 @@ * PB29 AUDIO_RD0/ZIG_TWD2 AUDIO_RD0_PB29 ADCDAT * PB28 AUDIO/HDMI_TD0/EXP AUDIO_TD0_PB28 ACDAT * PE4 AUDIO_IRQ AUDIO_IRQ_PE4 IRQ/GPIO1 Audio interrupt - * ---- ------------------ ---------------- ---------- ------------------------------ + * ---- ------------------ ---------------- ---------- ---------------------- * Note that jumper J23 must be closed to connect AUDIO_TWD0_PA30 */ @@ -819,9 +835,9 @@ #define PIO_SSC0_TD PIO_SSC0_TD_2 -/* Audio Interrupt. All interrupts are default, active high level. Pull down - * internally in the WM8904. So we want no pull-up/downs and we want to - * interrupt on the high level. +/* Audio Interrupt. All interrupts are default, active high level. + * Pull down internally in the WM8904. + * So we want no pull-up/downs and we want to interrupt on the high level. */ #define PIO_INT_WM8904 (PIO_INPUT | PIO_CFG_DEFAULT | PIO_CFG_DEGLITCH | \ @@ -837,9 +853,11 @@ #define WM8904_SSC_BUS 0 -/* SPI Chip Selects *****************************************************************/ -/* The SAMA5D4-EK includes an Atmel AT25DF321A, 32-megabit, 2.7-volt SPI serial - * FLASH on board. The connection is as follows: +/* SPI Chip Selects *********************************************************/ + +/* The SAMA5D4-EK includes an Atmel AT25DF321A, 32-megabit, + * 2.7-volt SPI serial FLASH on board. + * The connection is as follows: * * AT25DF321A SAMA5D4-EK SAMA5 * ---------- --------------- -------------------------------- @@ -855,49 +873,51 @@ PIO_PORT_PIOC | PIO_PIN3) #define AT25_PORT SPI0_CS0 -/* ACT8865 power management chip ****************************************************/ +/* ACT8865 power management chip ********************************************/ + /* The PMIC communicates on TWI0, I2C address 0x5b */ #define PMIC_TWI_BUS 0 #define PMIC_I2C_ADDRESS 0x5b #define PMIC_I2C_FREQUENCY 400000 /* 400KHz max */ -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public data - ************************************************************************************/ + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: sam_spidev_initialize * * Description: * Called to configure SPI chip select PIO pins for the SAMA5D4-EK board. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAMA5_SPI0) || defined(CONFIG_SAMA5_SPI1) void weak_function sam_spidev_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_sdram_config * * Description: * Configures DDR2 (MT47H128M16RT 128MB or, optionally, MT47H64M16HR) * - * Per the SAMA5D4-EK User guide: "Two SDRAM/DDR2 used as main system memory. - * MT47H128M16 - 2 Gb - 16 Meg x 16 x 8 banks, the board provides up to 2 Gb on- - * board, soldered DDR2 SDRAM. The memory bus is 32 bits wide and operates with - * up to 166 MHz." + * Per the SAMA5D4-EK User guide: + * "Two SDRAM/DDR2 used as main system memory. + * MT47H128M16 - 2 Gb - 16 Meg x 16 x 8 banks, the board provides up to + * 2 Gb on- board, soldered DDR2 SDRAM. + * The memory bus is 32 bits wide and operates with up to 166 MHz." * * From the Atmel Code Example: * MT47H64M16HR : 8 Meg x 16 x 8 banks @@ -912,11 +932,11 @@ void weak_function sam_spidev_initialize(void); * None * * Assumptions: - * The DDR memory regions is configured as strongly ordered memory. When we - * complete initialization of SDRAM and it is ready for use, we will make DRAM - * into normal memory. + * The DDR memory regions is configured as strongly ordered memory. + * When we complete initialization of SDRAM and it is ready for use, + * we will make DRAM into normal memory. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAMA5_DDRCS) && !defined(CONFIG_SAMA5_BOOT_SDRAM) void sam_sdram_config(void); @@ -970,19 +990,19 @@ int sam_at25_automount(int minor); int sam_hsmci_initialize(int slotno, int minor); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_cardinserted * * Description: * Check if a card is inserted into the selected HSMCI slot * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_HSMCI bool sam_cardinserted(int slotno); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_automount_initialize * * Description: @@ -994,26 +1014,27 @@ bool sam_cardinserted(int slotno); * Returned Value: * None * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_AUTOMOUNTER void sam_automount_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_automount_event * * Description: - * The HSMCI card detection logic has detected an insertion or removal event. It - * has already scheduled the MMC/SD block driver operations. Now we need to - * schedule the auto-mount event which will occur with a substantial delay to make - * sure that everything has settle down. + * The HSMCI card detection logic has detected an insertion or removal + * event. It has already scheduled the MMC/SD block driver operations. + * Now we need to schedule the auto-mount event which will occur with a + * substantial delay to make sure that everything has settle down. * * Input Parameters: - * slotno - Identifies the HSMCI0 slot: HSMCI0 or HSMCI1_SLOTNO. There is a - * terminology problem here: Each HSMCI supports two slots, slot A and slot B. - * Only slot A is used. So this is not a really a slot, but an HSCMI peripheral - * number. + * slotno - Identifies the HSMCI0 slot: HSMCI0 or HSMCI1_SLOTNO. + * There is a terminology problem here: + * Each HSMCI supports two slots, slot A and slot B. + * Only slot A is used. + * So this is not a really a slot, but an HSCMI peripheral number. * inserted - True if the card is inserted in the slot. False otherwise. * * Returned Value: @@ -1022,103 +1043,106 @@ void sam_automount_initialize(void); * Assumptions: * Interrupts are disabled. * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_AUTOMOUNTER void sam_automount_event(int slotno, bool inserted); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_writeprotected * * Description: * Check if the card in the MMCSD slot is write protected * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_HSMCI bool sam_writeprotected(int slotno); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_usbinitialize * * Description: - * Called from sam_usbinitialize very early in inialization to setup USB-related - * PIO pins for the SAMA5D4-EK board. + * Called from sam_usbinitialize very early in inialization to setup + * USB-related PIO pins for the SAMA5D4-EK board. * - ************************************************************************************/ + ****************************************************************************/ #if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS) void weak_function sam_usbinitialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: stm32_usbhost_initialize * * Description: - * Called at application startup time to initialize the USB host functionality. - * This function will start a thread that will monitor for device connection/ - * disconnection events. + * Called at application startup time to initialize the USB host + * functionality. + * This function will start a thread that will monitor for device + * connection/disconnection events. * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_USBHOST int sam_usbhost_initialize(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_tsc_setup * * Description: - * This function is called by board-bringup logic to configure the touchscreen - * device. This function will register the driver as /dev/inputN where N is the + * This function is called by board-bringup logic to configure the + * touchscreen device. + * This function will register the driver as /dev/inputN where N is the * minor device number. * * Input Parameters: * minor - The input device minor number * * Returned Value: - * Zero is returned on success. Otherwise, a negated errno value is returned to - * indicate the nature of the failure. + * Zero is returned on success. + * Otherwise, a negated errno value is returned to indicate the nature of + * the failure. * - ***********************************************************************************/ + ****************************************************************************/ #ifdef HAVE_MAXTOUCH int sam_tsc_setup(int minor); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_pwm_setup * * Description: * Initialize PWM and register the PWM device. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_PWM int sam_pwm_setup(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_adc_setup * * Description: * Initialize ADC and register the ADC driver. * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ADC int sam_adc_setup(void); #endif -/************************************************************************************ +/**************************************************************************** * Name: sam_netinitialize * * Description: * Configure board resources to support networking. * - ************************************************************************************/ + ****************************************************************************/ #ifdef HAVE_NETWORK void weak_function sam_netinitialize(void); @@ -1185,5 +1209,4 @@ void sam_pmic_initialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __BOARDS_ARM_SAMA5D4_EK_SRC_SAMA5D4_EK_H */ - +#endif /* __BOARDS_ARM_SAMA5_SAMA5D4_EK_SRC_SAMA5D4_EK_H */