mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Initial support for the NXP LPC11 family and the LPC1115 MCU in particular. Contributed by Alan Carvalho de Assis.
This commit is contained in:
@@ -272,6 +272,14 @@ config ARCH_BOARD_LM4F120_LAUNCHPAD
|
||||
---help---
|
||||
Stellaris LM4F120 LaunchPad.
|
||||
|
||||
config ARCH_BOARD_LPCXPRESSO_LPC1115
|
||||
bool "NXP LPCXpresso LPC1115"
|
||||
depends on ARCH_CHIP_LPC1115
|
||||
select ARCH_HAVE_LEDS
|
||||
---help---
|
||||
Embedded Artists base board with NXP LPCExpresso LPC1115. This board
|
||||
is based on the NXP LPC1115.
|
||||
|
||||
config ARCH_BOARD_LPCXPRESSO
|
||||
bool "NXP LPCExpresso LPC1768"
|
||||
depends on ARCH_CHIP_LPC1768
|
||||
@@ -1171,6 +1179,7 @@ config ARCH_BOARD
|
||||
default "lm4f120-launchpad" if ARCH_BOARD_LM4F120_LAUNCHPAD
|
||||
default "lpc4330-xplorer" if ARCH_BOARD_LPC4330_XPLORER
|
||||
default "lpc4357-evb" if ARCH_BOARD_LPC4357_EVB
|
||||
default "lpcxpresso-lpc1115" if ARCH_BOARD_LPCXPRESSO_LPC1115
|
||||
default "lpcxpresso-lpc1768" if ARCH_BOARD_LPCXPRESSO
|
||||
default "maple" if ARCH_BOARD_MAPLE
|
||||
default "mbed" if ARCH_BOARD_MBED
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see misc/tools/kconfig-language.txt.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_LPCXPRESSO_LPC1115
|
||||
endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,246 @@
|
||||
/************************************************************************************
|
||||
* configs/lpcxpresso-lpc1115/include/board.h
|
||||
* include/arch/board/board.h
|
||||
*
|
||||
* Copyright (C) 2011 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 __ARCH_BOARD_BOARD_H
|
||||
#define __ARCH_BOARD_BOARD_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Clocking *************************************************************************/
|
||||
/* NOTE: The following definitions require lpc11_syscon.h. It is not included here
|
||||
* because the including C file may not have that file in its include path.
|
||||
*/
|
||||
|
||||
#define BOARD_XTAL_FREQUENCY (12000000) /* XTAL oscillator frequency */
|
||||
#define BOARD_OSCCLK_FREQUENCY BOARD_XTAL_FREQUENCY /* Main oscillator frequency */
|
||||
#define BOARD_RTCCLK_FREQUENCY (32768) /* RTC oscillator frequency */
|
||||
#define BOARD_INTRCOSC_FREQUENCY (1200000) /* Internal RC oscillator frequency */
|
||||
|
||||
/* This is the clock setup we configure for:
|
||||
*
|
||||
* SYSCLK = BOARD_OSCCLK_FREQUENCY = 12MHz -> Select Main oscillator for source
|
||||
* PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz -> PLL0 multipler=20, pre-divider=1
|
||||
* MCLK = 480MHz / 6 = 80MHz -> MCLK divider = 6
|
||||
*/
|
||||
|
||||
#define LPC11_MCLK 48000000 /* 48Mhz */
|
||||
|
||||
/* Select the internal RC oscillator as the frequency source. SYSCLK is then the frequency
|
||||
* of the main oscillator.
|
||||
*/
|
||||
|
||||
#undef CONFIG_LPC11_INTRCOSC
|
||||
#define CONFIG_LPC11_INTRCOSC 1
|
||||
#define BOARD_SCS_VALUE SYSCON_SCS_OSCEN
|
||||
|
||||
/* Select the main oscillator and CCLK divider. The output of the divider is CCLK.
|
||||
* The input to the divider (PLLCLK) will be determined by the PLL output.
|
||||
*/
|
||||
|
||||
#define BOARD_CCLKCFG_DIVIDER 6
|
||||
#define BOARD_CCLKCFG_VALUE ((BOARD_CCLKCFG_DIVIDER-1) << SYSCON_CCLKCFG_SHIFT)
|
||||
|
||||
/* PLL0. PLL0 is used to generate the CPU clock divider input (PLLCLK).
|
||||
*
|
||||
* Source clock: Main oscillator
|
||||
* PLL0 Multiplier value (M): 20
|
||||
* PLL0 Pre-divider value (N): 1
|
||||
*
|
||||
* PLL0CLK = (2 * 20 * SYSCLK) / 1 = 480MHz
|
||||
*/
|
||||
|
||||
#undef CONFIG_LPC11_PLL0
|
||||
#define CONFIG_LPC11_PLL0 1
|
||||
#define BOARD_CLKSRCSEL_VALUE SYSCON_CLKSRCSEL_MAIN
|
||||
|
||||
#define BOARD_PLL0CFG_MSEL 20
|
||||
#define BOARD_PLL0CFG_NSEL 1
|
||||
#define BOARD_PLL0CFG_VALUE \
|
||||
(((BOARD_PLL0CFG_MSEL-1) << SYSCON_PLL0CFG_MSEL_SHIFT) | \
|
||||
((BOARD_PLL0CFG_NSEL-1) << SYSCON_PLL0CFG_NSEL_SHIFT))
|
||||
|
||||
/* PLL1 -- Not used. */
|
||||
|
||||
#undef CONFIG_LPC11_PLL1
|
||||
#define BOARD_PLL1CFG_MSEL 36
|
||||
#define BOARD_PLL1CFG_NSEL 1
|
||||
#define BOARD_PLL1CFG_VALUE \
|
||||
(((BOARD_PLL1CFG_MSEL-1) << SYSCON_PLL1CFG_MSEL_SHIFT) | \
|
||||
((BOARD_PLL1CFG_NSEL-1) << SYSCON_PLL1CFG_NSEL_SHIFT))
|
||||
|
||||
/* USB divider. This divider is used when PLL1 is not enabled to get the
|
||||
* USB clock from PLL0:
|
||||
*
|
||||
* USBCLK = PLL0CLK / 10 = 48MHz
|
||||
*/
|
||||
|
||||
#define BOARD_USBCLKCFG_VALUE SYSCON_USBCLKCFG_DIV10
|
||||
|
||||
/* FLASH Configuration */
|
||||
|
||||
#undef CONFIG_LPC11_FLASH
|
||||
#define CONFIG_LPC11_FLASH 1
|
||||
#define BOARD_FLASHCFG_VALUE 0x0000303a
|
||||
|
||||
/* LED definitions ******************************************************************/
|
||||
/* The LPCXpresso LPC1115 board has a single red LED (there are additional LEDs on
|
||||
* the base board not considered here).
|
||||
*/
|
||||
/* ON OFF */
|
||||
#define LED_STARTED 0 /* OFF ON (never happens) */
|
||||
#define LED_HEAPALLOCATE 0 /* OFF ON (never happens) */
|
||||
#define LED_IRQSENABLED 0 /* OFF ON (never happens) */
|
||||
#define LED_STACKCREATED 1 /* ON ON (never happens) */
|
||||
#define LED_INIRQ 2 /* OFF NC (momentary) */
|
||||
#define LED_SIGNAL 2 /* OFF NC (momentary) */
|
||||
#define LED_ASSERTION 2 /* OFF NC (momentary) */
|
||||
#define LED_PANIC 0 /* OFF ON (1Hz flashing) */
|
||||
|
||||
/* Alternate pin selections *********************************************************/
|
||||
/* Pin Description Connector On Board Base Board
|
||||
* -------------------------------- --------- -------------- ---------------------
|
||||
* P0[0]/RD1/TXD3/SDA1 J6-9 I2C E2PROM SDA TXD3/SDA1
|
||||
* P0[1]/TD1/RXD3/SCL J6-10 RXD3/SCL1
|
||||
* P0[2]/TXD0/AD0[7] J6-21
|
||||
* P0[3]/RXD0/AD0[6] J6-22
|
||||
* P0[4]/I2SRX-CLK/RD2/CAP2.0 J6-38 CAN_RX2
|
||||
* P0[5]/I2SRX-WS/TD2/CAP2.1 J6-39 CAN_TX2
|
||||
* P0[6]/I2SRX_SDA/SSEL1/MAT2[0] J6-8 SSEL1, OLED CS
|
||||
* P0[7]/I2STX_CLK/SCK1/MAT2[1] J6-7 SCK1, OLED SCK
|
||||
* P0[8]/I2STX_WS/MISO1/MAT2[2] J6-6 MISO1
|
||||
* P0[9]/I2STX_SDA/MOSI1/MAT2[3] J6-5 MOSI1, OLED data in
|
||||
* P0[10] J6-40 TXD2/SDA2
|
||||
* P0[11] J6-41 RXD2/SCL2
|
||||
*/
|
||||
|
||||
#define GPIO_UART3_TXD GPIO_UART3_TXD_1
|
||||
#define GPIO_I2C1_SDA GPIO_I2C1_SDA_1
|
||||
#define GPIO_UART3_RXD GPIO_UART3_RXD_1
|
||||
#define GPIO_I2C1_SCL GPIO_I2C1_SCL_1
|
||||
#define GPIO_SSP1_SCK GPIO_SSP1_SCK_1
|
||||
#define GPIO_UART2_TXD GPIO_UART2_TXD_1
|
||||
#define GPIO_UART2_RXD GPIO_UART2_RXD_1
|
||||
#define GPIO_UART1_TXD GPIO_UART1_TXD_1
|
||||
#define GPIO_SSP0_SCK GPIO_SSP0_SCK_1
|
||||
#define GPIO_UART1_RXD GPIO_UART1_RXD_1
|
||||
#define GPIO_SSP0_SSEL GPIO_SSP0_SSEL_1
|
||||
#define GPIO_SSP0_MISO GPIO_SSP0_MISO_1
|
||||
#define GPIO_SSP0_MOSI GPIO_SSP0_MOSI_1
|
||||
|
||||
/* P1[0]/ENET-TXD0 J6-34? TXD0 TX-(Ethernet PHY)
|
||||
* P1[1]/ENET_TXD1 J6-35? TXD1 TX+(Ethernet PHY)
|
||||
* P1[4]/ENET_TX_EN TXEN N/A
|
||||
* P1[8]/ENET_CRS CRS_DV/MODE2 N/A
|
||||
* P1[9]/ENET_RXD0 J6-32? RXD0/MODE0 RD-(Ethernet PHY)
|
||||
* P1[10]/ENET_RXD1 J6-33? RXD1/MODE1 RD+(Ethernet PHY)
|
||||
*/
|
||||
|
||||
#define GPIO_ENET_MDC GPIO_ENET_MDC_1
|
||||
#define GPIO_ENET_MDIO GPIO_ENET_MDIO_1
|
||||
|
||||
/* P2[0]/PWM1.1/TXD1 J6-42 PWM1.1 / RGB LED / RS422 RX
|
||||
* P2[1]/PWM1.2/RXD1 J6-43 PWM1.2 / OLED voltage / RGB LED / RS422 RX
|
||||
* P2[2]/PWM1.3/CTS1/TRACEDATA[3] J6-44 PWM1.3
|
||||
* P2[3]/PWM1.4/DCD1/TRACEDATA[2] J6-45 PWM1.4
|
||||
* P2[4]/PWM1.5/DSR1/TRACEDATA[1] J6-46 PWM1.5
|
||||
* P2[5]/PWM1[6]/DTR1/TRACEDATA[0] J6-47 PWM1.6
|
||||
* P2[6]/PCAP1[0]/RI1/TRACECLK J6-48
|
||||
* P2[7]/RD2/RTS1 J6-49 OLED command/data
|
||||
* P2[8]/TD2/TXD2 J6-50
|
||||
* P2[9]/USB_CONNECT/RXD2 PAD19 USB Pullup N/A
|
||||
* P2[10]/EINT0/NMI J6-51
|
||||
* P2[11]/EINT1/I2STX_CLK J6-52
|
||||
*/
|
||||
|
||||
#define GPIO_PWM1p1 GPIO_PWM1p1_2
|
||||
#define GPIO_PWM1p2 GPIO_PWM1p2_2
|
||||
#define GPIO_PWM1p3 GPIO_PWM1p3_2
|
||||
#define GPIO_PWM1p4 GPIO_PWM1p4_2
|
||||
#define GPIO_PWM1p5 GPIO_PWM1p5_2
|
||||
#define GPIO_PWM1p6 GPIO_PWM1p6_2
|
||||
|
||||
/* P3[25]/MAT0.0/PWM1.2 PAD13 N/A
|
||||
* P3[26]/STCLK/MAT0.1/PWM1.3 PAD14 N/A
|
||||
*/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************************************/
|
||||
/************************************************************************************
|
||||
* Name: lpc11_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* All LPC11xx 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
EXTERN void lpc11_boardinitialize(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_BOARD_BOARD_H */
|
||||
@@ -0,0 +1,123 @@
|
||||
############################################################################
|
||||
# configs/freedom-kl25z/nsh/Make.defs
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv6-m/Toolchain.defs
|
||||
|
||||
LDSCRIPT = ld.script
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(ARCROSSDEV)ar rcs
|
||||
NM = $(ARCROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHWARNINGSXX = -Wall -Wshadow
|
||||
ARCHDEFINES =
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
ifeq ($(CONFIG_HOST_WINDOWS),y)
|
||||
HOSTEXEEXT = .exe
|
||||
else
|
||||
HOSTEXEEXT =
|
||||
endif
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native host tools
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
|
||||
else
|
||||
# Linux/Cygwin-native host tools
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||
endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
# configs/lpcxpresso-lpc1768/nsh/setenv.sh
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
if [ "$(basename $0)" = "setenv.sh" ] ; then
|
||||
echo "You must source this script, not run it!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi
|
||||
|
||||
WD=`pwd`
|
||||
|
||||
# This is where the buildroot might reside on a Linux or Cygwin system
|
||||
# export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin"
|
||||
|
||||
# This is the default install location for Code Red on Linux
|
||||
export TOOLCHAIN_BIN="/usr/local/LPCXpresso/tools/bin"
|
||||
|
||||
# This is the Cygwin path to the LPCXpresso 3.6 install location under Windows
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/nxp/lpcxpresso_3.6/Tools/bin"
|
||||
|
||||
# This is the path to the LPCXpression tool subdirectory
|
||||
export LPCTOOL_DIR="${WD}/configs/lpcxpresso-lpc1768/tools"
|
||||
|
||||
# Add the path to the toolchain to the PATH varialble
|
||||
export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||
|
||||
echo "PATH : ${PATH}"
|
||||
@@ -0,0 +1,129 @@
|
||||
/****************************************************************************
|
||||
* configs/lpcxpresso-lpc1115/scripts/ld.script
|
||||
*
|
||||
* Copyright (C) 2011-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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The LPC1115 has 64Kb of FLASH beginning at address 0x00000000 and
|
||||
* 8Kb of SRAM at address 0x10000000.
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
vectflash (rx) : ORIGIN = 0x00000000, LENGTH = 0x00c0
|
||||
progflash (rx) : ORIGIN = 0x00000410, LENGTH = 64k
|
||||
datasram (rwx) : ORIGIN = 0x10000000, LENGTH = 8K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
EXTERN(_vectors)
|
||||
EXTERN(_cfmconfig)
|
||||
ENTRY(_stext)
|
||||
SECTIONS
|
||||
{
|
||||
.vectors : {
|
||||
_svectors = ABSOLUTE(.);
|
||||
*(.vectors)
|
||||
_evectors = ABSOLUTE(.);
|
||||
} > vectflash
|
||||
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.text .text.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata .rodata.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
} > progflash
|
||||
|
||||
.init_section : {
|
||||
_sinit = ABSOLUTE(.);
|
||||
*(.init_array .init_array.*)
|
||||
_einit = ABSOLUTE(.);
|
||||
} > progflash
|
||||
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} > progflash
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx : {
|
||||
*(.ARM.exidx*)
|
||||
} > progflash
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
.data : {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
_edata = ABSOLUTE(.);
|
||||
} > datasram AT > progflash
|
||||
|
||||
_eronly = LOADADDR(.data);
|
||||
|
||||
.ramfunc ALIGN(4): {
|
||||
_sramfuncs = ABSOLUTE(.);
|
||||
*(.ramfunc .ramfunc.*)
|
||||
_eramfuncs = ABSOLUTE(.);
|
||||
} > datasram AT > progflash
|
||||
|
||||
_framfuncs = LOADADDR(.ramfunc);
|
||||
|
||||
.bss : {
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > datasram
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
/.depend
|
||||
/Make.dep
|
||||
@@ -0,0 +1,108 @@
|
||||
############################################################################
|
||||
# configs/lpcxpresso-lpc1115/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2013-2014 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
|
||||
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
|
||||
ASRCS =
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
|
||||
CSRCS = up_boot.c
|
||||
|
||||
ifeq ($(CONFIG_NSH_ARCHINIT),y)
|
||||
CSRCS += up_nsh.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_KL_SPI0),y)
|
||||
CSRCS += kl_spi.c
|
||||
else
|
||||
ifeq ($(CONFIG_KL_SPI1),y)
|
||||
CSRCS += kl_spi.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += up_leds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PWM),y)
|
||||
CSRCS += up_pwm.c
|
||||
endif
|
||||
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
|
||||
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
CFLAGS += -I$(ARCH_SRCDIR)\chip -I$(ARCH_SRCDIR)\common -I$(ARCH_SRCDIR)\armv7-m
|
||||
else
|
||||
ifeq ($(WINTOOL),y)
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
|
||||
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
|
||||
-I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
|
||||
else
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
|
||||
endif
|
||||
endif
|
||||
|
||||
all: libboard$(LIBEXT)
|
||||
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
|
||||
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
|
||||
$(call COMPILE, $<, $@)
|
||||
|
||||
libboard$(LIBEXT): $(OBJS)
|
||||
$(call ARCHIVE, $@, $(OBJS))
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
$(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
$(Q) touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
$(call DELFILE, libboard$(LIBEXT))
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
$(call DELFILE, Make.dep)
|
||||
$(call DELFILE, .depend)
|
||||
|
||||
-include Make.dep
|
||||
@@ -0,0 +1,236 @@
|
||||
/************************************************************************************
|
||||
* configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h
|
||||
* arch/arm/src/board/lpcxpresso_internal.n
|
||||
*
|
||||
* Copyright (C) 2011 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_LPCXPRESSO_LPC1115_SRC_LPCXPRESSO_INTERNAL_H
|
||||
#define _CONFIGS_LPCXPRESSO_LPC1115_SRC_LPCXPRESSO_INTERNAL_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* LPCXpresso LPC1115 board pin usage ***********************************************/
|
||||
/* Pin Description Connector On Board Base Board
|
||||
* -------------------------------- --------- -------------- ---------------------
|
||||
* P0[0]/RD1/TXD3/SDA1 J6-9 I2C E2PROM SDA TXD3/SDA1
|
||||
* P0[1]/TD1/RXD3/SCL J6-10 RXD2/SCL1
|
||||
* P0[2]/TXD0/AD0[7] J6-21
|
||||
* P0[3]/RXD0/AD0[6] J6-22
|
||||
* P0[4]/I2SRX-CLK/RD2/CAP2.0 J6-38 CAN_RX2
|
||||
* P0[5]/I2SRX-WS/TD2/CAP2.1 J6-39 CAN_TX2
|
||||
* P0[6]/I2SRX_SDA/SSEL1/MAT2[0] J6-8 SSEL1
|
||||
* P0[7]/I2STX_CLK/SCK1/MAT2[1] J6-7 SCK1
|
||||
* P0[8]/I2STX_WS/MISO1/MAT2[2] J6-6 MISO1
|
||||
* P0[9]/I2STX_SDA/MOSI1/MAT2[3] J6-5 MOSI1
|
||||
* P0[10] J6-40 TXD2/SDA2
|
||||
* P0[11] J6-41 RXD2/SCL2
|
||||
* P0[15]/TXD1/SCK0/SCK J6-13 TXD1/SCK0
|
||||
* P0[16]/RXD1/SSEL0/SSEL J6-14 RXD1/SSEL0
|
||||
* P0[17]/CTS1/MISO0/MISO J6-12 MISO0
|
||||
* P0[18]/DCD1/MOSI0/MOSI J6-11 MOSI0
|
||||
* P0[19]/DSR1/SDA1 PAD17 N/A
|
||||
* P0[20]/DTR1/SCL1 PAD18 I2C E2PROM SCL N/A
|
||||
* P0[21]/RI1/MCIPWR/RD1 J6-23
|
||||
* P0[22]/RTS1/TD1 J6-24 LED
|
||||
* P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] J6-15 AD0.0
|
||||
* P0[24]/AD0[1]/I2SRX_WS/CAP3[1] J6-16 AD0.1
|
||||
* P0[25]/AD0[2]/I2SRX_SDA/TXD3 J6-17 AD0.2
|
||||
* P0[26]/AD0[3]/AOUT/RXD3 J6-18 AD0.3/AOUT
|
||||
* P0[27]/SDA0/USB_SDA J6-25
|
||||
* P0[28]/SCL0 J6-26
|
||||
* P0[29]/USB_D+ J6-37 USB_D+
|
||||
* P0[30]/USB_D- J6-36 USB_D-
|
||||
*/
|
||||
|
||||
#define LPCXPRESSO_I2C1_EPROM_SDA GPIO_I2C1_SDA_1
|
||||
#define LPCXPRESSO_I2C1_EPROM_SDL GPIO_I2C1_SCL_2
|
||||
#define LPCXPRESSO_LED (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT0 | GPIO_PIN7)
|
||||
|
||||
/* P1[0]/ENET-TXD0 J6-34? TXD0 TX-(Ethernet PHY)
|
||||
* P1[1]/ENET_TXD1 J6-35? TXD1 TX+(Ethernet PHY)
|
||||
* P1[4]/ENET_TX_EN TXEN N/A
|
||||
* P1[8]/ENET_CRS CRS_DV/MODE2 N/A
|
||||
* P1[9]/ENET_RXD0 J6-32? RXD0/MODE0 RD-(Ethernet PHY)
|
||||
* P1[10]/ENET_RXD1 J6-33? RXD1/MODE1 RD+(Ethernet PHY)
|
||||
* P1[14]/ENET_RX_ER RXER/PHYAD0 N/A
|
||||
* P1[15]/ENET_REF_CLK REFCLK N/A
|
||||
* P1[16]/ENET_MDC MDC N/A
|
||||
* P1[17]/ENET_MDIO MDIO N/A
|
||||
* P1[18]/USB_UP_LED/PWM1[1]/CAP1[0] PAD1 N/A
|
||||
* P1[19]/MC0A/USB_PPWR/N_CAP1.1 PAD2 N/A
|
||||
* P1[20]/MCFB0/PWM1.2/SCK0 PAD3 N/A
|
||||
* P1[21]/MCABORT/PWM1.3/SSEL0 PAD4 N/A
|
||||
* P1[22]/MC0B/USB-PWRD/MAT1.0 PAD5 N/A
|
||||
* P1[23]/MCFB1/PWM1.4/MISO0 PAD6 N/A
|
||||
* P1[24]/MCFB2/PWM1.5/MOSI0 PAD7 N/A
|
||||
* P1[25]/MC1A/MAT1.1 PAD8 N/A
|
||||
* P1[26]/MC1B/PWM1.6/CAP0.0 PAD9 N/A
|
||||
* P1[27]/CLKOUT/USB-OVRCR-N/CAP0.1 PAD10 N/A
|
||||
* P1[28]/MC2A/PCAP1.0/MAT0.0 PAD11 N/A
|
||||
* P1[29]/MC2B/PCAP1.1/MAT0.1 PAD12 N/A
|
||||
* P1[30]/VBUS/AD0[4] J6-19 AD0.4
|
||||
* P1[31]/SCK1/AD0[5] J6-20 AD0.5
|
||||
*
|
||||
* P2[0]/PWM1.1/TXD1 J6-42 PWM1.1
|
||||
* P2[1]/PWM1.2/RXD1 J6-43 PWM1.2
|
||||
* P2[2]/PWM1.3/CTS1/TRACEDATA[3] J6-44 PWM1.3
|
||||
* P2[3]/PWM1.4/DCD1/TRACEDATA[2] J6-45 PWM1.4
|
||||
* P2[4]/PWM1.5/DSR1/TRACEDATA[1] J6-46 PWM1.5
|
||||
* P2[5]/PWM1[6]/DTR1/TRACEDATA[0] J6-47 PWM1.6
|
||||
* P2[6]/PCAP1[0]/RI1/TRACECLK J6-48
|
||||
* P2[7]/RD2/RTS1 J6-49
|
||||
* P2[8]/TD2/TXD2 J6-50
|
||||
* P2[9]/USB_CONNECT/RXD2 PAD19 USB Pullup N/A
|
||||
* P2[10]/EINT0/NMI J6-51
|
||||
* P2[11]/EINT1/I2STX_CLK J6-52
|
||||
* P2[12]/EINT2/I2STX_WS J6-53
|
||||
* P2[13]/EINT3/I2STX_SDA J6-27
|
||||
*/
|
||||
|
||||
#define LPCXPRESSO_USB_PULLUP (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN9)
|
||||
|
||||
/* P3[25]/MAT0.0/PWM1.2 PAD13 N/A
|
||||
* P3[26]/STCLK/MAT0.1/PWM1.3 PAD14 N/A
|
||||
*
|
||||
* P4[28]/RX-MCLK/MAT2.0/TXD3 PAD15 N/A
|
||||
* P4[29]/TX-MCLK/MAT2.1/RXD3 PAD16 N/A
|
||||
*/
|
||||
|
||||
/* SD Slot
|
||||
*
|
||||
* Base-board J4/J6 LPC1115
|
||||
* SD Signal Pin Pin
|
||||
* --- ----------- ----- --------
|
||||
* CS PIO1_11* 55 P2.2 (See LPCXPRESSO_SD_CS)
|
||||
* DIN PIO0_9-MOSI 5 P0.9 MOSI1 (See GPIO_SSP1_MOSI in chip/lpc17_ssp.h)
|
||||
* DOUT PIO0_8-MISO 6 P0.8 MISO1 (See GPIO_SSP1_MISO in chip/lpc17_ssp.h)
|
||||
* CLK PIO2_11-SCK 7 P0.9 SCK1 (See GPIO_SSP1_SCK in board.h)
|
||||
* CD PIO2_10 52 P2.11 (See LPCXPRESSO_SD_CD)
|
||||
*/
|
||||
|
||||
#define LPCXPRESSO_SD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN2)
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
# define LPCXPRESSO_SD_CD (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11)
|
||||
#else
|
||||
# define LPCXPRESSO_SD_CD (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11)
|
||||
#endif
|
||||
|
||||
/* USB:
|
||||
*
|
||||
* Base-board J4/J6 LPC1115
|
||||
* Signal Pin Pin
|
||||
* ------------------- ----- --------
|
||||
* USB_DM 36 P0.30/USB-D-
|
||||
* USB_DP 37 P0.29/USB-D+
|
||||
* N/C N/C P1.18/USB-UP-LED/PWM1.1/CAP1.0
|
||||
* PIO1_3 (not used) 19 P1.30/VBUS/AD0.4
|
||||
* N/C N/C P2.9/USB-CONNECT/RXD2 (See Notes)
|
||||
* ------------------- ----- --------
|
||||
* PIO0_6-USB_CONNECT* 23 P0.21/RI1/RD1
|
||||
* PIO0_3-VBUS_SENSE 39 P0.5/I2SRX-WS/TD2/CAP2.1
|
||||
*
|
||||
* Notes:
|
||||
* - The standard USB CONNECT (P0.9) provides USB D+ pullup on board the
|
||||
* LPCXpresso card; it should be un-necessary to use the based board
|
||||
* version of the pullup.
|
||||
* - No changes to jumper settings are required. There are few USB-
|
||||
* related jumpers on the based board, but none are required:
|
||||
* - J14 must be set to permit GPIO control of the base board USB
|
||||
* connect pin. NOT USED
|
||||
* - J12 must be set to permit GPIO control of the USB vbus sense pin
|
||||
* - The standard VBUS (P1.30) is not connected. As a consequence, the
|
||||
* USB driver will not correctly respond to USB insertion or removal
|
||||
* events.
|
||||
* - The standard USB LED (P1.18) is not connected.
|
||||
*/
|
||||
|
||||
#define LPCXPRESSO_USB_CONNECT (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN21)
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
# define LPCXPRESSO_USB_VBUSSENSE (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5)
|
||||
#else
|
||||
# define LPCXPRESSO_USB_VBUSSENSE (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5)
|
||||
#endif
|
||||
|
||||
/* 96x64 White OLED with I2C/SPI interface
|
||||
*
|
||||
* ----------------------------+-------+-------------- -----------------------------
|
||||
* LPC1758 Pin | J4/6 | Base Board Description
|
||||
* ----------------------------+-------+-------------- -----------------------------
|
||||
* P2.1/PWM1.2/RXD1 | 43 | PIO1_10 FAN5331 Power Control (SHDN#)
|
||||
* P0.6/I2SRX-SDA/SSEL1/MAT2.0 | 8 | PIO0_2 OLED chip select (CS#)
|
||||
* P2.7/RD2/RTS1 | 49 | PIO2_7 OLED command/data (D/C#)
|
||||
* P0.7/I2STX-CLK/SCK1/MAT2.1 | 7 | PIO2_11-SCK OLED clock (D0)
|
||||
* P0.9/I2STX-SDA/MOSI1/MAT2.3 | 5 | PIO0_9-MOSI OLED data in (D1)
|
||||
* ----------------------------+-------+-------------- -----------------------------
|
||||
*/
|
||||
|
||||
#define LPCXPRESSO_OLED_POWER (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN1)
|
||||
#define LPCXPRESSO_OLED_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN6)
|
||||
#define LPCXPRESSO_OLED_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN7)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public data
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpcxpresso_sspinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins for the LPCXpresso board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function lpcxpresso_sspinitialize(void);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* _CONFIGS_LPCXPRESSO_LPC1115_SRC_LPCXPRESSO_INTERNAL_H */
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/************************************************************************************
|
||||
* configs/lpcexpresso-1768/src/up_adc.c
|
||||
* arch/arm/src/board/up_adc.c
|
||||
*
|
||||
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
|
||||
* Author: Kannan <code@nuttx.org>
|
||||
*
|
||||
* Based on configs/stm3220g-eval/src/up_adc.c
|
||||
*
|
||||
* Copyright (C) 2012, 2014 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 <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/analog/adc.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "up_arch.h"
|
||||
|
||||
#include "lpc17_adc.h"
|
||||
#include "lpcxpresso_internal.h"
|
||||
|
||||
#ifdef CONFIG_ADC
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: adc_devinit
|
||||
*
|
||||
* Description:
|
||||
* All LPC17 architectures must provide the following interface to work with
|
||||
* examples/adc.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int adc_devinit(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct adc_dev_s *adc;
|
||||
int ret;
|
||||
|
||||
/* Check if we have already initialized */
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
/* Call lpc17_adcinitialize() to get an instance of the ADC interface */
|
||||
|
||||
adc = lpc17_adcinitialize();
|
||||
if (adc == NULL)
|
||||
{
|
||||
adbg("ERROR: Failed to get ADC interface\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Register the ADC driver at "/dev/adc0" */
|
||||
|
||||
ret = adc_register("/dev/adc0", adc);
|
||||
if (ret < 0)
|
||||
{
|
||||
adbg("adc_register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ADC */
|
||||
@@ -0,0 +1,93 @@
|
||||
/************************************************************************************
|
||||
* configs/lpcxpresso-lpc1115/src/up_boot.c
|
||||
*
|
||||
* Copyright (C) 2011, 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 <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "lpc11_ssp.h"
|
||||
#include "lpcxpresso_internal.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc11_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* All LPC11xx 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 lpc11_boardinitialize(void)
|
||||
{
|
||||
/* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak
|
||||
* function lpcxpresso_sspinitialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_LPC11_SSP0) || defined(CONFIG_LPC11_SSP1)
|
||||
if (lpcxpresso_sspinitialize)
|
||||
{
|
||||
lpcxpresso_sspinitialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
board_led_initialize();
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/************************************************************************************
|
||||
* configs/zkit-arm-1769/src/up_dac.c
|
||||
* arch/arm/src/board/up_dac.c
|
||||
*
|
||||
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
|
||||
* Author: Kannan <code@nuttx.org>
|
||||
*
|
||||
* Based on configs/stm3220g-eval/src/up_dac.c
|
||||
*
|
||||
* Copyright (C) 2012, 2014 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 <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/analog/dac.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "lpc17_dac.h"
|
||||
|
||||
#ifdef CONFIG_DAC
|
||||
|
||||
/************************************************************************************
|
||||
* Name: dac_devinit
|
||||
*
|
||||
* Description:
|
||||
* All LPC17xx architectures must provide the following interface to work with
|
||||
* examples/diag.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int dac_devinit(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct dac_dev_s *dac;
|
||||
int ret;
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
/* Call lpc17_dacinitialize() to get an instance of the dac interface */
|
||||
|
||||
dac = lpc17_dacinitialize();
|
||||
if (dac == NULL)
|
||||
{
|
||||
adbg("ERROR: Failed to get dac interface\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = dac_register("/dev/dac0", dac);
|
||||
if (ret < 0)
|
||||
{
|
||||
adbg("dac_register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DAC */
|
||||
@@ -0,0 +1,154 @@
|
||||
/****************************************************************************
|
||||
* configs/lpcxpresso-lpc1168/src/up_leds.c
|
||||
*
|
||||
* Copyright (C) 2011, 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 <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "lpc11_gpio.h"
|
||||
#include "lpcxpresso_internal.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
|
||||
* with CONFIG_DEBUG_VERBOSE too)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DEBUG_LEDS
|
||||
# define leddbg lldbg
|
||||
# ifdef CONFIG_DEBUG_VERBOSE
|
||||
# define ledvdbg lldbg
|
||||
# else
|
||||
# define ledvdbg(x...)
|
||||
# endif
|
||||
#else
|
||||
# define leddbg(x...)
|
||||
# define ledvdbg(x...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static bool g_ncstate;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_led_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_led_initialize(void)
|
||||
{
|
||||
/* Configure all LED GPIO lines */
|
||||
|
||||
lpc11_configgpio(LPCXPRESSO_LED);
|
||||
g_ncstate = true;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_led_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_led_on(int led)
|
||||
{
|
||||
bool off;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
case 0:
|
||||
case 2:
|
||||
off = true;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
off = false;
|
||||
g_ncstate = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
lpc11_gpiowrite(LPCXPRESSO_LED, off);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_led_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_led_off(int led)
|
||||
{
|
||||
bool off;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
off = false;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
off = g_ncstate;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
lpc11_gpiowrite(LPCXPRESSO_LED, off);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
||||
@@ -0,0 +1,155 @@
|
||||
/****************************************************************************
|
||||
* config/lpcxpresso-lpc1768/src/up_nsh.c
|
||||
* arch/arm/src/board/up_nsh.c
|
||||
*
|
||||
* Copyright (C) 2011 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 <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/mmcsd.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* PORT and SLOT number probably depend on the board configuration */
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_LPCXPRESSO
|
||||
# define NSH_HAVEUSBDEV 1
|
||||
# ifdef CONFIG_LPC17_SSP1
|
||||
# define NSH_HAVEMMCSD 1
|
||||
# else
|
||||
# undef NSH_HAVEMMCSD
|
||||
# endif
|
||||
#else
|
||||
# error "Unrecognized board"
|
||||
# undef NSH_HAVEUSBDEV
|
||||
# undef NSH_HAVEMMCSD
|
||||
#endif
|
||||
|
||||
/* Do we have SPI support for MMC/SD? */
|
||||
|
||||
#ifdef NSH_HAVEMMCSD
|
||||
# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 1
|
||||
# error "The LPCXpresso MMC/SD is on SSP1"
|
||||
# undef CONFIG_NSH_MMCSDSPIPORTNO
|
||||
# define CONFIG_NSH_MMCSDSPIPORTNO 1
|
||||
# endif
|
||||
# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
|
||||
# error "The LPCXpresso MMC/SD has only one slot (0)"
|
||||
# undef CONFIG_NSH_MMCSDSLOTNO
|
||||
# define CONFIG_NSH_MMCSDSLOTNO 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Can't support USB device features if USB device is not enabled */
|
||||
|
||||
#ifndef CONFIG_USBDEV
|
||||
# undef NSH_HAVEUSBDEV
|
||||
#endif
|
||||
|
||||
/* Can't support MMC/SD features if mountpoints are disabled */
|
||||
|
||||
#if defined(CONFIG_DISABLE_MOUNTPOINT)
|
||||
# undef NSH_HAVEMMCSD
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NSH_MMCSDMINOR
|
||||
# define CONFIG_NSH_MMCSDMINOR 0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_archinitialize
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture specific initialization
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nsh_archinitialize(void)
|
||||
{
|
||||
#ifdef NSH_HAVEMMCSD
|
||||
FAR struct spi_dev_s *ssp;
|
||||
int ret;
|
||||
|
||||
/* Get the SSP port */
|
||||
|
||||
ssp = lpc17_sspinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
|
||||
if (!ssp)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize SSP port %d\n",
|
||||
CONFIG_NSH_MMCSDSPIPORTNO);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully initialized SSP port %d\n",
|
||||
CONFIG_NSH_MMCSDSPIPORTNO);
|
||||
|
||||
/* Bind the SSP port to the slot */
|
||||
|
||||
ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, ssp);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to bind SSP port %d to MMC/SD slot %d: %d\n",
|
||||
CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfuly bound SSP port %d to MMC/SD slot %d\n",
|
||||
CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
/************************************************************************************
|
||||
* configs/lpcexpresso-lpc1768/up_pwm.c
|
||||
*
|
||||
* Copyright (C) 2014 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/types.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/pwm.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "up_arch.h"
|
||||
#include "lpc17_pwm.h"
|
||||
#include "lpc17_timer.h"
|
||||
#include "lpcxpresso_internal.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PWM
|
||||
|
||||
FAR struct pwm_lowerhalf_s *lpc17_pwminitialize(int timer);
|
||||
FAR struct pwm_lowerhalf_s *lpc17_mcpwminitialize(int timer);
|
||||
FAR struct pwm_lowerhalf_s *lpc17_timerinitialize(int timer);
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: pwm_devinit
|
||||
*
|
||||
* Description:
|
||||
* All LPC17 architectures must provide the following interface to work with
|
||||
* examples/pwm.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int pwm_devinit(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct pwm_lowerhalf_s *pwm;
|
||||
struct pwm_lowerhalf_s *mcpwm;
|
||||
struct pwm_lowerhalf_s *timer;
|
||||
int ret;
|
||||
|
||||
/* Have we already initialized? */
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
/* Call lpc17_pwminitialize() to get an instance of the PWM interface */
|
||||
|
||||
pwm = lpc17_pwminitialize(0);
|
||||
if (!pwm)
|
||||
{
|
||||
adbg("Failed to get the LPC17XX PWM lower half\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Register the PWM driver at "/dev/pwm0" */
|
||||
|
||||
ret = pwm_register("/dev/pwm0", pwm);
|
||||
if (ret < 0)
|
||||
{
|
||||
adbg("pwm_register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
mcpwm = lpc17_mcpwminitialize(0);
|
||||
if (!mcpwm)
|
||||
{
|
||||
adbg("Failed to get the LPC17XX MOTOR PWM lower half\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Register the MOTOR CONTROL PWM driver at "/dev/mcpwm0" */
|
||||
|
||||
ret = pwm_register("/dev/mcpwm0", mcpwm);
|
||||
if (ret < 0)
|
||||
{
|
||||
adbg("mcpwm_register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
timer = lpc17_timerinitialize(0);
|
||||
if (!timer)
|
||||
{
|
||||
adbg("Failed to get the LPC17XX TIMER lower half\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Register the PWM driver at "/dev/timer0" */
|
||||
|
||||
ret = pwm_register("/dev/timer0", timer);
|
||||
if (ret < 0)
|
||||
{
|
||||
adbg("timer_register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PWM */
|
||||
@@ -0,0 +1,214 @@
|
||||
/************************************************************************************
|
||||
* configs/lpcxpresso-lpc1768/src/up_ssp.c
|
||||
* arch/arm/src/board/up_ssp.c
|
||||
*
|
||||
* Copyright (C) 2011, 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_gpio.h"
|
||||
#include "lpc17_ssp.h"
|
||||
#include "lpcxpresso_internal.h"
|
||||
|
||||
#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1)
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Enables debug output from this file (needs CONFIG_DEBUG too) */
|
||||
|
||||
#undef SSP_DEBUG /* Define to enable debug */
|
||||
#undef SSP_VERBOSE /* Define to enable verbose debug */
|
||||
|
||||
#ifdef SSP_DEBUG
|
||||
# define sspdbg lldbg
|
||||
# ifdef SSP_VERBOSE
|
||||
# define sspvdbg lldbg
|
||||
# else
|
||||
# define sspvdbg(x...)
|
||||
# endif
|
||||
#else
|
||||
# undef SSP_VERBOSE
|
||||
# define sspdbg(x...)
|
||||
# define sspvdbg(x...)
|
||||
#endif
|
||||
|
||||
/* Dump GPIO registers */
|
||||
|
||||
#ifdef SSP_VERBOSE
|
||||
# define ssp_dumpgpio(m) lpc17_dumpgpio(SDCCS_GPIO, m)
|
||||
#else
|
||||
# define ssp_dumpgpio(m)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpcxpresso_sspinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins for the LPCXpresso.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function lpcxpresso_sspinitialize(void)
|
||||
{
|
||||
/* Configure the SPI-based microSD CS GPIO */
|
||||
|
||||
ssp_dumpgpio("lpcxpresso_sspinitialize() Entry)");
|
||||
|
||||
/* Configure card detect and chip select for the SD slot. NOTE: Jumper J55 must
|
||||
* be set correctly for the SD slot chip select.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LPC17_SSP1
|
||||
(void)lpc17_configgpio(LPCXPRESSO_SD_CS);
|
||||
(void)lpc17_configgpio(LPCXPRESSO_SD_CD);
|
||||
|
||||
/* Configure chip select for the OLED. For the SPI interface, insert jumpers in
|
||||
* J42, J43, J45 pin1-2 and J46 pin 1-2.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NX_LCDDRIVER
|
||||
(void)lpc17_configgpio(LPCXPRESSO_OLED_CS);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ssp_dumpgpio("lpcxpresso_sspinitialize() Exit");
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status
|
||||
*
|
||||
* Description:
|
||||
* The external functions, lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status
|
||||
* 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_sspinitialize())
|
||||
* are provided by common LPC17xx logic. To use this common SPI logic on your
|
||||
* board:
|
||||
*
|
||||
* 1. Provide logic in lpc17_boardinitialize() to configure SPI/SSP chip select
|
||||
* pins.
|
||||
* 2. Provide lpc17_ssp0/ssp1select() and lpc17_ssp0/ssp1status() 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_sspinitialize() in your low level application
|
||||
* initialization logic
|
||||
* 4. The handle returned by lpc17_sspinitialize() 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_SSP0
|
||||
void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
ssp_dumpgpio("lpc17_ssp0select() Entry");
|
||||
|
||||
#warning "Assert CS here (false)"
|
||||
|
||||
ssp_dumpgpio("lpc17_ssp0select() Exit");
|
||||
}
|
||||
|
||||
uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
sspdbg("Returning SPI_STATUS_PRESENT\n");
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_LPC17_SSP1
|
||||
void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
ssp_dumpgpio("lpc17_ssp1select() Entry");
|
||||
|
||||
if (devid == SPIDEV_MMCSD)
|
||||
{
|
||||
/* Assert/de-assert the CS pin to the card */
|
||||
|
||||
(void)lpc17_gpiowrite(LPCXPRESSO_SD_CS, !selected);
|
||||
}
|
||||
#ifdef CONFIG_NX_LCDDRIVER
|
||||
else if (devid == SPIDEV_DISPLAY)
|
||||
{
|
||||
/* Assert the CS pin to the OLED display */
|
||||
|
||||
(void)lpc17_gpiowrite(LPCXPRESSO_OLED_CS, !selected);
|
||||
}
|
||||
#endif
|
||||
ssp_dumpgpio("lpc17_ssp1select() Exit");
|
||||
}
|
||||
|
||||
uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
if (devid == SPIDEV_MMCSD)
|
||||
{
|
||||
/* Read the state of the card-detect bit */
|
||||
|
||||
if (lpc17_gpioread(LPCXPRESSO_SD_CD) == 0)
|
||||
{
|
||||
sspdbg("Returning SPI_STATUS_PRESENT\n");
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
}
|
||||
|
||||
sspdbg("Returning zero\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_LPC17_SSP0 || CONFIG_LPC17_SSP1 */
|
||||
Reference in New Issue
Block a user