mirror of
https://github.com/apache/nuttx.git
synced 2026-10-12 08:40:20 +00:00
Merged in jjlange/nuttx/lpc40xx (pull request #946)
Add support for LPC40xx family chips
* Corrected a few peripheral definitions and pin functions for the LPC17xx family.
Added configuration options, chip definitions, and additional pin functions for the LPC40xx family.
Added board configurations for Embedded Artists LPC4088 Quickstart board and LPC4088 Developer's kit. These configurations are still something of a work in progress. In particular, the LCD functionality is untested.
* First pass rename in *.c and *.h files.
* Renamed LPC17XX to LPC17XX_40XX in config files
* Rplaced LPC17xx with LPC17xx/LPC40xx in .c files
* Replaced LPC17xx with LPC17xx/LPC40xx in .h files
* Updated some documentation
* Working on moving directories
* moved arch/arm/src/lpc17xx and arch/arm/include/lpc17xx to lpc17xx_40xx
* Renamed LPC17_* constants / configuration options to LPC17_40_*
* Updated chip family name defines
* Renamed some chip-specific files
* Updated references to renamed files
* Updated references to lpc17_ to lpc17_40_
* Renamed source files from lpc17_* to lpc17_40_*
* Clean up white space
Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
parent
8578ce9832
commit
e5dfd805e6
400 changed files with 27550 additions and 16939 deletions
2
configs/lpc4088-devkit/src/.gitignore
vendored
Normal file
2
configs/lpc4088-devkit/src/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/.depend
|
||||
/Make.dep
|
||||
79
configs/lpc4088-devkit/src/Makefile
Normal file
79
configs/lpc4088-devkit/src/Makefile
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
############################################################################
|
||||
# configs/lpc4088-devkit/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2013, 2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
ASRCS =
|
||||
CSRCS = lpc17_40_boardinitialize.c lpc17_40_bringup.c lpc17_40_ssp.c
|
||||
|
||||
ifeq ($(CONFIG_LPC17_40_EMC),y)
|
||||
ifeq ($(CONFIG_LPC17_40_EXTNOR),y)
|
||||
CSRCS += lpc17_40_norinitialize.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LPC17_40_EXTNAND),y)
|
||||
CSRCS += lpc17_40_nandinitialize.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LPC17_40_EXTDRAM),y)
|
||||
CSRCS += lpc17_40_sdraminitialize.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LPC17_40_LCD),y)
|
||||
CSRCS += lpc17_40_lcd.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += lpc17_40_appinit.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += lpc17_40_autoleds.c
|
||||
else
|
||||
CSRCS += lpc17_40_userleds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||
CSRCS += lpc17_40_buttons.c
|
||||
else ifeq ($(CONFIG_LPC4088_DEVKIT_DJOYSTICK),y)
|
||||
CSRCS += lpc17_40_djoystick.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_INPUT_ADS7843E),y)
|
||||
CSRCS += lpc17_40_touchscreen.c
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/configs/Board.mk
|
||||
94
configs/lpc4088-devkit/src/lpc17_40_appinit.c
Normal file
94
configs/lpc4088-devkit/src/lpc17_40_appinit.c
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/****************************************************************************
|
||||
* config/lpc4088-devkit/src/lpc17_40_appinit.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef OK
|
||||
# define OK 0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform application specific initialization. This function is never
|
||||
* called directly from application code, but only indirectly via the
|
||||
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||
* implementation without modification. The argument has no
|
||||
* meaning to NuttX; the meaning of the argument is a contract
|
||||
* between the board-specific initalization logic and the
|
||||
* matching application logic. The value cold be such things as a
|
||||
* mode enumeration value, a set of DIP switch switch settings, a
|
||||
* pointer to configuration data read from a file or serial FLASH,
|
||||
* or whatever you would like to do with it. Every implementation
|
||||
* should accept zero/NULL as a default configuration.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
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 lpc4088_devkit_bringup();
|
||||
#endif
|
||||
}
|
||||
265
configs/lpc4088-devkit/src/lpc17_40_autoleds.c
Normal file
265
configs/lpc4088-devkit/src/lpc17_40_autoleds.c
Normal file
|
|
@ -0,0 +1,265 @@
|
|||
/****************************************************************************
|
||||
* configs/lpc4088-devkit/src/lpc17_40_autoleds.c
|
||||
*
|
||||
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "lpc17_40_gpio.h"
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in
|
||||
* any way. The following definitions are used to access individual LEDs.
|
||||
*
|
||||
* LED1 -- Connected to P1[14]
|
||||
* LED2 -- Connected to P0[16]
|
||||
* LED3 -- Connected to P1[13]
|
||||
* LED4 -- Connected to P4[27]
|
||||
*
|
||||
* These LEDs are connected to ground so a high output value will illuminate them.
|
||||
*
|
||||
* If CONFIG_ARCH_LEDs is defined, then NuttX will control the two LEDs
|
||||
* on the LPC4088 Developer's Kit. The following definitions describe how NuttX
|
||||
* controls the LEDs:
|
||||
*
|
||||
* LED1 LED2 LED3 LED4
|
||||
* LED_STARTED 0 OFF OFF OFF OFF
|
||||
* LED_HEAPALLOCATE 1 ON OFF OFF OFF
|
||||
* LED_IRQSENABLED 2 OFF ON OFF OFF
|
||||
* LED_STACKCREATED 3 ON ON OFF OFF
|
||||
* LED_INIRQ 4 LED3 glows, on while in interrupt
|
||||
* LED_SIGNAL 4 LED3 glows, on while in signal handler
|
||||
* LED_ASSERTION 4 LED3 glows, on while in assertion
|
||||
* LED_PANIC 4 LED3 Flashes at 2Hz
|
||||
* LED_IDLE 5 LED glows, ON while sleeping
|
||||
*/
|
||||
|
||||
/* The following definitions map the encoded LED setting to GPIO settings */
|
||||
|
||||
#define LPC4088_DEVKIT_LED1 (1 << 0)
|
||||
#define LPC4088_DEVKIT_LED2 (1 << 1)
|
||||
#define LPC4088_DEVKIT_LED3 (1 << 2)
|
||||
#define LPC4088_DEVKIT_LED4 (1 << 3)
|
||||
|
||||
#define ON_SETBITS_SHIFT (0)
|
||||
#define ON_CLRBITS_SHIFT (4)
|
||||
#define OFF_SETBITS_SHIFT (8)
|
||||
#define OFF_CLRBITS_SHIFT (12)
|
||||
|
||||
#define ON_BITS(v) ((v) & 0xff)
|
||||
#define OFF_BITS(v) (((v) >> 8) & 0x0ff)
|
||||
#define SETBITS(b) ((b) & 0x0f)
|
||||
#define CLRBITS(b) (((b) >> 4) & 0x0f)
|
||||
|
||||
#define ON_SETBITS(v) (SETBITS(ON_BITS(v))
|
||||
#define ON_CLRBITS(v) (CLRBITS(ON_BITS(v))
|
||||
#define OFF_SETBITS(v) (SETBITS(OFF_BITS(v))
|
||||
#define OFF_CLRBITS(v) (CLRBITS(OFF_BITS(v))
|
||||
|
||||
#define LED_STARTED_ON_SETBITS ((0) << ON_SETBITS_SHIFT)
|
||||
#define LED_STARTED_ON_CLRBITS ((LPC4088_DEVKIT_LED1|LPC4088_DEVKIT_LED2|LPC4088_DEVKIT_LED3|LPC4088_DEVKIT_LED4) << ON_CLRBITS_SHIFT)
|
||||
#define LED_STARTED_OFF_SETBITS (0 << OFF_SETBITS_SHIFT)
|
||||
#define LED_STARTED_OFF_CLRBITS ((LPC4088_DEVKIT_LED1|LPC4088_DEVKIT_LED2|LPC4088_DEVKIT_LED3|LPC4088_DEVKIT_LED4) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
#define LED_HEAPALLOCATE_ON_SETBITS ((LPC4088_DEVKIT_LED1) << ON_SETBITS_SHIFT)
|
||||
#define LED_HEAPALLOCATE_ON_CLRBITS ((LPC4088_DEVKIT_LED2|LPC4088_DEVKIT_LED3|LPC4088_DEVKIT_LED4) << ON_CLRBITS_SHIFT)
|
||||
#define LED_HEAPALLOCATE_OFF_SETBITS (0 << OFF_SETBITS_SHIFT)
|
||||
#define LED_HEAPALLOCATE_OFF_CLRBITS ((LPC4088_DEVKIT_LED1|LPC4088_DEVKIT_LED2|LPC4088_DEVKIT_LED3|LPC4088_DEVKIT_LED4) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
#define LED_IRQSENABLED_ON_SETBITS ((LPC4088_DEVKIT_LED2) << ON_SETBITS_SHIFT)
|
||||
#define LED_IRQSENABLED_ON_CLRBITS ((LPC4088_DEVKIT_LED1|LPC4088_DEVKIT_LED3|LPC4088_DEVKIT_LED4) << ON_CLRBITS_SHIFT)
|
||||
#define LED_IRQSENABLED_OFF_SETBITS ((LPC4088_DEVKIT_LED1) << OFF_SETBITS_SHIFT)
|
||||
#define LED_IRQSENABLED_OFF_CLRBITS ((LPC4088_DEVKIT_LED2|LPC4088_DEVKIT_LED3|LPC4088_DEVKIT_LED4) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
#define LED_STACKCREATED_ON_SETBITS ((LPC4088_DEVKIT_LED1|LPC4088_DEVKIT_LED2) << ON_SETBITS_SHIFT)
|
||||
#define LED_STACKCREATED_ON_CLRBITS ((LPC4088_DEVKIT_LED3|LPC4088_DEVKIT_LED4) << ON_CLRBITS_SHIFT)
|
||||
#define LED_STACKCREATED_OFF_SETBITS ((LPC4088_DEVKIT_LED2) << OFF_SETBITS_SHIFT)
|
||||
#define LED_STACKCREATED_OFF_CLRBITS ((LPC4088_DEVKIT_LED1|LPC4088_DEVKIT_LED3|LPC4088_DEVKIT_LED4) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
#define LED_EVENT_ON_SETBITS ((LPC4088_DEVKIT_LED3) << ON_SETBITS_SHIFT)
|
||||
#define LED_EVENT_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
||||
#define LED_EVENT_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
||||
#define LED_EVENT_OFF_CLRBITS ((LPC4088_DEVKIT_LED3) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
#define LED_IDLE_ON_SETBITS ((0) << ON_SETBITS_SHIFT)
|
||||
#define LED_IDLE_ON_CLRBITS ((LPC4088_DEVKIT_LED4) << ON_CLRBITS_SHIFT)
|
||||
#define LED_IDLE_OFF_SETBITS ((LPC4088_DEVKIT_LED4) << OFF_SETBITS_SHIFT)
|
||||
#define LED_IDLE_OFF_CLRBITS ((0) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
/* Dump GPIO registers */
|
||||
|
||||
#ifdef CONFIG_DEBUG_LEDS_INFO
|
||||
# define led_dumpgpio(m) lpc17_40_dumpgpio(???, m)
|
||||
#else
|
||||
# define led_dumpgpio(m)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const uint16_t g_ledbits[8] =
|
||||
{
|
||||
(LED_STARTED_ON_SETBITS | LED_STARTED_ON_CLRBITS |
|
||||
LED_STARTED_OFF_SETBITS | LED_STARTED_OFF_CLRBITS),
|
||||
|
||||
(LED_HEAPALLOCATE_ON_SETBITS | LED_HEAPALLOCATE_ON_CLRBITS |
|
||||
LED_HEAPALLOCATE_OFF_SETBITS | LED_HEAPALLOCATE_OFF_CLRBITS),
|
||||
|
||||
(LED_IRQSENABLED_ON_SETBITS | LED_IRQSENABLED_ON_CLRBITS |
|
||||
LED_IRQSENABLED_OFF_SETBITS | LED_IRQSENABLED_OFF_CLRBITS),
|
||||
|
||||
(LED_STACKCREATED_ON_SETBITS | LED_STACKCREATED_ON_CLRBITS |
|
||||
LED_STACKCREATED_OFF_SETBITS | LED_STACKCREATED_OFF_CLRBITS),
|
||||
|
||||
(LED_EVENT_ON_SETBITS | LED_EVENT_ON_CLRBITS |
|
||||
LED_EVENT_OFF_SETBITS | LED_EVENT_OFF_CLRBITS),
|
||||
|
||||
(LED_IDLE_ON_SETBITS | LED_IDLE_ON_CLRBITS |
|
||||
LED_IDLE_OFF_SETBITS | LED_IDLE_OFF_CLRBITS)
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static inline void led_clrbits(unsigned int clrbits)
|
||||
{
|
||||
if ((clrbits & LPC4088_DEVKIT_LED1) != 0)
|
||||
{
|
||||
lpc17_40_gpiowrite(GPIO_LED1, false);
|
||||
}
|
||||
|
||||
if ((clrbits & LPC4088_DEVKIT_LED2) != 0)
|
||||
{
|
||||
lpc17_40_gpiowrite(GPIO_LED2, false);
|
||||
}
|
||||
|
||||
if ((clrbits & LPC4088_DEVKIT_LED3) != 0)
|
||||
{
|
||||
lpc17_40_gpiowrite(GPIO_LED3, false);
|
||||
}
|
||||
|
||||
if ((clrbits & LPC4088_DEVKIT_LED4) != 0)
|
||||
{
|
||||
lpc17_40_gpiowrite(GPIO_LED4, false);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void led_setbits(unsigned int setbits)
|
||||
{
|
||||
if ((setbits & LPC4088_DEVKIT_LED1) != 0)
|
||||
{
|
||||
lpc17_40_gpiowrite(GPIO_LED1, true);
|
||||
}
|
||||
|
||||
if ((setbits & LPC4088_DEVKIT_LED2) != 0)
|
||||
{
|
||||
lpc17_40_gpiowrite(GPIO_LED2, true);
|
||||
}
|
||||
|
||||
if ((setbits & LPC4088_DEVKIT_LED3) != 0)
|
||||
{
|
||||
lpc17_40_gpiowrite(GPIO_LED3, true);
|
||||
}
|
||||
|
||||
if ((setbits & LPC4088_DEVKIT_LED4) != 0)
|
||||
{
|
||||
lpc17_40_gpiowrite(GPIO_LED4, true);
|
||||
}
|
||||
}
|
||||
|
||||
static void led_setonoff(unsigned int bits)
|
||||
{
|
||||
led_clrbits(CLRBITS(bits));
|
||||
led_setbits(SETBITS(bits));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
/* Configure LED1-4 GPIOs for output */
|
||||
|
||||
lpc17_40_configgpio(GPIO_LED1);
|
||||
lpc17_40_configgpio(GPIO_LED2);
|
||||
lpc17_40_configgpio(GPIO_LED3);
|
||||
lpc17_40_configgpio(GPIO_LED4);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
led_setonoff(ON_BITS(g_ledbits[led]));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
led_setonoff(OFF_BITS(g_ledbits[led]));
|
||||
}
|
||||
142
configs/lpc4088-devkit/src/lpc17_40_boardinitialize.c
Normal file
142
configs/lpc4088-devkit/src/lpc17_40_boardinitialize.c
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
/************************************************************************************
|
||||
* configs/lpc4088-devkit/src/lpc17_40_boardinitialize.c
|
||||
*
|
||||
* Copyright (C) 2013, 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "lpc17_40_emc.h"
|
||||
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc17_40_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* All LPC17xx/LPC40xx 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 lpc17_40_boardinitialize(void)
|
||||
{
|
||||
/* Initialize the EMC, SDRAM, NOR FLASH, and NAND FLASH */
|
||||
|
||||
#ifdef CONFIG_LPC17_40_EMC
|
||||
lpc17_40_emcinitialize();
|
||||
|
||||
#ifdef CONFIG_LPC17_40_EXTDRAM
|
||||
lpc4088_devkit_sdram_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LPC17_40_EXTNOR
|
||||
lpc4088_devkit_nor_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LPC17_40_EXTNAND
|
||||
lpc4088_devkit_nand_initialize();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_LPC17_40_SSP0) || defined(CONFIG_LPC17_40_SSP1) || \
|
||||
defined(CONFIG_LPC17_40_SSP2)
|
||||
/* Configure SSP chip selects if 1) at least one SSP is enabled, and 2)
|
||||
* the weak function lpc4088_devkit_sspdev_initialize() has been brought into
|
||||
* the link.
|
||||
*/
|
||||
|
||||
if (lpc4088_devkit_sspdev_initialize)
|
||||
{
|
||||
lpc4088_devkit_sspdev_initialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
board_autoled_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LPC17_40_LCD
|
||||
/* Configure the LCD GPIOs if LCD support has been selected. */
|
||||
|
||||
lpc4088_devkit_lcd_initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_late_initialize
|
||||
*
|
||||
* 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_initialize() is called and just before the
|
||||
* initial application is started. This additional initialization phase
|
||||
* may be used, for example, to initialize board-specific device drivers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
void board_late_initialize(void)
|
||||
{
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
(void)lpc4088_devkit_bringup();
|
||||
}
|
||||
#endif
|
||||
400
configs/lpc4088-devkit/src/lpc17_40_bringup.c
Normal file
400
configs/lpc4088-devkit/src/lpc17_40_bringup.c
Normal file
|
|
@ -0,0 +1,400 @@
|
|||
/****************************************************************************
|
||||
* config/lpc4088-devkit/src/lpc17_40_bringup.c
|
||||
*
|
||||
* Copyright (C) 2013, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/kthread.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/sdio.h>
|
||||
#include <nuttx/mmcsd.h>
|
||||
#include <nuttx/video/fb.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
|
||||
#include "lpc17_40_gpio.h"
|
||||
#include "lpc17_40_sdcard.h"
|
||||
#include "lpc17_40_usbhost.h"
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#define NSH_HAVE_MMCSD 1
|
||||
#define NSH_HAVE_USBHOST 1
|
||||
#define NSH_HAVE_USBHDEV 1
|
||||
|
||||
#undef NSH_HAVE_MMCSD_CD
|
||||
#undef NSH_HAVE_MMCSD_CDINT
|
||||
|
||||
/* MMC/SD support */
|
||||
|
||||
#if !defined(CONFIG_LPC17_40_SDCARD) || !defined(CONFIG_MMCSD) && !defined(CONFIG_MMCD_SDIO)
|
||||
# undef NSH_HAVE_MMCSD
|
||||
#endif
|
||||
|
||||
/* Can't support MMC/SD features if mountpoints are disabled */
|
||||
|
||||
#if defined(CONFIG_DISABLE_MOUNTPOINT)
|
||||
# undef NSH_HAVE_MMCSD
|
||||
#endif
|
||||
|
||||
/* MMC/SD support requires that an SPI support is enabled and an SPI port is selected */
|
||||
|
||||
#ifdef NSH_HAVE_MMCSD
|
||||
# if !defined(CONFIG_NSH_MMCSDSLOTNO)
|
||||
# warning "Assuming slot MMC/SD slot 0"
|
||||
# define CONFIG_NSH_MMCSDSLOTNO 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef NSH_HAVE_MMCSD
|
||||
# if !defined(CONFIG_NSH_MMCSDMINOR)
|
||||
# warning "Assuming /dev/mmcsd0"
|
||||
# define CONFIG_NSH_MMCSDMINOR 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The SD card detect (CD) signal is on the port expander U8, bit 4.
|
||||
* The port expander is not currently supported. If support is added,
|
||||
* this section can be uncommented.
|
||||
*/
|
||||
#if 0
|
||||
# ifdef NSH_HAVE_MMCSD
|
||||
# ifdef CONFIG_MMCSD_HAVE_CARDDETECT
|
||||
# define NSH_HAVE_MMCSD_CD 1
|
||||
# ifdef CONFIG_LPC17_40_GPIOIRQ
|
||||
# define NSH_HAVE_MMCSD_CDINT 1
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* USB Host */
|
||||
|
||||
#ifndef CONFIG_USBHOST
|
||||
# undef NSH_HAVE_USBHOST
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_LPC17_40_USBHOST
|
||||
# undef NSH_HAVE_USBHOST
|
||||
#endif
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
# ifndef CONFIG_USBHOST_DEFPRIO
|
||||
# define CONFIG_USBHOST_DEFPRIO 50
|
||||
# endif
|
||||
# ifndef CONFIG_USBHOST_STACKSIZE
|
||||
# ifdef CONFIG_USBHOST_HUB
|
||||
# define CONFIG_USBHOST_STACKSIZE 1536
|
||||
# else
|
||||
# define CONFIG_USBHOST_STACKSIZE 1024
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* USB Device */
|
||||
|
||||
#ifndef CONFIG_USBDEV
|
||||
# undef NSH_HAVE_USBDEV
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_LPC17_40_USBDEV
|
||||
# undef NSH_HAVE_USBDEV
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
#ifdef NSH_HAVE_MMCSD
|
||||
static FAR struct sdio_dev_s *g_sdiodev;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_waiter
|
||||
*
|
||||
* Description:
|
||||
* Wait for USB devices to be connected.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
static int nsh_waiter(int argc, char *argv[])
|
||||
{
|
||||
struct usbhost_hubport_s *hport;
|
||||
|
||||
syslog(LOG_INFO, "nsh_waiter: Running\n");
|
||||
for (;;)
|
||||
{
|
||||
/* Wait for the device to change state */
|
||||
|
||||
DEBUGVERIFY(CONN_WAIT(g_usbconn, &hport));
|
||||
syslog(LOG_INFO, "nsh_waiter: %s\n",
|
||||
hport->connected ? "connected" : "disconnected");
|
||||
|
||||
/* Did we just become connected? */
|
||||
|
||||
if (hport->connected)
|
||||
{
|
||||
/* Yes.. enumerate the newly connected device */
|
||||
|
||||
(void)CONN_ENUMERATE(g_usbconn, hport);
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep the compiler from complaining */
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_sdinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize SPI-based microSD.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVE_MMCSD
|
||||
static int nsh_sdinitialize(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Enable power to the SD card */
|
||||
|
||||
lpc17_40_configgpio(GPIO_SD_PWR);
|
||||
|
||||
#ifdef NSH_HAVE_MMCSD_CD
|
||||
/* Configure the SD card detect GPIO */
|
||||
|
||||
lpc17_40_configgpio(GPIO_SD_CD);
|
||||
|
||||
#endif
|
||||
|
||||
/* First, get an instance of the SDIO interface */
|
||||
|
||||
g_sdiodev = sdio_initialize(CONFIG_NSH_MMCSDSLOTNO);
|
||||
if (!g_sdiodev)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize SDIO slot %d\n",
|
||||
CONFIG_NSH_MMCSDSLOTNO);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Now bind the SDIO interface to the MMC/SD driver */
|
||||
|
||||
ret = mmcsd_slotinitialize(CONFIG_NSH_MMCSDMINOR, g_sdiodev);
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to bind SDIO to the MMC/SD driver: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Check if there is a card in the slot and inform the SDCARD driver. If
|
||||
* we do not support the card detect, then let's assume that there is
|
||||
* one.
|
||||
*/
|
||||
|
||||
#ifdef NSH_HAVE_MMCSD_CD
|
||||
sdio_mediachange(g_sdiodev, !lpc17_40_gpioread(GPIO_SD_CD));
|
||||
#else
|
||||
sdio_mediachange(g_sdiodev, true);
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
#else
|
||||
# define nsh_sdinitialize() (OK)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_usbhostinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize SPI-based microSD.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
static int nsh_usbhostinitialize(void)
|
||||
{
|
||||
int pid;
|
||||
int ret;
|
||||
|
||||
/* First, register all of the class drivers needed to support the drivers
|
||||
* that we care about:
|
||||
*/
|
||||
|
||||
syslog(LOG_INFO, "Register class drivers\n");
|
||||
|
||||
#ifdef CONFIG_USBHOST_MSC
|
||||
/* Register the USB host Mass Storage Class */
|
||||
|
||||
ret = usbhost_msc_initialize();
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to register the mass storage class: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_CDCACM
|
||||
/* Register the CDC/ACM serial class */
|
||||
|
||||
ret = usbhost_cdcacm_initialize();
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to register the CDC/ACM serial class: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
syslog(LOG_INFO, "Initialize USB host\n");
|
||||
g_usbconn = lpc17_40_usbhost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
syslog(LOG_INFO, "Start nsh_waiter\n");
|
||||
|
||||
pid = kthread_create("usbhost", CONFIG_USBHOST_DEFPRIO,
|
||||
CONFIG_USBHOST_STACKSIZE,
|
||||
(main_t)nsh_waiter, (FAR char * const *)NULL);
|
||||
return pid < 0 ? -ENOEXEC : OK;
|
||||
}
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
#else
|
||||
# define nsh_usbhostinitialize() (OK)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lpc4088_devkit_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library via boardctl()
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int lpc4088_devkit_bringup(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system at the default location, /proc */
|
||||
|
||||
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize SD Card*/
|
||||
|
||||
ret = nsh_sdinitialize();
|
||||
if (ret == OK)
|
||||
{
|
||||
/* Initialize USB host */
|
||||
|
||||
ret = nsh_usbhostinitialize();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_VIDEO_FB
|
||||
/* Initialize and register the framebuffer driver */
|
||||
|
||||
ret = fb_register(0, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INPUT_ADS7843E
|
||||
/* Initialize the touchscreen */
|
||||
|
||||
ret = lpc4088_devkit_tsc_setup(0);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: lpc4088_devkit_tsc_setup failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LPC4088_DEVKIT_DJOYSTICK
|
||||
/* Initialize and register the joystick driver */
|
||||
|
||||
ret = lpc17_40_djoy_initialization();
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to register the joystick driver: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
240
configs/lpc4088-devkit/src/lpc17_40_buttons.c
Normal file
240
configs/lpc4088-devkit/src/lpc17_40_buttons.c
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
/****************************************************************************
|
||||
* configs/lpc4088-devkit/src/lpc17_40_buttons.c
|
||||
*
|
||||
* Copyright (C) 2013, 2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "lpc17_40_gpio.h"
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* The LPC4088 Developer's Kit supports several buttons. All will read "1"
|
||||
* when open and "0" when closed
|
||||
*
|
||||
* USER1 -- Connected to P4[26]
|
||||
* USER2 -- Connected to P2[22]
|
||||
* USER3 -- Connected to P0[10]
|
||||
*
|
||||
* And a Joystick
|
||||
*
|
||||
* JOY_A -- Connected to P2[25]
|
||||
* JOY_B -- Connected to P2[26]
|
||||
* JOY_C -- Connected to P2[23]
|
||||
* JOY_D -- Connected to P2[19]
|
||||
* JOY_CTR -- Connected to P0[14]
|
||||
*
|
||||
* The switches are all connected to ground and should be pulled up and sensed
|
||||
* with a value of '0' when closed.
|
||||
*/
|
||||
|
||||
/* Pin configuration for each LPC4088 Developer's Kit button. This array is
|
||||
* indexed by the BUTTON_* and JOYSTICK_* definitions in board.h
|
||||
*/
|
||||
|
||||
static const lpc17_40_pinset_t g_buttoncfg[NUM_BUTTONS] =
|
||||
{
|
||||
GPIO_USER1, GPIO_JOY_A, GPIO_JOY_B, GPIO_JOY_C, GPIO_JOY_D, GPIO_JOY_CTR
|
||||
};
|
||||
|
||||
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC17_40_GPIOIRQ)
|
||||
/* This array provides the mapping from button ID numbers to button IRQ
|
||||
* numbers.
|
||||
*/
|
||||
|
||||
static const uint8_t g_buttonirq[NUM_BUTTONS] =
|
||||
{
|
||||
GPIO_USER2_IRQ, GPIO_JOY_A_IRQ, GPIO_JOY_B_IRQ, GPIO_JOY_C_IRQ,
|
||||
GPIO_JOY_D_IRQ, GPIO_JOY_CTR_IRQ
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_button_initialize(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Configure the GPIO pins as interrupting inputs. */
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
lpc17_40_configgpio(g_buttoncfg[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* board_buttons() may be called at any time to harvest the state of every
|
||||
* button. The state of the buttons is returned as a bitset with one
|
||||
* bit corresponding to each button: If the bit is set, then the button
|
||||
* is pressed. See the BOARD_BUTTON_*_BIT and BOARD_JOYSTICK_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed. */
|
||||
|
||||
bool released = lpc17_40_gpioread(g_buttoncfg[i]);
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
* will be called when a button is depressed or released. The ID value is
|
||||
* a button enumeration value that uniquely identifies a button resource.
|
||||
* See the BOARD_BUTTON_* and BOARD_JOYSTICK_* definitions in board.h for
|
||||
* the meaning of enumeration values.
|
||||
*
|
||||
* Note that board_button_irq() also enables button interrupts. Button
|
||||
* interrupts will remain enabled after the interrupt handler is attached.
|
||||
* Interrupts may be disabled (and detached) by calling board_button_irq with
|
||||
* irqhandler equal to NULL.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_LPC17_40_GPIOIRQ)
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
irqstate_t flags;
|
||||
int ret = -EINVAL;
|
||||
int irq;
|
||||
|
||||
/* Verify that the button ID is within range */
|
||||
|
||||
if ((unsigned)id < NUM_BUTTONS)
|
||||
{
|
||||
/* Get the IRQ number for the button; A value of zero indicates that
|
||||
* the button does not support the interrupt function.
|
||||
*/
|
||||
|
||||
irq = g_buttonirq[id];
|
||||
if (irq > 0)
|
||||
{
|
||||
/* Disable interrupts until we are done */
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
/* Configure the interrupt. Either attach and enable the new
|
||||
* interrupt or disable and detach the old interrupt handler.
|
||||
*/
|
||||
|
||||
if (irqhandler)
|
||||
{
|
||||
/* Attach then enable the new interrupt handler */
|
||||
|
||||
(void)irq_attach(irq, irqhandler, arg);
|
||||
up_enable_irq(irq);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable then detach the old interrupt handler */
|
||||
|
||||
up_disable_irq(irq);
|
||||
(void)irq_detach(irq);
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
||||
336
configs/lpc4088-devkit/src/lpc17_40_djoystick.c
Normal file
336
configs/lpc4088-devkit/src/lpc17_40_djoystick.c
Normal file
|
|
@ -0,0 +1,336 @@
|
|||
/****************************************************************************
|
||||
* configs/lpc4088-devkit/src/lpc17_40_djoystick.c
|
||||
*
|
||||
* Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/input/djoystick.h>
|
||||
|
||||
#include "lpc17_40_gpio.h"
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* The LPC4088 Developer's Kit supports several buttons. All will read "1"
|
||||
* when open and "0" when closed
|
||||
*
|
||||
* USER1 -- Connected to P2[10]
|
||||
*
|
||||
* Joystick:
|
||||
*
|
||||
* JOY_A -- Connected to P2[23]
|
||||
* JOY_B -- Connected to P2[25]
|
||||
* JOY_C -- Connected to P2[26]
|
||||
* JOY_D -- Connected to P2[27]
|
||||
* JOY_CTR -- Connected to P2[22]
|
||||
*
|
||||
* The switches are all connected to ground and should be pulled up and sensed
|
||||
* with a value of '0' when closed.
|
||||
*
|
||||
* Mapping to DJOYSTICK buttons:
|
||||
*
|
||||
* DJOY_UP JOY_B
|
||||
* DJOY_DOWN JOY_C
|
||||
* DJOY_LEFT JOY_A
|
||||
* DJOY_RIGHT JOY_D
|
||||
* DJOY_BUTTON_1 JOY_CTR
|
||||
* DJOY_BUTTON_2 USER1
|
||||
*/
|
||||
|
||||
/* Number of Joystick discretes */
|
||||
|
||||
#define DJOY_NGPIOS 6
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
static djoy_buttonset_t djoy_supported(FAR const struct djoy_lowerhalf_s *lower);
|
||||
static djoy_buttonset_t djoy_sample(FAR const struct djoy_lowerhalf_s *lower);
|
||||
static void djoy_enable(FAR const struct djoy_lowerhalf_s *lower,
|
||||
djoy_buttonset_t press, djoy_buttonset_t release,
|
||||
djoy_interrupt_t handler, FAR void *arg);
|
||||
|
||||
|
||||
static void djoy_disable(void);
|
||||
static int djoy_interrupt(int irq, FAR void *context, FAR void *arg);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
/* Pin configuration for each LPC4088 Developer's Kit joystick "button."
|
||||
* Indexed using DJOY_* definitions in include/nuttx/input/djoystick.h.
|
||||
*/
|
||||
|
||||
static const lpc17_40_pinset_t g_joygpio[DJOY_NGPIOS] =
|
||||
{
|
||||
GPIO_JOY_B, GPIO_JOY_C, GPIO_JOY_A, GPIO_JOY_D,
|
||||
GPIO_JOY_CTR, GPIO_USER1
|
||||
};
|
||||
|
||||
#ifdef CONFIG_LPC17_40_GPIOIRQ
|
||||
/* This array provides the mapping from button ID numbers to button IRQ
|
||||
* numbers. Indexed using DJOY_* definitions in
|
||||
* include/nuttx/input/djoystick.h.
|
||||
*/
|
||||
|
||||
static const uint8_t g_buttonirq[DJOY_NGPIOS] =
|
||||
{
|
||||
GPIO_JOY_B_IRQ, GPIO_JOY_C_IRQ, GPIO_JOY_A_IRQ, GPIO_JOY_D_IRQ,
|
||||
GPIO_JOY_CTR_IRQ, GPIO_USER1_IRQ
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Current interrupt handler and argument */
|
||||
|
||||
static djoy_interrupt_t g_djoyhandler;
|
||||
static FAR void *g_djoyarg;
|
||||
|
||||
/* This is the discrete joystick lower half driver interface */
|
||||
|
||||
static const struct djoy_lowerhalf_s g_djoylower =
|
||||
{
|
||||
.dl_supported = djoy_supported,
|
||||
.dl_sample = djoy_sample,
|
||||
.dl_enable = djoy_enable,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: djoy_supported
|
||||
*
|
||||
* Description:
|
||||
* Return the set of buttons supported on the discrete joystick device
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static djoy_buttonset_t djoy_supported(FAR const struct djoy_lowerhalf_s *lower)
|
||||
{
|
||||
iinfo("Supported: %02x\n", DJOY_ALLBITS);
|
||||
return (djoy_buttonset_t)DJOY_ALLBITS;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: djoy_sample
|
||||
*
|
||||
* Description:
|
||||
* Return the current state of all discrete joystick buttons
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static djoy_buttonset_t djoy_sample(FAR const struct djoy_lowerhalf_s *lower)
|
||||
{
|
||||
djoy_buttonset_t ret = 0;
|
||||
int i;
|
||||
|
||||
/* Read each joystick GPIO value */
|
||||
|
||||
for (i = 0; i < DJOY_NGPIOS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed. */
|
||||
|
||||
bool released = lpc17_40_gpioread(g_joygpio[i]);
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
iinfo("Returning: %02x\n", DJOY_ALLBITS);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: djoy_enable
|
||||
*
|
||||
* Description:
|
||||
* Enable interrupts on the selected set of joystick buttons. And empty
|
||||
* set will disable all interrupts.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void djoy_enable(FAR const struct djoy_lowerhalf_s *lower,
|
||||
djoy_buttonset_t press, djoy_buttonset_t release,
|
||||
djoy_interrupt_t handler, FAR void *arg)
|
||||
{
|
||||
#ifdef CONFIG_LPC17_40_GPIOIRQ
|
||||
irqstate_t flags;
|
||||
djoy_buttonset_t either = press | release;
|
||||
int irq;
|
||||
int i;
|
||||
|
||||
iinfo("press: %02x release: %02x handler: %p arg: %p\n",
|
||||
press, release, handler, arg);
|
||||
|
||||
/* Start with all interrupts disabled */
|
||||
|
||||
flags = enter_critical_section();
|
||||
djoy_disable();
|
||||
|
||||
/* If no events are indicated or if no handler is provided, then this
|
||||
* must really be a request to disable interrupts.
|
||||
*/
|
||||
|
||||
/* REVISIT: Currently does not distinguish press/release selections */
|
||||
|
||||
if (either && handler != NULL)
|
||||
{
|
||||
/* Save the new the handler and argument */
|
||||
|
||||
g_djoyhandler = handler;
|
||||
g_djoyarg = arg;
|
||||
|
||||
/* Attach and enable interrupts each GPIO. */
|
||||
|
||||
for (i = 0; i < DJOY_NGPIOS; i++)
|
||||
{
|
||||
irq = g_buttonirq[i];
|
||||
if (irq > 0)
|
||||
{
|
||||
(void)irq_attach(irq, djoy_interrupt, arg);
|
||||
up_enable_irq(irq);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: djoy_disable
|
||||
*
|
||||
* Description:
|
||||
* Disable all joystick interrupts
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void djoy_disable(void)
|
||||
{
|
||||
#ifdef CONFIG_LPC17_40_GPIOIRQ
|
||||
irqstate_t flags;
|
||||
int irq;
|
||||
int i;
|
||||
|
||||
/* Disable and detach all button handlers for each GPIO */
|
||||
|
||||
flags = enter_critical_section();
|
||||
for (i = 0; i < DJOY_NGPIOS; i++)
|
||||
{
|
||||
irq = g_buttonirq[i];
|
||||
if (irq > 0)
|
||||
{
|
||||
up_disable_irq(irq);
|
||||
(void)irq_detach(irq);
|
||||
}
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
#endif
|
||||
|
||||
/* Nullify the handler and argument */
|
||||
|
||||
g_djoyhandler = NULL;
|
||||
g_djoyarg = NULL;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: djoy_interrupt
|
||||
*
|
||||
* Description:
|
||||
* Discrete joystick interrupt handler
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int djoy_interrupt(int irq, FAR void *context, FAR void *arg)
|
||||
{
|
||||
DEBUGASSERT(g_djoyhandler != NULL);
|
||||
if (g_djoyhandler != NULL)
|
||||
{
|
||||
g_djoyhandler(&g_djoylower, g_djoyarg);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lpc17_40_djoy_initialization
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the discrete joystick driver
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int lpc17_40_djoy_initialization(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Configure the GPIO pins as inputs. NOTE: This is unnecessary for
|
||||
* interrupting pins since it will also be done by lpc17_40_gpiosetevent().
|
||||
*/
|
||||
|
||||
for (i = 0; i < DJOY_NGPIOS; i++)
|
||||
{
|
||||
lpc17_40_configgpio(g_joygpio[i]);
|
||||
}
|
||||
|
||||
/* Make sure that all interrupts are disabled */
|
||||
|
||||
djoy_disable();
|
||||
|
||||
/* Register the joystick device as /dev/djoy0 */
|
||||
|
||||
return djoy_register(CONFIG_LPC4088_DEVKIT_DJOYDEV, &g_djoylower);
|
||||
}
|
||||
88
configs/lpc4088-devkit/src/lpc17_40_lcd.c
Normal file
88
configs/lpc4088-devkit/src/lpc17_40_lcd.c
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
/************************************************************************************
|
||||
* configs/lpc4088-devkit/src/lpc17_40_lcd.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "lpc17_40_lcd.h"
|
||||
#include "lpc17_40_gpio.h"
|
||||
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
#ifdef CONFIG_LPC17_40_LCD
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc4088_devkit_lcd_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the LCD. Setup backlight (initially off)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void lpc4088_devkit_lcd_initialize(void)
|
||||
{
|
||||
/* Configure the LCD backlight (and turn the backlight off) */
|
||||
#ifdef CONFIG_LPC17_40_LCD_BACKLIGHT
|
||||
lpc17_40_configgpio(GPIO_LCD_BL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc17_40_backlight
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_LPC17_40_LCD_BACKLIGHT is defined, then the board-specific logic must
|
||||
* provide this interface to turn the backlight on and off.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LPC17_40_LCD_BACKLIGHT
|
||||
void lpc17_40_backlight(bool blon)
|
||||
{
|
||||
lpc17_40_gpiowrite(GPIO_LCD_BL, blon);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_LPC17_40_LCD */
|
||||
93
configs/lpc4088-devkit/src/lpc17_40_nandinitialize.c
Normal file
93
configs/lpc4088-devkit/src/lpc17_40_nandinitialize.c
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/************************************************************************************
|
||||
* configs/lpc4088-devkit/src/lpc17_40_nandinitialize.c
|
||||
* arch/arm/src/board/lpc17_40_nandinitialize.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
#if defined(CONFIG_LPC17_40_EMC) && defined(CONFIG_LPC17_40_EXTNAND)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc4088_devkit_nand_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize NAND FLASH
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void lpc4088_devkit_nand_initialize(void)
|
||||
{
|
||||
uint32_t regval;
|
||||
|
||||
/* Set the memory width and byte lanes */
|
||||
|
||||
regval = getreg32(LPC17_40_EMC_STATICCONFIG1);
|
||||
regval &= ~EMC_STATICCONFIG_MW_MASK;
|
||||
regbal |= (EMC_STATICCONFIG_MW_8BIT | EMC_STATICCONFIG_PB);
|
||||
putreg32(regval, LPC17_40_EMC_STATICCONFIG1);
|
||||
|
||||
/* Configure timing */
|
||||
|
||||
putreg32(2, LPC17_40_EMC_STATICWAITWEN1);
|
||||
putreg32(2, LPC17_40_EMC_STATICWAITOEN1);
|
||||
putreg32(31, LPC17_40_EMC_STATICWAITRD1);
|
||||
putreg32(31, LPC17_40_EMC_STATICWAITPAGE1);
|
||||
putreg32(31, LPC17_40_EMC_STATICWAITWR1);
|
||||
putreg32(31, LPC17_40_EMC_STATICWAITTURN1);
|
||||
|
||||
/* GPIO P2[21] connects to the Ready/Busy pin of the NAND part. We need to
|
||||
* reconfigure this pin as normal GPIO input.
|
||||
*/
|
||||
|
||||
lpc17_40_gpioconfig(GPIO_NAND_RB);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_LPC17_40_EMC && CONFIG_LPC17_40_EXTNAND */
|
||||
89
configs/lpc4088-devkit/src/lpc17_40_norinitialize.c
Normal file
89
configs/lpc4088-devkit/src/lpc17_40_norinitialize.c
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
/************************************************************************************
|
||||
* configs/lpc4088-devkit/src/lpc17_40_norinitialize.c
|
||||
* arch/arm/src/board/lpc17_40_norinitialize.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
#if defined(CONFIG_LPC17_40_EMC) && defined(CONFIG_LPC17_40_EXTNOR)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc4088_devkit_nor_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize NOR FLASH
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void lpc4088_devkit_nor_initialize(void)
|
||||
{
|
||||
uint32_t regval;
|
||||
|
||||
/* Set the memory width and byte lanes */
|
||||
|
||||
regval = getreg32(LPC17_40_EMC_STATICCONFIG0);
|
||||
regval &= ~EMC_STATICCONFIG_MW_MASK;
|
||||
regbal |= (EMC_STATICCONFIG_MW_16BIT | EMC_STATICCONFIG_PB);
|
||||
putreg32(regval, LPC17_40_EMC_STATICCONFIG0);
|
||||
|
||||
/* Configure timing */
|
||||
|
||||
putreg32(2, LPC17_40_EMC_STATICWAITWEN0);
|
||||
putreg32(2, LPC17_40_EMC_STATICWAITOEN0);
|
||||
putreg32(31, LPC17_40_EMC_STATICWAITRD0);
|
||||
putreg32(31, LPC17_40_EMC_STATICWAITPAGE0);
|
||||
putreg32(31, LPC17_40_EMC_STATICWAITWR0);
|
||||
putreg32(31, LPC17_40_EMC_STATICWAITTURN0);
|
||||
|
||||
up_mdelay(10);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_LPC17_40_EMC && CONFIG_LPC17_40_EXTNOR */
|
||||
234
configs/lpc4088-devkit/src/lpc17_40_sdraminitialize.c
Normal file
234
configs/lpc4088-devkit/src/lpc17_40_sdraminitialize.c
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
/************************************************************************************
|
||||
* configs/lpc4088-devkit/src/lpc17_40_sdraminitialize.c
|
||||
* arch/arm/src/board/lpc17_40_sdraminitialize.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "chip/lpc17_40_syscon.h"
|
||||
#include "lpc17_40_emc.h"
|
||||
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
#if defined(CONFIG_LPC17_40_EMC) && defined(CONFIG_LPC17_40_EXTDRAM)
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* The core clock is LPC17_40_EMCCLK which may be either LPC17_40_CCLK* (undivided), or
|
||||
* LPC17_40_CCLK / 2 as determined by settings in the board.h header file.
|
||||
*
|
||||
* For example:
|
||||
* LPC17_40_CCLCK = 120,000,000
|
||||
* EMCCLKSEL -> LPC17_40_CCLK divided by 2
|
||||
* LPC17_40_EMCCLK = 60,000,000
|
||||
* LPC17_40_EMCCLK_MHZ = 60 (Rounded to an integer)
|
||||
* EMC_NSPERCLK = 16.667 (Represented with 4 bits of fraction, 267)
|
||||
*
|
||||
* EMC_NS2CLK(63) = ((63 << 4) + 266) / 267 = 4 (actual 3.78)
|
||||
* EMC_NS2CLK(20) = ((20 << 4) + 266) / 267 = 2 (actual 1.20)
|
||||
*/
|
||||
|
||||
#define LPC17_40_EMCCLK_MHZ ((LPC17_40_EMCCLK + 500000) / 1000000)
|
||||
#define EMC_NSPERCLK_B4 (((1000 << 4) + (LPC17_40_EMCCLK_MHZ >> 1)) / LPC17_40_EMCCLK_MHZ)
|
||||
#define EMC_NS2CLK(ns) (((ns << 4) + (EMC_NSPERCLK_B4 - 1)) / EMC_NSPERCLK_B4)
|
||||
#define MDKCFG_RASCAS0VAL 0x00000303
|
||||
|
||||
/* Set up for 32-bit SDRAM at CS0 */
|
||||
|
||||
#ifdef CONFIG_LPC17_40_EXTDRAMSIZE
|
||||
# define SDRAM_SIZE CONFIG_LPC17_40_EXTDRAMSIZE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LPC17_40_SDRAM_16BIT
|
||||
# ifndef SDRAM_SIZE
|
||||
# define SDRAM_SIZE 0x02000000 /* 256Mbit */
|
||||
# endif
|
||||
#else /* if defined(CONFIG_LPC17_40_SDRAM_32BIT) */
|
||||
# undef CONFIG_LPC17_40_SDRAM_32BIT
|
||||
# define CONFIG_LPC17_40_SDRAM_32BIT 1
|
||||
# ifndef SDRAM_SIZE
|
||||
# define SDRAM_SIZE 0x04000000 /* 512Mbit */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define SDRAM_BASE 0xa0000000 /* CS0 */
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc4088_devkit_sdram_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize SDRAM
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void lpc4088_devkit_sdram_initialize(void)
|
||||
{
|
||||
uint32_t regval;
|
||||
int i;
|
||||
|
||||
/* Reconfigure delays:
|
||||
*
|
||||
* CMDDLY: Programmable delay value for EMC outputs in command delayed
|
||||
* mode. The delay amount is roughly CMDDLY * 250 picoseconds.
|
||||
* FBCLKDLY: Programmable delay value for the feedback clock that controls
|
||||
* input data sampling. The delay amount is roughly (FBCLKDLY+1) * 250
|
||||
* picoseconds.
|
||||
* CLKOUT0DLY: Programmable delay value for the CLKOUT0 output. This would
|
||||
* typically be used in clock delayed mode. The delay amount is roughly
|
||||
* (CLKOUT0DLY+1) * 250 picoseconds.
|
||||
* CLKOUT1DLY: Programmable delay value for the CLKOUT1 output. This would
|
||||
* typically be used in clock delayed mode. The delay amount is roughly
|
||||
* (CLKOUT1DLY+1) * 250 picoseconds.
|
||||
*/
|
||||
|
||||
regval = SYSCON_EMCDLYCTL_CMDDLY(32) |
|
||||
SYSCON_EMCDLYCTL_FBCLKDLY(32) |
|
||||
SYSCON_EMCDLYCTL_CLKOUT0DLY(1) |
|
||||
SYSCON_EMCDLYCTL_CLKOUT1DLY(1);
|
||||
putreg32(regval, LPC17_40_SYSCON_EMCDLYCTL);
|
||||
|
||||
/* Configure the SDRAM */
|
||||
|
||||
putreg32( EMC_NS2CLK(20), LPC17_40_EMC_DYNAMICRP); /* TRP = 20 nS */
|
||||
putreg32( 15, LPC17_40_EMC_DYNAMICRAS); /* RAS = 42ns to 100K ns, */
|
||||
putreg32( 0, LPC17_40_EMC_DYNAMICSREX); /* TSREX = 1 clock */
|
||||
putreg32( 1, LPC17_40_EMC_DYNAMICAPR); /* TAPR = 2 clocks? */
|
||||
putreg32(EMC_NS2CLK(20) + 2, LPC17_40_EMC_DYNAMICDAL); /* TDAL = TRP + TDPL = 20ns + 2clk */
|
||||
putreg32( 1, LPC17_40_EMC_DYNAMICWR); /* TWR = 2 clocks */
|
||||
putreg32( EMC_NS2CLK(63), LPC17_40_EMC_DYNAMICRC); /* H57V2562GTR-75C TRC = 63ns(min)*/
|
||||
putreg32( EMC_NS2CLK(63), LPC17_40_EMC_DYNAMICRFC); /* H57V2562GTR-75C TRFC = TRC */
|
||||
putreg32( 15, LPC17_40_EMC_DYNAMICXSR); /* Exit self-refresh to active */
|
||||
putreg32( EMC_NS2CLK(63), LPC17_40_EMC_DYNAMICRRD); /* 3 clock, TRRD = 15ns (min) */
|
||||
putreg32( 1, LPC17_40_EMC_DYNAMICMRD); /* 2 clock, TMRD = 2 clocks (min) */
|
||||
|
||||
/* Command delayed strategy, using EMCCLKDELAY */
|
||||
|
||||
putreg32(EMC_DYNAMICREADCONFIG_RD_CMD, LPC17_40_EMC_DYNAMICREADCONFIG);
|
||||
|
||||
/* H57V2562GTR-75C: TCL=3CLK, TRCD = 20ns(min), 3 CLK = 24ns */
|
||||
|
||||
putreg32(MDKCFG_RASCAS0VAL, LPC17_40_EMC_DYNAMICRASCAS0);
|
||||
|
||||
#ifdef CONFIG_LPC17_40_SDRAM_16BIT
|
||||
/* For Manley lpc1778 SDRAM: H57V2562GTR-75C, 256Mb, 16Mx16, 4 banks, row=13, column=9:
|
||||
*
|
||||
* 256Mb, 16Mx16, 4 banks, row=13, column=9, RBC
|
||||
*/
|
||||
|
||||
putreg32(EMC_DYNAMICCONFIG_MD_SDRAM | EMC_DYNAMICCONFIG_AM0(13),
|
||||
LPC17_40_EMC_DYNAMICCONFIG0);
|
||||
|
||||
#elif defined CONFIG_LPC17_40_SDRAM_32BIT
|
||||
/* 256Mb, 16Mx16, 4 banks, row=13, column=9, RBC */
|
||||
|
||||
putreg32(EMC_DYNAMICCONFIG_MD_SDRAM | EMC_DYNAMICCONFIG_AM0(13) | EMC_DYNAMICCONFIG_AM1,
|
||||
LPC17_40_EMC_DYNAMICCONFIG0);
|
||||
#endif
|
||||
|
||||
up_mdelay(100);
|
||||
|
||||
/* Issue NOP command */
|
||||
|
||||
putreg32(EMC_DYNAMICCONTROL_CE | EMC_DYNAMICCONTROL_CS | EMC_DYNAMICCONTROL_I_NOP,
|
||||
LPC17_40_EMC_DYNAMICCONTROL);
|
||||
|
||||
/* Wait 200 Msec */
|
||||
|
||||
up_mdelay(200);
|
||||
|
||||
/* Issue PALL command */
|
||||
|
||||
putreg32(EMC_DYNAMICCONTROL_CE | EMC_DYNAMICCONTROL_CS | EMC_DYNAMICCONTROL_I_PALL,
|
||||
LPC17_40_EMC_DYNAMICCONTROL);
|
||||
|
||||
putreg32(2, LPC17_40_EMC_DYNAMICREFRESH); /* ( n * 16 ) -> 32 clock cycles */
|
||||
|
||||
/* Wait 128 AHB clock cycles */
|
||||
|
||||
for (i = 0; i < 128; i++);
|
||||
|
||||
/* 64ms/8192 = 7.8125us, nx16x8.33ns < 7.8125us, n < 58.6*/
|
||||
|
||||
regval = 64000000 / (1 << 13);
|
||||
regval -= 16;
|
||||
regval >>= 4;
|
||||
regval = regval * LPC17_40_EMCCLK_MHZ / 1000;
|
||||
putreg32(regval, LPC17_40_EMC_DYNAMICREFRESH);
|
||||
|
||||
/* Issue MODE command */
|
||||
|
||||
putreg32(EMC_DYNAMICCONTROL_CE | EMC_DYNAMICCONTROL_CS | EMC_DYNAMICCONTROL_I_MODE,
|
||||
LPC17_40_EMC_DYNAMICCONTROL);
|
||||
|
||||
#ifdef CONFIG_LPC17_40_SDRAM_16BIT
|
||||
(void)getreg16(SDRAM_BASE | (0x33 << 12)); /* 8 burst, 3 CAS latency */
|
||||
#elif defined CONFIG_LPC17_40_SDRAM_32BIT
|
||||
(void)getreg32(SDRAM_BASE | (0x32 << 13)); /* 4 burst, 3 CAS latency */
|
||||
#endif
|
||||
|
||||
/* Issue NORMAL command */
|
||||
|
||||
putreg32(EMC_DYNAMICCONTROL_I_NORMAL, LPC17_40_EMC_DYNAMICCONTROL);
|
||||
|
||||
/* Enable buffer */
|
||||
|
||||
regval = getreg32(LPC17_40_EMC_DYNAMICCONFIG0);
|
||||
regval |= EMC_DYNAMICCONFIG_B;
|
||||
putreg32(regval, LPC17_40_EMC_DYNAMICCONFIG0);
|
||||
up_mdelay(12);
|
||||
|
||||
regval = getreg32(LPC17_40_SYSCON_EMCDLYCTL);
|
||||
regval &= ~SYSCON_EMCDLYCTL_CMDDLY_MASK;
|
||||
regval |= SYSCON_EMCDLYCTL_CMDDLY(18);
|
||||
putreg32(regval, LPC17_40_SYSCON_EMCDLYCTL);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_LPC17_40_EMC && CONFIG_LPC17_40_EXTDRAM */
|
||||
179
configs/lpc4088-devkit/src/lpc17_40_ssp.c
Normal file
179
configs/lpc4088-devkit/src/lpc17_40_ssp.c
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
/****************************************************************************
|
||||
* configs/lpc4088-devkit/src/lpc17_40_ssp.c
|
||||
* arch/arm/src/board/lpc17_40_ssp.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "chip.h"
|
||||
#include "lpc17_40_gpio.h"
|
||||
#include "lpc17_40_ssp.h"
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
#if defined(CONFIG_LPC17_40_SSP0) || defined(CONFIG_LPC17_40_SSP1) || \
|
||||
defined(CONFIG_LPC17_40_SSP2)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Dump GPIO registers */
|
||||
|
||||
#ifdef CONFIG_DEBUG_GPIO_INFO
|
||||
# define ssp_dumpgpio(p,m) lpc17_40_dumpgpio(p,m)
|
||||
#else
|
||||
# define ssp_dumpgpio(p,m)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lpc4088_devkit_sspdev_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins for the LPC1766-STK.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void weak_function lpc4088_devkit_sspdev_initialize(void)
|
||||
{
|
||||
/* Configure the SSP0 chip select GPIOs. */
|
||||
|
||||
#ifdef CONFIG_LPC17_40_SSP0
|
||||
#endif
|
||||
|
||||
/* Configure SSP1 chip select GPIOs. This includes the touchscreen on the
|
||||
* the LCD module.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LPC17_40_SSP1
|
||||
ssp_dumpgpio(GPIO_TC_CS, "BEFORE SSP1 Initialization");
|
||||
lpc17_40_configgpio(GPIO_TC_CS);
|
||||
ssp_dumpgpio(GPIO_TC_CS, "AFTER SSP1 Initialization");
|
||||
#endif
|
||||
|
||||
/* Configure the SSP2 chip select GPIOs. */
|
||||
|
||||
#ifdef CONFIG_LPC17_40_SSP2
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc17_40_ssp0/1/2select and lpc17_40_ssp0/1/2status
|
||||
*
|
||||
* Description:
|
||||
* The external functions, lpc17_40_ssp0/1/2select and lpc17_40_ssp0/1/2status
|
||||
* must be provided by board-specific logic. They are implementations of the select
|
||||
* and status methods of the SPI interface defined by struct spi_ops_s (see
|
||||
* include/nuttx/spi/spi.h). All other methods (including lpc17_40_sspbus_initialize())
|
||||
* are provided by common LPC17xx/LPC40xx logic. To use this common SPI logic on your
|
||||
* board:
|
||||
*
|
||||
* 1. Provide logic in lpc17_40_boardinitialize() to configure SPI/SSP chip select
|
||||
* pins.
|
||||
* 2. Provide lpc17_40_ssp0/1/2select() and lpc17_40_ssp0/1/2status() functions
|
||||
* in your board-specific logic. These functions will perform chip selection
|
||||
* and status operations using GPIOs in the way your board is configured.
|
||||
* 3. Add a calls to lpc17_40_sspbus_initialize() in your low level application
|
||||
* initialization logic
|
||||
* 4. The handle returned by lpc17_40_sspbus_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).
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LPC17_40_SSP0
|
||||
void lpc17_40_ssp0select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
}
|
||||
|
||||
uint8_t lpc17_40_ssp0status(FAR struct spi_dev_s *dev, uint32_t devid)
|
||||
{
|
||||
spiinfo("Returning nothing\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LPC17_40_SSP1
|
||||
void lpc17_40_ssp1select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
if (devid == SPIDEV_TOUCHSCREEN(0))
|
||||
{
|
||||
/* Assert/de-assert the CS pin to the touchscreen */
|
||||
|
||||
ssp_dumpgpio(GPIO_TC_CS, "lpc17_40_ssp1select() Entry");
|
||||
lpc17_40_gpiowrite(GPIO_TC_CS, !selected);
|
||||
ssp_dumpgpio(GPIO_TC_CS, "lpc17_40_ssp1select() Exit");
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t lpc17_40_ssp1status(FAR struct spi_dev_s *dev, uint32_t devid)
|
||||
{
|
||||
spiinfo("Returning nothing\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LPC17_40_SSP2
|
||||
void lpc17_40_ssp2select(FAR struct spi_dev_s *dev, uint32_t devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
}
|
||||
|
||||
uint8_t lpc17_40_ssp2status(FAR struct spi_dev_s *dev, uint32_t devid)
|
||||
{
|
||||
spiinfo("Returning nothing\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_LPC17_40_SSP0 || CONFIG_LPC17_40_SSP1 || CONFIG_LPC17_40_SSP2 */
|
||||
314
configs/lpc4088-devkit/src/lpc17_40_touchscreen.c
Normal file
314
configs/lpc4088-devkit/src/lpc17_40_touchscreen.c
Normal file
|
|
@ -0,0 +1,314 @@
|
|||
/************************************************************************************
|
||||
* configs/lpc4088-devkit/src/lpc17_40_touchscreen.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
#include <nuttx/input/ads7843e.h>
|
||||
|
||||
#include "lpc17_40_gpio.h"
|
||||
#include "lpc17_40_ssp.h"
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
#ifdef CONFIG_INPUT_ADS7843E
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifndef CONFIG_INPUT
|
||||
# error "Touchscreen support requires CONFIG_INPUT"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_LPC17_40_SSP1
|
||||
# error "Touchscreen support requires CONFIG_LPC17_40_SSP1"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_LPC17_40_GPIOIRQ
|
||||
# error "Touchscreen support requires CONFIG_LPC17_40_GPIOIRQ"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ADS7843E_FREQUENCY
|
||||
# define CONFIG_ADS7843E_FREQUENCY 500000
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ADS7843E_SPIDEV
|
||||
# define CONFIG_ADS7843E_SPIDEV 1
|
||||
#endif
|
||||
|
||||
#if CONFIG_ADS7843E_SPIDEV != 1
|
||||
# error "CONFIG_ADS7843E_SPIDEV must be one"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_ADS7843E_DEVMINOR
|
||||
# define CONFIG_ADS7843E_DEVMINOR 0
|
||||
#endif
|
||||
|
||||
/* REVISIT: Currently, XPT2046 reports BUSY all of the time. This is
|
||||
* probably GPIO setting issues. But there is this cryptic statement in
|
||||
* the XPT2046 spec: "No DCLK delay required with dedicated serial port."
|
||||
*
|
||||
* The busy state is used by the XPT2046 driver to control the delay
|
||||
* between sending the command, then reading the returned data.
|
||||
*/
|
||||
|
||||
#define XPT2046_NO_BUSY 1
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* IRQ/GPIO access callbacks. These operations all hidden behind
|
||||
* callbacks to isolate the XPT2046 driver from differences in GPIO
|
||||
* interrupt handling by varying boards and MCUs. If possible,
|
||||
* interrupts should be configured on both rising and falling edges
|
||||
* so that contact and loss-of-contact events can be detected.
|
||||
*
|
||||
* attach - Attach the XPT2046 interrupt handler to the GPIO interrupt
|
||||
* enable - Enable or disable the GPIO interrupt
|
||||
* clear - Acknowledge/clear any pending GPIO interrupt
|
||||
* pendown - Return the state of the pen down GPIO input
|
||||
*/
|
||||
|
||||
static int tsc_attach(FAR struct ads7843e_config_s *state, xcpt_t isr);
|
||||
static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable);
|
||||
static void tsc_clear(FAR struct ads7843e_config_s *state);
|
||||
static bool tsc_busy(FAR struct ads7843e_config_s *state);
|
||||
static bool tsc_pendown(FAR struct ads7843e_config_s *state);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* A reference to a structure of this type must be passed to the XPT2046
|
||||
* driver. This structure provides information about the configuration
|
||||
* of the XPT2046 and provides some board-specific hooks.
|
||||
*
|
||||
* Memory for this structure is provided by the caller. It is not copied
|
||||
* by the driver and is presumed to persist while the driver is active.
|
||||
*/
|
||||
|
||||
static struct ads7843e_config_s g_tscinfo =
|
||||
{
|
||||
.frequency = CONFIG_ADS7843E_FREQUENCY,
|
||||
.attach = tsc_attach,
|
||||
.enable = tsc_enable,
|
||||
.clear = tsc_clear,
|
||||
.busy = tsc_busy,
|
||||
.pendown = tsc_pendown,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/* IRQ/GPIO access callbacks. These operations all hidden behind
|
||||
* callbacks to isolate the XPT2046 driver from differences in GPIO
|
||||
* interrupt handling by varying boards and MCUs. If possible,
|
||||
* interrupts should be configured on both rising and falling edges
|
||||
* so that contact and loss-of-contact events can be detected.
|
||||
*
|
||||
* attach - Attach the XPT2046 interrupt handler to the GPIO interrupt
|
||||
* enable - Enable or disable the GPIO interrupt
|
||||
* clear - Acknowledge/clear any pending GPIO interrupt
|
||||
* pendown - Return the state of the pen down GPIO input
|
||||
*/
|
||||
|
||||
static int tsc_attach(FAR struct ads7843e_config_s *state, xcpt_t handler)
|
||||
{
|
||||
/* Attach then enable the touchscreen interrupt handler */
|
||||
|
||||
(void)irq_attach(LPC17_40_IRQ_PENIRQ, handler, NULL);
|
||||
return OK;
|
||||
}
|
||||
|
||||
static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable)
|
||||
{
|
||||
iinfo("enable:%d\n", enable);
|
||||
if (enable)
|
||||
{
|
||||
/* Enable PENIRQ interrupts. NOTE: The pin interrupt is enabled from worker thread
|
||||
* logic after completion of processing of the touchscreen interrupt.
|
||||
*/
|
||||
|
||||
up_enable_irq(LPC17_40_IRQ_PENIRQ);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable PENIRQ interrupts. NOTE: The PENIRQ interrupt will be disabled from
|
||||
* interrupt handling logic.
|
||||
*/
|
||||
|
||||
up_disable_irq(LPC17_40_IRQ_PENIRQ);
|
||||
}
|
||||
}
|
||||
|
||||
static void tsc_clear(FAR struct ads7843e_config_s *state)
|
||||
{
|
||||
/* Does nothing. The interrupt is cleared automatically in the GPIO
|
||||
* logic for the LPC17xx/LPC40xx family.
|
||||
*/
|
||||
}
|
||||
|
||||
static bool tsc_busy(FAR struct ads7843e_config_s *state)
|
||||
{
|
||||
/* The busy state is used by the XPT2046 driver to control the delay
|
||||
* between sending the command, then reading the returned data.
|
||||
*/
|
||||
|
||||
#ifdef XPT2046_NO_BUSY
|
||||
/* REVISIT: Currently, XPT2046 reports BUSY all of the time. This is
|
||||
* probably GPIO setting issues. But there is this cryptic statement in
|
||||
* the XPT2046 spec: "No DCLK delay required with dedicated serial port."
|
||||
*/
|
||||
|
||||
return false;
|
||||
|
||||
#else /* XPT2046_NO_BUSY */
|
||||
|
||||
#if defined(CONFIG_DEBUG_INPUT) && defined(CONFIG_DEBUG_INFO)
|
||||
static bool last = (bool)-1;
|
||||
#endif
|
||||
|
||||
/* REVISIT: This might need to be inverted */
|
||||
|
||||
bool busy = lpc17_40_gpioread(GPIO_TC_BUSY);
|
||||
#if defined(CONFIG_DEBUG_INPUT) && defined(CONFIG_DEBUG_INFO)
|
||||
if (busy != last)
|
||||
{
|
||||
iinfo("busy:%d\n", busy);
|
||||
last = busy;
|
||||
}
|
||||
#endif
|
||||
|
||||
return busy;
|
||||
|
||||
#endif /* XPT2046_NO_BUSY */
|
||||
}
|
||||
|
||||
static bool tsc_pendown(FAR struct ads7843e_config_s *state)
|
||||
{
|
||||
/* XPT2046 uses an an internal pullup resistor. The PENIRQ output goes low
|
||||
* due to the current path through the touch screen to ground, which
|
||||
* initiates an interrupt to the processor via TP_INT.
|
||||
*/
|
||||
|
||||
bool pendown = !lpc17_40_gpioread(GPIO_TC_PENIRQ);
|
||||
iinfo("pendown:%d\n", pendown);
|
||||
return pendown;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: lpc4088_devkit_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 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int lpc4088_devkit_tsc_setup(int minor)
|
||||
{
|
||||
FAR struct spi_dev_s *dev;
|
||||
int ret;
|
||||
|
||||
iinfo("minor:%d\n", minor);
|
||||
DEBUGASSERT(minor == 0);
|
||||
|
||||
/* Configure and enable the XPT2046 PENIRQ pin as an interrupting input. */
|
||||
|
||||
(void)lpc17_40_configgpio(GPIO_TC_PENIRQ);
|
||||
|
||||
/* Configure the XPT2046 BUSY pin as a normal input. */
|
||||
|
||||
#ifndef XPT2046_NO_BUSY
|
||||
(void)lpc17_40_configgpio(GPIO_TC_BUSY);
|
||||
#endif
|
||||
|
||||
/* Get an instance of the SPI interface */
|
||||
|
||||
dev = lpc17_40_sspbus_initialize(CONFIG_ADS7843E_SPIDEV);
|
||||
if (!dev)
|
||||
{
|
||||
ierr("ERROR: Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Initialize and register the SPI touchscreen device */
|
||||
|
||||
ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR);
|
||||
if (ret < 0)
|
||||
{
|
||||
ierr("ERROR: Failed to register touchscreen device minor=%d\n",
|
||||
CONFIG_ADS7843E_DEVMINOR);
|
||||
/* up_spiuninitialize(dev); */
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_INPUT_ADS7843E */
|
||||
120
configs/lpc4088-devkit/src/lpc17_40_userleds.c
Normal file
120
configs/lpc4088-devkit/src/lpc17_40_userleds.c
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/****************************************************************************
|
||||
* configs/lpc4088-devkit/src/lpc17_40_userleds.c
|
||||
* arch/arm/src/board/lpc17_40_userleds.c
|
||||
*
|
||||
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
#include <nuttx/power/pm.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "lpc17_40_gpio.h"
|
||||
#include "lpc4088-devkit.h"
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Dump GPIO registers */
|
||||
|
||||
#ifdef CONFIG_DEBUG_LEDS_INFO
|
||||
# define led_dumpgpio(m) lpc17_40_dumpgpio(???, m)
|
||||
#else
|
||||
# define led_dumpgpio(m)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* This array maps an LED number to GPIO pin configuration */
|
||||
|
||||
static uint32_t g_ledcfg[BOARD_NLEDS] =
|
||||
{
|
||||
GPIO_LED1, GPIO_LED2
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_initialize(void)
|
||||
{
|
||||
/* Configure LED1-4 GPIOs for output */
|
||||
|
||||
lpc17_40_configgpio(GPIO_LED1);
|
||||
lpc17_40_configgpio(GPIO_LED2);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
if ((unsigned)led < BOARD_NLEDS)
|
||||
{
|
||||
lpc17_40_gpiowrite(g_ledcfg[led], ledon);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint8_t ledset)
|
||||
{
|
||||
lpc17_40_gpiowrite(GPIO_LED1, (ledset & BOARD_LED1_BIT) == 0);
|
||||
lpc17_40_gpiowrite(GPIO_LED2, (ledset & BOARD_LED2_BIT) == 0);
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
||||
272
configs/lpc4088-devkit/src/lpc4088-devkit.h
Normal file
272
configs/lpc4088-devkit/src/lpc4088-devkit.h
Normal file
|
|
@ -0,0 +1,272 @@
|
|||
/************************************************************************************
|
||||
* configs/lpc4088-devkit/src/lpc4088-devkit.h
|
||||
* arch/arm/src/board/lpc4088-devkit.h
|
||||
*
|
||||
* Copyright (C) 2013, 2017-2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef _CONFIGS_LPC4088_DEVKIT_SRC_LPC4088_DEVKIT_H
|
||||
#define _CONFIGS_LPC4088_DEVKIT_SRC_LPC4088_DEVKIT_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* LPC4088 Developer's Kit GPIO Pin Definitions *************************************/
|
||||
/* GPIO P2[21] connects to the Ready/Busy pin of the NAND part. We need to
|
||||
* reconfigure this pin as normal GPIO input if NAND is used.
|
||||
*/
|
||||
|
||||
#define GPIO_NAND_RB (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN21)
|
||||
|
||||
/* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in
|
||||
* any way. The following definitions are used to access individual LEDs.
|
||||
*
|
||||
* LED1 -- Connected to P1[14]
|
||||
* LED2 -- Connected to P0[16]
|
||||
* LED3 -- Connected to P1[13]
|
||||
* LED4 -- Connected to P4[27]
|
||||
*
|
||||
* These LEDs are connecte to ground so a high output value will illuminate them.
|
||||
*/
|
||||
|
||||
#define GPIO_LED1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN14)
|
||||
#define GPIO_LED2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN16)
|
||||
#define GPIO_LED3 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN13)
|
||||
#define GPIO_LED4 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT4 | GPIO_PIN27)
|
||||
|
||||
/* Button definitions ***************************************************************/
|
||||
/* The LPC4088 Developer's Kit supports several buttons. All are pulled up externally.
|
||||
* When closed, the pins will be pulled to ground. So the buttons will read "1"
|
||||
* when open and "0" when closed. All are capable of generating
|
||||
* interrupts.
|
||||
*
|
||||
* USER1 -- Connected to P2[10]
|
||||
*
|
||||
* Joystick:
|
||||
*
|
||||
* JOY_A -- Connected to P2[23]
|
||||
* JOY_B -- Connected to P2[25]
|
||||
* JOY_C -- Connected to P2[26]
|
||||
* JOY_D -- Connected to P2[27]
|
||||
* JOY_CTR -- Connected to P2[22]
|
||||
*
|
||||
* For the interrupting buttons, interrupts are generated on both edges (press and
|
||||
* release).
|
||||
*/
|
||||
|
||||
#define GPIO_USER1 (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN26)
|
||||
|
||||
#define GPIO_JOY_A (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN25)
|
||||
#define GPIO_JOY_B (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN26)
|
||||
#define GPIO_JOY_C (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN23)
|
||||
#define GPIO_JOY_D (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN19)
|
||||
#define GPIO_JOY_CTR (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN14)
|
||||
|
||||
/* IRQ numbers for the buttons that do support interrupts */
|
||||
|
||||
#define GPIO_USER1_IRQ LPC17_40_IRQ_P2p10
|
||||
#define GPIO_JOY_A_IRQ LPC17_40_IRQ_P2p23
|
||||
#define GPIO_JOY_B_IRQ LPC17_40_IRQ_P2p25
|
||||
#define GPIO_JOY_C_IRQ LPC17_40_IRQ_P2p26
|
||||
#define GPIO_JOY_D_IRQ LPC17_40_IRQ_P2p27
|
||||
#define GPIO_JOY_CTR_IRQ LPC17_40_IRQ_P2p22
|
||||
|
||||
/* SD Card **************************************************************************/
|
||||
/* The SD card detect (CD) signal is on bit 4 of the PCA9532 port expander U8.
|
||||
* Support for this is not currently set up.
|
||||
* The SD card's power is controlled through a P-channel MOSFET connected to P1[5].
|
||||
* This pin must be driven LOW in order to enable the SD card.*/
|
||||
|
||||
#define GPIO_SD_PWR (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT1 | GPIO_PIN5)
|
||||
|
||||
/* More work is required to complete implementation of LCD support on this board. */
|
||||
|
||||
#if 0
|
||||
/* LCD ******************************************************************************/
|
||||
/* Backlight enable, P2[1]. Initial state is OFF (zero) */
|
||||
|
||||
#define GPIO_LCD_BL (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN1)
|
||||
|
||||
/* XPT2046 Touchscreen **************************************************************/
|
||||
/* -------------- -------------------- ------------ --------------------------------
|
||||
* XTPT2046 Module Module LPC4088 Developer's Kit LED
|
||||
* Signal Connector Connector
|
||||
* -------------- -------------------- ------------ ---------------------------------
|
||||
* Pin 11 PENIRQ\ PENIRQ (pulled high) PORT3 Pin 1 P2.15 PENIRQ
|
||||
* Pin 12 DOUT MISO PORT3 Pin 4 P1.18 MISO1 (Also USB HOST UP LED)
|
||||
* Pin 13 BUSY BUSY (pulled high) PORT3 Pin 9 P2.14 BUSY
|
||||
* Pin 14 DIN MOSI PORT3 Pin 3 P0.13 MOSI1 (Also USB Device up LED and SD CD pin)
|
||||
* Pin 15 CS\ SSEL (pulled high) PORT3 Pin 6 P1.8 GPIO (Also RMII_CRS_DV)
|
||||
* Pin 16 DCLK SCK PORT3 Pin 5 P1.19 SCK1
|
||||
* -------------- -------------------- ------------ ---------------------------------
|
||||
*
|
||||
* Pins should not need to be configured as pull-ups because, according to the LCD
|
||||
* schematic, the are pulled-up on board the LCD module.
|
||||
*/
|
||||
|
||||
#define GPIO_TC_PENIRQ (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN15)
|
||||
#define GPIO_TC_BUSY (GPIO_INPUT | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN14)
|
||||
#define GPIO_TC_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN8)
|
||||
|
||||
#define LPC17_40_IRQ_PENIRQ LPC17_40_IRQ_P2p15
|
||||
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public data
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc4088_devkit_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library via boardctl()
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int lpc4088_devkit_bringup(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc4088_devkit_sspdev_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins for the LPC4088 Developer's Kit board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function lpc4088_devkit_sspdev_initialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc4088_devkit_sdram_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize SDRAM
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LPC17_40_EMC
|
||||
#ifdef CONFIG_LPC17_40_EXTDRAM
|
||||
void lpc4088_devkit_sdram_initialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc4088_devkit_nor_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize NOR FLASH
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LPC17_40_EXTNOR
|
||||
void lpc4088_devkit_nor_initialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc4088_devkit_nand_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize NAND FLASH
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LPC17_40_EXTNAND
|
||||
void lpc4088_devkit_nand_initialize(void);
|
||||
#endif
|
||||
#endif /* CONFIG_LPC17_40_EMC */
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc4088_devkit_lcd_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the LCD. Setup backlight (initially off)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LPC17_40_LCD
|
||||
void lpc4088_devkit_lcd_initialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc4088_devkit_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
|
||||
* 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_INPUT_ADS7843E
|
||||
int lpc4088_devkit_tsc_setup(int minor);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc17_40_djoy_initialization
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the discrete joystick driver
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LPC4088_DEVKIT_DJOYSTICK
|
||||
int lpc17_40_djoy_initialization(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* _CONFIGS_LPC4088_DEVKIT_SRC_LPC4088_DEVKIT_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue