Merged in alinjerpelea/nuttx (pull request #996)
arm: sam34: codestyle fixes
* arm: sam34: codestyle fixes
After the board restructuration is time for codestyle cleanup
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
* arm: sama5: codestyle fixes
After the board restructuration is time for codestyle cleanup
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
parent
eb4fff5221
commit
061728b440
237 changed files with 3797 additions and 3154 deletions
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_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 <nuttx/config.h>
|
||||
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_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 <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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) && \
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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
|
||||
****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_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 <nuttx/config.h>
|
||||
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_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 <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __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 <nuttx/config.h>
|
||||
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_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 <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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 <nuttx/config.h>
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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 */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
|
|
@ -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).
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <masayuki.ishikawa@gmail.com>
|
||||
|
|
@ -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 <nuttx/config.h>
|
||||
|
||||
|
|
@ -46,13 +46,15 @@
|
|||
# include <stdint.h>
|
||||
#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 */
|
||||
|
|
|
|||
|
|
@ -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 <masayuki.ishikawa@gmail.com>
|
||||
|
|
|
|||
|
|
@ -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 <masayuki.ishikawa@gmail.com>
|
||||
|
|
|
|||
|
|
@ -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 <masayuki.ishikawa@gmail.com>
|
||||
|
|
|
|||
|
|
@ -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 <masayuki.ishikawa@gmail.com>
|
||||
|
|
@ -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 <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <masayuki.ishikawa@gmail.com>
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
|
|
@ -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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __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 <nuttx/config.h>
|
||||
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_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 <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <nuttx/config.h>
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <nuttx/config.h>
|
||||
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_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 <nuttx/config.h>
|
||||
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_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 <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
|
@ -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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -55,6 +55,7 @@
|
|||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifdef CONFIG_DISABLE_MOUNTPOINT
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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 <nuttx/config.h>
|
||||
#include <stdbool.h>
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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 <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -113,7 +113,6 @@ void board_autoled_on(int led)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,11 +31,11 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
|
|
@ -46,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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -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 <nuttx/config.h>
|
||||
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
@ -31,14 +31,14 @@
|
|||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_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 <nuttx/config.h>
|
||||
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue