diff --git a/configs/Kconfig b/configs/Kconfig index 61ed3b936c7..16dbac6f911 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -244,6 +244,12 @@ config ARCH_BOARD_HYMINI_STM32V A configuration for the HY-Mini STM32v board. This board is based on the STM32F103VCT6 chip. +config ARCH_BOARD_LC823450_XGEVK + bool "ON Semiconductor LC823450-XGEVK development board" + depends on ARCH_CHIP_LC823450 + ---help--- + This port uses the ON Semiconductor LC823450-XGEVK development board. + config ARCH_BOARD_LINCOLN60 bool "Micromint Lincoln 60 board" depends on ARCH_CHIP_LPC1769 @@ -1557,6 +1563,7 @@ config ARCH_BOARD default "hymini-stm32v" if ARCH_BOARD_HYMINI_STM32V default "kwikstik-k40" if ARCH_BOARD_KWIKSTIK_K40 default "launchxl-tms57004" if ARCH_BOARD_LAUNCHXL_TMS57004 + default "lc823450-xgevk" if ARCH_BOARD_LC823450_XGEVK default "lincoln60" if ARCH_BOARD_LINCOLN60 default "lm3s6432-s2e" if ARCH_BOARD_LM3S6432S2E default "lm3s6965-ek" if ARCH_BOARD_LM3S6965EK @@ -1790,6 +1797,9 @@ endif if ARCH_BOARD_LAUNCHXL_TMS57004 source "configs/launchxl-tms57004/Kconfig" endif +if ARCH_BOARD_LC823450_XGEVK +source "configs/lc823450-xgevk/Kconfig" +endif if ARCH_BOARD_LINCOLN60 source "configs/lincoln60/Kconfig" endif diff --git a/configs/lc823450-xgevk/Kconfig b/configs/lc823450-xgevk/Kconfig new file mode 100644 index 00000000000..8e1d81013d2 --- /dev/null +++ b/configs/lc823450-xgevk/Kconfig @@ -0,0 +1,7 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +if ARCH_BOARD_LC823450_XGEVK +endif diff --git a/configs/lc823450-xgevk/README.txt b/configs/lc823450-xgevk/README.txt new file mode 100644 index 00000000000..8994500bf4e --- /dev/null +++ b/configs/lc823450-xgevk/README.txt @@ -0,0 +1,84 @@ +README +^^^^^^ + +README for NuttX port to the LC823450XGEVK board. + +The board information is available at + + http://www.onsemi.com/PowerSolutions/evalBoard.do?id=LC823450XGEVK + +LC823450 related documents are available at + + http://www.onsemi.com/PowerSolutions/supportDoc.do?type=AppNotes&rpn=LC823450 + +This port is intended to test LC823450 features including SMP. +Supported peripherals are UART, TIMER, RTC, GPIO, DMA, I2C, SPI, LCD. + + +Settings +^^^^^^^^ + +1. Currently only SRAM boot via ICE is supported. +2. If SWD connection is lost, please specify lower adaptor clock. +3. Both CPUs are running at 160MHz. +4. Internal SRAMs (seg0 to seg5) are used. +5. Serial console can be used via external USB-UART (115200/8/N/1). +6. Interrupt handlers except for inter-cpu are handled on CPU0. + + +SMP related Status +^^^^^^^^^^^^^^^^^^ + +Currently SMP feature works on the board but might not be stable. +In addition, console output might be corrupted if the both CPUs +output into the console because UART operates in FIFO mode. + +1. "nsh> smp" works but the result will be corrupted. +2. "nsh> ostest" works but might cause a deadlock or assertion. + + +Other Status +^^^^^^^^^^^^ + +1. nsh built-in commands such as ps, free are available. + +NuttShell (NSH) +nsh> ps + PID GROUP CPU PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK COMMAND + 0 0 0 0 FIFO Kthread N-- Assigned 00000000 000000 CPU0 IDLE + 1 0 1 0 FIFO Kthread N-- Running 00000000 002044 CPU1 IDLE + 3 1 0 100 FIFO Task --- Running 00000000 003052 init +nsh> free + total used free largest +Mem: 1027024 13136 1013888 1013888 + +2. date command can be used to get/set RTC date and time. + +nsh> date +Oct 03 00:00:55 2013 +nsh> date -s "Mar 31 12:34:56 2017" +nsh> date +Mar 31 12:34:56 2017 + +3. i2c app can be used to test I2C buses. + +nsh> i2c get -b 1 -a 18 -r 0 +READ Bus: 1 Addr: 18 Subaddr: 00 Value: f9 + +4. nxhello app can be used to test LCD via SPI. + +nsh> nxhello +nxhello_initialize: Initializing LCD +nxhello_initialize: Open NX +nxhello_main: NX handle=20096f0 +nxhello_main: Set background color=0 +nxhello_main: Screen resolution (128,48) +nxhello_hello: Position (31,20) +nxhello_main: Close NX + + +TODO +^^^^ + +The following peripherals will be supported. +eMMC, uSD, USB, ADC, Audio, etc. diff --git a/configs/lc823450-xgevk/include/board.h b/configs/lc823450-xgevk/include/board.h new file mode 100644 index 00000000000..be0bd236c06 --- /dev/null +++ b/configs/lc823450-xgevk/include/board.h @@ -0,0 +1,69 @@ +/**************************************************************************** + * configs/lc823450-xgevk/include/board.h + * + * Copyright (C) 2017 Sony Corporation. All rights reserved. + * Author: Masayuki Ishikawa + * + * 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_LC823450_XGEVK_INCLUDE_BOARD_H +#define __CONFIGS_LC823450_XGEVK_INCLUDE_BOARD_H + +#include + +/************************************************************************************ + * Public Data + ************************************************************************************/ +#ifndef __ASSEMBLY__ + +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +extern unsigned int XT1OSC_CLK; + +/************************************************************************************ + * Public Function Prototypes + ************************************************************************************/ + +void up_init_default_mux(void); + + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __CONFIGS_LC823450_XGEVK_INCLUDE_BOARD_H */ diff --git a/configs/lc823450-xgevk/nsh/defconfig b/configs/lc823450-xgevk/nsh/defconfig new file mode 100644 index 00000000000..a6588691c40 --- /dev/null +++ b/configs/lc823450-xgevk/nsh/defconfig @@ -0,0 +1,119 @@ +CONFIG_AQM_1248A=y +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="lc823450-xgevk" +CONFIG_ARCH_BOARD_LC823450_XGEVK=y +CONFIG_ARCH_CHIP_LC823450=y +CONFIG_ARCH_FLOAT_H=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_STDARG_H=y +CONFIG_BOARD_LOOPSPERMSEC=12061 +CONFIG_BUILTIN=y +CONFIG_C99_BOOL8=y +CONFIG_CODECS_HASH_MD5=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_ERROR=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEBUG_WARN=y +CONFIG_DEV_ZERO=y +CONFIG_DISABLE_MQUEUE=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_NSH=y +CONFIG_EXAMPLES_NXHELLO_BPP=1 +CONFIG_EXAMPLES_NXHELLO=y +CONFIG_EXAMPLES_OSTEST=y +CONFIG_EXAMPLES_PIPE=y +CONFIG_EXAMPLES_SMP=y +CONFIG_EXPERIMENTAL=y +CONFIG_FS_PROCFS=y +CONFIG_FS_WRITABLE=y +CONFIG_I2C_RESET=y +CONFIG_I2CTOOL_MAXBUS=1 +CONFIG_I2C=y +CONFIG_INTELHEX_BINARY=y +CONFIG_LC823450_I2C0=y +CONFIG_LC823450_I2C1=y +# CONFIG_LC823450_SDIF is not set +CONFIG_LC823450_SPI_DMA=y +CONFIG_LC823450_UART0=y +CONFIG_LCD_ST7565=y +CONFIG_LCD=y +CONFIG_LIB_KBDCODEC=y +CONFIG_LIBM=y +CONFIG_MAX_TASKS=64 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_MEMSET_OPTSPEED=y +CONFIG_NAME_MAX=765 +CONFIG_NETUTILS_CODECS=y +CONFIG_NFILE_DESCRIPTORS=45 +CONFIG_NFILE_STREAMS=8 +CONFIG_NSH_ARCHINIT=y +# CONFIG_NSH_ARGCAT is not set +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLE_BASENAME=y +CONFIG_NSH_DISABLE_CP=y +CONFIG_NSH_DISABLE_DD=y +CONFIG_NSH_DISABLE_DELROUTE=y +CONFIG_NSH_DISABLE_DIRNAME=y +CONFIG_NSH_DISABLE_EXEC=y +CONFIG_NSH_DISABLE_GET=y +CONFIG_NSH_DISABLE_HEXDUMP=y +CONFIG_NSH_DISABLE_IFCONFIG=y +CONFIG_NSH_DISABLE_LOSETUP=y +CONFIG_NSH_DISABLE_MB=y +CONFIG_NSH_DISABLE_MD5=y +CONFIG_NSH_DISABLE_MH=y +CONFIG_NSH_DISABLE_MKDIR=y +CONFIG_NSH_DISABLE_MKFIFO=y +CONFIG_NSH_DISABLE_MKRD=y +CONFIG_NSH_DISABLE_MV=y +CONFIG_NSH_DISABLE_PUT=y +CONFIG_NSH_DISABLE_RMDIR=y +CONFIG_NSH_DISABLE_RM=y +CONFIG_NSH_DISABLE_SH=y +CONFIG_NSH_DISABLE_WGET=y +CONFIG_NSH_DISABLE_XD=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_MAXARGUMENTS=10 +CONFIG_NSH_READLINE=y +# CONFIG_NX_DISABLE_1BPP is not set +CONFIG_NXFONT_MONO5X8=y +CONFIG_NX=y +CONFIG_PIPES=y +CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=2048 +CONFIG_PREALLOC_TIMERS=4 +CONFIG_PREALLOC_WDOGS=16 +CONFIG_PTHREAD_MUTEX_TYPES=y +CONFIG_PTHREAD_STACK_DEFAULT=3072 +CONFIG_RAM_SIZE=1044480 +CONFIG_RAM_START=0x02001000 +CONFIG_RAW_BINARY=y +CONFIG_RTC_DATETIME=y +CONFIG_RTC=y +CONFIG_SCHED_ATEXIT=y +CONFIG_SCHED_CHILD_STATUS=y +CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SCHED_INSTRUMENTATION_BUFFER=y +CONFIG_SCHED_INSTRUMENTATION=y +CONFIG_SCHED_ONEXIT_MAX=32 +CONFIG_SCHED_ONEXIT=y +CONFIG_SCHED_STARTHOOK=y +CONFIG_SCHED_WAITPID=y +CONFIG_SDCLONE_DISABLE=y +CONFIG_SERIAL_TERMIOS=y +CONFIG_SMP_NCPUS=2 +CONFIG_SMP=y +# CONFIG_SPI_EXCHANGE is not set +CONFIG_SPI=y +CONFIG_START_DAY=3 +CONFIG_START_MONTH=10 +CONFIG_START_YEAR=2013 +CONFIG_SYSTEM_I2CTOOL=y +CONFIG_TASK_NAME_SIZE=24 +CONFIG_UART0_RXBUFSIZE=512 +CONFIG_UART0_SERIAL_CONSOLE=y +CONFIG_UART0_TXBUFSIZE=2048 +CONFIG_USER_ENTRYPOINT="nsh_main" +CONFIG_USERMAIN_STACKSIZE=3072 diff --git a/configs/lc823450-xgevk/scripts/Make.defs b/configs/lc823450-xgevk/scripts/Make.defs new file mode 100644 index 00000000000..cedcd64e369 --- /dev/null +++ b/configs/lc823450-xgevk/scripts/Make.defs @@ -0,0 +1,126 @@ +############################################################################ +# configs/lc823450-xgevk/scripts/Make.defs +# +# Copyright (C) 2017 Sony Corporation. All rights reserved. +# Author: Masayuki Ishikawa +# +# 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/armv7-m/Toolchain.defs + +ifeq ($(WINTOOL),y) + # Windows-native toolchains + DIRLINK = $(TOPDIR)/tools/copydir.sh + DIRUNLINK = $(TOPDIR)/tools/unlink.sh + MKDEP = $(TOPDIR)/tools/mkwindeps.sh + 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/ld.script}" +else + # Linux/Cygwin-native toolchain + MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT) + ARCHINCLUDES = -I. -isystem $(TOPDIR)/include + ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx + ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script +endif + +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(CROSSDEV)ar rcs +NM = $(CROSSDEV)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 -ffunction-sections -fdata-sections -nostdinc +ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti -nostdinc++ +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef +ARCHWARNINGSXX = -Wall -Wshadow -Wundef +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 + +ASMEXT = .S +OBJEXT = .o +LIBEXT = .a +EXEEXT = + +ifneq ($(CROSSDEV),arm-nuttx-elf-) + LDFLAGS += -nostartfiles -nodefaultlibs +endif +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDFLAGS += -g +endif + +LDFLAGS += --gc-sections + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe +HOSTLDFLAGS = + +ifeq ($(CONFIG_MTD_LC823450),y) +ARCH_LIBS += -lSdDr_patch_es2 +ARCH_LIBPATHS += -L"$(TOPDIR)/arch/arm/src/lc823450" +ARCH_LIBS += $(ARCH_LIBS_OPT)--just-symbols=$(TOPDIR)/arch/arm/src/lc823450/rom_symbols.txt +LDFLAGS +=--no-wchar-size-warning +endif + + +# NEVER use 'override' variables +# NUTTX_EXTRA_LIBS and NUTTX_EXTRA_LIBPATHS are defined by out-of-repository + +EXTRA_LIBS := $(NUTTX_EXTRA_LIBS) $(ARCH_LIBS) +EXTRA_LIBPATHS := $(NUTTX_EXTRA_LIBPATHS) $(ARCH_LIBPATHS) + diff --git a/configs/lc823450-xgevk/scripts/gnu-elf.ld b/configs/lc823450-xgevk/scripts/gnu-elf.ld new file mode 100644 index 00000000000..04b1d2f9275 --- /dev/null +++ b/configs/lc823450-xgevk/scripts/gnu-elf.ld @@ -0,0 +1,139 @@ +/**************************************************************************** + * configs/lc823450-xgevk/scripts/gnu-elf.ld + * + * Copyright (C) 2017 Sony Corporation. All rights reserved. + * Author: Masayuki Ishikawa + * + * 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. + * + ****************************************************************************/ + +SECTIONS +{ + .text 0x00000000 : + { + _stext = . ; + *(.text) + *(.text.*) + *(.gnu.warning) + *(.stub) + *(.glue_7) + *(.glue_7t) + *(.jcr) + + /* C++ support: The .init and .fini sections contain specific logic + * to manage static constructors and destructors. + */ + + *(.gnu.linkonce.t.*) + *(.init) /* Old ABI */ + *(.fini) /* Old ABI */ + _etext = . ; + } + + .ARM.extab : + { + *(.ARM.extab*) + } + + .ARM.exidx : + { + *(.ARM.exidx*) + } + + .rodata : + { + _srodata = . ; + *(.rodata) + *(.rodata1) + *(.rodata.*) + *(.gnu.linkonce.r*) + _erodata = . ; + } + + .data : + { + _sdata = . ; + *(.data) + *(.data1) + *(.data.*) + *(.gnu.linkonce.d*) + _edata = . ; + } + + /* C++ support. For each global and static local C++ object, + * GCC creates a small subroutine to construct the object. Pointers + * to these routines (not the routines themselves) are stored as + * simple, linear arrays in the .ctors section of the object file. + * Similarly, pointers to global/static destructor routines are + * stored in .dtors. + */ + + .ctors : + { + _sctors = . ; + *(.ctors) /* Old ABI: Unallocated */ + *(.init_array) /* New ABI: Allocated */ + _edtors = . ; + } + + .dtors : + { + _sdtors = . ; + *(.dtors) /* Old ABI: Unallocated */ + *(.fini_array) /* New ABI: Allocated */ + _edtors = . ; + } + + .bss : + { + _sbss = . ; + *(.bss) + *(.bss.*) + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.b*) + *(COMMON) + _ebss = . ; + } + + /* 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) } +} diff --git a/configs/lc823450-xgevk/scripts/ld.script b/configs/lc823450-xgevk/scripts/ld.script new file mode 100644 index 00000000000..1b638ebb319 --- /dev/null +++ b/configs/lc823450-xgevk/scripts/ld.script @@ -0,0 +1,124 @@ +/**************************************************************************** + * configs/lc823450-xgevk/scripts/ld.script + * + * Copyright (C) 2017 Sony Corporation. All rights reserved. + * Author: Masayuki Ishikawa + * + * 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. + * + ****************************************************************************/ + + +MEMORY +{ + progmem (rx) : ORIGIN = 0x02040000, LENGTH = 480K + flash (rx) : ORIGIN = 0x05008000, LENGTH = 2016K + sram (rwx) : ORIGIN = 0x02001000, LENGTH = 124K +} + +OUTPUT_ARCH(arm) +ENTRY(_stext) +SECTIONS +{ + .text_spif : + { + _sspif = ABSOLUTE(.); + _espif = ABSOLUTE(.); + } > flash + + .text : + { + _stext = ABSOLUTE(.); + KEEP(*(.vectors)) + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > progmem + + .init_section : + { + _sinit = ABSOLUTE(.); + KEEP(*(.init_array .init_array.*)) + _einit = ABSOLUTE(.); + } > progmem + + .ARM.extab : + { + *(.ARM.extab*) + } > progmem + + __exidx_start = ABSOLUTE(.); + .ARM.exidx : + { + *(.ARM.exidx*) + } > progmem + __exidx_end = ABSOLUTE(.); + + _eronly = ABSOLUTE(LOADADDR(.data)); + + .data : + { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + _edata = ABSOLUTE(.); + } > sram AT > progmem + + .bss : + { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + _ebss = ABSOLUTE(.); + } > sram + + /* 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) } +} diff --git a/configs/lc823450-xgevk/src/Makefile b/configs/lc823450-xgevk/src/Makefile new file mode 100644 index 00000000000..8c6063ddb91 --- /dev/null +++ b/configs/lc823450-xgevk/src/Makefile @@ -0,0 +1,71 @@ +############################################################################ +# configs/lc823450-xgevk/src/Makefile +# +# Copyright (C) 2017 Sony Corporation. All rights reserved. +# Author: Masayuki Ishikawa +# +# 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 = lc823450_boot.c lc823450_mux.c + +ifeq ($(CONFIG_LIB_BOARDCTL),y) +CSRCS += lc823450_appinit.c lc823450_bringup.c +else ifeq ($(CONFIG_BOARD_INITIALIZE),y) +CSRCS += lc823450_bringup.c +endif + +ifeq ($(CONFIG_LC823450_SDIF),y) +CSRCS += lc823450_sdif.c +endif + +ifeq ($(CONFIG_USBMSC),y) +CSRCS += lc823450_usbmsc.c +endif + +ifeq ($(CONFIG_SPI),y) +CSRCS += lc823450_spi.c +endif + +ifeq ($(CONFIG_LCD_ST7565),y) +CSRCS += lc823450_st7565.c +endif + +ifeq ($(CONFIG_BMA250),y) +CSRCS += lc823450_bma250.c +endif + +ifeq ($(CONFIG_NETDEVICES),y) +CSRCS += lc823450_netinit.c +endif + +include $(TOPDIR)/configs/Board.mk diff --git a/configs/lc823450-xgevk/src/lc823450-xgevk.h b/configs/lc823450-xgevk/src/lc823450-xgevk.h new file mode 100644 index 00000000000..b3e6ef698a6 --- /dev/null +++ b/configs/lc823450-xgevk/src/lc823450-xgevk.h @@ -0,0 +1,96 @@ +/**************************************************************************** + * configs/lc823450-xgevk/src/lc823450-xgevk.h + * + * Copyright (C) 2017 Sony Corporation. All rights reserved. + * Author: Masayuki Ishikawa + * + * 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_LC823450_XGEVK_SRC_LC823450_XGEVK_H +#define __CONFIGS_LC823450_XGEVK_SRC_LC823450_XGEVK_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Do we need to register I2C drivers on behalf of the I2C tool? */ + +#define HAVE_I2CTOOL 1 +#if !defined(CONFIG_SYSTEM_I2CTOOL) || !defined(CONFIG_I2C_DRIVER) +# undef HAVE_I2CTOOL +#endif + + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public data + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lc823450_bringup + * + * Description: + * Bring up board features + * + ****************************************************************************/ + +#if defined(CONFIG_LIB_BOARDCTL) || defined(CONFIG_BOARD_INITIALIZE) +int lc823450_bringup(void); +#endif + + +/************************************************************************************ + * Name: lc823450_bma250initialize + ************************************************************************************/ +#ifdef CONFIG_BMA250 +int lc823450_bma250initialize(FAR const char *devpath); +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __CONFIGS_LC823450_XGEVK_SRC_LC823450_XGEVK_H */ diff --git a/configs/lc823450-xgevk/src/lc823450-xgevk_mux.h b/configs/lc823450-xgevk/src/lc823450-xgevk_mux.h new file mode 100644 index 00000000000..bc64b00a4ce --- /dev/null +++ b/configs/lc823450-xgevk/src/lc823450-xgevk_mux.h @@ -0,0 +1,629 @@ +/**************************************************************************** + * configs/lc823450-xgevk/src/lc823450-xgevk_mux.h + * + * Copyright (C) 2017 Sony Corporation. All rights reserved. + * Author: Masatoshi Tateishi + * Author: Masayuki Ishikawa + * + * 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_LC823450_XGEVK_SRC_LC823450_XGEVK_MUX_H +#define __CONFIGS_LC823450_XGEVK_SRC_LC823450_XGEVK_MUX_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * PORT0 + ****************************************************************************/ + +#define PORT0_MUX \ + 0 << 0 | /* 0: GPIO00, 1:TCLKA0, 2: 3:BCK1 */ \ + 0 << 2 | /* 0: GPIO01, 1:TCLKB0, 2: 3:LRCK1 */ \ + 3 << 4 | /* 0: GPIO02, 1:TIOCB00, 2:DMDIN0, 3:DIN1 */ \ + 3 << 6 | /* 0: GPIO03, 1:TIOCB01, 2:DMCKO0, 3:QSCS */ \ + 1 << 8 | /* 0: GPIO04, 1:TXD1, 2:SDAT20 */ \ + 1 << 10 | /* 0: GPIO05, 1:RXD1, 2:SDAT21 */ \ + 0 << 12 | /* 0: GPIO06, 1:NCS0 */ \ + 1 << 14 | /* 0: GPIO07, 1:SCL0 */ \ + 1 << 16 | /* 0: GPIO08, 1:SDA0 */ \ + 0 << 18 | /* 0: GPIO09, 1:TIOCA00, 2:SDCLK2, 3:PHI0 */ \ + 3 << 20 | /* 0: GPIO0A, 1:TIOCA00, 2:SDCMD2, 3:PHI1 */ \ + 0 << 22 | /* 0: GPIO0B, 1:TXD2, 2:TIOCA10 */ \ + 0 << 24 | /* 0: GPIO0C, 1:RXD2, 2:TIOCA11 */ \ + 1 << 26 | /* 0: GPIO0D, 1:SCK1 */ \ + 1 << 28 | /* 0: GPIO0E, 1:SDI1 */ \ + 1 << 30 /* 0: GPIO0F, 1:SDO1 */ + +#define PORT0_PUPD \ + 0 << 0 | /* GPIO00 0:non, 1:PU, 2:PD */ \ + 0 << 2 | /* GPIO01 0:non, 1:PU, 2:PD */ \ + 0 << 4 | /* GPIO02 0:non, 1:PU, 2:PD */ \ + 1 << 6 | /* GPIO03 0:non, 1:PU, 2:PD */ \ + 0 << 8 | /* GPIO04 0:non, 1:PU, 2:PD */ \ + 0 << 10 | /* GPIO05 0:non, 1:PU, 2:PD */ \ + 0 << 12 | /* GPIO06 0:non, 1:PU */ \ + 0 << 14 | /* GPIO07 0:non, 1:PU, 2:PD */ \ + 0 << 16 | /* GPIO08 0:non, 1:PU, 2:PD */ \ + 0 << 18 | /* GPIO09 0:non, 1:PU, 2:PD */ \ + 0 << 20 | /* GPIO0A 0:non, 1:PU, 2:PD */ \ + 0 << 22 | /* GPIO0B 0:non, 1:PU, 2:PD */ \ + 0 << 24 | /* GPIO0C 0:non, 1:PU, 2:PD */ \ + 0 << 26 | /* GPIO0D 0:non, 1:PU, 2:PD */ \ + 0 << 28 | /* GPIO0E 0:non, 1:PU, 2:PD */ \ + 0 << 30 /* GPIO0F 0:non, 1:PU, 2:PD */ + +#define PORT0_DRV \ + 0 << 0 | /* GPIO00 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 2 | /* GPIO01 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 4 | /* GPIO02 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 6 | /* GPIO03 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 8 | /* GPIO04 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 10 | /* GPIO05 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 12 | /* GPIO06 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 14 | /* GPIO07 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 16 | /* GPIO08 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 18 | /* GPIO09 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 20 | /* GPIO0A 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 22 | /* GPIO0B 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 24 | /* GPIO0C 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 26 | /* GPIO0D 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 28 | /* GPIO0E 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 30 /* GPIO0F 0:6mA, 1:---, 2:8mA, 3:10mA */ + +#define PORT0_DIR \ + 1 << 0 | /* GPIO00 0:in, 1:out */ \ + 1 << 1 | /* GPIO01 0:in, 1:out */ \ + 0 << 2 | /* GPIO02 0:in, 1:out */ \ + 0 << 3 | /* GPIO03 0:in, 1:out */ \ + 0 << 4 | /* GPIO04 0:in, 1:out */ \ + 0 << 5 | /* GPIO05 0:in, 1:out */ \ + 1 << 6 | /* GPIO06 0:in, 1:out */ \ + 0 << 7 | /* GPIO07 0:in, 1:out */ \ + 0 << 8 | /* GPIO08 0:in, 1:out */ \ + 1 << 9 | /* GPIO09 0:in, 1:out */ \ + 0 << 10 | /* GPIO0A 0:in, 1:out */ \ + 1 << 11 | /* GPIO0B 0:in, 1:out */ \ + 1 << 12 | /* GPIO0C 0:in, 1:out */ \ + 0 << 13 | /* GPIO0D 0:in, 1:out */ \ + 0 << 14 | /* GPIO0E 0:in, 1:out */ \ + 0 << 15 /* GPIO0F 0:in, 1:out */ + +#define PORT0_DAT \ + 0 << 0 | /* GPIO00 0:0, 1:1 */ \ + 1 << 1 | /* GPIO01 0:0, 1:1 */ \ + 0 << 2 | /* GPIO02 0:0, 1:1 */ \ + 0 << 3 | /* GPIO03 0:0, 1:1 */ \ + 0 << 4 | /* GPIO04 0:0, 1:1 */ \ + 0 << 5 | /* GPIO05 0:0, 1:1 */ \ + 0 << 6 | /* GPIO06 0:0, 1:1 */ \ + 0 << 7 | /* GPIO07 0:0, 1:1 */ \ + 0 << 8 | /* GPIO08 0:0, 1:1 */ \ + 0 << 9 | /* GPIO09 0:0, 1:1 */ \ + 0 << 10 | /* GPIO0A 0:0, 1:1 */ \ + 0 << 11 | /* GPIO0B 0:0, 1:1 */ \ + 0 << 12 | /* GPIO0C 0:0, 1:1 */ \ + 0 << 13 | /* GPIO0D 0:0, 1:1 */ \ + 0 << 14 | /* GPIO0E 0:0, 1:1 */ \ + 0 << 15 /* GPIO0F 0:0, 1:1 */ \ + + +/**************************************************************************** + * PORT1 + ****************************************************************************/ + +#define PORT1_MUX \ + 3 << 0 | /* 0: GPIO10, 1:NCS1 2: 3:RXD0 */ \ + 1 << 2 | /* 0: GPIO11, 1:SWP1 */ \ + 1 << 4 | /* 0: GPIO12, 1:SHOLD1 */ \ + 1 << 6 | /* 0: GPIO13, 1:BCK1 */ \ + 1 << 8 | /* 0: GPIO14, 1:LRCK1 */ \ + 1 << 10 | /* 0: GPIO15, 1:DOUT1 */ \ + 0 << 12 | /* 0: GPIO16, 1:NLBEXA0 */ \ + 0 << 14 | /* 0: GPIO17, 1:NRD */ \ + 0 << 16 | /* 0: GPIO18, 1:MCLK0, 2:MCLK1 */ \ + 0 << 18 | /* 0: GPIO19, 1:BCK0, 2:DMCKO1 */ \ + 0 << 20 | /* 0: GPIO1A, 1:LRCK0, 2:DMDIN1 */ \ + 2 << 22 | /* 0: GPIO1B, 1:DIN0, 2:DMDIN0 */ \ + 0 << 24 | /* 0: GPIO1C, 1:DOUT0, 2:DMCKO0 */ \ + 1 << 26 | /* 0: GPIO1D, 1:SCK0 */ \ + 0 << 28 | /* 0: GPIO1E, 1:SDI0 */ \ + 1 << 30 /* 0: GPIO1F, 1:SDO0 */ + +#define PORT1_PUPD \ + 0 << 0 | /* GPIO10 0:non, 1:PU */ \ + 0 << 2 | /* GPIO11 0:non, 1:PU, 2:PD */ \ + 0 << 4 | /* GPIO12 0:non, 1:PU, 2:PD */ \ + 0 << 6 | /* GPIO13 0:non, 1:PU, 2:PD */ \ + 0 << 8 | /* GPIO14 0:non, 1:PU, 2:PD */ \ + 0 << 10 | /* GPIO15 0:non, 1:PU, 2:PD */ \ + 0 << 12 | /* GPIO16 0:non, 1: 2:PD */ \ + 0 << 14 | /* GPIO17 0:non, 1: 2:PD */ \ + 0 << 16 | /* GPIO18 0:non, 1:PU, 2:PD */ \ + 0 << 18 | /* GPIO19 0:non, 1:PU, 2:PD */ \ + 0 << 20 | /* GPIO1A 0:non, 1:PU, 2:PD */ \ + 0 << 22 | /* GPIO1B 0:non, 1:PU, 2:PD */ \ + 0 << 24 | /* GPIO1C 0:non, 1:PU, 2:PD */ \ + 0 << 26 | /* GPIO1D 0:non, 1:PU, 2:PD */ \ + 0 << 28 | /* GPIO1E 0:non, 1:PU, 2:PD */ \ + 0 << 30 /* GPIO1F 0:non, 1:PU, 2:PD */ + +#define PORT1_DRV \ + 0 << 0 | /* GPIO10 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 2 | /* GPIO11 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 4 | /* GPIO12 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 6 | /* GPIO13 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 8 | /* GPIO14 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 10 | /* GPIO15 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 12 | /* GPIO16 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 14 | /* GPIO17 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 16 | /* GPIO18 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 18 | /* GPIO19 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 20 | /* GPIO1A 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 22 | /* GPIO1B 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 24 | /* GPIO1C 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 26 | /* GPIO1D 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 28 | /* GPIO1E 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 30 /* GPIO1F 0:1mA, 1:---, 2:2mA, 3:4mA */ + +#define PORT1_DIR \ + 0 << 0 | /* GPIO10 0:in, 1:out */ \ + 0 << 1 | /* GPIO11 0:in, 1:out */ \ + 0 << 2 | /* GPIO12 0:in, 1:out */ \ + 0 << 3 | /* GPIO13 0:in, 1:out */ \ + 0 << 4 | /* GPIO14 0:in, 1:out */ \ + 0 << 5 | /* GPIO15 0:in, 1:out */ \ + 1 << 6 | /* GPIO16 0:in, 1:out */ \ + 1 << 7 | /* GPIO17 0:in, 1:out */ \ + 0 << 8 | /* GPIO18 0:in, 1:out */ \ + 0 << 9 | /* GPIO19 0:in, 1:out */ \ + 0 << 10 | /* GPIO1A 0:in, 1:out */ \ + 0 << 11 | /* GPIO1B 0:in, 1:out */ \ + 0 << 12 | /* GPIO1C 0:in, 1:out */ \ + 0 << 13 | /* GPIO1D 0:in, 1:out */ \ + 1 << 14 | /* GPIO1E 0:in, 1:out */ \ + 0 << 15 /* GPIO1F 0:in, 1:out */ + +#define PORT1_DAT \ + 0 << 0 | /* GPIO10 0:0, 1:1 */ \ + 0 << 1 | /* GPIO11 0:0, 1:1 */ \ + 0 << 2 | /* GPIO12 0:0, 1:1 */ \ + 0 << 3 | /* GPIO13 0:0, 1:1 */ \ + 0 << 4 | /* GPIO14 0:0, 1:1 */ \ + 0 << 5 | /* GPIO15 0:0, 1:1 */ \ + 0 << 6 | /* GPIO16 0:0, 1:1 */ \ + 0 << 7 | /* GPIO17 0:0, 1:1 */ \ + 0 << 8 | /* GPIO18 0:0, 1:1 */ \ + 0 << 9 | /* GPIO19 0:0, 1:1 */ \ + 0 << 10 | /* GPIO1A 0:0, 1:1 */ \ + 0 << 11 | /* GPIO1B 0:0, 1:1 */ \ + 0 << 12 | /* GPIO1C 0:0, 1:1 */ \ + 0 << 13 | /* GPIO1D 0:0, 1:1 */ \ + 0 << 14 | /* GPIO1E 0:0, 1:1 */ \ + 0 << 15 /* GPIO1F 0:0, 1:1 */ \ + + +/**************************************************************************** + * PORT2 + ****************************************************************************/ + +#define PORT2_MUX \ + 0 << 0 | /* 0: GPIO20, 1:SDCD1, 2:SWO, 3:TDI */ \ + 0 << 2 | /* 0: GPIO21, 1:SDWP1, 2:INS, 3:TDO */ \ + 1 << 4 | /* 0: GPIO22, 1:SDCLK1, 2:SCLK */ \ + 1 << 6 | /* 0: GPIO23, 1:SDCMD1, 2:BS */ \ + 1 << 8 | /* 0: GPIO24, 1:SDAT10, 2:DATA0 */ \ + 1 << 10 | /* 0: GPIO25, 1:SDAT11, 2:DATA1 */ \ + 1 << 12 | /* 0: GPIO26, 1:SDAT12, 2:DATA2 */ \ + 1 << 14 | /* 0: GPIO27, 1:SDAT13, 2:DATA3 */ \ + 0 << 16 | /* 0: GPIO28, 1: 2:SDWP2, 3:TMS */ \ + 0 << 18 | /* 0: GPIO29, 1: 2:SDCD2, 3:TCK */ \ + 0 << 20 | /* 0: GPIO2A, 1: 2:SDRADDR12 */ \ + 1 << 22 | /* 0: GPIO2B, 1:SCL1 */ \ + 1 << 24 | /* 0: GPIO2C, 1:SDA1 */ \ + 1 << 26 | /* 0: GPIO2D, 1:DMCK0, 2:SDRADDR11 */ \ + 0 << 28 | /* 0: GPIO2E */ \ + 0 << 30 /* 0: GPIO2F */ + +#define PORT2_PUPD \ + 0 << 0 | /* GPIO20 0:non, 1:PU, 2:PD */ \ + 0 << 2 | /* GPIO21 0:non, 1:PU, 2:PD */ \ + 0 << 4 | /* GPIO22 0:non, 1:PU, 2:PD */ \ + 1 << 6 | /* GPIO23 0:non, 1:PU, 2:PD */ \ + 1 << 8 | /* GPIO24 0:non, 1:PU, 2:PD */ \ + 1 << 10 | /* GPIO25 0:non, 1:PU, 2:PD */ \ + 1 << 12 | /* GPIO26 0:non, 1:PU, 2:PD */ \ + 1 << 14 | /* GPIO27 0:non, 1:PU, 2:PD */ \ + 0 << 16 | /* GPIO28 0:non, 1:PU, 2:PD */ \ + 0 << 18 | /* GPIO29 0:non, 1:PU, 2:PD */ \ + 0 << 20 | /* GPIO2A 0:non, 1:PU, 2:PD */ \ + 0 << 22 | /* GPIO2B 0:non, 1:PU, 2:PD */ \ + 0 << 24 | /* GPIO2C 0:non, 1:PU, 2:PD */ \ + 0 << 26 | /* GPIO2D 0:non, 1:PU, 2:PD */ \ + 0 << 28 | /* GPIO2E 0:non, 1:PU, 2:PD */ \ + 0 << 30 /* GPIO2F 0:non, 1:PU, 2:PD */ + +#define PORT2_DRV \ + 0 << 0 | /* GPIO20 0:---, 1:---, 2:---, 3:--- */ \ + 0 << 2 | /* GPIO21 0:---, 1:---, 2:---, 3:--- */ \ + 0 << 4 | /* GPIO22 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 6 | /* GPIO23 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 8 | /* GPIO24 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 10 | /* GPIO25 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 12 | /* GPIO26 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 14 | /* GPIO27 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 16 | /* GPIO28 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 18 | /* GPIO29 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 20 | /* GPIO2A 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 22 | /* GPIO2B 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 24 | /* GPIO2C 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 26 | /* GPIO2D 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 28 | /* GPIO2E 0:1mA, 1:---, 2:2mA, 3:4mA */ \ + 0 << 30 /* GPIO2F 0:1mA, 1:---, 2:2mA, 3:4mA */ + +#define PORT2_DIR \ + 0 << 0 | /* GPIO20 0:in, 1:out */ \ + 1 << 1 | /* GPIO21 0:in, 1:out */ \ + 0 << 2 | /* GPIO22 0:in, 1:out */ \ + 0 << 3 | /* GPIO23 0:in, 1:out */ \ + 0 << 4 | /* GPIO24 0:in, 1:out */ \ + 0 << 5 | /* GPIO25 0:in, 1:out */ \ + 0 << 6 | /* GPIO26 0:in, 1:out */ \ + 0 << 7 | /* GPIO27 0:in, 1:out */ \ + 0 << 8 | /* GPIO28 0:in, 1:out */ \ + 0 << 9 | /* GPIO29 0:in, 1:out */ \ + 0 << 10 | /* GPIO2A 0:in, 1:out */ \ + 0 << 11 | /* GPIO2B 0:in, 1:out */ \ + 0 << 12 | /* GPIO2C 0:in, 1:out */ \ + 0 << 13 | /* GPIO2D 0:in, 1:out */ \ + 0 << 14 | /* GPIO2E 0:in, 1:out */ \ + 1 << 15 /* GPIO2F 0:in, 1:out */ + +#define PORT2_DAT \ + 0 << 0 | /* GPIO20 0:0, 1:1 */ \ + 1 << 1 | /* GPIO21 0:0, 1:1 */ \ + 0 << 2 | /* GPIO22 0:0, 1:1 */ \ + 0 << 3 | /* GPIO23 0:0, 1:1 */ \ + 0 << 4 | /* GPIO24 0:0, 1:1 */ \ + 0 << 5 | /* GPIO25 0:0, 1:1 */ \ + 0 << 6 | /* GPIO26 0:0, 1:1 */ \ + 0 << 7 | /* GPIO27 0:0, 1:1 */ \ + 0 << 8 | /* GPIO28 0:0, 1:1 */ \ + 0 << 9 | /* GPIO29 0:0, 1:1 */ \ + 0 << 10 | /* GPIO2A 0:0, 1:1 */ \ + 0 << 11 | /* GPIO2B 0:0, 1:1 */ \ + 0 << 12 | /* GPIO2C 0:0, 1:1 */ \ + 0 << 13 | /* GPIO2D 0:0, 1:1 */ \ + 0 << 14 | /* GPIO2E 0:0, 1:1 */ \ + 0 << 15 /* GPIO2F 0:0, 1:1 */ \ + + +/**************************************************************************** + * PORT3 + ****************************************************************************/ + +#define PORT3_MUX \ + 0 << 0 | /* 0: GPIO30, 1:NWRENWRL */ \ + 3 << 2 | /* 0: GPIO31, 1:NHBNWRH, 2: 3:TXDO */ \ + 0 << 4 | /* 0: GPIO32, 1:EXA1 */ \ + 0 << 6 | /* 0: GPIO33, 1:EXA2 */ \ + 0 << 8 | /* 0: GPIO34, 1:EXA3 */ \ + 0 << 10 | /* 0: GPIO35, 1:EXA4 */ \ + 0 << 12 | /* 0: GPIO36, 1:EXA5 */ \ + 0 << 14 | /* 0: GPIO37, 1:EXA6 */ \ + 0 << 16 | /* 0: GPIO38, 1:EXA7 */ \ + 0 << 18 | /* 0: GPIO39, 1:EXA8 */ \ + 0 << 20 | /* 0: GPIO3A, 1:EXA9 */ \ + 0 << 22 | /* 0: GPIO3B, 1:EXA10 */ \ + 0 << 24 | /* 0: GPIO3C, 1:EXA11 */ \ + 0 << 26 | /* 0: GPIO3D, 1:EXA12 */ \ + 0 << 28 | /* 0: GPIO3E, 1:EXA13 */ \ + 0 << 30 /* 0: GPIO3F, 1:EXA14 */ + +#define PORT3_PUPD \ + 0 << 0 | /* GPIO30 0:non, 1: 2:PD */ \ + 0 << 2 | /* GPIO31 0:non, 1: 2:PD */ \ + 0 << 4 | /* GPIO32 0:non, 1: 2:PD */ \ + 0 << 6 | /* GPIO33 0:non, 1: 2:PD */ \ + 0 << 8 | /* GPIO34 0:non, 1: 2:PD */ \ + 0 << 10 | /* GPIO35 0:non, 1: 2:PD */ \ + 0 << 12 | /* GPIO36 0:non, 1: 2:PD */ \ + 0 << 14 | /* GPIO37 0:non, 1: 2:PD */ \ + 0 << 16 | /* GPIO38 0:non, 1: 2:PD */ \ + 0 << 18 | /* GPIO39 0:non, 1: 2:PD */ \ + 0 << 20 | /* GPIO3A 0:non, 1: 2:PD */ \ + 0 << 22 | /* GPIO3B 0:non, 1: 2:PD */ \ + 0 << 24 | /* GPIO3C 0:non, 1: 2:PD */ \ + 0 << 26 | /* GPIO3D 0:non, 1: 2:PD */ \ + 0 << 28 | /* GPIO3E 0:non, 1: 2:PD */ \ + 0 << 30 /* GPIO3F 0:non, 1: 2:PD */ + +#define PORT3_DRV \ + 0 << 0 | /* GPIO30 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 2 | /* GPIO31 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 4 | /* GPIO32 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 6 | /* GPIO33 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 8 | /* GPIO34 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 10 | /* GPIO35 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 12 | /* GPIO36 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 14 | /* GPIO37 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 16 | /* GPIO38 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 18 | /* GPIO39 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 20 | /* GPIO3A 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 22 | /* GPIO3B 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 24 | /* GPIO3C 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 26 | /* GPIO3D 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 28 | /* GPIO3E 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 30 /* GPIO3F 0:2mA, 1:---, 2:4mA, 3:8mA */ + +#define PORT3_DIR \ + 1 << 0 | /* GPIO30 0:in, 1:out */ \ + 0 << 1 | /* GPIO31 0:in, 1:out */ \ + 0 << 2 | /* GPIO32 0:in, 1:out */ \ + 0 << 3 | /* GPIO33 0:in, 1:out */ \ + 0 << 4 | /* GPIO34 0:in, 1:out */ \ + 0 << 5 | /* GPIO35 0:in, 1:out */ \ + 0 << 6 | /* GPIO36 0:in, 1:out */ \ + 0 << 7 | /* GPIO37 0:in, 1:out */ \ + 0 << 8 | /* GPIO38 0:in, 1:out */ \ + 0 << 9 | /* GPIO39 0:in, 1:out */ \ + 0 << 10 | /* GPIO3A 0:in, 1:out */ \ + 0 << 11 | /* GPIO3B 0:in, 1:out */ \ + 0 << 12 | /* GPIO3C 0:in, 1:out */ \ + 0 << 13 | /* GPIO3D 0:in, 1:out */ \ + 0 << 14 | /* GPIO3E 0:in, 1:out */ \ + 0 << 15 /* GPIO3F 0:in, 1:out */ + +#define PORT3_DAT \ + 0 << 0 | /* GPIO30 0:0, 1:1 */ \ + 0 << 1 | /* GPIO31 0:0, 1:1 */ \ + 0 << 2 | /* GPIO32 0:0, 1:1 */ \ + 0 << 3 | /* GPIO33 0:0, 1:1 */ \ + 0 << 4 | /* GPIO34 0:0, 1:1 */ \ + 0 << 5 | /* GPIO35 0:0, 1:1 */ \ + 0 << 6 | /* GPIO36 0:0, 1:1 */ \ + 0 << 7 | /* GPIO37 0:0, 1:1 */ \ + 0 << 8 | /* GPIO38 0:0, 1:1 */ \ + 0 << 9 | /* GPIO39 0:0, 1:1 */ \ + 0 << 10 | /* GPIO3A 0:0, 1:1 */ \ + 0 << 11 | /* GPIO3B 0:0, 1:1 */ \ + 0 << 12 | /* GPIO3C 0:0, 1:1 */ \ + 0 << 13 | /* GPIO3D 0:0, 1:1 */ \ + 0 << 14 | /* GPIO3E 0:0, 1:1 */ \ + 0 << 15 /* GPIO3F 0:0, 1:1 */ + + +/**************************************************************************** + * PORT4 + ****************************************************************************/ + +#define PORT4_MUX \ + 0 << 0 | /* 0: GPIO40, 1:EXA15 */ \ + 0 << 2 | /* 0: GPIO41, 1:EXA16 */ \ + 0 << 4 | /* 0: GPIO42, 1:EXA17 */ \ + 0 << 6 | /* 0: GPIO43, 1:EXA18 */ \ + 0 << 8 | /* 0: GPIO44, 1:EXA19 */ \ + 0 << 10 | /* 0: GPIO45, 1:EXA20 */ \ + 0 << 12 | /* 0: GPIO46, 1:EXD0 */ \ + 0 << 14 | /* 0: GPIO47, 1:EXD1 */ \ + 0 << 16 | /* 0: GPIO48, 1:EXD2 */ \ + 0 << 18 | /* 0: GPIO49, 1:EXD3 */ \ + 0 << 20 | /* 0: GPIO4A, 1:EXD4 */ \ + 0 << 22 | /* 0: GPIO4B, 1:EXD5 */ \ + 0 << 24 | /* 0: GPIO4C, 1:EXD6 */ \ + 0 << 26 | /* 0: GPIO4D, 1:EXD7 */ \ + 0 << 28 | /* 0: GPIO4E, 1:EXD8 */ \ + 0 << 30 /* 0: GPIO4F, 1:EXD9 */ + +#define PORT4_PUPD \ + 0 << 0 | /* GPIO40 0:non, 1: 2:PD */ \ + 0 << 2 | /* GPIO41 0:non, 1: 2:PD */ \ + 0 << 4 | /* GPIO42 0:non, 1: 2:PD */ \ + 0 << 6 | /* GPIO43 0:non, 1: 2:PD */ \ + 0 << 8 | /* GPIO44 0:non, 1: 2:PD */ \ + 0 << 10 | /* GPIO45 0:non, 1: 2:PD */ \ + 0 << 12 | /* GPIO46 0:non, 1: 2:PD */ \ + 0 << 14 | /* GPIO47 0:non, 1: 2:PD */ \ + 0 << 16 | /* GPIO48 0:non, 1: 2:PD */ \ + 0 << 18 | /* GPIO49 0:non, 1: 2:PD */ \ + 0 << 20 | /* GPIO4A 0:non, 1: 2:PD */ \ + 0 << 22 | /* GPIO4B 0:non, 1: 2:PD */ \ + 0 << 24 | /* GPIO4C 0:non, 1: 2:PD */ \ + 0 << 26 | /* GPIO4D 0:non, 1: 2:PD */ \ + 0 << 28 | /* GPIO4E 0:non, 1: 2:PD */ \ + 0 << 30 /* GPIO4F 0:non, 1: 2:PD */ + +#define PORT4_DRV \ + 0 << 0 | /* GPIO40 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 2 | /* GPIO41 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 4 | /* GPIO42 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 6 | /* GPIO43 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 8 | /* GPIO44 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 10 | /* GPIO45 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 12 | /* GPIO46 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 14 | /* GPIO47 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 16 | /* GPIO48 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 18 | /* GPIO49 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 20 | /* GPIO4A 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 22 | /* GPIO4B 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 24 | /* GPIO4C 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 26 | /* GPIO4D 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 28 | /* GPIO4E 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 30 /* GPIO4F 0:2mA, 1:---, 2:4mA, 3:8mA */ + +#define PORT4_DIR \ + 0 << 0 | /* GPIO40 0:in, 1:out */ \ + 0 << 1 | /* GPIO41 0:in, 1:out */ \ + 0 << 2 | /* GPIO42 0:in, 1:out */ \ + 0 << 3 | /* GPIO43 0:in, 1:out */ \ + 0 << 4 | /* GPIO44 0:in, 1:out */ \ + 0 << 5 | /* GPIO45 0:in, 1:out */ \ + 0 << 6 | /* GPIO46 0:in, 1:out */ \ + 1 << 7 | /* GPIO47 0:in, 1:out */ \ + 1 << 8 | /* GPIO48 0:in, 1:out */ \ + 1 << 9 | /* GPIO49 0:in, 1:out */ \ + 0 << 10 | /* GPIO4A 0:in, 1:out */ \ + 0 << 11 | /* GPIO4B 0:in, 1:out */ \ + 0 << 12 | /* GPIO4C 0:in, 1:out */ \ + 0 << 13 | /* GPIO4D 0:in, 1:out */ \ + 0 << 14 | /* GPIO4E 0:in, 1:out */ \ + 0 << 15 /* GPIO4F 0:in, 1:out */ + +#define PORT4_DAT \ + 0 << 0 | /* GPIO40 0:0, 1:1 */ \ + 0 << 1 | /* GPIO41 0:0, 1:1 */ \ + 0 << 2 | /* GPIO42 0:0, 1:1 */ \ + 0 << 3 | /* GPIO43 0:0, 1:1 */ \ + 0 << 4 | /* GPIO44 0:0, 1:1 */ \ + 0 << 5 | /* GPIO45 0:0, 1:1 */ \ + 0 << 6 | /* GPIO46 0:0, 1:1 */ \ + 0 << 7 | /* GPIO47 0:0, 1:1 */ \ + 0 << 8 | /* GPIO48 0:0, 1:1 */ \ + 0 << 9 | /* GPIO49 0:0, 1:1 */ \ + 0 << 10 | /* GPIO4A 0:0, 1:1 */ \ + 0 << 11 | /* GPIO4B 0:0, 1:1 */ \ + 0 << 12 | /* GPIO4C 0:0, 1:1 */ \ + 0 << 13 | /* GPIO4D 0:0, 1:1 */ \ + 0 << 14 | /* GPIO4E 0:0, 1:1 */ \ + 0 << 15 /* GPIO4F 0:0, 1:1 */ + + +/**************************************************************************** + * PORT5 + ****************************************************************************/ + +#define PORT5_MUX \ + 0 << 0 | /* 0: GPIO50, 1:EXD10 */ \ + 0 << 2 | /* 0: GPIO51, 1:EXD11 */ \ + 0 << 4 | /* 0: GPIO52, 1:EXD12 */ \ + 0 << 6 | /* 0: GPIO53, 1:EXD13 */ \ + 0 << 8 | /* 0: GPIO54, 1:EXD14 */ \ + 0 << 10 | /* 0: GPIO55, 1:EXD25 */ \ + 1 << 12 | /* 0: GPIO56, 1:CTS1, 2:SDAT22 3:RXD0 */ \ + 1 << 14 | /* 0: GPIO57, 1:RTS1, 2:SDAT23 3:TXD0 */ \ + 3 << 16 | /* 0: GPIO58, 1:DMCKO1, 2: 3:SWDCLK */ \ + 3 << 18 /* 0: GPIO59, 1:DMDIN1, 2: 3:SWDIO */ + +#define PORT5_PUPD \ + 0 << 0 | /* GPIO50 0:non, 1: 2:PD */ \ + 0 << 2 | /* GPIO51 0:non, 1: 2:PD */ \ + 0 << 4 | /* GPIO52 0:non, 1: 2:PD */ \ + 0 << 6 | /* GPIO53 0:non, 1: 2:PD */ \ + 0 << 8 | /* GPIO54 0:non, 1: 2:PD */ \ + 0 << 10 | /* GPIO55 0:non, 1: 2:PD */ \ + 2 << 12 | /* GPIO56 0:non, 1:PU, 2:PD */ \ + 2 << 14 | /* GPIO57 0:non, 1:PU, 2:PD */ \ + 0 << 16 | /* GPIO58 0:non, 1:PU, 2:PD */ \ + 0 << 18 /* GPIO59 0:non, 1:PU */ + +#define PORT5_DRV \ + 0 << 0 | /* GPIO50 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 2 | /* GPIO51 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 4 | /* GPIO52 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 6 | /* GPIO53 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 8 | /* GPIO54 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 10 | /* GPIO55 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 12 | /* GPIO56 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 14 | /* GPIO57 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 16 | /* GPIO58 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 18 /* GPIO59 0:1mA, 1:---, 2:2mA, 3:4mA */ + +#define PORT5_DIR \ + 0 << 0 | /* GPIO50 0:in, 1:out */ \ + 0 << 1 | /* GPIO51 0:in, 1:out */ \ + 0 << 2 | /* GPIO52 0:in, 1:out */ \ + 0 << 3 | /* GPIO53 0:in, 1:out */ \ + 0 << 4 | /* GPIO54 0:in, 1:out */ \ + 0 << 5 | /* GPIO55 0:in, 1:out */ \ + 0 << 6 | /* GPIO56 0:in, 1:out */ \ + 0 << 7 | /* GPIO57 0:in, 1:out */ \ + 0 << 8 | /* GPIO58 0:in, 1:out */ \ + 0 << 9 /* GPIO59 0:in, 1:out */ + +#define PORT5_DAT \ + 0 << 0 | /* GPIO50 0:0, 1:1 */ \ + 0 << 1 | /* GPIO51 0:0, 1:1 */ \ + 0 << 2 | /* GPIO52 0:0, 1:1 */ \ + 0 << 3 | /* GPIO53 0:0, 1:1 */ \ + 0 << 4 | /* GPIO54 0:0, 1:1 */ \ + 0 << 5 | /* GPIO55 0:0, 1:1 */ \ + 0 << 6 | /* GPIO56 0:0, 1:1 */ \ + 0 << 7 | /* GPIO57 0:0, 1:1 */ \ + 0 << 8 | /* GPIO58 0:0, 1:1 */ \ + 0 << 9 /* GPIO59 0:0, 1:1 */ + + +/**************************************************************************** + * PORT6 + ****************************************************************************/ + +#define PORT6_PUPD \ + 1 << 2 | /* SDCMD0 0:non, 1: 2:PD */ \ + 1 << 4 | /* SDAT03-0 0:non, 1: 2:PD */ \ + 0 << 6 | /* SDRDATA15-0 0:non, 1: 2:PD */ \ + 0 << 8 | /* BMODE0 0:non, 1: 2:PD */ \ + 0 << 10 | /* BMODE1 0:non, 1: 2:PD */ \ + 0 << 12 | /* XTALINFO0 0:non, 1:PU, 2:PD */ \ + 0 << 14 /* XTALINFO1 0:non, 1:PU, 2:PD */ + +#define PORT6_DRV \ + 2 << 0 | /* SDCLK0 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 2 << 2 | /* SDCMD0 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 2 << 4 | /* SDAT03 0:6mA, 1:---, 2:8mA, 3:10mA */ \ + 0 << 6 | /* SDRDA1 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 8 | /* SDRAD1 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 10 | /* SDRBA1 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 12 | /* SDRCAS 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 14 | /* SDRCKE 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 16 | /* SDRCLK 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 18 | /* SDRCS 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 20 | /* SDRDQM 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 22 | /* XTALI0 0:2mA, 1:---, 2:4mA, 3:8mA */ \ + 0 << 24 /* XTALI1 0:2mA, 1:---, 2:4mA, 3:8mA */ + + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public data + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +#endif /* __CONFIGS_LC823450_XGEVK_SRC_LC823450_XGEVK_MUX_H */ diff --git a/configs/lc823450-xgevk/src/lc823450_appinit.c b/configs/lc823450-xgevk/src/lc823450_appinit.c new file mode 100644 index 00000000000..9d4a8fb42f4 --- /dev/null +++ b/configs/lc823450-xgevk/src/lc823450_appinit.c @@ -0,0 +1,179 @@ +/**************************************************************************** + * configs/lc823450-xgevk/src/lc823450_appinit.c + * + * Copyright (C) 2017 Sony Corporation. All rights reserved. + * Author: Masayuki Ishikawa + * + * 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 + +#include + +#include +#include + +#include "lc823450_i2c.h" +#include "lc823450-xgevk.h" + +#ifdef CONFIG_LIB_BOARDCTL + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lc823450_i2c_register + * + * Description: + * Register one I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void lc823450_i2c_register(int bus) +{ + FAR struct i2c_master_s *i2c; + int ret; + + i2c = lc823450_i2cbus_initialize(bus); + if (i2c == NULL) + { + _err("ERROR: Failed to get I2C%d interface\n", bus); + } + else + { + ret = i2c_register(i2c, bus); + if (ret < 0) + { + _err("ERROR: Failed to register I2C%d driver: %d\n", bus, ret); + lc823450_i2cbus_uninitialize(i2c); + } + } +} +#endif + +/**************************************************************************** + * Name: lc823450_i2ctool + * + * Description: + * Register I2C drivers for the I2C tool. + * + ****************************************************************************/ + +#ifdef HAVE_I2CTOOL +static void lc823450_i2ctool(void) +{ +#ifdef CONFIG_LC823450_I2C0 + lc823450_i2c_register(0); +#endif +#ifdef CONFIG_LC823450_I2C1 + lc823450_i2c_register(1); +#endif +} +#else +# define lc823450_i2ctool() +#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 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) +{ + /* Register I2C drivers on behalf of the I2C tool */ + + lc823450_i2ctool(); + +#ifdef CONFIG_MTD_LC823450 + /* Initialize eMMC */ + + int ret = lc823450_mtd_initialize(CONFIG_MTD_DEVNO_EMMC); + if (ret != OK) + { + _err("Failed to initialize eMMC: ret=%d\n", ret); + } + +#ifdef CONFIG_LC823450_SDIF_SDC + /* Initialize uSD */ + + ret = lc823450_mtd_initialize(CONFIG_MTD_DEVNO_SDC); + if (ret != OK) + { + _err("Failed to initialize uSD: ret=%d\n", ret); + } +#endif /* CONFIG_LC823450_SDIF_SDC */ + +#endif /* CONFIG_MTD_LC823450 */ + +#ifndef CONFIG_BOARD_INITIALIZE + /* Perform board initialization */ + + return lc823450_bringup(); +#else + return OK; +#endif +} + +#endif /* CONFIG_LIB_BOARDCTL */ diff --git a/configs/lc823450-xgevk/src/lc823450_boot.c b/configs/lc823450-xgevk/src/lc823450_boot.c new file mode 100644 index 00000000000..3c70f673e2b --- /dev/null +++ b/configs/lc823450-xgevk/src/lc823450_boot.c @@ -0,0 +1,79 @@ +/**************************************************************************** + * configs/lc823450-xgevk/src/lc823450_boot.c + * + * Copyright (C) 2017 Sony Corporation. All rights reserved. + * Author: Masayuki Ishikawa + * + * 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 +#include +#include + + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_initialize + * + * Description: + * If CONFIG_BOARD_INITIALIZE is selected, then an additional + * initialization call will be performed in the boot-up sequence to a + * function called board_initialize(). board_initialize() will be + * called immediately after up_intitialize() is called and just before the + * initial application is started. This additional initialization phase + * may be used, for example, to initialize board-specific device drivers. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_INITIALIZE +void board_initialize(void) +{ + /* Perform board initialization */ + + (void)lc823450_bringup(); +} +#endif /* CONFIG_BOARD_INITIALIZE */ diff --git a/configs/lc823450-xgevk/src/lc823450_bringup.c b/configs/lc823450-xgevk/src/lc823450_bringup.c new file mode 100644 index 00000000000..4f033231ccd --- /dev/null +++ b/configs/lc823450-xgevk/src/lc823450_bringup.c @@ -0,0 +1,95 @@ +/**************************************************************************** + * configs/lc823450-xgevk/src/lc823450_bringup.c + * + * Copyright (C) 2017 Sony Corporation. All rights reserved. + * Author: Masayuki Ishikawa + * + * 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 + +#include +#include + +#include +#include + +#include "lc823450-xgevk.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lc823450_bringup + * + * Description: + * Bring up board features + * + ****************************************************************************/ + +int lc823450_bringup(void) +{ + int ret; + +#ifdef CONFIG_FS_PROCFS + /* Mount the procfs file system */ + + ret = mount(NULL, "/proc", "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); + } +#endif + +#ifdef CONFIG_BMA250 + lc823450_bma250initialize("/dev/accel"); +#endif + + /* If we got here then perhaps not all initialization was successful, but + * at least enough succeeded to bring-up NSH with perhaps reduced + * capabilities. + */ + + UNUSED(ret); + return OK; +} diff --git a/configs/lc823450-xgevk/src/lc823450_mux.c b/configs/lc823450-xgevk/src/lc823450_mux.c new file mode 100644 index 00000000000..f054d84415e --- /dev/null +++ b/configs/lc823450-xgevk/src/lc823450_mux.c @@ -0,0 +1,133 @@ +/**************************************************************************** + * configs/lc823450-xgevk/src/lc823450_mux.c + * + * Copyright (C) 2017 Sony Corporation. All rights reserved. + * Author: Masatoshi Tateishi + * Author: Masayuki Ishikawa + * + * 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 +#include +#include +#include + +#include + +#include "chip.h" +#include "up_arch.h" +#include "up_internal.h" +#include "lc823450_syscontrol.h" + +#include "lc823450-xgevk_mux.h" + + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_init_default_mux + * + * Description: + * Initial pinmux settings at boot + * + ****************************************************************************/ + +void up_init_default_mux(void) +{ + modifyreg32(MCLKCNTAPB, 0, + MCLKCNTAPB_PORT0_CLKEN | + MCLKCNTAPB_PORT1_CLKEN | + MCLKCNTAPB_PORT2_CLKEN | + MCLKCNTAPB_PORT3_CLKEN | + MCLKCNTAPB_PORT4_CLKEN | + MCLKCNTAPB_PORT5_CLKEN); + + modifyreg32(MRSTCNTAPB, 0, + MRSTCNTAPB_PORT0_RSTB | + MRSTCNTAPB_PORT1_RSTB | + MRSTCNTAPB_PORT2_RSTB | + MRSTCNTAPB_PORT3_RSTB | + MRSTCNTAPB_PORT4_RSTB | + MRSTCNTAPB_PORT5_RSTB); + + putreg32(PORT0_MUX, PMDCNT0); + putreg32(PORT0_PUPD, PUDCNT0); + putreg32(PORT0_DRV, PTDRVCNT0); + putreg32(PORT0_DAT, rP0DT); + putreg32(PORT0_DIR, rP0DRC); + + putreg32(PORT1_MUX, PMDCNT1); + putreg32(PORT1_PUPD, PUDCNT1); + putreg32(PORT1_DRV, PTDRVCNT1); + putreg32(PORT1_DAT, rP1DT); + putreg32(PORT1_DIR, rP1DRC); + + putreg32(PORT2_MUX, PMDCNT2); + putreg32(PORT2_PUPD, PUDCNT2); + putreg32(PORT2_DRV, PTDRVCNT2); + putreg32(PORT2_DAT, rP2DT); + putreg32(PORT2_DIR, rP2DRC); + + putreg32(PORT3_MUX, PMDCNT3); + putreg32(PORT3_PUPD, PUDCNT3); + putreg32(PORT3_DRV, PTDRVCNT3); + putreg32(PORT3_DAT, rP3DT); + putreg32(PORT3_DIR, rP3DRC); + + putreg32(PORT4_MUX, PMDCNT4); + putreg32(PORT4_PUPD, PUDCNT4); + putreg32(PORT4_DRV, PTDRVCNT4); + putreg32(PORT4_DAT, rP4DT); + putreg32(PORT4_DIR, rP4DRC); + + putreg32(PORT5_MUX, PMDCNT5); + putreg32(PORT5_PUPD, PUDCNT5); + putreg32(PORT5_DRV, PTDRVCNT5); + putreg32(PORT5_DAT, rP5DT); + putreg32(PORT5_DIR, rP5DRC); + + putreg32(PORT6_PUPD, PUDCNT6); + putreg32(PORT6_DRV, PTDRVCNT6); + +} diff --git a/configs/lc823450-xgevk/src/lc823450_spi.c b/configs/lc823450-xgevk/src/lc823450_spi.c new file mode 100644 index 00000000000..ea3563662ac --- /dev/null +++ b/configs/lc823450-xgevk/src/lc823450_spi.c @@ -0,0 +1,81 @@ +/**************************************************************************** + * configs/lc823450-xgevk/src/lc823450_spi.c + * + * Copyright (C) 2017 Sony Corporation. All rights reserved. + * Author: Masayuki Ishikawa + * + * 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 + +#include +#include +#include + +#include + +#include "lc823450_gpio.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + + +/**************************************************************************** + * Name: lc823450_spiselect + * + ****************************************************************************/ + +void lc823450_spiselect(FAR struct spi_dev_s *dev, uint32_t devid, bool selected) +{ + /* no need */ +} + + +/**************************************************************************** + * Name: lc823450_spiinitialize + * + * Description: + * Called to configure SPI chip select GPIO pins for the lc823450 board. + * + ****************************************************************************/ + +void lc823450_spiinitialize(void) +{ + /* NOTE: already set in _mux.h */ +} diff --git a/configs/lc823450-xgevk/src/lc823450_st7565.c b/configs/lc823450-xgevk/src/lc823450_st7565.c new file mode 100644 index 00000000000..c939cc00420 --- /dev/null +++ b/configs/lc823450-xgevk/src/lc823450_st7565.c @@ -0,0 +1,226 @@ +/**************************************************************************** + * configs/lc823450-xgevk/src/lc823450_st7565.c + * + * Copyright (C) 2017 Sony Corporation. All rights reserved. + * Author: Masayuki Ishikawa + * + * 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 + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "up_arch.h" +#include "lc823450_gpio.h" +#include "lc823450_spi.h" +#include "lc823450-xgevk.h" + + +#ifdef CONFIG_NX_LCDDRIVER + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define LCD_SPI_PORTNO 0 + +#define GPIO_LCD_CS (GPIO_PORT1 | GPIO_PINE | GPIO_MODE_OUTPUT | GPIO_VALUE_ONE) +#define GPIO_LCD_A0 (GPIO_PORT4 | GPIO_PIN9 | GPIO_MODE_OUTPUT | GPIO_VALUE_ONE) +#define GPIO_LCD_NRES (GPIO_PORT4 | GPIO_PIN8 | GPIO_MODE_OUTPUT | GPIO_VALUE_ONE) + +/**************************************************************************** + * Private Data + ****************************************************************************/ + + +static void lc823450_st7565_reset(FAR struct st7565_lcd_s *lcd, bool on); +static void lc823450_st7565_select(FAR struct st7565_lcd_s *lcd); +static void lc823450_st7565_deselect(FAR struct st7565_lcd_s *lcd); +static void lc823450_st7565_cmddata(FAR struct st7565_lcd_s *lcd, const uint8_t cmd); +static int lc823450_st7565_senddata(FAR struct st7565_lcd_s *lcd, FAR const uint8_t *data, + int size); +static int lc823450_st7565_backlight(FAR struct st7565_lcd_s *lcd, int level); + + +static FAR struct spi_dev_s *g_spidev; +static FAR struct lcd_dev_s *g_lcddev; + +static struct st7565_lcd_s g_st7565_dev = +{ + .reset = lc823450_st7565_reset, + .select = lc823450_st7565_select, + .deselect = lc823450_st7565_deselect, + .cmddata = lc823450_st7565_cmddata, + .senddata = lc823450_st7565_senddata, + .backlight = lc823450_st7565_backlight, +}; + + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lc823450_st7565_reset + ****************************************************************************/ + +static void lc823450_st7565_reset(FAR struct st7565_lcd_s *lcd, bool on) +{ + if (on) + { + lc823450_gpio_write(GPIO_LCD_NRES, false); + } + else + { + lc823450_gpio_write(GPIO_LCD_NRES, true); + } +} + +/**************************************************************************** + * Name: lc823450_st7565_select + ****************************************************************************/ + +static void lc823450_st7565_select(FAR struct st7565_lcd_s *lcd) +{ + lc823450_gpio_write(GPIO_LCD_CS, false); +} + +/**************************************************************************** + * Name: lc823450_st7565_deselect + ****************************************************************************/ + +static void lc823450_st7565_deselect(FAR struct st7565_lcd_s *lcd) +{ + lc823450_gpio_write(GPIO_LCD_CS, true); +} + +/**************************************************************************** + * Name: lc823450_st7565_cmddata + ****************************************************************************/ + +static void lc823450_st7565_cmddata(FAR struct st7565_lcd_s *lcd, const uint8_t cmd) +{ + lc823450_gpio_write(GPIO_LCD_A0, !cmd); +} + +/**************************************************************************** + * Name: lc823450_st7565_senddata + ****************************************************************************/ + +static int lc823450_st7565_senddata(FAR struct st7565_lcd_s *lcd, + FAR const uint8_t *data, + int size) +{ + SPI_SNDBLOCK(g_spidev, data, size); + return 0; +} + +/**************************************************************************** + * Name: lc823450_st7565_backlight + ****************************************************************************/ + +static int lc823450_st7565_backlight(FAR struct st7565_lcd_s *lcd, int level) +{ + return 0; +} + + + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_lcd_initialize + ****************************************************************************/ + +int board_lcd_initialize(void) +{ + g_spidev = lc823450_spibus_initialize(LCD_SPI_PORTNO); + ASSERT(NULL != g_spidev); + + g_spidev->ops->setmode(g_spidev, SPIDEV_MODE3); + g_spidev->ops->setbits(g_spidev, 8); + g_spidev->ops->setfrequency(g_spidev, 1000000); + + return 0; +} + + +/**************************************************************************** + * Name: board_lcd_getdev + ****************************************************************************/ + +FAR struct lcd_dev_s *board_lcd_getdev(int lcddev) +{ + g_lcddev = st7565_initialize(&g_st7565_dev, lcddev); + if (!g_lcddev) + { + lcderr("ERROR: Failed to bind SPI port 1 to LCD %d: %d\n", lcddev); + } + else + { + lcdinfo("SPI port 1 bound to LCD %d\n", lcddev); + + (void)g_lcddev->setcontrast(g_lcddev, CONFIG_LCD_MAXCONTRAST); + + /* And turn the LCD on (CONFIG_LCD_MAXPOWER should be 1) */ + + (void)g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER); + return g_lcddev; + } + + return NULL; +} + +/**************************************************************************** + * Name: board_lcd_uninitialize + ****************************************************************************/ + +void board_lcd_uninitialize(void) +{ +} + +#endif /* CONFIG_NX_LCDDRIVER */