From 01f95a4c52a64f1706fb2733a2a2bd9284ebb8b5 Mon Sep 17 00:00:00 2001 From: Vladimir Komendantskiy Date: Sun, 31 Jan 2016 08:49:30 -0600 Subject: [PATCH] Adds support for the U-Blox C027 board with the lower-half U-Blox modem driver. --- configs/Kconfig | 13 + configs/u-blox-c027/Kconfig | 7 + configs/u-blox-c027/README.txt | 144 +++ configs/u-blox-c027/include/board.h | 295 ++++++ configs/u-blox-c027/nsh/Make.defs | 110 +++ configs/u-blox-c027/nsh/defconfig | 1248 ++++++++++++++++++++++++ configs/u-blox-c027/nsh/setenv.sh | 59 ++ configs/u-blox-c027/scripts/ld.script | 117 +++ configs/u-blox-c027/src/.gitignore | 2 + configs/u-blox-c027/src/Makefile | 53 + configs/u-blox-c027/src/lpc17_adc.c | 113 +++ configs/u-blox-c027/src/lpc17_boot.c | 117 +++ configs/u-blox-c027/src/lpc17_dac.c | 105 ++ configs/u-blox-c027/src/lpc17_leds.c | 150 +++ configs/u-blox-c027/src/lpc17_nsh.c | 175 ++++ configs/u-blox-c027/src/lpc17_pwm.c | 154 +++ configs/u-blox-c027/src/lpc17_ssp.c | 199 ++++ configs/u-blox-c027/src/lpc17_ubxmdm.c | 310 ++++++ configs/u-blox-c027/src/lpc17_usbmsc.c | 125 +++ configs/u-blox-c027/src/u-blox-c027.h | 103 ++ configs/u-blox-c027/tools/flash.sh | 146 +++ 21 files changed, 3745 insertions(+) create mode 100644 configs/u-blox-c027/Kconfig create mode 100644 configs/u-blox-c027/README.txt create mode 100644 configs/u-blox-c027/include/board.h create mode 100644 configs/u-blox-c027/nsh/Make.defs create mode 100644 configs/u-blox-c027/nsh/defconfig create mode 100644 configs/u-blox-c027/nsh/setenv.sh create mode 100644 configs/u-blox-c027/scripts/ld.script create mode 100644 configs/u-blox-c027/src/.gitignore create mode 100644 configs/u-blox-c027/src/Makefile create mode 100644 configs/u-blox-c027/src/lpc17_adc.c create mode 100644 configs/u-blox-c027/src/lpc17_boot.c create mode 100644 configs/u-blox-c027/src/lpc17_dac.c create mode 100644 configs/u-blox-c027/src/lpc17_leds.c create mode 100644 configs/u-blox-c027/src/lpc17_nsh.c create mode 100644 configs/u-blox-c027/src/lpc17_pwm.c create mode 100644 configs/u-blox-c027/src/lpc17_ssp.c create mode 100644 configs/u-blox-c027/src/lpc17_ubxmdm.c create mode 100644 configs/u-blox-c027/src/lpc17_usbmsc.c create mode 100644 configs/u-blox-c027/src/u-blox-c027.h create mode 100644 configs/u-blox-c027/tools/flash.sh diff --git a/configs/Kconfig b/configs/Kconfig index fbfe9a08d3f..69cc4b0978e 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -1070,6 +1070,15 @@ config ARCH_BOARD_TWR_K60N512 Kinetis K60 Cortex-M4 MCU. This port uses the FreeScale TWR-K60N512 development board. +config ARCH_BOARD_U_BLOX_C027 + bool "u-blox C027" + depends on ARCH_CHIP_LPC1768 + select ARCH_HAVE_LEDS + ---help--- + u-blox GSM and GPS module evaluation board with NXP LPCExpresso + LPC1768. The GSM module is one of LISA-C200, LISA-U200 or SARA-G350. + The GPS module is one of MAX-M7 or MAX-M8. + config ARCH_BOARD_UBW32 bool "UBW32 v2.4 board from Sparkfun" depends on ARCH_CHIP_PIC32MX460F512L @@ -1386,6 +1395,7 @@ config ARCH_BOARD default "tm4c1294-launchpad" if ARCH_BOARD_TM4C1294_LAUNCHPAD default "cc3200-launchpad" if ARCH_BOARD_CC3200_LAUNCHPAD default "twr-k60n512" if ARCH_BOARD_TWR_K60N512 + default "u-blox-c027" if ARCH_BOARD_U_BLOX_C027 default "ubw32" if ARCH_BOARD_UBW32 default "us7032evb1" if ARCH_BOARD_US7032EVB1 default "viewtool-stm32f107" if ARCH_BOARD_VIEWTOOL_STM32F107 @@ -1766,6 +1776,9 @@ endif if ARCH_BOARD_TWR_K60N512 source "configs/twr-k60n512/Kconfig" endif +if ARCH_BOARD_U_BLOX_C027 +source "configs/u-blox-c027/Kconfig" +endif if ARCH_BOARD_UBW32 source "configs/ubw32/Kconfig" endif diff --git a/configs/u-blox-c027/Kconfig b/configs/u-blox-c027/Kconfig new file mode 100644 index 00000000000..8e78bc18082 --- /dev/null +++ b/configs/u-blox-c027/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_U_BLOX_C027 +endif diff --git a/configs/u-blox-c027/README.txt b/configs/u-blox-c027/README.txt new file mode 100644 index 00000000000..17b6988718c --- /dev/null +++ b/configs/u-blox-c027/README.txt @@ -0,0 +1,144 @@ +README +^^^^^^ + +README for NuttX port to the u-blox C027 dev board. + +The board is intended for prototyping software for u-blox cellular modems (SARA +or LISA families) and the u-blox GPS receiver (MAX-7Q, MAX-M8Q, or other, +depending on board revision). + +This board features the LPC1768 MCU and is related to the Embedded Artists' base +board with the NXP the LPCXpresso daughter board, see +configs/lpcxpresso-lpc1768/README.txt. + +The board also features an embedded USB debugger. + +Contents +^^^^^^^^ + + u-blox C027 Board + Configurations + +u-blox C027 Board +^^^^^^^^^^^^^^^^^ + +Pin Description Connector On Board +-------------------------------- --------- -------------- +P0[0]/RD1/TXD3/SDA1 D14 TXD3/SDA1 +P0[1]/TD1/RXD3/SCL1 D15 RXD3/SCL1 +P0[2]/TXD0/AD0[7] USBTXD +P0[3]/RXD0/AD0[6] USBRXD +P0[4]/I2SRX-CLK/RD2/CAP2.0 CANRD CAN_RX2 +P0[5]/I2SRX-WS/TD2/CAP2.1 CANTD CAN_TX2 +P0[6]/I2SRX_SDA/SSEL1/MAT2[0] CANS SSEL1 +P0[7]/I2STX_CLK/SCK1/MAT2[1] MDMUSBDET +P0[8]/I2STX_WS/MISO1/MAT2[2] MDMLVLOE +P0[9]/I2STX_SDA/MOSI1/MAT2[3] MDMILVLOE +P0[10]/TXD2/SDA2 GPSTXD +P0[11]/RXD2/SCL2 GPSRXD +P0[15]/TXD1/SCK0/SCK MDMTXD +P0[16]/RXD1/SSEL0/SSEL MDMRXD +P0[17]/CTS1/MISO0/MISO MDMCTS +P0[18]/DCD1/MOSI0/MOSI MDMDCD +P0[19]/DSR1/SDA1 MDMDCR +P0[20]/DTR1/SCL1 MDMDTR +P0[21]/RI1/MCIPWR/RD1 MDMRI +P0[22]/RTS1/TD1 MDMRTS +P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] A0 I2S_CLK +P0[24]/AD0[1]/I2SRX_WS/CAP3[1] A1 I2S_WS +P0[25]/AD0[2]/I2SRX_SDA/TXD3 A2 I2S_SDA +P0[26]/AD0[3]/AOUT/RXD3 A3 AD0.3/AOUT +P0[27]/SDA0/USB_SDA GPSSDA +P0[28]/SCL0 GPSSCL +P0[29]/USB_D+ MDMUSBDP +P0[30]/USB_D- MDMUSBDM +P1[0]/ENET_TXD0 ENET_TXD0 +P1[1]/ENET_TXD1 ENET_TXD1 +P1[4]/ENET_TX_EN ENET_TX_EN +P1[8]/ENET_CRS ENET_CRS +P1[9]/ENET_RXD0 ENET_RXD0 +P1[10]/ENET_RXD1 ENET_RXD1 +P1[14]/ENET_RX_ER ENET_RX_ER +P1[15]/ENET_REF_CLK ENET_REF_CLK +P1[16]/ENET_MDC ENET_MDC +P1[17]/ENET_MDIO ENET_MDIO +P1[18]/USB_UP_LED/PWM1[1]/CAP1[0] GPSRST +P1[19]/MC0A/USB_PPWR/N_CAP1.1 GPSPPS +P1[20]/MCFB0/PWM1.2/SCK0 D13 PWM1.2/SCK0 +P1[21]/MCABORT/PWM1.3/SSEL0 D10 PWM1.3/SSEL0 +P1[22]/MC0B/USB-PWRD/MAT1.0 GPSINT +P1[23]/MCFB1/PWM1.4/MISO0 D12 PWM1.4/MISO0 +P1[24]/MCFB2/PWM1.5/MOSI0 D11 PWM1.5/MOSI0 +P1[25]/MC1A/MAT1.1 ETH_LED_LNK +P1[26]/MC1B/PWM1.6/CAP0.0 ETH_LED_SPD +P1[27]/CLKOUT/USB-OVRCR-N/CAP0.1 ETH_OSC_EN +P1[28]/MC2A/PCAP1.0/MAT0.0 ETH_RST +P1[29]/MC2B/PCAP1.1/MAT0.1 GPSEN +P1[30]/VBUS/AD0[4] A4 AD0.4 +P1[31]/SCK1/AD0[5] A5 AD0.5 +P2[0]/PWM1.1/TXD1 D3 PWM1.1 +P2[1]/PWM1.2/RXD1 D5 PWM1.2 +P2[2]/PWM1.3/CTS1/TRACEDATA[3] D6 PWM1.3 +P2[3]/PWM1.4/DCD1/TRACEDATA[2] D9 PWM1.4 +P2[4]/PWM1.5/DSR1/TRACEDATA[1] D8 PWM1.5 +P2[5]/PWM1[6]/DTR1/TRACEDATA[0] MDMEN +P2[6]/PCAP1[0]/RI1/TRACECLK MDMPWRON +P2[7]/RD2/RTS1 MDMGPIO1 +P2[8]/TD2/TXD2 MDMRST +P2[9]/USB_CONNECT/RXD2 MDMUSBCON +P2[10]/EINT0/NMI ISP_PAD +P2[11]/EINT1/I2STX_CLK D7 EINT1 +P2[12]/EINT2/I2STX_WS D4 EINT2 +P2[13]/EINT3/I2STX_SDA D2 EINT3 +P3[25]/MAT0.0/PWM1.2 LED +P4[28]/RX-MCLK/MAT2.0/TXD3 D0 TXD3 +P4[29]/TX-MCLK/MAT2.1/RXD3 D1 RXD3 + +Configurations +^^^^^^^^^^^^^^ + +nsh +--- + +The nsh configuration allows to test the modem and the GPS receiver. The modem +can be tested in either the internal TCP/IP stack mode or with the NuttX TCP/IP +stack and pppd. + +Modem starts in power-down mode and has to be switched on, e.g., using the nsh +command: + +nsh> ubloxmodem on + +To connect using the NuttX TCP/IP stack, use pppd. At the time of writing the +pppd app is located in apps/examples/pppd and requires setting correct login +details in the source code. + +To connect using the internal u-blox TCP/IP stack, use the chat app. Its +configuration is done in configs/u-blox-c027/nsh/defconfig and can be adjusted +using 'make menuconfig'. + +The NuttX u-blox modem driver is included like this: + +CONFIG_MODEM=y +CONFIG_MODEM_U_BLOX=y + +The nsh app that allows power control is included with the default configuration +as follows: + +CONFIG_EXAMPLES_UBLOXMODEM=y +CONFIG_EXAMPLES_UBLOXMODEM_TTY_DEVNODE="/dev/ttyS1" +CONFIG_EXAMPLES_UBLOXMODEM_DEVNODE="/dev/ubxmdm" + +The modem driver uses two device nodes. The TTY device is the modem terminal, +while the other device is used for general control via GPIO such as power +control. At the moment only one modem is supported, and the corresponding device +control node is /dev/ubxmdm. + +The chat app allows to run scripts. A few such scripts are preset in the +defconfig: + +CONFIG_EXAMPLES_CHAT_PRESET[0..3]: +0 - set up the provider context with username and password, +1 - connect to the provider, +2 - open a TCP socket to the u-blox test server, +3 - test the TCP socket server operation and close the socket. diff --git a/configs/u-blox-c027/include/board.h b/configs/u-blox-c027/include/board.h new file mode 100644 index 00000000000..41f94eb5350 --- /dev/null +++ b/configs/u-blox-c027/include/board.h @@ -0,0 +1,295 @@ +/************************************************************************************ + * configs/u-blox-c027/include/board.h + * + * Copyright (C) 2016 Vladimir Komendantskiy. All rights reserved. + * Author: Vladimir Komendantskiy + * + * 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_U_BLOX_C027_INCLUDE_BOARD_H +#define __CONFIGS_U_BLOX_C027_INCLUDE_BOARD_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Clocking *************************************************************************/ +/* NOTE: The following definitions require lpc17_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 (4000000) /* 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 + * CCLCK = 480MHz / 6 = 80MHz -> CCLK divider = 6 + */ + +#define LPC17_CCLK 80000000 /* 80Mhz */ + +/* Select the main oscillator as the frequency source. SYSCLK is then the frequency + * of the main oscillator. + */ + +#undef CONFIG_LPC17_MAINOSC +#define CONFIG_LPC17_MAINOSC 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_LPC17_PLL0 +#define CONFIG_LPC17_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_LPC17_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_LPC17_FLASH +#define CONFIG_LPC17_FLASH 1 +#define BOARD_FLASHCFG_VALUE 0x0000303a + +/* Ethernet configuration */ + +#define ETH_MCFG_CLKSEL_DIV ETH_MCFG_CLKSEL_DIV20 + +/* u-blox C027 board pin usage ***************************************************/ +/* Pin Description Connector On Board + * -------------------------------- --------- -------------- + * P0[0]/RD1/TXD3/SDA1 D14 TXD3/SDA1 + * P0[1]/TD1/RXD3/SCL1 D15 RXD3/SCL1 + * P0[2]/TXD0/AD0[7] USBTXD + * P0[3]/RXD0/AD0[6] USBRXD + * P0[4]/I2SRX-CLK/RD2/CAP2.0 CANRD CAN_RX2 + * P0[5]/I2SRX-WS/TD2/CAP2.1 CANTD CAN_TX2 + * P0[6]/I2SRX_SDA/SSEL1/MAT2[0] CANS SSEL1 + * P0[7]/I2STX_CLK/SCK1/MAT2[1] MDMUSBDET + * P0[8]/I2STX_WS/MISO1/MAT2[2] MDMLVLOE + * P0[9]/I2STX_SDA/MOSI1/MAT2[3] MDMILVLOE + * P0[10]/TXD2/SDA2 GPSTXD + * P0[11]/RXD2/SCL2 GPSRXD + * P0[15]/TXD1/SCK0/SCK MDMTXD + * P0[16]/RXD1/SSEL0/SSEL MDMRXD + * P0[17]/CTS1/MISO0/MISO MDMCTS + * P0[18]/DCD1/MOSI0/MOSI MDMDCD + * P0[19]/DSR1/SDA1 MDMDCR + * P0[20]/DTR1/SCL1 MDMDTR + * P0[21]/RI1/MCIPWR/RD1 MDMRI + * P0[22]/RTS1/TD1 MDMRTS + * P0[23]/AD0[0]/I2SRX_CLK/CAP3[0] A0 I2S_CLK + * P0[24]/AD0[1]/I2SRX_WS/CAP3[1] A1 I2S_WS + * P0[25]/AD0[2]/I2SRX_SDA/TXD3 A2 I2S_SDA + * P0[26]/AD0[3]/AOUT/RXD3 A3 AD0.3/AOUT + * P0[27]/SDA0/USB_SDA GPSSDA + * P0[28]/SCL0 GPSSCL + * P0[29]/USB_D+ MDMUSBDP + * P0[30]/USB_D- MDMUSBDM + * + * P1[0]/ENET_TXD0 ENET_TXD0 + * P1[1]/ENET_TXD1 ENET_TXD1 + * P1[4]/ENET_TX_EN ENET_TX_EN + * P1[8]/ENET_CRS ENET_CRS + * P1[9]/ENET_RXD0 ENET_RXD0 + * P1[10]/ENET_RXD1 ENET_RXD1 + * P1[14]/ENET_RX_ER ENET_RX_ER + * P1[15]/ENET_REF_CLK ENET_REF_CLK + * P1[16]/ENET_MDC ENET_MDC + * P1[17]/ENET_MDIO ENET_MDIO + * P1[18]/USB_UP_LED/PWM1[1]/CAP1[0] GPSRST + * P1[19]/MC0A/USB_PPWR/N_CAP1.1 GPSPPS + * P1[20]/MCFB0/PWM1.2/SCK0 D13 PWM1.2/SCK0 + * P1[21]/MCABORT/PWM1.3/SSEL0 D10 PWM1.3/SSEL0 + * P1[22]/MC0B/USB-PWRD/MAT1.0 GPSINT + * P1[23]/MCFB1/PWM1.4/MISO0 D12 PWM1.4/MISO0 + * P1[24]/MCFB2/PWM1.5/MOSI0 D11 PWM1.5/MOSI0 + * P1[25]/MC1A/MAT1.1 ETH_LED_LNK + * P1[26]/MC1B/PWM1.6/CAP0.0 ETH_LED_SPD + * P1[27]/CLKOUT/USB-OVRCR-N/CAP0.1 ETH_OSC_EN + * P1[28]/MC2A/PCAP1.0/MAT0.0 ETH_RST + * P1[29]/MC2B/PCAP1.1/MAT0.1 GPSEN + * P1[30]/VBUS/AD0[4] A4 AD0.4 + * P1[31]/SCK1/AD0[5] A5 AD0.5 + * + * P2[0]/PWM1.1/TXD1 D3 PWM1.1 + * P2[1]/PWM1.2/RXD1 D5 PWM1.2 + * P2[2]/PWM1.3/CTS1/TRACEDATA[3] D6 PWM1.3 + * P2[3]/PWM1.4/DCD1/TRACEDATA[2] D9 PWM1.4 + * P2[4]/PWM1.5/DSR1/TRACEDATA[1] D8 PWM1.5 + * P2[5]/PWM1[6]/DTR1/TRACEDATA[0] MDMEN + * P2[6]/PCAP1[0]/RI1/TRACECLK MDMPWRON + * P2[7]/RD2/RTS1 MDMGPIO1 + * P2[8]/TD2/TXD2 MDMRST + * P2[9]/USB_CONNECT/RXD2 MDMUSBCON + * P2[10]/EINT0/NMI ISP_PAD + * P2[11]/EINT1/I2STX_CLK D7 EINT1 + * P2[12]/EINT2/I2STX_WS D4 EINT2 + * P2[13]/EINT3/I2STX_SDA D2 EINT3 + * + * P3[25]/MAT0.0/PWM1.2 LED + * + * P4[28]/RX-MCLK/MAT2.0/TXD3 D0 TXD3 + * P4[29]/TX-MCLK/MAT2.1/RXD3 D1 RXD3 + */ + +/* LED definitions ******************************************************************/ +/* The u-blox C027 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) */ + +#define GPIO_I2C1_SDA GPIO_I2C1_SDA_1 +#define GPIO_I2C1_SCL GPIO_I2C1_SCL_1 + +#define GPIO_SSP1_SCK GPIO_SSP1_SCK_1 +#define GPIO_SSP0_SCK GPIO_SSP0_SCK_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 + +#define GPIO_UART1_TXD GPIO_UART1_TXD_1 +#define GPIO_UART1_RXD GPIO_UART1_RXD_1 +#define GPIO_UART1_CTS GPIO_UART1_CTS_1 +#define GPIO_UART1_RTS GPIO_UART1_RTS_1 +#define GPIO_UART1_DCD GPIO_UART1_DCD_1 +#define GPIO_UART1_DSR GPIO_UART1_DSR_1 +#define GPIO_UART1_DTR GPIO_UART1_DTR_1 +#define GPIO_UART1_RI GPIO_UART1_RI_1 + +#define GPIO_UART2_TXD GPIO_UART2_TXD_1 +#define GPIO_UART2_RXD GPIO_UART2_RXD_1 + +#define GPIO_UART3_TXD GPIO_UART3_TXD_3 +#define GPIO_UART3_RXD GPIO_UART3_RXD_3 + +#define GPIO_ENET_MDC GPIO_ENET_MDC_1 +#define GPIO_ENET_MDIO GPIO_ENET_MDIO_1 + +#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 + +/************************************************************************************ + * 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: lpc17_boardinitialize + * + * Description: + * All LPC17xx architectures must provide the following entry point. This entry + * point is called early in the intitialization -- after all memory has been + * configured and mapped but before any devices have been initialized. + * + ************************************************************************************/ + +void lpc17_boardinitialize(void); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __CONFIGS_U_BLOX_C027_INCLUDE_BOARD_H */ diff --git a/configs/u-blox-c027/nsh/Make.defs b/configs/u-blox-c027/nsh/Make.defs new file mode 100644 index 00000000000..7d08bc55687 --- /dev/null +++ b/configs/u-blox-c027/nsh/Make.defs @@ -0,0 +1,110 @@ +############################################################################ +# configs/u-blox-c027/nsh/Make.defs +# +# Copyright (C) 2016 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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/mknulldeps.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 + 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 +ARCHCXXFLAGS = -fno-builtin -fno-exceptions +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 + + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe +HOSTLDFLAGS = diff --git a/configs/u-blox-c027/nsh/defconfig b/configs/u-blox-c027/nsh/defconfig new file mode 100644 index 00000000000..f4f456f9c1e --- /dev/null +++ b/configs/u-blox-c027/nsh/defconfig @@ -0,0 +1,1248 @@ +# +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration +# + +# +# Build Setup +# +# CONFIG_EXPERIMENTAL is not set +# CONFIG_DEFAULT_SMALL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + +# +# Build Configuration +# +CONFIG_APPS_DIR="../apps" +CONFIG_BUILD_FLAT=y +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +CONFIG_INTELHEX_BINARY=y +# CONFIG_MOTOROLA_SREC is not set +CONFIG_RAW_BINARY=y +# CONFIG_UBOOT_UIMAGE is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDINT_H is not set +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set +# CONFIG_ARCH_DEBUG_H is not set + +# +# Debug Options +# +CONFIG_DEBUG=y +# CONFIG_ARCH_HAVE_HEAPCHECK is not set +# CONFIG_DEBUG_VERBOSE is not set + +# +# Subsystem Debug Options +# +# CONFIG_DEBUG_AUDIO is not set +# CONFIG_DEBUG_BINFMT is not set +# CONFIG_DEBUG_FS is not set +# CONFIG_DEBUG_GRAPHICS is not set +# CONFIG_DEBUG_LIB is not set +# CONFIG_DEBUG_MM is not set +# CONFIG_DEBUG_NET is not set +# CONFIG_DEBUG_SCHED is not set + +# +# OS Function Debug Options +# +# CONFIG_DEBUG_IRQ is not set + +# +# Driver Debug Options +# +# CONFIG_DEBUG_LEDS is not set +# CONFIG_DEBUG_ANALOG is not set +CONFIG_DEBUG_GPIO=y +CONFIG_ARCH_HAVE_STACKCHECK=y +# CONFIG_STACK_COLORATION is not set +CONFIG_DEBUG_SYMBOLS=y +CONFIG_ARCH_HAVE_CUSTOMOPT=y +# CONFIG_DEBUG_NOOPT is not set +# CONFIG_DEBUG_CUSTOMOPT is not set +CONFIG_DEBUG_FULLOPT=y + +# +# System Type +# +CONFIG_ARCH_ARM=y +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_A1X is not set +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_EFM32 is not set +# CONFIG_ARCH_CHIP_IMX is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +# CONFIG_ARCH_CHIP_KL is not set +# CONFIG_ARCH_CHIP_LM is not set +# CONFIG_ARCH_CHIP_TIVA is not set +# CONFIG_ARCH_CHIP_LPC11XX is not set +CONFIG_ARCH_CHIP_LPC17XX=y +# CONFIG_ARCH_CHIP_LPC214X is not set +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_NUC1XX is not set +# CONFIG_ARCH_CHIP_SAMA5 is not set +# CONFIG_ARCH_CHIP_SAMD is not set +# CONFIG_ARCH_CHIP_SAML is not set +# CONFIG_ARCH_CHIP_SAM34 is not set +# CONFIG_ARCH_CHIP_SAMV7 is not set +# CONFIG_ARCH_CHIP_STM32 is not set +# CONFIG_ARCH_CHIP_STM32F7 is not set +# CONFIG_ARCH_CHIP_STR71X is not set +# CONFIG_ARCH_CHIP_TMS570 is not set +# CONFIG_ARCH_CHIP_MOXART is not set +# CONFIG_ARCH_ARM7TDMI is not set +# CONFIG_ARCH_ARM926EJS is not set +# CONFIG_ARCH_ARM920T is not set +# CONFIG_ARCH_CORTEXM0 is not set +CONFIG_ARCH_CORTEXM3=y +# CONFIG_ARCH_CORTEXM4 is not set +# CONFIG_ARCH_CORTEXM7 is not set +# CONFIG_ARCH_CORTEXA5 is not set +# CONFIG_ARCH_CORTEXA8 is not set +# CONFIG_ARCH_CORTEXR4 is not set +# CONFIG_ARCH_CORTEXR4F is not set +# CONFIG_ARCH_CORTEXR5 is not set +# CONFIG_ARCH_CORTEX5F is not set +# CONFIG_ARCH_CORTEXR7 is not set +# CONFIG_ARCH_CORTEXR7F is not set +CONFIG_ARCH_FAMILY="armv7-m" +CONFIG_ARCH_CHIP="lpc17xx" +# CONFIG_ARMV7M_USEBASEPRI is not set +CONFIG_ARCH_HAVE_CMNVECTOR=y +# CONFIG_ARMV7M_CMNVECTOR is not set +# CONFIG_ARMV7M_LAZYFPU is not set +# CONFIG_ARCH_HAVE_FPU is not set +# CONFIG_ARCH_HAVE_DPFPU is not set +CONFIG_ARM_HAVE_MPU_UNIFIED=y +# CONFIG_ARM_MPU is not set +# CONFIG_DEBUG_HARDFAULT is not set + +# +# ARMV7M Configuration Options +# +# CONFIG_ARMV7M_HAVE_ICACHE is not set +# CONFIG_ARMV7M_HAVE_DCACHE is not set +# CONFIG_ARMV7M_HAVE_ITCM is not set +# CONFIG_ARMV7M_HAVE_DTCM is not set +# CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set +CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIL=y +# CONFIG_ARMV7M_HAVE_STACKCHECK is not set +# CONFIG_ARMV7M_ITMSYSLOG is not set +# CONFIG_GPIO_IRQ is not set +# CONFIG_SERIAL_TERMIOS is not set + +# +# LPC17xx Configuration Options +# +# CONFIG_ARCH_CHIP_LPC1751 is not set +# CONFIG_ARCH_CHIP_LPC1752 is not set +# CONFIG_ARCH_CHIP_LPC1754 is not set +# CONFIG_ARCH_CHIP_LPC1756 is not set +# CONFIG_ARCH_CHIP_LPC1758 is not set +# CONFIG_ARCH_CHIP_LPC1759 is not set +# CONFIG_ARCH_CHIP_LPC1764 is not set +# CONFIG_ARCH_CHIP_LPC1765 is not set +# CONFIG_ARCH_CHIP_LPC1766 is not set +# CONFIG_ARCH_CHIP_LPC1767 is not set +CONFIG_ARCH_CHIP_LPC1768=y +# CONFIG_ARCH_CHIP_LPC1769 is not set +# CONFIG_ARCH_CHIP_LPC1773 is not set +# CONFIG_ARCH_CHIP_LPC1774 is not set +# CONFIG_ARCH_CHIP_LPC1776 is not set +# CONFIG_ARCH_CHIP_LPC1777 is not set +# CONFIG_ARCH_CHIP_LPC1778 is not set +# CONFIG_ARCH_CHIP_LPC1785 is not set +# CONFIG_ARCH_CHIP_LPC1786 is not set +# CONFIG_ARCH_CHIP_LPC1787 is not set +# CONFIG_ARCH_CHIP_LPC1788 is not set +CONFIG_ARCH_FAMILY_LPC176X=y + +# +# LPC17xx Peripheral Support +# +CONFIG_LPC17_MAINOSC=y +CONFIG_LPC17_PLL0=y +CONFIG_LPC17_PLL1=y +CONFIG_LPC17_ETHERNET=y +# CONFIG_LPC17_USBHOST is not set +# CONFIG_LPC17_USBDEV is not set +CONFIG_LPC17_UART0=y +CONFIG_LPC17_UART1=y +CONFIG_LPC17_UART2=y +CONFIG_LPC17_UART3=y +# CONFIG_LPC17_UART4 is not set +# CONFIG_LPC17_CAN1 is not set +# CONFIG_LPC17_CAN2 is not set +# CONFIG_LPC17_SPI is not set +# CONFIG_LPC17_SSP0 is not set +# CONFIG_LPC17_SSP1 is not set +CONFIG_LPC17_I2C0=y +CONFIG_LPC17_I2C1=y +# CONFIG_LPC17_I2C2 is not set +# CONFIG_LPC17_I2S is not set +# CONFIG_LPC17_TMR0 is not set +# CONFIG_LPC17_TMR1 is not set +# CONFIG_LPC17_TMR2 is not set +# CONFIG_LPC17_TMR3 is not set +# CONFIG_LPC17_RIT is not set +# CONFIG_LPC17_PWM0 is not set +# CONFIG_LPC17_PWM1 is not set +# CONFIG_LPC17_MCPWM is not set +# CONFIG_LPC17_QEI is not set +# CONFIG_LPC17_RTC is not set +# CONFIG_LPC17_WDT is not set +# CONFIG_LPC17_ADC is not set +# CONFIG_LPC17_DAC is not set +# CONFIG_LPC17_GPDMA is not set +# CONFIG_LPC17_FLASH is not set + +# +# External Memory Configuration +# + +# +# Serial driver options +# +CONFIG_UART1_RINGINDICATOR=y + +# +# I2C driver options +# +CONFIG_LPC17_I2C0_FREQUENCY=100000 +CONFIG_LPC17_I2C1_FREQUENCY=100000 + +# +# Ethernet driver options +# +CONFIG_PHY_AUTONEG=y +CONFIG_NET_EMACRAM_SIZE=7296 +CONFIG_NET_NTXDESC=6 +CONFIG_NET_NRXDESC=6 +# CONFIG_NET_WOL is not set +# CONFIG_NET_REGDEBUG is not set +# CONFIG_NET_HASH is not set +# CONFIG_NET_MULTICAST is not set + +# +# Architecture Options +# +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_VECNOTIRQ is not set +# CONFIG_ARCH_DMA is not set +CONFIG_ARCH_HAVE_IRQPRIO=y +# CONFIG_ARCH_L2CACHE is not set +# CONFIG_ARCH_HAVE_COHERENT_DCACHE is not set +# CONFIG_ARCH_HAVE_ADDRENV is not set +# CONFIG_ARCH_NEED_ADDRENV_MAPPING is not set +CONFIG_ARCH_HAVE_VFORK=y +# CONFIG_ARCH_HAVE_MMU is not set +CONFIG_ARCH_HAVE_MPU=y +# CONFIG_ARCH_NAND_HWECC is not set +# CONFIG_ARCH_HAVE_EXTCLK is not set +# CONFIG_ARCH_HAVE_POWEROFF is not set +CONFIG_ARCH_HAVE_RESET=y +# CONFIG_ARCH_USE_MPU is not set +# CONFIG_ARCH_IRQPRIO is not set +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set +# CONFIG_ARCH_IDLE_CUSTOM is not set +# CONFIG_ARCH_HAVE_RAMFUNCS is not set +CONFIG_ARCH_HAVE_RAMVECTORS=y +# CONFIG_ARCH_RAMVECTORS is not set + +# +# Board Settings +# +CONFIG_BOARD_LOOPSPERMSEC=8079 +# CONFIG_ARCH_CALIBRATION is not set + +# +# Interrupt options +# +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 +CONFIG_ARCH_HAVE_HIPRI_INTERRUPT=y +# CONFIG_ARCH_HIPRI_INTERRUPT is not set + +# +# Boot options +# +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Boot Memory Configuration +# +CONFIG_RAM_START=0x10000000 +CONFIG_RAM_SIZE=32768 +# CONFIG_ARCH_HAVE_SDRAM is not set + +# +# Board Selection +# +# CONFIG_ARCH_BOARD_LPCXPRESSO is not set +# CONFIG_ARCH_BOARD_MBED is not set +# CONFIG_ARCH_BOARD_NUCLEUS2G is not set +CONFIG_ARCH_BOARD_U_BLOX_C027=y +# CONFIG_ARCH_BOARD_ZKITARM is not set +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="u-blox-c027" + +# +# Common Board Options +# +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y +CONFIG_NSH_MMCSDMINOR=0 + +# +# Board-Specific Options +# +CONFIG_LIB_BOARDCTL=y +# CONFIG_BOARDCTL_RESET is not set +# CONFIG_BOARDCTL_UNIQUEID is not set +# CONFIG_BOARDCTL_TSCTEST is not set +# CONFIG_BOARDCTL_ADCTEST is not set +# CONFIG_BOARDCTL_PWMTEST is not set +# CONFIG_BOARDCTL_GRAPHICS is not set +# CONFIG_BOARDCTL_IOCTL is not set + +# +# RTOS Features +# +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +CONFIG_DISABLE_ENVIRON=y + +# +# Clocks and Timers +# +CONFIG_USEC_PER_TICK=10000 +# CONFIG_SYSTEM_TIME64 is not set +CONFIG_CLOCK_MONOTONIC=y +# CONFIG_JULIAN_TIME is not set +CONFIG_START_YEAR=2016 +CONFIG_START_MONTH=1 +CONFIG_START_DAY=5 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=8 +CONFIG_WDOG_INTRESERVE=1 +CONFIG_PREALLOC_TIMERS=4 + +# +# Tasks and Scheduling +# +# CONFIG_INIT_NONE is not set +CONFIG_INIT_ENTRYPOINT=y +# CONFIG_INIT_FILEPATH is not set +CONFIG_USER_ENTRYPOINT="nsh_main" +CONFIG_RR_INTERVAL=200 +# CONFIG_SCHED_SPORADIC is not set +CONFIG_TASK_NAME_SIZE=0 +CONFIG_MAX_TASKS=16 +# CONFIG_SCHED_HAVE_PARENT is not set +# CONFIG_SCHED_WAITPID is not set + +# +# Pthread Options +# +# CONFIG_MUTEX_TYPES is not set +CONFIG_NPTHREAD_KEYS=4 + +# +# Performance Monitoring +# +# CONFIG_SCHED_CPULOAD is not set +# CONFIG_SCHED_INSTRUMENTATION is not set + +# +# Files and I/O +# +CONFIG_DEV_CONSOLE=y +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set +CONFIG_SDCLONE_DISABLE=y +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NAME_MAX=32 +# CONFIG_PRIORITY_INHERITANCE is not set + +# +# RTOS hooks +# +CONFIG_BOARD_INITIALIZE=y +# CONFIG_BOARD_INITTHREAD is not set +# CONFIG_SCHED_STARTHOOK is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +# CONFIG_SIG_EVTHREAD is not set + +# +# Signal Numbers +# +CONFIG_SIG_SIGUSR1=1 +CONFIG_SIG_SIGUSR2=2 +CONFIG_SIG_SIGALARM=3 +CONFIG_SIG_SIGCONDTIMEDOUT=16 +CONFIG_SIG_SIGWORK=17 + +# +# POSIX Message Queue Options +# +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_MQ_MAXMSGSIZE=32 +# CONFIG_MODULE is not set + +# +# Work queue support +# +CONFIG_SCHED_WORKQUEUE=y +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_HPWORKPRIORITY=224 +CONFIG_SCHED_HPWORKPERIOD=50000 +CONFIG_SCHED_HPWORKSTACKSIZE=2048 +# CONFIG_SCHED_LPWORK is not set + +# +# Stack and heap information +# +CONFIG_IDLETHREAD_STACKSIZE=1024 +CONFIG_USERMAIN_STACKSIZE=2048 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=2048 +# CONFIG_LIB_SYSCALL is not set + +# +# Device Drivers +# +# CONFIG_DISABLE_POLL is not set +CONFIG_DEV_NULL=y +CONFIG_DEV_ZERO=y +# CONFIG_DEV_LOOP is not set + +# +# Buffering +# +# CONFIG_DRVR_WRITEBUFFER is not set +# CONFIG_DRVR_READAHEAD is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set +# CONFIG_ARCH_HAVE_PWM_MULTICHAN is not set +# CONFIG_PWM is not set +# CONFIG_ARCH_HAVE_I2CRESET is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_I2S is not set + +# +# Timer Driver Support +# +# CONFIG_TIMER is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_AUDIO_DEVICES is not set +# CONFIG_VIDEO_DEVICES is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_IOEXPANDER is not set +# CONFIG_LCD is not set + +# +# LED Support +# +# CONFIG_USERLED is not set +# CONFIG_PCA9635PW is not set +# CONFIG_MMCSD is not set +CONFIG_MODEM=y +CONFIG_MODEM_U_BLOX=y +CONFIG_MODEM_U_BLOX_DEBUG=y +# CONFIG_MTD is not set +# CONFIG_EEPROM is not set +CONFIG_NETDEVICES=y + +# +# General Ethernet MAC Driver Options +# +# CONFIG_NETDEV_LOOPBACK is not set +CONFIG_NETDEV_TELNET=y +CONFIG_TELNET_RXBUFFER_SIZE=256 +CONFIG_TELNET_TXBUFFER_SIZE=256 +CONFIG_NETDEV_MULTINIC=y +CONFIG_ARCH_HAVE_NETDEV_STATISTICS=y +# CONFIG_NETDEV_STATISTICS is not set +CONFIG_NETDEV_LATEINIT=y +# CONFIG_NET_DUMPPACKET is not set + +# +# External Ethernet MAC Device Support +# +# CONFIG_NET_DM90x0 is not set +# CONFIG_ENC28J60 is not set +# CONFIG_ENCX24J600 is not set +# CONFIG_NET_E1000 is not set +# CONFIG_NET_SLIP is not set +# CONFIG_NET_FTMAC100 is not set +# CONFIG_NET_VNET is not set + +# +# External Ethernet PHY Device Support +# +# CONFIG_ARCH_PHY_INTERRUPT is not set +# CONFIG_ETH0_PHY_NONE is not set +# CONFIG_ETH0_PHY_AM79C874 is not set +# CONFIG_ETH0_PHY_KS8721 is not set +# CONFIG_ETH0_PHY_KSZ8041 is not set +# CONFIG_ETH0_PHY_KSZ8051 is not set +# CONFIG_ETH0_PHY_KSZ8061 is not set +# CONFIG_ETH0_PHY_KSZ8081 is not set +# CONFIG_ETH0_PHY_KSZ90x1 is not set +CONFIG_ETH0_PHY_DP83848C=y +# CONFIG_ETH0_PHY_LAN8720 is not set +# CONFIG_ETH0_PHY_LAN8740 is not set +# CONFIG_ETH0_PHY_LAN8740A is not set +# CONFIG_ETH0_PHY_LAN8742A is not set +# CONFIG_ETH0_PHY_DM9161 is not set +CONFIG_ETH1_PHY_NONE=y +# CONFIG_ETH1_PHY_AM79C874 is not set +# CONFIG_ETH1_PHY_KS8721 is not set +# CONFIG_ETH1_PHY_KSZ8041 is not set +# CONFIG_ETH1_PHY_KSZ8051 is not set +# CONFIG_ETH1_PHY_KSZ8081 is not set +# CONFIG_ETH1_PHY_KSZ90x1 is not set +# CONFIG_ETH1_PHY_DP83848C is not set +# CONFIG_ETH1_PHY_LAN8720 is not set +# CONFIG_ETH1_PHY_DM9161 is not set +# CONFIG_NETDEV_PHY_DEBUG is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +# CONFIG_ARCH_HAVE_UART is not set +CONFIG_ARCH_HAVE_UART0=y +CONFIG_ARCH_HAVE_UART1=y +CONFIG_ARCH_HAVE_UART2=y +CONFIG_ARCH_HAVE_UART3=y +# CONFIG_ARCH_HAVE_UART4 is not set +# CONFIG_ARCH_HAVE_UART5 is not set +# CONFIG_ARCH_HAVE_UART6 is not set +# CONFIG_ARCH_HAVE_UART7 is not set +# CONFIG_ARCH_HAVE_UART8 is not set +# CONFIG_ARCH_HAVE_SCI0 is not set +# CONFIG_ARCH_HAVE_SCI1 is not set +# CONFIG_ARCH_HAVE_USART0 is not set +# CONFIG_ARCH_HAVE_USART1 is not set +# CONFIG_ARCH_HAVE_USART2 is not set +# CONFIG_ARCH_HAVE_USART3 is not set +# CONFIG_ARCH_HAVE_USART4 is not set +# CONFIG_ARCH_HAVE_USART5 is not set +# CONFIG_ARCH_HAVE_USART6 is not set +# CONFIG_ARCH_HAVE_USART7 is not set +# CONFIG_ARCH_HAVE_USART8 is not set +# CONFIG_ARCH_HAVE_OTHER_UART is not set + +# +# USART Configuration +# +CONFIG_MCU_SERIAL=y +CONFIG_STANDARD_SERIAL=y +CONFIG_SERIAL_NPOLLWAITERS=2 +CONFIG_SERIAL_IFLOWCONTROL=y +CONFIG_SERIAL_OFLOWCONTROL=y +# CONFIG_SERIAL_DMA is not set +# CONFIG_SERIAL_IFLOWCONTROL_WATERMARKS is not set +# CONFIG_SERIAL_TIOCSERGSTRUCT is not set +CONFIG_ARCH_HAVE_SERIAL_TERMIOS=y +CONFIG_UART0_SERIAL_CONSOLE=y +# CONFIG_UART1_SERIAL_CONSOLE is not set +# CONFIG_UART2_SERIAL_CONSOLE is not set +# CONFIG_UART3_SERIAL_CONSOLE is not set +# CONFIG_OTHER_SERIAL_CONSOLE is not set +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# UART0 Configuration +# +CONFIG_UART0_RXBUFSIZE=256 +CONFIG_UART0_TXBUFSIZE=256 +CONFIG_UART0_BAUD=115200 +CONFIG_UART0_BITS=8 +CONFIG_UART0_PARITY=0 +CONFIG_UART0_2STOP=0 +# CONFIG_UART0_IFLOWCONTROL is not set +# CONFIG_UART0_OFLOWCONTROL is not set +# CONFIG_UART0_DMA is not set + +# +# UART1 Configuration +# +CONFIG_UART1_RXBUFSIZE=256 +CONFIG_UART1_TXBUFSIZE=256 +CONFIG_UART1_BAUD=115200 +CONFIG_UART1_BITS=8 +CONFIG_UART1_PARITY=0 +CONFIG_UART1_2STOP=0 +CONFIG_UART1_IFLOWCONTROL=y +CONFIG_UART1_OFLOWCONTROL=y +# CONFIG_UART1_DMA is not set + +# +# UART2 Configuration +# +CONFIG_UART2_RXBUFSIZE=256 +CONFIG_UART2_TXBUFSIZE=256 +CONFIG_UART2_BAUD=9600 +CONFIG_UART2_BITS=8 +CONFIG_UART2_PARITY=0 +CONFIG_UART2_2STOP=0 +# CONFIG_UART2_IFLOWCONTROL is not set +# CONFIG_UART2_OFLOWCONTROL is not set +# CONFIG_UART2_DMA is not set + +# +# UART3 Configuration +# +CONFIG_UART3_RXBUFSIZE=256 +CONFIG_UART3_TXBUFSIZE=256 +CONFIG_UART3_BAUD=115200 +CONFIG_UART3_BITS=8 +CONFIG_UART3_PARITY=0 +CONFIG_UART3_2STOP=0 +# CONFIG_UART3_IFLOWCONTROL is not set +# CONFIG_UART3_OFLOWCONTROL is not set +# CONFIG_UART3_DMA is not set +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set +# CONFIG_SYSLOG_CONSOLE is not set + +# +# Networking Support +# +CONFIG_ARCH_HAVE_NET=y +CONFIG_ARCH_HAVE_PHY=y +CONFIG_NET=y +CONFIG_NET_NOINTS=y +# CONFIG_NET_PROMISCUOUS is not set + +# +# Driver buffer configuration +# +CONFIG_NET_MULTIBUFFER=y +CONFIG_NET_ETH_MTU=590 +CONFIG_NET_ETH_TCP_RECVWNDO=536 +CONFIG_NET_TUN_MTU=296 +CONFIG_NET_TUN_TCP_RECVWNDO=256 +CONFIG_NET_GUARDSIZE=2 + +# +# Data link support +# +CONFIG_NET_MULTILINK=y +CONFIG_NET_ETHERNET=y +# CONFIG_NET_LOOPBACK is not set +CONFIG_NET_TUN=y +CONFIG_TUN_NINTERFACES=1 + +# +# Network Device Operations +# +# CONFIG_NETDEV_PHY_IOCTL is not set + +# +# Internet Protocol Selection +# +CONFIG_NET_IPv4=y +# CONFIG_NET_IPv6 is not set + +# +# Socket Support +# +CONFIG_NSOCKET_DESCRIPTORS=8 +CONFIG_NET_NACTIVESOCKETS=16 +CONFIG_NET_SOCKOPTS=y +# CONFIG_NET_SOLINGER is not set + +# +# Raw Socket Support +# +# CONFIG_NET_PKT is not set + +# +# Unix Domain Socket Support +# +# CONFIG_NET_LOCAL is not set + +# +# TCP/IP Networking +# +CONFIG_NET_TCP=y +# CONFIG_NET_TCPURGDATA is not set +CONFIG_NET_TCP_CONNS=8 +CONFIG_NET_MAX_LISTENPORTS=8 +CONFIG_NET_TCP_READAHEAD=y +CONFIG_NET_TCP_WRITE_BUFFERS=y +CONFIG_NET_TCP_NWRBCHAINS=8 +# CONFIG_NET_TCP_WRBUFFER_DEBUG is not set +CONFIG_NET_TCP_RECVDELAY=0 +CONFIG_NET_TCPBACKLOG=y +# CONFIG_NET_SENDFILE is not set + +# +# UDP Networking +# +CONFIG_NET_UDP=y +CONFIG_NET_UDP_CHECKSUMS=y +CONFIG_NET_UDP_CONNS=8 +CONFIG_NET_BROADCAST=y +# CONFIG_NET_RXAVAIL is not set +CONFIG_NET_UDP_READAHEAD=y + +# +# ICMP Networking Support +# +CONFIG_NET_ICMP=y +CONFIG_NET_ICMP_PING=y + +# +# IGMPv2 Client Support +# +# CONFIG_NET_IGMP is not set + +# +# ARP Configuration +# +CONFIG_NET_ARP=y +CONFIG_NET_ARPTAB_SIZE=16 +CONFIG_NET_ARP_MAXAGE=120 +# CONFIG_NET_ARP_IPIN is not set +CONFIG_NET_ARP_SEND=y +CONFIG_ARP_SEND_MAXTRIES=5 +CONFIG_ARP_SEND_DELAYMSEC=20 +# CONFIG_NET_ARP_DUMP is not set + +# +# Network I/O Buffer Support +# +CONFIG_NET_IOB=y +CONFIG_IOB_NBUFFERS=24 +CONFIG_IOB_BUFSIZE=196 +CONFIG_IOB_NCHAINS=8 +CONFIG_IOB_THROTTLE=8 +# CONFIG_IOB_DEBUG is not set +# CONFIG_NET_ARCH_INCR32 is not set +# CONFIG_NET_ARCH_CHKSUM is not set +CONFIG_NET_STATISTICS=y + +# +# Routing Table Configuration +# +# CONFIG_NET_ROUTE is not set +CONFIG_NET_HOSTNAME="c027" + +# +# Crypto API +# +# CONFIG_CRYPTO is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_FS_AUTOMOUNTER is not set +# CONFIG_DISABLE_PSEUDOFS_OPERATIONS is not set +CONFIG_FS_READABLE=y +CONFIG_FS_WRITABLE=y +# CONFIG_FS_NAMED_SEMAPHORES is not set +CONFIG_FS_MQUEUE_MPATH="/var/mqueue" +# CONFIG_FS_RAMMAP is not set +CONFIG_FS_FAT=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FAT_MAXFNAME=32 +# CONFIG_FS_FATTIME is not set +# CONFIG_FAT_DMAMEMORY is not set +# CONFIG_NFS is not set +# CONFIG_FS_NXFFS is not set +# CONFIG_FS_ROMFS is not set +# CONFIG_FS_TMPFS is not set +# CONFIG_FS_SMARTFS is not set +# CONFIG_FS_BINFS is not set +CONFIG_FS_PROCFS=y +# CONFIG_FS_PROCFS_REGISTER is not set + +# +# Exclude individual procfs entries +# +# CONFIG_FS_PROCFS_EXCLUDE_PROCESS is not set +# CONFIG_FS_PROCFS_EXCLUDE_UPTIME is not set +# CONFIG_FS_PROCFS_EXCLUDE_MOUNTS is not set +# CONFIG_FS_PROCFS_EXCLUDE_NET is not set +# CONFIG_FS_UNIONFS is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set +# CONFIG_SYSLOG_TIMESTAMP is not set + +# +# Graphics Support +# +# CONFIG_NX is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=2 +# CONFIG_ARCH_HAVE_HEAP2 is not set +# CONFIG_GRAN is not set + +# +# Audio Support +# +# CONFIG_AUDIO is not set + +# +# Binary Loader +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +CONFIG_BUILTIN=y +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=64 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +CONFIG_LIBC_LONG_LONG=y +# CONFIG_LIBC_IOCTL_VARIADIC is not set +CONFIG_LIB_RAND_ORDER=1 +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_EXECFUNCS is not set +CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=1024 +CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=2048 +CONFIG_LIBC_STRERROR=y +CONFIG_LIBC_STRERROR_SHORT=y +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_LIBC_TMPDIR="/tmp" +CONFIG_LIBC_MAX_TMPFILE=32 +CONFIG_ARCH_LOWPUTC=y +# CONFIG_TIME_EXTENDED is not set +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set +CONFIG_LIBC_NETDB=y +# CONFIG_NETDB_HOSTFILE is not set +CONFIG_NETDB_DNSCLIENT=y +CONFIG_NETDB_DNSCLIENT_ENTRIES=8 +CONFIG_NETDB_DNSCLIENT_NAMESIZE=32 +CONFIG_NETDB_DNSCLIENT_LIFESEC=3600 +CONFIG_NETDB_DNSCLIENT_MAXRESPONSE=96 +# CONFIG_NETDB_RESOLVCONF is not set +CONFIG_NETDB_DNSSERVER_NOADDR=y +# CONFIG_NETDB_DNSSERVER_IPv4 is not set + +# +# Non-standard Library Support +# +# CONFIG_LIB_KBDCODEC is not set +# CONFIG_LIB_SLCDCODEC is not set + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +CONFIG_BUILTIN_PROXY_STACKSIZE=1024 + +# +# CAN Utilities +# + +# +# Examples +# +# CONFIG_EXAMPLES_BRIDGE is not set +CONFIG_EXAMPLES_CHAT=y +CONFIG_EXAMPLES_CHAT_TTY_DEVNODE="/dev/ttyS1" +CONFIG_EXAMPLES_CHAT_TIMEOUT_SECONDS=20 +CONFIG_EXAMPLES_CHAT_SIZE=1024 +CONFIG_EXAMPLES_CHAT_PRESET0="\"\" ATE1 OK AT+CMEE=2 OK AT+UPSD=0,0 OK AT+UPSD=0,1,\\\"eseye.com\\\" OK AT+UPSD=0,2,\\\"user\\\" OK AT+UPSD=0,3,\\\"pass\\\" OK AT+UPSD=0,6,1 OK \\c" +CONFIG_EXAMPLES_CHAT_PRESET1="\"\" AT+UPSDA=0,3 OK AT+UPSND=0,8 OK AT+UPSND=0,0 OK \\c" +CONFIG_EXAMPLES_CHAT_PRESET2="\"\" AT+USOCR=6 OK AT+USOCO=0,\\\"195.34.89.241\\\",7 PAUSE 10 OK AT+USORD=0,32 u-blox \\c" +CONFIG_EXAMPLES_CHAT_PRESET3="\"\" AT+USOWR=0,5,\\\"NuttX\\\" PAUSE 10 OK AT+USORD=0,5 NuttX AT+USOCL=0" +# CONFIG_EXAMPLES_CONFIGDATA is not set +# CONFIG_EXAMPLES_CPUHOG is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FSTEST is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_MEDIA is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NRF24L01TERM is not set +CONFIG_EXAMPLES_NSH=y +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXTERM is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PCA9635 is not set +# CONFIG_EXAMPLES_PIPE is not set +CONFIG_EXAMPLES_PPPD=y +# CONFIG_EXAMPLES_POSIXSPAWN is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERIALBLASTER is not set +# CONFIG_EXAMPLES_SERIALRX is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_SLCD is not set +# CONFIG_EXAMPLES_SMART_TEST is not set +# CONFIG_EXAMPLES_SMART is not set +# CONFIG_EXAMPLES_TCPECHO is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UDPBLASTER is not set +# CONFIG_EXAMPLES_DISCOVER is not set +# CONFIG_EXAMPLES_WEBSERVER is not set +CONFIG_EXAMPLES_UBLOXMODEM=y +CONFIG_EXAMPLES_UBLOXMODEM_TTY_DEVNODE="/dev/ttyS1" +CONFIG_EXAMPLES_UBLOXMODEM_DEVNODE="/dev/ubxmdm" +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set +# CONFIG_EXAMPLES_XMLRPC is not set + +# +# File System Utilities +# +# CONFIG_FSUTILS_INIFILE is not set +# CONFIG_FSUTILS_PASSWD is not set + +# +# Graphics Support +# +# CONFIG_TIFF is not set +# CONFIG_GRAPHICS_TRAVELER is not set + +# +# Interpreters +# +# CONFIG_INTERPRETERS_BAS is not set +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set +# CONFIG_INTERPRETERS_MICROPYTHON is not set + +# +# FreeModBus +# +# CONFIG_MODBUS is not set + +# +# Network Utilities +# +CONFIG_NETUTILS_CHAT=y +# CONFIG_NETUTILS_CODECS is not set +CONFIG_NETUTILS_DHCPC=y +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_SMTP is not set +CONFIG_NETUTILS_TELNETD=y +CONFIG_NETUTILS_TFTPC=y +CONFIG_NETUTILS_NETLIB=y +CONFIG_NETUTILS_WEBCLIENT=y +CONFIG_NSH_WGET_USERAGENT="NuttX/7.xx.x (; http://www.nuttx.org/)" +CONFIG_WEBCLIENT_TIMEOUT=10 +# CONFIG_NETUTILS_WEBSERVER is not set +# CONFIG_NETUTILS_NTPCLIENT is not set +# CONFIG_NETUTILS_DISCOVER is not set +# CONFIG_NETUTILS_XMLRPC is not set +CONFIG_NETUTILS_PPPD=y +CONFIG_NETUTILS_PPPD_STACKSIZE=2048 +CONFIG_NETUTILS_PPPD_PAP=y + +# +# NSH Library +# +CONFIG_NSH_LIBRARY=y +# CONFIG_NSH_MOTD is not set + +# +# Command Line Configuration +# +CONFIG_NSH_READLINE=y +# CONFIG_NSH_CLE is not set +CONFIG_NSH_LINELEN=64 +# CONFIG_NSH_DISABLE_SEMICOLON is not set +CONFIG_NSH_CMDPARMS=y +CONFIG_NSH_MAXARGUMENTS=6 +CONFIG_NSH_ARGCAT=y +CONFIG_NSH_NESTDEPTH=3 +# CONFIG_NSH_DISABLEBG is not set +CONFIG_NSH_BUILTIN_APPS=y + +# +# Disable Individual commands +# +# CONFIG_NSH_DISABLE_ADDROUTE is not set +# CONFIG_NSH_DISABLE_BASENAME is not set +# CONFIG_NSH_DISABLE_CAT is not set +# CONFIG_NSH_DISABLE_CD is not set +# CONFIG_NSH_DISABLE_CP is not set +# CONFIG_NSH_DISABLE_CMP is not set +# CONFIG_NSH_DISABLE_DATE is not set +# CONFIG_NSH_DISABLE_DD is not set +# CONFIG_NSH_DISABLE_DF is not set +# CONFIG_NSH_DISABLE_DELROUTE is not set +# CONFIG_NSH_DISABLE_DIRNAME is not set +# CONFIG_NSH_DISABLE_ECHO is not set +# CONFIG_NSH_DISABLE_EXEC is not set +# CONFIG_NSH_DISABLE_EXIT is not set +# CONFIG_NSH_DISABLE_FREE is not set +# CONFIG_NSH_DISABLE_GET is not set +# CONFIG_NSH_DISABLE_HELP is not set +# CONFIG_NSH_DISABLE_HEXDUMP is not set +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_IFUPDOWN is not set +# CONFIG_NSH_DISABLE_KILL is not set +# CONFIG_NSH_DISABLE_LOSETUP is not set +# CONFIG_NSH_DISABLE_LOSMART is not set +# CONFIG_NSH_DISABLE_LS is not set +# CONFIG_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MKDIR is not set +# CONFIG_NSH_DISABLE_MKFATFS is not set +# CONFIG_NSH_DISABLE_MKFIFO is not set +# CONFIG_NSH_DISABLE_MKRD is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MOUNT is not set +# CONFIG_NSH_DISABLE_MV is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_NSH_DISABLE_NSLOOKUP is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_DISABLE_PING is not set +# CONFIG_NSH_DISABLE_PUT is not set +# CONFIG_NSH_DISABLE_PWD is not set +# CONFIG_NSH_DISABLE_RM is not set +# CONFIG_NSH_DISABLE_RMDIR is not set +# CONFIG_NSH_DISABLE_SET is not set +# CONFIG_NSH_DISABLE_SH is not set +# CONFIG_NSH_DISABLE_SLEEP is not set +# CONFIG_NSH_DISABLE_TIME is not set +# CONFIG_NSH_DISABLE_TEST is not set +# CONFIG_NSH_DISABLE_UMOUNT is not set +# CONFIG_NSH_DISABLE_UNAME is not set +# CONFIG_NSH_DISABLE_UNSET is not set +# CONFIG_NSH_DISABLE_USLEEP is not set +# CONFIG_NSH_DISABLE_WGET is not set +# CONFIG_NSH_DISABLE_XD is not set + +# +# Configure Command Options +# +CONFIG_NSH_CMDOPT_DF_H=y +CONFIG_NSH_CODECS_BUFSIZE=128 +CONFIG_NSH_CMDOPT_HEXDUMP=y +CONFIG_NSH_PROC_MOUNTPOINT="/proc" +CONFIG_NSH_FILEIOSIZE=1024 +CONFIG_NSH_STRERROR=y + +# +# Scripting Support +# +# CONFIG_NSH_DISABLESCRIPT is not set +# CONFIG_NSH_DISABLE_ITEF is not set +# CONFIG_NSH_DISABLE_LOOPS is not set + +# +# Console Configuration +# +CONFIG_NSH_CONSOLE=y +CONFIG_NSH_ARCHINIT=y + +# +# Networking Configuration +# +CONFIG_NSH_NETINIT_THREAD=y +CONFIG_NSH_NETINIT_THREAD_STACKSIZE=1568 +CONFIG_NSH_NETINIT_THREAD_PRIORITY=80 +# CONFIG_NSH_NETINIT_DEBUG is not set + +# +# IP Address Configuration +# +CONFIG_NSH_DHCPC=y + +# +# IPv4 Addresses +# +CONFIG_NSH_DRIPADDR=0xc0a80101 +CONFIG_NSH_NETMASK=0xffffff00 +# CONFIG_NSH_DNS is not set +CONFIG_NSH_NOMAC=y +CONFIG_NSH_SWMAC=y +CONFIG_NSH_MACADDR=0xbada55add7e5 +CONFIG_NSH_MAX_ROUNDTRIP=20 + +# +# Telnet Configuration +# +CONFIG_NSH_TELNET=y +CONFIG_NSH_TELNETD_PORT=23 +CONFIG_NSH_TELNETD_DAEMONPRIO=100 +CONFIG_NSH_TELNETD_DAEMONSTACKSIZE=2048 +CONFIG_NSH_TELNETD_CLIENTPRIO=100 +CONFIG_NSH_TELNETD_CLIENTSTACKSIZE=2048 +CONFIG_NSH_IOBUFFER_SIZE=512 +CONFIG_NSH_LOGIN=y +# CONFIG_NSH_CONSOLE_LOGIN is not set +CONFIG_NSH_TELNET_LOGIN=y +CONFIG_NSH_LOGIN_FIXED=y +# CONFIG_NSH_LOGIN_PLATFORM is not set +CONFIG_NSH_LOGIN_USERNAME="admin" +CONFIG_NSH_LOGIN_PASSWORD="Administrator" +CONFIG_NSH_LOGIN_FAILDELAY=0 +CONFIG_NSH_LOGIN_FAILCOUNT=3 + +# +# NxWidgets/NxWM +# + +# +# Platform-specific Support +# +# CONFIG_PLATFORM_CONFIGDATA is not set + +# +# System Libraries and NSH Add-Ons +# +# CONFIG_SYSTEM_FREE is not set +CONFIG_SYSTEM_CLE=y +CONFIG_SYSTEM_CLE_DEBUGLEVEL=0 +# CONFIG_SYSTEM_CUTERM is not set +# CONFIG_SYSTEM_INSTALL is not set +# CONFIG_SYSTEM_HEX2BIN is not set +# CONFIG_SYSTEM_HEXED is not set +# CONFIG_SYSTEM_NETDB is not set +# CONFIG_SYSTEM_RAMTEST is not set +CONFIG_READLINE_HAVE_EXTMATCH=y +CONFIG_SYSTEM_READLINE=y +CONFIG_READLINE_ECHO=y +# CONFIG_READLINE_TABCOMPLETION is not set +# CONFIG_READLINE_CMD_HISTORY is not set +# CONFIG_SYSTEM_SDCARD is not set +# CONFIG_SYSTEM_SUDOKU is not set +# CONFIG_SYSTEM_VI is not set +CONFIG_SYSTEM_ZMODEM=y +CONFIG_SYSTEM_ZMODEM_DEVNAME="/dev/console" +CONFIG_SYSTEM_ZMODEM_RCVBUFSIZE=512 +CONFIG_SYSTEM_ZMODEM_PKTBUFSIZE=512 +CONFIG_SYSTEM_ZMODEM_SNDBUFSIZE=512 +CONFIG_SYSTEM_ZMODEM_MOUNTPOINT="/tmp" +# CONFIG_SYSTEM_ZMODEM_RCVSAMPLE is not set +# CONFIG_SYSTEM_ZMODEM_SENDATTN is not set +CONFIG_SYSTEM_ZMODEM_ALWAYSSINT=y +# CONFIG_SYSTEM_ZMODEM_SENDBRAK is not set +CONFIG_SYSTEM_ZMODEM_RESPTIME=10 +CONFIG_SYSTEM_ZMODEM_CONNTIME=30 +CONFIG_SYSTEM_ZMODEM_SERIALNO=0 +CONFIG_SYSTEM_ZMODEM_MAXERRORS=20 +CONFIG_SYSTEM_ZMODEM_WRITESIZE=0 +# CONFIG_DEBUG_ZMODEM is not set diff --git a/configs/u-blox-c027/nsh/setenv.sh b/configs/u-blox-c027/nsh/setenv.sh new file mode 100644 index 00000000000..137954e6dac --- /dev/null +++ b/configs/u-blox-c027/nsh/setenv.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# configs/u-blox-c027/nsh/setenv.sh +# +# Copyright (C) 2016 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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}/../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/u-blox-c027/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}" diff --git a/configs/u-blox-c027/scripts/ld.script b/configs/u-blox-c027/scripts/ld.script new file mode 100644 index 00000000000..60d5d2de019 --- /dev/null +++ b/configs/u-blox-c027/scripts/ld.script @@ -0,0 +1,117 @@ +/**************************************************************************** + * configs/u-blox-c027/scripts/ld.script + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 LPC1768 has 512Kb of FLASH beginning at address 0x0000:0000 and + * 64Kb of total SRAM: 32Kb of SRAM in the CPU block beginning at address + * 0x10000000 and 32Kb of AHB SRAM in two banks of 16Kb beginning at addresses + * 0x20070000 and 0x20080000. Here we assume that .data and .bss will all fit + * into the 32Kb CPU SRAM address range. + */ + +MEMORY +{ + flash (rx) : ORIGIN = 0x00000000, LENGTH = 512K + sram (rwx) : ORIGIN = 0x10000000, LENGTH = 32K +} + +OUTPUT_ARCH(arm) +ENTRY(_stext) +SECTIONS +{ + .text : { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > flash + + .init_section : { + _sinit = ABSOLUTE(.); + *(.init_array .init_array.*) + _einit = ABSOLUTE(.); + } > flash + + .ARM.extab : { + *(.ARM.extab*) + } > flash + + __exidx_start = ABSOLUTE(.); + .ARM.exidx : { + *(.ARM.exidx*) + } > flash + __exidx_end = ABSOLUTE(.); + + _eronly = ABSOLUTE(.); + + .data : { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + _edata = ABSOLUTE(.); + } > sram AT > flash + + .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/u-blox-c027/src/.gitignore b/configs/u-blox-c027/src/.gitignore new file mode 100644 index 00000000000..726d936e1e3 --- /dev/null +++ b/configs/u-blox-c027/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/configs/u-blox-c027/src/Makefile b/configs/u-blox-c027/src/Makefile new file mode 100644 index 00000000000..3b18848d80e --- /dev/null +++ b/configs/u-blox-c027/src/Makefile @@ -0,0 +1,53 @@ +############################################################################ +# configs/u-blox-c027/src/Makefile +# +# Copyright (C) 2016 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +-include $(TOPDIR)/Make.defs + +ASRCS = +CSRCS = lpc17_boot.c lpc17_leds.c lpc17_ssp.c lpc17_adc.c lpc17_dac.c lpc17_pwm.c + +ifeq ($(CONFIG_LIB_BOARDCTL),y) +CSRCS += lpc17_nsh.c +endif + +ifeq ($(CONFIG_MODEM_U_BLOX),y) +CSRCS += lpc17_ubxmdm.c +endif + +ifeq ($(CONFIG_USBMSC),y) +CSRCS += lpc17_usbmsc.c +endif + +include $(TOPDIR)/configs/Board.mk diff --git a/configs/u-blox-c027/src/lpc17_adc.c b/configs/u-blox-c027/src/lpc17_adc.c new file mode 100644 index 00000000000..9d620f84c69 --- /dev/null +++ b/configs/u-blox-c027/src/lpc17_adc.c @@ -0,0 +1,113 @@ +/************************************************************************************ + * configs/u-blox-c027/src/lpc17_adc.c + * + * Derives from configs/stm3220g-eval/src/lpc17_adc.c + * + * Copyright (C) 2013 Zilogic Systems. All rights reserved. + * Author: Kannan + * + * which, in turn, was based on configs/stm3220g-eval/src/lpc17_adc.c + * + * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 "chip.h" +#include "up_arch.h" + +#include "lpc17_adc.h" +#include "u-blox-c027.h" + +#ifdef CONFIG_ADC + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: board_adc_setup + * + * Description: + * All LPC17 architectures must provide the following interface to work with + * examples/adc. + * + ************************************************************************************/ + +int board_adc_setup(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 */ diff --git a/configs/u-blox-c027/src/lpc17_boot.c b/configs/u-blox-c027/src/lpc17_boot.c new file mode 100644 index 00000000000..c93d2bcbcab --- /dev/null +++ b/configs/u-blox-c027/src/lpc17_boot.c @@ -0,0 +1,117 @@ +/************************************************************************************ + * configs/u-blox-c027/src/lpc17_boot.c + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 "up_arch.h" +#include "up_internal.h" + +#include "lpc17_gpio.h" +#include "lpc17_ssp.h" +#include "u-blox-c027.h" + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: lpc17_boardinitialize + * + * Description: + * All LPC17xx architectures must provide the following entry point. This entry point + * is called early in the intitialization -- after all memory has been configured + * and mapped but before any devices have been initialized. + * + ************************************************************************************/ + +void lpc17_boardinitialize(void) +{ + /* Configure SSP chip selects if 1) at least one SSP is enabled, and 2) the weak + * function c027_ssp_initialize() has been brought into the link. + */ + +#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) + if (c027_ssp_initialize) + { + c027_ssp_initialize(); + } +#endif + + /* Configure on-board LEDs if LED support has been selected. */ + +#ifdef CONFIG_ARCH_LEDS + board_autoled_initialize(); +#endif +} + +/**************************************************************************** + * 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_initialize() is called and just before the + * initial application is started. This additional initialization phase + * may be used, for example, to initialize board-specific device drivers. + * + ****************************************************************************/ + +#ifdef CONFIG_BOARD_INITIALIZE +void board_initialize(void) +{ + lpc17_ubxmdm_init(false); + +#if 0 + lpc17_configgpio(C027_MDMEN | GPIO_VALUE_ZERO); /* Modem disabled */ + lpc17_configgpio(C027_MDMRST | GPIO_VALUE_ONE); /* Modem reset on */ + lpc17_configgpio(C027_MDMPWR | GPIO_VALUE_ONE); /* Modem power off */ + lpc17_configgpio(C027_GPSEN | GPIO_VALUE_ZERO); /* GPS disabled */ + lpc17_configgpio(C027_GPSRST | GPIO_VALUE_ONE); /* GPS reset on */ + lpc17_configgpio(C027_MDMLVLOE | GPIO_VALUE_ONE); /* UART shifter disabled */ + lpc17_configgpio(C027_MDMILVLOE | GPIO_VALUE_ZERO); /* I2C shifter disabled */ + lpc17_configgpio(C027_MDMUSBDET | GPIO_VALUE_ZERO); /* USB sense off */ +#endif +} +#endif /* CONFIG_BOARD_INITIALIZE */ diff --git a/configs/u-blox-c027/src/lpc17_dac.c b/configs/u-blox-c027/src/lpc17_dac.c new file mode 100644 index 00000000000..91c1585f058 --- /dev/null +++ b/configs/u-blox-c027/src/lpc17_dac.c @@ -0,0 +1,105 @@ +/************************************************************************************ + * configs/u-blox-c027/src/lpc17_dac.c + * + * Derives from configs/stm3220g-eval/src/lpc17_adc.c + * + * Copyright (C) 2013 Zilogic Systems. All rights reserved. + * Author: Kannan + * + * which, in turn, was based on configs/stm3220g-eval/src/lpc17_adc.c + * + * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 "up_arch.h" +#include "up_internal.h" + +#include "lpc17_dac.h" + +#ifdef CONFIG_DAC + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * 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 */ diff --git a/configs/u-blox-c027/src/lpc17_leds.c b/configs/u-blox-c027/src/lpc17_leds.c new file mode 100644 index 00000000000..5987d6f66ec --- /dev/null +++ b/configs/u-blox-c027/src/lpc17_leds.c @@ -0,0 +1,150 @@ +/**************************************************************************** + * configs/u-blox-c027/src/lpc17_leds.c + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 "up_arch.h" +#include "up_internal.h" + +#include "lpc17_gpio.h" +#include "u-blox-c027.h" + +#ifdef CONFIG_ARCH_LEDS + +/**************************************************************************** + * Pre-processor 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; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_autoled_initialize + ****************************************************************************/ + +void board_autoled_initialize(void) +{ + /* Configure all LED GPIO lines */ + + lpc17_configgpio(C027_LED); + g_ncstate = true; +} + +/**************************************************************************** + * Name: board_autoled_on + ****************************************************************************/ + +void board_autoled_on(int led) +{ + bool off; + + switch (led) + { + case 0: + case 2: + off = true; + break; + + case 1: + off = false; + g_ncstate = false; + break; + + default: + return; + } + + lpc17_gpiowrite(C027_LED, off); +} + +/**************************************************************************** + * Name: board_autoled_off + ****************************************************************************/ + +void board_autoled_off(int led) +{ + bool off; + + switch (led) + { + case 0: + case 1: + off = false; + break; + + case 2: + off = g_ncstate; + break; + + default: + return; + } + + lpc17_gpiowrite(C027_LED, off); +} + +#endif /* CONFIG_ARCH_LEDS */ diff --git a/configs/u-blox-c027/src/lpc17_nsh.c b/configs/u-blox-c027/src/lpc17_nsh.c new file mode 100644 index 00000000000..84bf35b263b --- /dev/null +++ b/configs/u-blox-c027/src/lpc17_nsh.c @@ -0,0 +1,175 @@ +/**************************************************************************** + * config/u-blox-c027/src/lpc17_nsh.c + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 "lpc17_ssp.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#ifdef CONFIG_NSH_ARCHINIT + +/* PORT and SLOT number probably depend on the board configuration */ + +#ifdef CONFIG_ARCH_BOARD_U_BLOX_C027 +# define NSH_HAVEUSBDEV 1 +# ifdef CONFIG_LPC17_SSP0 +# 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 != 0 +# error "External MMC/SD on SSP0" +# undef CONFIG_NSH_MMCSDSPIPORTNO +# define CONFIG_NSH_MMCSDSPIPORTNO 0 +# endif +# if !defined(CONFIG_NSH_MMCSDSLOTNO) +# error "Use MMC/SD slot 0 by default" +# 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 + +/* Currnently MMC/SD support is available only for NSH configurations */ + +#else +# undef NSH_HAVEMMCSD +#endif /* CONFIG_NSH_ARCHINIT */ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_app_initialize + * + * Description: + * Perform architecture specific initialization + * + ****************************************************************************/ + +int board_app_initialize(void) +{ + int ret; + +#ifdef CONFIG_FS_PROCFS + /* mount the proc filesystem */ + + syslog(LOG_INFO, "Mounting procfs to /proc\n"); + + ret = mount(NULL, "/proc", "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", + ret, errno); + return ret; + } +#endif + +#ifdef NSH_HAVEMMCSD + FAR struct spi_dev_s *ssp; + + /* 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; +} diff --git a/configs/u-blox-c027/src/lpc17_pwm.c b/configs/u-blox-c027/src/lpc17_pwm.c new file mode 100644 index 00000000000..d5d4bb506ce --- /dev/null +++ b/configs/u-blox-c027/src/lpc17_pwm.c @@ -0,0 +1,154 @@ +/************************************************************************************ + * configs/u-blox-c027/lpc17_pwm.c + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 "chip.h" +#include "up_arch.h" +#include "lpc17_pwm.h" +#include "lpc17_timer.h" +#include "u-blox-c027.h" + +/************************************************************************************ + * Pre-processor 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: board_pwm_setup + * + * Description: + * All LPC17 architectures must provide the following interface to work with + * examples/pwm. + * + ************************************************************************************/ + +int board_pwm_setup(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 */ diff --git a/configs/u-blox-c027/src/lpc17_ssp.c b/configs/u-blox-c027/src/lpc17_ssp.c new file mode 100644 index 00000000000..31be19ef77d --- /dev/null +++ b/configs/u-blox-c027/src/lpc17_ssp.c @@ -0,0 +1,199 @@ +/************************************************************************************ + * configs/u-blox-c027/src/lpc17_ssp.c + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 "up_arch.h" +#include "chip.h" +#include "lpc17_gpio.h" +#include "lpc17_ssp.h" +#include "u-blox-c027.h" + +#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) + +/************************************************************************************ + * Pre-processor 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 + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: c027_ssp_initialize + * + * Description: + * Called to configure SPI chip select GPIO pins for the C027. + * + ************************************************************************************/ + +void weak_function c027_ssp_initialize(void) +{ + /* Configure the SPI-based microSD CS GPIO */ + + ssp_dumpgpio("c027_ssp_initialize() Entry)"); + + /* Configure card detect and chip select for the SD slot. */ + +#if defined(CONFIG_LPC17_SSP0) && defined(CONFIG_MMCSD_SPI) + (void)lpc17_configgpio(C027_SD_CS); + (void)lpc17_configgpio(C027_SD_CD); +#endif + + ssp_dumpgpio("c027_ssp_initialize() 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(C027_SD_CS, !selected); + } +#ifdef CONFIG_NX_LCDDRIVER + else if (devid == SPIDEV_DISPLAY) + { + /* Assert the CS pin to the OLED display */ + + (void)lpc17_gpiowrite(C027_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(C027_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 */ diff --git a/configs/u-blox-c027/src/lpc17_ubxmdm.c b/configs/u-blox-c027/src/lpc17_ubxmdm.c new file mode 100644 index 00000000000..e9cb8674bde --- /dev/null +++ b/configs/u-blox-c027/src/lpc17_ubxmdm.c @@ -0,0 +1,310 @@ +/**************************************************************************** + * config/u-blox-c027/src/lpc17_ubxmdm.c + * + * Copyright (C) 2016 Vladimir Komendantskiy. All rights reserved. + * Author: Vladimir Komendantskiy + * + * 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 +#include "lpc17_gpio.h" +#include "u-blox-c027.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* Debug ********************************************************************/ +/* Non-standard debug that may be enabled just for testing the modem driver */ + +#ifdef CONFIG_MODEM_U_BLOX_DEBUG +# define m_dbg dbg +# define m_vdbg vdbg +# define m_vlldbg lldbg +# define m_vllvdbg llvdbg +#else +# define m_dbg(x...) +# define m_vdbg(x...) +# define m_lldbg(x...) +# define m_llvdbg(x...) +#endif + +#define UBXMDM_REGISTER_COUNT \ + (sizeof(lpc17_ubxmdm_name_pins) / \ + sizeof(struct lpc17_name_pin)) + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/* Core interface pin connections. These do not include UART or USB pins. */ + +struct lpc17_ubxmdm_pins +{ + lpc17_pinset_t ldo_enable; + lpc17_pinset_t power_on_n; + lpc17_pinset_t reset_n; + lpc17_pinset_t shifter_en_n; + lpc17_pinset_t usb_detect; +}; + +/* This structure type provides the private representation of the "lower-half" + * driver state. This type must be coercible to type 'ubxmdm_lower'. + */ + +struct lpc17_ubxmdm_lower +{ + FAR const struct ubxmdm_ops* ops; /* Lower half operations */ + + /* Private, architecture-specific information. */ + + FAR const struct lpc17_ubxmdm_pins* pins; + bool usb_used; +}; + +/* Pair type for associating a register name to a pin. */ + +struct lpc17_name_pin +{ + const char name[3]; + const lpc17_pinset_t pin; +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/* "Lower half" driver methods **********************************************/ + +static int lpc17_poweron (FAR struct ubxmdm_lower* lower); +static int lpc17_poweroff (FAR struct ubxmdm_lower* lower); +static int lpc17_reset (FAR struct ubxmdm_lower* lower); +static int lpc17_getstatus(FAR struct ubxmdm_lower* lower, + FAR struct ubxmdm_status* status); +static int lpc17_ioctl (FAR struct ubxmdm_lower* lower, + int cmd, + unsigned long arg); + +/* "Lower half" driver state */ + +static struct lpc17_ubxmdm_lower lpc17_ubxmdm_lower; + +/**************************************************************************** + * Private Data + ****************************************************************************/ +/* "Lower half" driver methods */ + +static const struct lpc17_ubxmdm_pins lpc17_ubxmdm_pins = +{ + .ldo_enable = C027_MDMLDOEN, + .power_on_n = C027_MDMPWR, + .reset_n = C027_MDMRST, + .shifter_en_n = C027_MDMLVLOE, + .usb_detect = C027_MDMUSBDET, +}; + +static const struct ubxmdm_ops lpc17_ubxmdm_ops = +{ + .poweron = lpc17_poweron, + .poweroff = lpc17_poweroff, + .reset = lpc17_reset, + .getstatus = lpc17_getstatus, + .ioctl = lpc17_ioctl, +}; + +static const struct lpc17_name_pin lpc17_ubxmdm_name_pins[] = +{ + {{'T','X','D'}, GPIO_UART1_TXD}, + {{'R','X','D'}, GPIO_UART1_RXD}, + {{'C','T','S'}, GPIO_UART1_CTS}, + {{'R','T','S'}, GPIO_UART1_RTS}, + {{'D','C','D'}, GPIO_UART1_DCD}, + {{'D','S','R'}, GPIO_UART1_DSR}, + {{'D','T','R'}, GPIO_UART1_DTR}, + {{'R','I',' '}, GPIO_UART1_RI }, + {{'I','O','1'}, C027_MDMGPIO1 }, + {{'R','S','T'}, C027_MDMRST }, + {{'P','W','R'}, C027_MDMPWR }, + {{'D','E','T'}, C027_MDMUSBDET}, + {{'L','D','O'}, C027_MDMLDOEN }, + {{'L','V','L'}, C027_MDMLVLOE }, +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static int lpc17_poweron(FAR struct ubxmdm_lower* lower) +{ + FAR struct lpc17_ubxmdm_lower* priv = + (FAR struct lpc17_ubxmdm_lower*) lower; + lpc17_pinset_t usb_detect_val; + + lpc17_configgpio(priv->pins->reset_n | GPIO_VALUE_ONE); /* Modem not in reset */ + lpc17_configgpio(priv->pins->power_on_n | GPIO_VALUE_ZERO); /* Switch closed to GND */ + usleep(10 * 1000); /* Min. time for power_on_n being low is 5 ms */ + + if (priv->usb_used) + { + usb_detect_val = GPIO_VALUE_ONE; /* USB sense on */ + } + else + { + usb_detect_val = GPIO_VALUE_ZERO; /* USB sense off */ + } + + lpc17_configgpio(priv->pins->usb_detect | usb_detect_val); + + lpc17_configgpio(priv->pins->ldo_enable | GPIO_VALUE_ONE); /* LDO enabled */ + usleep(1 * 1000); /* Delay to obtain correct voltage on shifters + + lpc17_configgpio(priv->pins->shifter_en_n | GPIO_VALUE_ZERO); /* UART shifter enabled */ +/* lpc17_configgpio(priv->pins->power_on_n | GPIO_VALUE_ONE); * Stop current through switch */ + + return OK; +} + +static int lpc17_poweroff(FAR struct ubxmdm_lower* lower) +{ + FAR struct lpc17_ubxmdm_lower* priv = + (FAR struct lpc17_ubxmdm_lower*) lower; + + lpc17_configgpio(priv->pins->ldo_enable | GPIO_VALUE_ZERO); /* LDO disabled */ + lpc17_configgpio(priv->pins->reset_n | GPIO_VALUE_ONE); /* Modem not in reset */ + lpc17_configgpio(priv->pins->power_on_n | GPIO_VALUE_ONE); /* Switch open */ + lpc17_configgpio(priv->pins->shifter_en_n | GPIO_VALUE_ONE); /* UART shifter disabled */ + lpc17_configgpio(priv->pins->usb_detect | GPIO_VALUE_ZERO); /* USB sense off */ + + return OK; +} + +static int lpc17_reset(FAR struct ubxmdm_lower* lower) +{ + FAR struct lpc17_ubxmdm_lower* priv = + (FAR struct lpc17_ubxmdm_lower*) lower; + + lpc17_configgpio(priv->pins->reset_n | GPIO_VALUE_ZERO); /* Modem in reset */ + usleep(75 * 1000); /* The minimum reset_n low time is 50 ms */ + lpc17_configgpio(priv->pins->reset_n | GPIO_VALUE_ONE); /* Modem not in reset */ + + return OK; +} + +static int lpc17_getstatus(FAR struct ubxmdm_lower* lower, + FAR struct ubxmdm_status* status) +{ + FAR struct lpc17_ubxmdm_lower* priv = + (FAR struct lpc17_ubxmdm_lower*) lower; + int i; + + status->on = + lpc17_gpioread(priv->pins->ldo_enable) && + lpc17_gpioread(priv->pins->reset_n) && + !lpc17_gpioread(priv->pins->shifter_en_n); + + DEBUGASSERT(status->register_values_size >= UBXMDM_REGISTER_COUNT); + status->register_values_size = UBXMDM_REGISTER_COUNT; + + for (i = 0; i < UBXMDM_REGISTER_COUNT; i++) + { + strncpy(status->register_values[i].name, + lpc17_ubxmdm_name_pins[i].name, + 3); + status->register_values[i].val = + lpc17_gpioread(lpc17_ubxmdm_name_pins[i].pin); + } + + return OK; +} + +static int lpc17_ioctl(FAR struct ubxmdm_lower* lower, + int cmd, + unsigned long arg) +{ + /* No platform-specific IOCTL at the moment. */ + + return -ENOSYS; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lpc17_ubxmdm_init + * + * Description: + * Initialize the modem. The modem is initialized and + * registered at '/dev/ubxmdm'. + * + * Input Parameters: + * usb_used - enables the USB sense pin if 'true' + * + * Returned Values: + * None + * + ****************************************************************************/ + +void lpc17_ubxmdm_init(bool usb_used) +{ + FAR struct lpc17_ubxmdm_lower* priv = &lpc17_ubxmdm_lower; + + DEBUGASSERT(priv->ops == NULL && priv->pins == NULL); + + /* Initialize the driver state structure. Here we assume: (1) the state + * structure lies in .bss and was zeroed at reset time. (2) This function + * is only called once so it is never necessary to re-zero the structure. + */ + + priv->ops = &lpc17_ubxmdm_ops; + priv->pins = &lpc17_ubxmdm_pins; + priv->usb_used = usb_used; + + lpc17_poweroff((FAR struct ubxmdm_lower*) priv); + + (void) ubxmdm_register("/dev/ubxmdm", (FAR struct ubxmdm_lower*) priv); +} diff --git a/configs/u-blox-c027/src/lpc17_usbmsc.c b/configs/u-blox-c027/src/lpc17_usbmsc.c new file mode 100644 index 00000000000..217e28b1dd1 --- /dev/null +++ b/configs/u-blox-c027/src/lpc17_usbmsc.c @@ -0,0 +1,125 @@ +/**************************************************************************** + * configs/u-blox-c027/src/lpc17_usbmsc.c + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Configure and register the LPC17xx MMC/SD SPI block driver. + * + * 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 "lpc17_ssp.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +#ifndef CONFIG_SYSTEM_USBMSC_DEVMINOR1 +# define CONFIG_SYSTEM_USBMSC_DEVMINOR1 0 +#endif + +/* PORT and SLOT number probably depend on the board configuration */ + +#ifdef CONFIG_ARCH_BOARD_U_BLOX_C027 +# undef LPC17XX_MMCSDSPIPORTNO +# define LPC17XX_MMCSDSPIPORTNO 0 +# undef LPC17XX_MMCSDSLOTNO +# define LPC17XX_MMCSDSLOTNO 0 +#else + /* Add configuration for new LPC17xx boards here */ + +# error "Unrecognized LPC17xx board" +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: usbmsc_archinitialize + * + * Description: + * Perform architecture specific initialization + * + ****************************************************************************/ + +int usbmsc_archinitialize(void) +{ + FAR struct spi_dev_s *spi; + int ret; + + /* Get the SPI port */ + + syslog(LOG_INFO, "Initializing SPI port %d\n", LPC17XX_MMCSDSPIPORTNO); + + spi = lpc17_sspinitialize(LPC17XX_MMCSDSPIPORTNO); + if (!spi) + { + syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n", + LPC17XX_MMCSDSPIPORTNO); + return -ENODEV; + } + + syslog(LOG_INFO, "Successfully initialized SPI port %d\n", + LPC17XX_MMCSDSPIPORTNO); + + /* Bind the SPI port to the slot */ + + syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n", + LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO); + + ret = mmcsd_spislotinitialize(CONFIG_SYSTEM_USBMSC_DEVMINOR1, LPC17XX_MMCSDSLOTNO, spi); + if (ret < 0) + { + syslog(LOG_ERR, + "ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n", + LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO, ret); + return ret; + } + + syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n", + LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO); + return OK; +} diff --git a/configs/u-blox-c027/src/u-blox-c027.h b/configs/u-blox-c027/src/u-blox-c027.h new file mode 100644 index 00000000000..6ecb7928faa --- /dev/null +++ b/configs/u-blox-c027/src/u-blox-c027.h @@ -0,0 +1,103 @@ +/************************************************************************************ + * configs/u-blox-c027/src/u-blox-c027.h + * + * Copyright (C) 2016 Vladimir Komendantskiy. All rights reserved. + * Author: Vladimir Komendantskiy + * + * 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_U_BLOX_C027_SRC_U_BLOX_C027_H +#define __CONFIGS_U_BLOX_C027_SRC_U_BLOX_C027_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +#define C027_LED (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT3 | GPIO_PIN25) + +#define C027_SD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN2) +#ifdef CONFIG_GPIO_IRQ +# define C027_SD_CD (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11) +#else +# define C027_SD_CD (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11) +#endif + +#define GPSADDR (66<<1) /* GPS I2C Address */ +#define GPSBAUD 9600 /* Default GPS Baud Rate */ +#define MDMBAUD 115200 /* Default Modem Baud Rate */ + +#define C027_MDMUSBDET (GPIO_OUTPUT | GPIO_PORT0 | GPIO_PIN7) +#define C027_MDMILVLOE (GPIO_OUTPUT | GPIO_PORT0 | GPIO_PIN8) +#define C027_MDMLVLOE (GPIO_OUTPUT | GPIO_PORT0 | GPIO_PIN9) +#define C027_MDMLDOEN (GPIO_OUTPUT | GPIO_PORT2 | GPIO_PIN5) +#define C027_MDMPWR (GPIO_OUTPUT | GPIO_PORT2 | GPIO_PIN6) +#define C027_MDMGPIO1 (GPIO_INPUT | GPIO_PORT2 | GPIO_PIN7) +#define C027_MDMRST (GPIO_OUTPUT | GPIO_PORT2 | GPIO_PIN8) +#define C027_GPSEN (GPIO_OUTPUT | GPIO_PORT1 | GPIO_PIN29) +#define C027_GPSRST (GPIO_OUTPUT | GPIO_PORT1 | GPIO_PIN18) + +/************************************************************************************ + * Public data + ************************************************************************************/ + +#ifndef __ASSEMBLY__ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: c027_ssp_initialize + * + * Description: + * Called to configure SPI chip select GPIO pins for the C027 board. + * + ************************************************************************************/ + +void weak_function c027_ssp_initialize(void); + +#if defined(CONFIG_MODEM_U_BLOX) + +/* + * Initialisation function for the u-blox modem. + */ +void lpc17_ubxmdm_init(bool usb_used); + +#endif /* CONFIG_MODEM_U_BLOX */ + +#endif /* __ASSEMBLY__ */ +#endif /* __CONFIGS_U_BLOX_C027_SRC_U_BLOX_C027_H */ diff --git a/configs/u-blox-c027/tools/flash.sh b/configs/u-blox-c027/tools/flash.sh new file mode 100644 index 00000000000..4faa709ca0e --- /dev/null +++ b/configs/u-blox-c027/tools/flash.sh @@ -0,0 +1,146 @@ +#!/bin/bash +#################################################################################### +# flash.sh +# +# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# +#################################################################################### + +USAGE="$0 " + +echo "############################################################################" +echo "# Assumptions:" +echo "#" +echo "# - Windows 7" +echo "# - LPCXpresso 3.6 installed at /cygdrive/c/nxp/lpcxpresso_3.6" +echo "# - AXF image built with Code Red" +echo "# - LPC1768" +echo "#" +echo "# You will need to edit this is any of the above are false" +echo "#" +echo "############################################################################" +echo "" + +# This is the default install location for binaries on Windows (note that this +# path could change with the Code Red version number) +BINDIR="/cygdrive/c/nxp/lpcxpresso_3.6/bin" +if [ ! -d "${BINDIR}" ]; then + echo "Directory ${BINDIR} does not exist" + exit 1 +fi + +# This is the relative path to the booLPCXpresso utility +BOOTLPC="Scripts/bootLPCXpresso.cmd" +if [ ! -x "${BINDIR}/$BOOTLPC" ]; then + echo "No executable at ${BINDIR}/${BOOTLPC}" + exit 1 +fi + +# BOOTLPC_ARG=winusb # WinXP +BOOTLPC_ARG=hid # Win7 + +# FLASHUTIL="crt_emu_lpc11_13" # for LPC11xx or LPC13xx parts) +FLASHUTIL="crt_emu_cm3_nxp" # for LPC17xx parts +# FLASHUTIL="crt_emu_a7_nxp" # for LPC21/22/23/24 parts) +# FLASHUTIL="crt_emu_a9_nxp" # for LPC31/32 and LPC29xx parts) +# FLASHUTIL="crt_emu_cm3_lmi" # for TI Stellaris LM3S parts + +if [ ! -x "${BINDIR}/${FLASHUTIL}" ]; then + echo "No executable file at ${BINDIR}/${FLASHUTIL}" + exit 1 +fi + +# unset WIRE # for Red Probe+, Red Probe, RDB1768v1, or TI Stellaris evaluation boards +# WIRE="-wire=hi" # for RDB1768v2 without upgraded firmware) +# WIRE="-wire=winusb" # for RDB1768v2 with upgraded firmware) +# WIRE="-wire=winusb" # for LPC-Link on Windows XP) +WIRE="-wire=hid" # for LPC-Link on Windows Vista/Windows 7) + +TARGET=LPC1768 + +# The nuttx directory must be provided as an argument + +NUTTX=$1 +if [ -z "${NUTTX}" ]; then + echo "Missing argument" + echo $USAGE + exit 1 +fi + +if [ ! -d "${NUTTX}" ]; then + echo "Directory ${NUTTX} does not exist" + echo $USAGE + exit 1 +fi + +# The binary to download: + +if [ ! -f "${NUTTX}/nuttx.axf" ]; then + if [ -f "${NUTTX}/nuttx" ]; then + echo "Renaming ${NUTTX}/nuttx to ${NUTTX}/nuttx.axf" + mv ${NUTTX}/nuttx ${NUTTX}/nuttx.axf + fi +else + if [ -f "${NUTTX}/nuttx" ]; then + echo "Both ${NUTTX}/nuttx ${NUTTX}/nuttx.axf exist.." + echo " Deleting ${NUTTX}/nuttx.axf" + rm -f ${NUTTX}/nuttx.axf + echo "Renaming ${NUTTX}/nuttx to ${NUTTX}/nuttx.axf" + mv ${NUTTX}/nuttx ${NUTTX}/nuttx.axf + fi +fi +NUTTXPATH=`cygpath -w "${NUTTX}/nuttx.axf"` + +# First of all boot the LPC-Link using the script: + +cd ${BINDIR} || \ + { echo "Failed to CD to ${BINDIR}"; exit 1; } +./${BOOTLPC} ${BOOTLPC_ARG} || \ + { echo "'${BOOTLPC} ${BOOTLPC_ARG}' Failed"; } + +echo "" +echo "Wait a bit" +echo "5..." +sleep 1 +echo "4..." +sleep 1 +echo "3..." +sleep 1 +echo "2..." +sleep 1 +echo "1..." +sleep 1 +echo "0..." +echo "" + +# Then program the FLASH + +./${FLASHUTIL} ${WIRE} -p${TARGET} -flash-load-exec="${NUTTXPATH}"