Add port to Zilogic Systems ZKIT-ARM-1769 board (more coming)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5673 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
7675676c93
commit
13948eedf0
12 changed files with 2054 additions and 0 deletions
|
@ -653,6 +653,13 @@ config ARCH_BOARD_ZP214XPA
|
|||
ZPA213X/4XPA development board. Includes support for the
|
||||
UG-2864AMBAG01 OLED also from The0.net
|
||||
|
||||
config ARCH_BOARD_ZKITARM
|
||||
bool "Zilogic ZKit-ARM-1769 Development Kit"
|
||||
depends on ARCH_CHIP_LPC1768
|
||||
---help---
|
||||
Zilogic System's ARM development Kit, ZKIT-ARM-1769. This board is based
|
||||
on the NXP LPC1769. The Nuttx Buildroot toolchain is used by default.
|
||||
|
||||
config ARCH_BOARD_SIM
|
||||
bool "User mode simulation"
|
||||
depends on ARCH_SIM
|
||||
|
@ -738,6 +745,7 @@ config ARCH_BOARD
|
|||
default "z8encore000zco" if ARCH_BOARD_Z8ENCORE000ZCO
|
||||
default "z8f64200100kit" if ARCH_BOARD_Z8F64200100KIT
|
||||
default "zp214xpa" if ARCH_BOARD_ZP214XPA
|
||||
default "zkit-arm-1769" if ARCH_BOARD_ZKITARM
|
||||
default "sim" if ARCH_BOARD_SIM
|
||||
default "" if ARCH_BOARD_CUSTOM
|
||||
|
||||
|
@ -982,6 +990,9 @@ endif
|
|||
if ARCH_BOARD_ZP214XPA
|
||||
source "configs/zp214xpa/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_ZKITARM
|
||||
source "configs/zkit-arm-1769/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_SIM
|
||||
source "configs/sim/Kconfig"
|
||||
endif
|
||||
|
|
|
@ -2036,6 +2036,10 @@ configs/zp214xpa
|
|||
ZPA213X/4XPA development board. Includes support for the
|
||||
UG-2864AMBAG01 OLED also from The0.net
|
||||
|
||||
configs/zkit-arm-1769
|
||||
Zilogic System's ARM development Kit, ZKIT-ARM-1769. This board is based
|
||||
on the NXP LPC1769. The Nuttx Buildroot toolchain is used by default.
|
||||
|
||||
Configuring NuttX
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
13
configs/zkit-arm-1769/Kconfig
Normal file
13
configs/zkit-arm-1769/Kconfig
Normal file
|
@ -0,0 +1,13 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see misc/tools/kconfig-language.txt.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_ZKITARM
|
||||
config ARCH_LEDS
|
||||
bool "NuttX LED support"
|
||||
default n
|
||||
---help---
|
||||
"Support control of board LEDs by NuttX to indicate system state"
|
||||
|
||||
endif
|
555
configs/zkit-arm-1769/README.txt
Normal file
555
configs/zkit-arm-1769/README.txt
Normal file
|
@ -0,0 +1,555 @@
|
|||
README
|
||||
^^^^^^
|
||||
|
||||
README for NuttX port to the Zilogic's ZKIT-ARM-1769 [NXP-LPC1769]
|
||||
board.
|
||||
|
||||
Contents
|
||||
^^^^^^^^
|
||||
|
||||
ZKit-ARM LPC1769 Board
|
||||
Development Environment
|
||||
GNU Toolchain Options
|
||||
NuttX buildroot Toolchain
|
||||
LEDs
|
||||
ZKit-ARM Configuration Options
|
||||
Configurations
|
||||
|
||||
Zilogic's ZKit-ARM-1769 Board
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Pin Description On Board Connector
|
||||
-------------------------------- ---------------- -------------
|
||||
P0.0/RD1/TXD3/SDA1 RD1 CAN1
|
||||
P0.1/TD1/RXD3/SCL1 TD1
|
||||
P0.2/TXD0/AD0.7 TXD0 COM0
|
||||
P0.3/RXD0/AD0.6 RXD0
|
||||
P0.4/I2SRX_CLK/RD2/CAP2.0 GPIO0
|
||||
P0.5/I2SRX_WS/TD2/CAP2.1 GPIO1
|
||||
P0.6/I2SRX_SDA/SSEL1/MAT2.0 SSEL1 SPI
|
||||
P0.7/I2STX_CLK/SCK1/MAT2.1 SCK1
|
||||
P0.8/I2STX_WS/MISO1/MAT2.2 MISO1
|
||||
P0.9/I2STX_SDA/MOSI1/MAT2.3 MOSI1
|
||||
P0.10/TXD2/SDA2/MAT3.0 TXD2 COM2
|
||||
P0.11/RXD2/SCL2/MAT3.1 RXD2
|
||||
P0.15/TXD1/SCK0/SCK SD-SCK
|
||||
P0.16/RXD1/SSEL0/SSEL SD-SSEL SD-CARD
|
||||
P0.17/CTS1/MISO0/MISO SD-MISO
|
||||
P0.18/DCD1/M0SI0/MOSI SD-MOSI
|
||||
P0.19/DSR1/SDA1 LED1
|
||||
P0.20/DTR1/SCL1 DTR1 COM1
|
||||
P0.21/RI1/RD1 NC LED2
|
||||
P0.22/RTS1/TD1 RTS1 COM1
|
||||
P0.23/AD0.0/I2SRX_CLK/CAP3.0 AD0
|
||||
P0.24/AD0.1/I2SRX_WS/CAP3.1 AD1 AIN
|
||||
P0.25/AD0.2/I2SRX_SDA/TXD3 AD2
|
||||
P0.26/AD0.3/AOUT/RXD3 AD3
|
||||
P0.27/SDA0/USB_SDA SDA0 I2C0
|
||||
P0.28/SCL0/USB_SCL SCL0
|
||||
P0.29/USB_D+ USB-D+ USB
|
||||
P0.30/USB_D- USB-D-
|
||||
|
||||
P1.0/ENET_TXD0 ETH-TXD0
|
||||
P1.1/ENET_TXD1 ETH-TXD1
|
||||
P1.4/ENET_TX_EN ETH-TXEN
|
||||
P1.8/ENET_CRS ETH-CRS
|
||||
P1.9/ENET_RXD0 ETH-RXD0 ETH
|
||||
P1.10/ENET_RXD1 ETH-RXD1
|
||||
P1.14/ENET_RX_ER ETH-RXER
|
||||
P1.15/ENET_REF_CLK ETH-REFCLK
|
||||
P1.16/ENET_MDC ETH-MDC
|
||||
P1.17/ENET_MDIO ETH-MDIO
|
||||
P1.18/USB_UP_LED/PWM1.1/CAP1.0 USB-UP-LED
|
||||
P1.19/MCOA0/nUSB_PPWR/CAP1.1 KEY1
|
||||
P1.20/MCFB0/PWM1.2/SCK0 LCD-SCK
|
||||
P1.21/MCABORT/PWM1.3/SSEL0 LCD-SSEL
|
||||
P1.22/MCOB0/USB_PWRD/MAT1.0 LCD-A0 LCD
|
||||
P1.23/MCFB1/PWM1.4/MISO0 NC
|
||||
P1.24/MCFB2/PWM1.5/MOSI0 LCD_MOSI
|
||||
P1.25/MCOA1/MAT1.1 LCD-RST
|
||||
P1.26/MCOB1/PWM1.6/CAP0.0 LCD-AO
|
||||
P1.27/CLKOUT/nUSB_OVRCR/CAP0.1 KEY2
|
||||
P1.28/MCOA2/MAT0.0 KEY3
|
||||
P1.29/MCOB2/PCAP1.1/MAT0.1 CAP1 PWM-CON
|
||||
P1.30/VBUS/AD0.4 VBUS USB
|
||||
P1.31/SCK1/AD0.5 KEY4
|
||||
|
||||
P2.0/PWM1.1/TXD1 TXD1
|
||||
P2.1/PWM1.2/RXD1 RXD1 COM1
|
||||
P2.2/PWM1.3/CTS1/TRACEDATA3 CTS1
|
||||
P2.3/PWM1.4/DCD1/TRACEDATA2 PWM4
|
||||
P2.4/PWM1.5/DSR1/TRACEDATA1 PWM5 PWM
|
||||
P2.5/PWM1.6/DTR1/TRACEDATA0 PWM6
|
||||
P2.6/PCAP1.0/RI1/TRACECLK CAP0
|
||||
P2.7/RD2/RTS1 RD2 CAN2
|
||||
P2.8/TD2/TXD2 TD2
|
||||
P2.9/USB_CONNECT/RXD2 USB_CONNECT USB
|
||||
P2.10/nEINT0/NMI ISP
|
||||
P2.11/nEINT1/I2STX_CLK INT1 I2C
|
||||
P2.12/nEINT2/I2STX_WS SD-DET SD-CARD
|
||||
P2.13/nEINT3/I2STX_SDA KEY5
|
||||
|
||||
P3.25/MAT0.0/PWM1.2 PWM2 PWM
|
||||
P3.26/STCLK/MAT0.1/PWM1.3 PWM3
|
||||
|
||||
P4.28/RX_MCLK/MAT2.0/TXD3 GPIO2 SPI
|
||||
P4.28/RX_MCLK/MAT2.0/TXD3 GPIO3
|
||||
|
||||
Zilogic's ZKit-ARM-1769 Board
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
SD Slot
|
||||
-------
|
||||
|
||||
Board LPC1768
|
||||
SD Signal Pin
|
||||
--- ----------- ----------
|
||||
CS SD-SSEL P0.16 SSEL0
|
||||
DIN SD-MOSI P0.18 MOSI0
|
||||
DOUT SD-MISO P0.17 MISO0
|
||||
CLK SD-SCK P0.15 SCK0
|
||||
CD SD-DET P2.12
|
||||
|
||||
USB Device
|
||||
----------
|
||||
|
||||
Board LPC1768
|
||||
Signal Pin
|
||||
----------------- -----------------
|
||||
USB_CONNECT P2.9 USB_CONNECT
|
||||
USB_DM P0.29 USB_D-
|
||||
USB_DP P0.30 USB_D+
|
||||
USB_VBUS P1.30 USB_VBUS
|
||||
USB_UPLED P1.18 USB_UPLED
|
||||
|
||||
128x64 LCD with SPI interface
|
||||
---------------------------------------
|
||||
The LCD display is connected to the SPI-bus.
|
||||
|
||||
ZKit-ARM Signals
|
||||
|
||||
----------------------------+--------------- -------------------------------------------
|
||||
LPC1758 Pin | Board Signal Description
|
||||
----------------------------+--------------- -------------------------------------------
|
||||
P1.20/MCFB0/PWM1.2/SCK0 | LCD-SCK LCD Clock signal (D6)
|
||||
P1.21/MCABORT/PWM1.3/SSEL0 | LCD-SSEL LCD Chip Select (CSB)
|
||||
P1.22/MCOB0/USB_PWRD/MAT1.0 | LCD-A0 LCD-A0 (A0)
|
||||
P1.23/MCFB1/PWM1.4/MISO0 | N.C
|
||||
P1.24/MCFB2/PWM1.5/MOSI0 | LCD-MOSI LCD Data (D7)
|
||||
P1.25/MCOA1/MAT1.1 | LCD-RST LCD Reset (RSTB) - Resets Everything in LCD
|
||||
----------------------------+--------------- -------------------------------------------
|
||||
|
||||
Development Environment
|
||||
^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Either Linux or Cygwin on Windows can be used for the development environment.
|
||||
The source has been built only using the GNU toolchain (see below). Other
|
||||
toolchains will likely cause problems. Testing was performed using the Cygwin
|
||||
environment.
|
||||
|
||||
GNU Toolchain Options
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The NuttX make system has been modified to support the following different
|
||||
toolchain options.
|
||||
|
||||
1. The Code Red GNU toolchain
|
||||
2. The CodeSourcery GNU toolchain,
|
||||
3. The devkitARM GNU toolchain,
|
||||
4. The NuttX buildroot Toolchain (see below).
|
||||
|
||||
All testing has been conducted using the Code Red toolchain and the
|
||||
make system is setup to default to use the Code Red Linux toolchain. To use
|
||||
the other toolchain, you simply need add one of the following configuration
|
||||
options to your .config (or defconfig) file:
|
||||
|
||||
CONFIG_LPC17_CODESOURCERYW=y : CodeSourcery under Windows
|
||||
CONFIG_LPC17_CODESOURCERYL=y : CodeSourcery under Linux
|
||||
CONFIG_LPC17_DEVKITARM=y : devkitARM under Windows
|
||||
CONFIG_LPC17_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default)
|
||||
CONFIG_LPC17_CODEREDW=n : Code Red toolchain under Windows
|
||||
CONFIG_LPC17_CODEREDL=y : Code Red toolchain under Linux
|
||||
|
||||
You may also have to modify the PATH in the setenv.h file if your make cannot
|
||||
find the tools.
|
||||
|
||||
NOTE: the CodeSourcery (for Windows), devkitARM, and Code Red (for Windoes)
|
||||
are Windows native toolchains. The CodeSourcey (for Linux), Code Red (for Linux)
|
||||
and NuttX buildroot toolchains are Cygwin and/or Linux native toolchains. There
|
||||
are several limitations to using a Windows based toolchain in a Cygwin
|
||||
environment. The three biggest are:
|
||||
|
||||
1. The Windows toolchain cannot follow Cygwin paths. Path conversions are
|
||||
performed automatically in the Cygwin makefiles using the 'cygpath' utility
|
||||
but you might easily find some new path problems. If so, check out 'cygpath -w'
|
||||
|
||||
2. Windows toolchains cannot follow Cygwin symbolic links. Many symbolic links
|
||||
are used in Nuttx (e.g., include/arch). The make system works around these
|
||||
problems for the Windows tools by copying directories instead of linking them.
|
||||
But this can also cause some confusion for you: For example, you may edit
|
||||
a file in a "linked" directory and find that your changes had no effect.
|
||||
That is because you are building the copy of the file in the "fake" symbolic
|
||||
directory. If you use a Windows toolchain, you should get in the habit of
|
||||
making like this:
|
||||
|
||||
make clean_context all
|
||||
|
||||
An alias in your .bashrc file might make that less painful.
|
||||
|
||||
3. Dependencies are not made when using Windows versions of the GCC. This is
|
||||
because the dependencies are generated using Windows pathes which do not
|
||||
work with the Cygwin make.
|
||||
|
||||
Support has been added for making dependencies with the windows-native toolchains.
|
||||
That support can be enabled by modifying your Make.defs file as follows:
|
||||
|
||||
- MKDEP = $(TOPDIR)/tools/mknulldeps.sh
|
||||
+ MKDEP = $(TOPDIR)/tools/mkdeps.sh --winpaths "$(TOPDIR)"
|
||||
|
||||
If you have problems with the dependency build (for example, if you are not
|
||||
building on C:), then you may need to modify tools/mkdeps.sh
|
||||
|
||||
NOTE 1: The CodeSourcery toolchain (2009q1) does not work with default optimization
|
||||
level of -Os (See Make.defs). It will work with -O0, -O1, or -O2, but not with
|
||||
-Os.
|
||||
|
||||
NOTE 2: The devkitARM toolchain includes a version of MSYS make. Make sure that
|
||||
the paths to Cygwin's /bin and /usr/bin directories appear BEFORE the devkitARM
|
||||
path or will get the wrong version of make.
|
||||
|
||||
NuttX buildroot Toolchain
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
A GNU GCC-based toolchain is assumed. The files */setenv.sh should
|
||||
be modified to point to the correct path to the Cortex-M3 GCC toolchain (if
|
||||
different from the default in your PATH variable).
|
||||
|
||||
If you have no Cortex-M3 toolchain, one can be downloaded from the NuttX
|
||||
SourceForge download site (https://sourceforge.net/projects/nuttx/files/).
|
||||
This GNU toolchain builds and executes in the Linux or Cygwin environment.
|
||||
|
||||
1. You must have already configured Nuttx in <some-dir>/nuttx.
|
||||
|
||||
cd tools
|
||||
./configure.sh zkit-arm-1769/<sub-dir>
|
||||
|
||||
2. Download the latest buildroot package into <some-dir>
|
||||
|
||||
3. unpack the buildroot tarball. The resulting directory may
|
||||
have versioning information on it like buildroot-x.y.z. If so,
|
||||
rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
|
||||
|
||||
4. cd <some-dir>/buildroot
|
||||
|
||||
5. cp configs/cortexm3-defconfig-4.3.3 .config
|
||||
|
||||
6. make oldconfig
|
||||
|
||||
7. make
|
||||
|
||||
8. Edit setenv.h, if necessary, so that the PATH variable includes
|
||||
the path to the newly built binaries.
|
||||
|
||||
See the file configs/README.txt in the buildroot source tree. That has more
|
||||
detailed PLUS some special instructions that you will need to follow if you
|
||||
are building a Cortex-M3 toolchain for Cygwin under Windows.
|
||||
|
||||
NOTE: The cortexm3-defconfig-4.3.3 produces an older-style is OABI toolchain.
|
||||
There is another configuration, cortexm3-eabi-defconfig-4.6.3, that will
|
||||
build a newer, EABI, toolchain. Unfortunately, the 4.6.3 EABI toolchain is
|
||||
not compatible with the NXFLAT tools. See the top-level TODO file (under
|
||||
"Binary loaders") for more information about this problem. If you plan to
|
||||
use NXFLAT, please do not use the GCC 4.6.3 EABI toochain; instead use the
|
||||
GCC 4.3.3 OABI toolchain.
|
||||
|
||||
NXFLAT Toolchain
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
If you are *not* using the NuttX buildroot toolchain and you want to use
|
||||
the NXFLAT tools, then you will still have to build a portion of the buildroot
|
||||
tools -- just the NXFLAT tools. The buildroot with the NXFLAT tools can
|
||||
be downloaded from the NuttX SourceForge download site
|
||||
(https://sourceforge.net/projects/nuttx/files/).
|
||||
|
||||
This GNU toolchain builds and executes in the Linux or Cygwin environment.
|
||||
|
||||
1. You must have already configured Nuttx in <some-dir>/nuttx.
|
||||
|
||||
cd tools
|
||||
./configure.sh zkit-arm-1769/<sub-dir>
|
||||
|
||||
2. Download the latest buildroot package into <some-dir>
|
||||
|
||||
3. unpack the buildroot tarball. The resulting directory may
|
||||
have versioning information on it like buildroot-x.y.z. If so,
|
||||
rename <some-dir>/buildroot-x.y.z to <some-dir>/buildroot.
|
||||
|
||||
4. cd <some-dir>/buildroot
|
||||
|
||||
5. cp configs/cortexm3-defconfig-nxflat .config
|
||||
|
||||
6. make oldconfig
|
||||
|
||||
7. make
|
||||
|
||||
8. Edit setenv.h, if necessary, so that the PATH variable includes
|
||||
the path to the newly builtNXFLAT binaries.
|
||||
|
||||
LEDs
|
||||
^^^^
|
||||
|
||||
If CONFIG_ARCH_LEDS is defined, then support for the ZKit-ARM LEDs will be
|
||||
included in the build. See:
|
||||
|
||||
- configs/zkit-arm-1769/include/board.h - Defines LED constants, types and
|
||||
prototypes the LED interface functions.
|
||||
|
||||
- configs/zkit-arm-1769/src/zkitarm_internal.h - GPIO settings for the LEDs.
|
||||
|
||||
- configs/zkit-arm-1769/src/up_leds.c - LED control logic.
|
||||
|
||||
The ZKit-ARM LPC1768 has a single LEDs (there are more on the Embedded Artists
|
||||
base board, but those are not controlled by NuttX). Usage this single LED by NuttX
|
||||
is as follows:
|
||||
|
||||
- The LED is not illuminated until the ZKit-ARM completes initialization.
|
||||
|
||||
If the LED is stuck in the OFF state, this means that the ZKit-ARM did not
|
||||
complete intialization.
|
||||
|
||||
- Each time the OS enters an interrupt (or a signal) it will turn the LED OFF and
|
||||
restores its previous stated upon return from the interrupt (or signal).
|
||||
|
||||
The normal state, after initialization will be a dull glow. The brightness of
|
||||
the glow will be inversely related to the proportion of time spent within interrupt
|
||||
handling logic. The glow may decrease in brightness when the system is very
|
||||
busy handling device interrupts and increase in brightness as the system becomes
|
||||
idle.
|
||||
|
||||
Stuck in the OFF state suggests that that the system never completed
|
||||
initialization; Stuck in the ON state would indicated that the system
|
||||
intialialized, but is not takint interrupts.
|
||||
|
||||
- If a fatal assertion or a fatal unhandled exception occurs, the LED will flash
|
||||
strongly as a slow, 2Hz rate.
|
||||
|
||||
ZKit-ARM Configuration Options
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
General Architecture Settings:
|
||||
|
||||
CONFIG_ARCH - Identifies the arch/ subdirectory. This should
|
||||
be set to:
|
||||
|
||||
CONFIG_ARCH=arm
|
||||
|
||||
CONFIG_ARCH_family - For use in C code:
|
||||
|
||||
CONFIG_ARCH_ARM=y
|
||||
|
||||
CONFIG_ARCH_architecture - For use in C code:
|
||||
|
||||
CONFIG_ARCH_CORTEXM3=y
|
||||
|
||||
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
|
||||
|
||||
CONFIG_ARCH_CHIP=lpc17xx
|
||||
|
||||
CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
|
||||
chip:
|
||||
|
||||
CONFIG_ARCH_CHIP_LPC1768=y
|
||||
|
||||
CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
|
||||
hence, the board that supports the particular chip or SoC.
|
||||
|
||||
CONFIG_ARCH_BOARD=zkit-arm-1769
|
||||
|
||||
CONFIG_ARCH_BOARD_name - For use in C code
|
||||
|
||||
CONFIG_ARCH_BOARD_ZKITARM=y
|
||||
|
||||
CONFIG_ARCH_LOOPSPERMSEC - Must be calibrated for correct operation
|
||||
of delay loops
|
||||
|
||||
CONFIG_ENDIAN_BIG - define if big endian (default is little
|
||||
endian)
|
||||
|
||||
CONFIG_DRAM_SIZE - Describes the installed DRAM (CPU SRAM in this case):
|
||||
|
||||
CONFIG_DRAM_SIZE=(32*1024) (32Kb)
|
||||
|
||||
There is an additional 32Kb of SRAM in AHB SRAM banks 0 and 1.
|
||||
|
||||
CONFIG_DRAM_START - The start address of installed DRAM
|
||||
|
||||
CONFIG_DRAM_START=0x10000000
|
||||
|
||||
CONFIG_ARCH_IRQPRIO - The LPC17xx supports interrupt prioritization
|
||||
|
||||
CONFIG_ARCH_IRQPRIO=y
|
||||
|
||||
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to boards that
|
||||
have LEDs
|
||||
|
||||
CONFIG_ARCH_INTERRUPTSTACK - This architecture supports an interrupt
|
||||
stack. If defined, this symbol is the size of the interrupt
|
||||
stack in bytes. If not defined, the user task stacks will be
|
||||
used during interrupt handling.
|
||||
|
||||
CONFIG_ARCH_STACKDUMP - Do stack dumps after assertions
|
||||
|
||||
CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture.
|
||||
|
||||
CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that
|
||||
cause a 100 second delay during boot-up. This 100 second delay
|
||||
serves no purpose other than it allows you to calibratre
|
||||
CONFIG_ARCH_LOOPSPERMSEC. You simply use a stop watch to measure
|
||||
the 100 second delay then adjust CONFIG_ARCH_LOOPSPERMSEC until
|
||||
the delay actually is 100 seconds.
|
||||
|
||||
Individual subsystems can be enabled:
|
||||
CONFIG_LPC17_MAINOSC=y
|
||||
CONFIG_LPC17_PLL0=y
|
||||
CONFIG_LPC17_PLL1=n
|
||||
CONFIG_LPC17_ETHERNET=n
|
||||
CONFIG_LPC17_USBHOST=n
|
||||
CONFIG_LPC17_USBOTG=n
|
||||
CONFIG_LPC17_USBDEV=n
|
||||
CONFIG_LPC17_UART0=y
|
||||
CONFIG_LPC17_UART1=n
|
||||
CONFIG_LPC17_UART2=n
|
||||
CONFIG_LPC17_UART3=n
|
||||
CONFIG_LPC17_CAN1=n
|
||||
CONFIG_LPC17_CAN2=n
|
||||
CONFIG_LPC17_SPI=n
|
||||
CONFIG_LPC17_SSP0=n
|
||||
CONFIG_LPC17_SSP1=n
|
||||
CONFIG_LPC17_I2C0=n
|
||||
CONFIG_LPC17_I2C1=n
|
||||
CONFIG_LPC17_I2S=n
|
||||
CONFIG_LPC17_TMR0=n
|
||||
CONFIG_LPC17_TMR1=n
|
||||
CONFIG_LPC17_TMR2=n
|
||||
CONFIG_LPC17_TMR3=n
|
||||
CONFIG_LPC17_RIT=n
|
||||
CONFIG_LPC17_PWM=n
|
||||
CONFIG_LPC17_MCPWM=n
|
||||
CONFIG_LPC17_QEI=n
|
||||
CONFIG_LPC17_RTC=n
|
||||
CONFIG_LPC17_WDT=n
|
||||
CONFIG_LPC17_ADC=n
|
||||
CONFIG_LPC17_DAC=n
|
||||
CONFIG_LPC17_GPDMA=n
|
||||
CONFIG_LPC17_FLASH=n
|
||||
|
||||
LPC17xx specific device driver settings
|
||||
|
||||
CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the
|
||||
console and ttys0 (default is the UART0).
|
||||
CONFIG_UARTn_RXBUFSIZE - Characters are buffered as received.
|
||||
This specific the size of the receive buffer
|
||||
CONFIG_UARTn_TXBUFSIZE - Characters are buffered before
|
||||
being sent. This specific the size of the transmit buffer
|
||||
CONFIG_UARTn_BAUD - The configure BAUD of the UART. Must be
|
||||
CONFIG_UARTn_BITS - The number of bits. Must be either 7 or 8.
|
||||
CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
|
||||
CONFIG_UARTn_2STOP - Two stop bits
|
||||
|
||||
LPC17xx specific CAN device driver settings. These settings all
|
||||
require CONFIG_CAN:
|
||||
|
||||
CONFIG_CAN_EXTID - Enables support for the 29-bit extended ID. Default
|
||||
Standard 11-bit IDs.
|
||||
CONFIG_CAN1_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN1 is defined.
|
||||
CONFIG_CAN2_BAUD - CAN1 BAUD rate. Required if CONFIG_LPC17_CAN2 is defined.
|
||||
CONFIG_CAN1_DIVISOR - CAN1 is clocked at CCLK divided by this number.
|
||||
(the CCLK frequency is divided by this number to get the CAN clock).
|
||||
Options = {1,2,4,6}. Default: 4.
|
||||
CONFIG_CAN2_DIVISOR - CAN2 is clocked at CCLK divided by this number.
|
||||
(the CCLK frequency is divided by this number to get the CAN clock).
|
||||
Options = {1,2,4,6}. Default: 4.
|
||||
CONFIG_CAN_TSEG1 - The number of CAN time quanta in segment 1. Default: 6
|
||||
CONFIG_CAN_TSEG2 = the number of CAN time quanta in segment 2. Default: 7
|
||||
|
||||
LPC17xx specific PHY/Ethernet device driver settings. These setting
|
||||
also require CONFIG_NET and CONFIG_LPC17_ETHERNET.
|
||||
|
||||
CONFIG_PHY_KS8721 - Selects Micrel KS8721 PHY
|
||||
CONFIG_PHY_AUTONEG - Enable auto-negotion
|
||||
CONFIG_PHY_SPEED100 - Select 100Mbit vs. 10Mbit speed.
|
||||
CONFIG_PHY_FDUPLEX - Select full (vs. half) duplex
|
||||
|
||||
CONFIG_NET_EMACRAM_SIZE - Size of EMAC RAM. Default: 16Kb
|
||||
CONFIG_NET_NTXDESC - Configured number of Tx descriptors. Default: 18
|
||||
CONFIG_NET_NRXDESC - Configured number of Rx descriptors. Default: 18
|
||||
CONFIG_NET_PRIORITY - Ethernet interrupt priority. The is default is
|
||||
the higest priority.
|
||||
CONFIG_NET_WOL - Enable Wake-up on Lan (not fully implemented).
|
||||
CONFIG_NET_REGDEBUG - Enabled low level register debug. Also needs
|
||||
CONFIG_DEBUG.
|
||||
CONFIG_NET_DUMPPACKET - Dump all received and transmitted packets.
|
||||
Also needs CONFIG_DEBUG.
|
||||
CONFIG_NET_HASH - Enable receipt of near-perfect match frames.
|
||||
CONFIG_NET_MULTICAST - Enable receipt of multicast (and unicast) frames.
|
||||
Automatically set if CONFIG_NET_IGMP is selected.
|
||||
|
||||
LPC17xx USB Device Configuration
|
||||
|
||||
CONFIG_LPC17_USBDEV_FRAME_INTERRUPT
|
||||
Handle USB Start-Of-Frame events.
|
||||
Enable reading SOF from interrupt handler vs. simply reading on demand.
|
||||
Probably a bad idea... Unless there is some issue with sampling the SOF
|
||||
from hardware asynchronously.
|
||||
CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT
|
||||
Enable high priority interrupts. I have no idea why you might want to
|
||||
do that
|
||||
CONFIG_LPC17_USBDEV_NDMADESCRIPTORS
|
||||
Number of DMA descriptors to allocate in SRAM.
|
||||
CONFIG_LPC17_USBDEV_DMA
|
||||
Enable lpc17xx-specific DMA support
|
||||
CONFIG_LPC17_USBDEV_NOVBUS
|
||||
Define if the hardware implementation does not support the VBUS signal
|
||||
CONFIG_LPC17_USBDEV_NOLED
|
||||
Define if the hardware implementation does not support the LED output
|
||||
|
||||
LPC17xx USB Host Configuration (the ZKit-ARM does not support USB Host)
|
||||
|
||||
CONFIG_USBHOST_OHCIRAM_SIZE
|
||||
Total size of OHCI RAM (in AHB SRAM Bank 1)
|
||||
CONFIG_USBHOST_NEDS
|
||||
Number of endpoint descriptors
|
||||
CONFIG_USBHOST_NTDS
|
||||
Number of transfer descriptors
|
||||
CONFIG_USBHOST_TDBUFFERS
|
||||
Number of transfer descriptor buffers
|
||||
CONFIG_USBHOST_TDBUFSIZE
|
||||
Size of one transfer descriptor buffer
|
||||
CONFIG_USBHOST_IOBUFSIZE
|
||||
Size of one end-user I/O buffer. This can be zero if the
|
||||
application can guarantee that all end-user I/O buffers
|
||||
reside in AHB SRAM.
|
||||
|
||||
Configurations
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
Each ZKit-ARM configuration is maintained in a sudirectory and can be
|
||||
selected as follow:
|
||||
|
||||
cd tools
|
||||
./configure.sh zkit-arm-1769/<subdir>
|
||||
cd -
|
||||
. ./setenv.sh
|
||||
|
||||
Where <subdir> is one of the following:
|
||||
|
||||
hello:
|
||||
This builds an example application using apps/examples/hello. See
|
||||
apps/examples/README.txt for information about the examples.
|
||||
|
||||
thttpd:
|
||||
This builds the THTTPD web server example using the THTTPD and
|
||||
the apps/examples/thttpd application.
|
||||
|
||||
NOTE: You will need to build the NXFLAT toolchain as described
|
||||
above in order to use this example.
|
342
configs/zkit-arm-1769/include/board.h
Normal file
342
configs/zkit-arm-1769/include/board.h
Normal file
|
@ -0,0 +1,342 @@
|
|||
/************************************************************************************
|
||||
* configs/zkit-arm-1769/include/board.h
|
||||
* include/arch/board/board.h
|
||||
*
|
||||
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
|
||||
* Author: BabuSubashChandar <code@zilogic.com>
|
||||
*
|
||||
* Based on configs/lpcxpresso-lpc1768/include/board.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __CONFIGS_ZKIT_ARM_1769_INCLUDE_BOARD_H
|
||||
#define __CONFIGS_ZKIT_ARM_1769_INCLUDE_BOARD_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ)
|
||||
# include <nuttx/irq.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* 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_LP17_FLASH
|
||||
#define CONFIG_LP17_FLASH 1
|
||||
#define BOARD_FLASHCFG_VALUE 0x0000303a
|
||||
|
||||
/* Ethernet configuration */
|
||||
|
||||
//#define ETH_MCFG_CLKSEL_DIV ETH_MCFG_CLKSEL_DIV44
|
||||
#define ETH_MCFG_CLKSEL_DIV ETH_MCFG_CLKSEL_DIV20
|
||||
|
||||
/* LED definitions ******************************************************************/
|
||||
/* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in
|
||||
* any way. The following definitions are used to access individual LEDs.
|
||||
*
|
||||
* LED1 -- Connected to P0[19]
|
||||
* LED2 -- Connected to P0[21]
|
||||
*/
|
||||
|
||||
/* LED index values for use with lpc17_setled() */
|
||||
|
||||
#define BOARD_LED1 0
|
||||
#define BOARD_LED2 1
|
||||
#define BOARD_NLEDS 2
|
||||
|
||||
/* LED bits for use with lpc17_setleds() */
|
||||
|
||||
#define BOARD_LED1_BIT (1 << BOARD_LED1)
|
||||
#define BOARD_LED2_BIT (1 << BOARD_LED2)
|
||||
|
||||
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the 2 LEDs
|
||||
* on board the ZKIT-ARM-1769. The following definitions
|
||||
* describe how NuttX controls the LEDs:
|
||||
*/
|
||||
/* LED1 LED2 */
|
||||
#define LED_STARTED 0 /* OFF OFF = Still initializing */
|
||||
#define LED_HEAPALLOCATE 0 /* OFF OFF = Still initializing */
|
||||
#define LED_IRQSENABLED 0 /* OFF OFF = Still initializing */
|
||||
#define LED_STACKCREATED 1 /* ON OFF = Initialization complete */
|
||||
#define LED_INIRQ 2 /* N/C ON = In an interrupt handler */
|
||||
#define LED_SIGNAL 2 /* N/C ON = In a signal handler (glowing) */
|
||||
#define LED_ASSERTION 2 /* N/C ON = In an assertion */
|
||||
#define LED_PANIC 2 /* N/C ON = Oops! We crashed. (flashing) */
|
||||
#define LED_IDLE 3 /* OFF N/C = LPC17 in sleep mode (LED1 glowing) */
|
||||
|
||||
/* Button definitions ***************************************************************/
|
||||
/* The ZKIT-ARM-1769 supports several buttons. All will read "1" when open and "0"
|
||||
* when closed
|
||||
*
|
||||
* KEY1 -- Connected to P1[19]
|
||||
* KEY2 -- Connected to P1[27]
|
||||
* KEY3 -- Connected to P1[28]
|
||||
* KEY4 -- Connected to P1[31]
|
||||
* KEY5 -- Connected to P2[13]
|
||||
*
|
||||
*/
|
||||
#define BOARD_BUTTON_1 0
|
||||
#define BOARD_BUTTON_2 1
|
||||
#define BOARD_BUTTON_3 2
|
||||
#define BOARD_BUTTON_4 3
|
||||
#define BOARD_BUTTON_5 4
|
||||
#define BOARD_NUM_BUTTONS 5
|
||||
#define BOARD_BUTTON_BUTTON1_BIT (1 << BOARD_BUTTON_1)
|
||||
#define BOARD_BUTTON_BUTTON2_BIT (1 << BOARD_BUTTON_2)
|
||||
#define BOARD_BUTTON_BUTTON3_BIT (1 << BOARD_BUTTON_3)
|
||||
#define BOARD_BUTTON_BUTTON4_BIT (1 << BOARD_BUTTON_4)
|
||||
#define BOARD_BUTTON_BUTTON5_BIT (1 << BOARD_BUTTON_5)
|
||||
|
||||
/* Alternate pin selections *********************************************************/
|
||||
/* Pin Description On Board Connector
|
||||
* -------------------------------- ---------------- -------------
|
||||
* P0.0/RD1/TXD3/SDA1 RD1 AUX-CON
|
||||
* P0.1/TD1/RXD3/SCL1 TD1
|
||||
* P0.2/TXD0/AD0.7 TXD0 COM0
|
||||
* P0.3/RXD0/AD0.6 RXD0
|
||||
* P0.4/I2SRX_CLK/RD2/CAP2.0 GPIO0
|
||||
* P0.5/I2SRX_WS/TD2/CAP2.1 GPIO1
|
||||
* P0.6/I2SRX_SDA/SSEL1/MAT2.0 SSEL1 SPI
|
||||
* P0.7/I2STX_CLK/SCK1/MAT2.1 SCK1
|
||||
* P0.8/I2STX_WS/MISO1/MAT2.2 MISO1
|
||||
* P0.9/I2STX_SDA/MOSI1/MAT2.3 MOSI1
|
||||
* P0.10/TXD2/SDA2/MAT3.0 TXD2 AUX-CON
|
||||
* P0.11/RXD2/SCL2/MAT3.1 RXD2
|
||||
* P0.15/TXD1/SCK0/SCK SD-SCK
|
||||
* P0.16/RXD1/SSEL0/SSEL SD-SSEL SD-CARD
|
||||
* P0.17/CTS1/MISO0/MISO SD-MISO
|
||||
* P0.18/DCD1/M0SI0/MOSI SD-MOSI
|
||||
* P0.19/DSR1/SDA1 LED1
|
||||
* P0.20/DTR1/SCL1 DTR1 COM1
|
||||
* P0.21/RI1/RD1 N.C LED2
|
||||
* P0.22/RTS1/TD1 RTS1 COM1
|
||||
* P0.23/AD0.0/I2SRX_CLK/CAP3.0 AD0
|
||||
* P0.24/AD0.1/I2SRX_WS/CAP3.1 AD1 AIN
|
||||
* P0.25/AD0.2/I2SRX_SDA/TXD3 AD2
|
||||
* P0.26/AD0.3/AOUT/RXD3 AD3
|
||||
* P0.27/SDA0/USB_SDA SDA0 I2C0
|
||||
* P0.28/SCL0/USB_SCL SCL0
|
||||
* P0.29/USB_D+ USB-D+ USB
|
||||
* P0.30/USB_D- USB-D-
|
||||
*/
|
||||
|
||||
#define GPIO_CAN1_RD GPIO_CAN1_RD_1
|
||||
#define GPIO_CAN1_TD GPIO_CAN1_TD_1
|
||||
#define GPIO_I2C1_SDA GPIO_I2C0_SDA
|
||||
#define GPIO_I2C1_SCL GPIO_I2C0_SCL
|
||||
#define GPIO_SSP1_SCK GPIO_SSP1_SCK_1
|
||||
#define GPIO_UART2_TXD GPIO_UART2_TXD_1
|
||||
#define GPIO_UART2_RXD GPIO_UART2_RXD_1
|
||||
#define GPIO_UART1_TXD GPIO_UART1_TXD_2
|
||||
#define GPIO_UART1_RXD GPIO_UART1_RXD_2
|
||||
#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
|
||||
|
||||
/* P1.0/ENET_TXD0 ETH-TXD0
|
||||
* P1.1/ENET_TXD1 ETH-TXD1
|
||||
* P1.4/ENET_TX_EN ETH-TXEN
|
||||
* P1.8/ENET_CRS ETH-CRS
|
||||
* P1.9/ENET_RXD0 ETH-RXD0 ETH
|
||||
* P1.10/ENET_RXD1 ETH-RXD1
|
||||
* P1.14/ENET_RX_ER ETH-RXER
|
||||
* P1.15/ENET_REF_CLK ETH-REFCLK
|
||||
* P1.16/ENET_MDC ETH-MDC
|
||||
* P1.17/ENET_MDIO ETH-MDIO
|
||||
* P1.18/USB_UP_LED/PWM1.1/CAP1.0 USB-UP-LED
|
||||
* P1.19/MCOA0/nUSB_PPWR/CAP1.1 KEY1
|
||||
* P1.20/MCFB0/PWM1.2/SCK0 LCD-SCK
|
||||
* P1.21/MCABORT/PWM1.3/SSEL0 LCD-SSEL
|
||||
* P1.22/MCOB0/USB_PWRD/MAT1.0 LCD-A0 LCD
|
||||
* P1.23/MCFB1/PWM1.4/MISO0 NC
|
||||
* P1.24/MCFB2/PWM1.5/MOSI0 LCD_MOSI
|
||||
* P1.25/MCOA1/MAT1.1 LCD-RST
|
||||
* P1.26/MCOB1/PWM1.6/CAP0.0 LCD-AO
|
||||
* P1.27/CLKOUT/nUSB_OVRCR/CAP0.1 KEY2
|
||||
* P1.28/MCOA2/MAT0.0 KEY3
|
||||
* P1.29/MCOB2/PCAP1.1/MAT0.1 CAP1 PWM-CON
|
||||
* P1.30/VBUS/AD0.4 VBUS USB
|
||||
* P1.31/SCK1/AD0.5 KEY4
|
||||
*/
|
||||
|
||||
#define GPIO_ENET_MDC GPIO_ENET_MDC_1
|
||||
#define GPIO_ENET_MDIO GPIO_ENET_MDIO_1
|
||||
|
||||
/* P2.0/PWM1.1/TXD1 TXD1
|
||||
* P2.1/PWM1.2/RXD1 RXD1 COM1
|
||||
* P2.2/PWM1.3/CTS1/TRACEDATA3 CTS1
|
||||
* P2.3/PWM1.4/DCD1/TRACEDATA2 PWM4
|
||||
* P2.4/PWM1.5/DSR1/TRACEDATA1 PWM5 PWM
|
||||
* P2.5/PWM1.6/DTR1/TRACEDATA0 PWM6
|
||||
* P2.6/PCAP1.0/RI1/TRACECLK CAP0
|
||||
* P2.7/RD2/RTS1 RD2 RD2 CAN2
|
||||
* P2.8/TD2/TXD2 TD2 TD2
|
||||
* P2.9/USB_CONNECT/RXD2 USB_CONNECT USB
|
||||
* P2.10/nEINT0/NMI ISP
|
||||
* P2.11/nEINT1/I2STX_CLK INT1 I2C
|
||||
* P2.12/nEINT2/I2STX_WS SD-DET SD-CARD
|
||||
* P2.13/nEINT3/I2STX_SDA KEY5
|
||||
*/
|
||||
|
||||
#define GPIO_PWM1p2 GPIO_PWM1p2_3
|
||||
#define GPIO_PWM1p3 GPIO_PWM1p3_3
|
||||
#define GPIO_PWM1p4 GPIO_PWM1p4_2
|
||||
#define GPIO_PWM1p5 GPIO_PWM1p5_2
|
||||
#define GPIO_PWM1p6 GPIO_PWM1p6_2
|
||||
|
||||
/* P3.25/MAT0.0/PWM1.2 PWM2 PWM
|
||||
* P3.26/STCLK/MAT0.1/PWM1.3 PWM3
|
||||
*
|
||||
* P4.28/RX_MCLK/MAT2.0/TXD3 GPIO2 SPI
|
||||
* P4.28/RX_MCLK/MAT2.0/TXD3 GPIO3
|
||||
*/
|
||||
|
||||
/************************************************************************************
|
||||
* 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_ZKIT_ARM_1769_INCLUDE_BOARD_H */
|
97
configs/zkit-arm-1769/src/Makefile
Normal file
97
configs/zkit-arm-1769/src/Makefile
Normal file
|
@ -0,0 +1,97 @@
|
|||
############################################################################
|
||||
# configs/zkit-arm-1769/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2013 Zilogic Systems. All rights reserved.
|
||||
# Author: BabuSubashChandar <code@zilogic.com>
|
||||
#
|
||||
# Based on configs/lpcxpresso-lpc1768/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
CFLAGS += -I$(TOPDIR)/sched
|
||||
|
||||
ASRCS =
|
||||
CSRCS = up_boot.c up_leds.c up_ssp.c
|
||||
|
||||
ifeq ($(CONFIG_NSH_ARCHINIT),y)
|
||||
CSRCS += up_nsh.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USBMSC),y)
|
||||
CSRCS += up_usbmsc.c
|
||||
endif
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src
|
||||
ifeq ($(WINTOOL),y)
|
||||
CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \
|
||||
-I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \
|
||||
-I "${shell cygpath -w $(ARCH_SRCDIR)/armv7-m}"
|
||||
else
|
||||
CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/armv7-m
|
||||
endif
|
||||
|
||||
all: libboard$(LIBEXT)
|
||||
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
$(call ASSEMBLE, $<, $@)
|
||||
|
||||
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
|
||||
$(call COMPILE, $<, $@)
|
||||
|
||||
libboard$(LIBEXT): $(OBJS)
|
||||
@( for obj in $(OBJS) ; do \
|
||||
$(call ARCHIVE, $@, $${obj}); \
|
||||
done ; )
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm -f libboard$(LIBEXT) *~ .*.swp
|
||||
$(call CLEAN)
|
||||
|
||||
distclean: clean
|
||||
@rm -f Make.dep .depend
|
||||
|
||||
-include Make.dep
|
98
configs/zkit-arm-1769/src/up_boot.c
Normal file
98
configs/zkit-arm-1769/src/up_boot.c
Normal file
|
@ -0,0 +1,98 @@
|
|||
/************************************************************************************
|
||||
* configs/zkit-arm-1769/src/up_boot.c
|
||||
* arch/arm/src/board/up_boot.c
|
||||
*
|
||||
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
|
||||
* Author: BabuSubashChandar <code@zilogic.com>
|
||||
*
|
||||
* Based on configs/lpcxpresso-lpc1768/src/up_boot.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "lpc17_internal.h"
|
||||
#include "zkitarm_internal.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* 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 lpc17_sspinitialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1)
|
||||
if (lpc17_sspinitialize)
|
||||
{
|
||||
lpc17_sspinitialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
up_ledinit();
|
||||
#endif
|
||||
}
|
161
configs/zkit-arm-1769/src/up_leds.c
Normal file
161
configs/zkit-arm-1769/src/up_leds.c
Normal file
|
@ -0,0 +1,161 @@
|
|||
/****************************************************************************
|
||||
* configs/zkit-arm-1769/src/up_leds.c
|
||||
* arch/arm/src/board/up_leds.c
|
||||
*
|
||||
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
|
||||
* Author: BabuSubashChandar <code@zilogic.com>
|
||||
*
|
||||
* Based on configs/lpcxpresso-lpc1768/src/up_leds.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "lpc17_internal.h"
|
||||
#include "zkitarm_internal.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* CONFIG_DEBUG_LED enables debug output from this file (needs CONFIG_DEBUG
|
||||
* and pherhaps CONFIG_DEBUG_VERBOSE too)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DEBUG_LED
|
||||
# define leddbg lldbg
|
||||
# ifdef CONFIG_DEBUG_VERBOSE
|
||||
# define ledvdbg lldbg
|
||||
# else
|
||||
# define ledvdbg(x...)
|
||||
# endif
|
||||
#else
|
||||
# define leddbg(x...)
|
||||
# define ledvdbg(x...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static bool g_ncstate;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ledinit
|
||||
****************************************************************************/
|
||||
|
||||
void up_ledinit(void)
|
||||
{
|
||||
/* Configure all LED GPIO lines */
|
||||
|
||||
lpc17_configgpio(ZKITARM_LED1);
|
||||
lpc17_configgpio(ZKITARM_LED2);
|
||||
g_ncstate = true;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ledon
|
||||
****************************************************************************/
|
||||
|
||||
void up_ledon(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(ZKITARM_LED1, off);
|
||||
lpc17_gpiowrite(ZKITARM_LED2, off);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ledoff
|
||||
****************************************************************************/
|
||||
|
||||
void up_ledoff(int led)
|
||||
{
|
||||
bool off;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
off = false;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
off = g_ncstate;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
lpc17_gpiowrite(ZKITARM_LED1, off);
|
||||
lpc17_gpiowrite(ZKITARM_LED2, off);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
176
configs/zkit-arm-1769/src/up_nsh.c
Normal file
176
configs/zkit-arm-1769/src/up_nsh.c
Normal file
|
@ -0,0 +1,176 @@
|
|||
/****************************************************************************
|
||||
* config/zkit-arm-1769/src/up_nsh.c
|
||||
* arch/arm/src/board/up_nsh.c
|
||||
*
|
||||
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
|
||||
* Author: BabuSubashChandar <code@zilogic.com>
|
||||
*
|
||||
* Based on config/lpcxpresso-lpc1768/src/up_nsh.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi.h>
|
||||
#include <nuttx/mmcsd.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* PORT and SLOT number probably depend on the board configuration */
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_ZKITARM
|
||||
# define CONFIG_NSH_HAVEUSBDEV 1
|
||||
# ifdef CONFIG_LPC17_SSP0
|
||||
# define CONFIG_NSH_HAVEMMCSD 1
|
||||
# else
|
||||
# undef CONFIG_NSH_HAVEMMCSD
|
||||
# endif
|
||||
#else
|
||||
# error "Unrecognized board"
|
||||
# undef CONFIG_NSH_HAVEUSBDEV
|
||||
# undef CONFIG_NSH_HAVEMMCSD
|
||||
#endif
|
||||
|
||||
/* Do we have SPI support for MMC/SD? */
|
||||
|
||||
#ifdef CONFIG_NSH_HAVEMMCSD
|
||||
# if !defined(CONFIG_NSH_MMCSDSPIPORTNO) || CONFIG_NSH_MMCSDSPIPORTNO != 0
|
||||
# error "The ZKit-arm MMC/SD is on SSP0"
|
||||
# undef CONFIG_NSH_MMCSDSPIPORTNO
|
||||
# define CONFIG_NSH_MMCSDSPIPORTNO 0
|
||||
# endif
|
||||
# if !defined(CONFIG_NSH_MMCSDSLOTNO) || CONFIG_NSH_MMCSDSLOTNO != 0
|
||||
# error "The ZKit-arm MMC/SD has only one slot (0)"
|
||||
# undef CONFIG_NSH_MMCSDSLOTNO
|
||||
# define CONFIG_NSH_MMCSDSLOTNO 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Can't support USB device features if USB device is not enabled */
|
||||
|
||||
#ifndef CONFIG_USBDEV
|
||||
# undef CONFIG_NSH_HAVEUSBDEV
|
||||
#endif
|
||||
|
||||
/* Can't support MMC/SD features if mountpoints are disabled */
|
||||
|
||||
#if defined(CONFIG_DISABLE_MOUNTPOINT)
|
||||
# undef CONFIG_NSH_HAVEMMCSD
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NSH_MMCSDMINOR
|
||||
# define CONFIG_NSH_MMCSDMINOR 0
|
||||
#endif
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_lowprintf
|
||||
# else
|
||||
# define message printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_archinitialize
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture specific initialization
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nsh_archinitialize(void)
|
||||
{
|
||||
#ifdef CONFIG_NSH_HAVEMMCSD
|
||||
FAR struct spi_dev_s *ssp;
|
||||
int ret;
|
||||
|
||||
/* Get the SSP port */
|
||||
|
||||
ssp = up_spiinitialize(CONFIG_NSH_MMCSDSPIPORTNO);
|
||||
if (!ssp)
|
||||
{
|
||||
message("nsh_archinitialize: Failed to initialize SSP port %d\n",
|
||||
CONFIG_NSH_MMCSDSPIPORTNO);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
message("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)
|
||||
{
|
||||
message("nsh_archinitialize: Failed to bind SSP port %d to MMC/SD slot %d: %d\n",
|
||||
CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
message("Successfuly bound SSP port %d to MMC/SD slot %d\n",
|
||||
CONFIG_NSH_MMCSDSPIPORTNO, CONFIG_NSH_MMCSDSLOTNO);
|
||||
#endif
|
||||
return OK;
|
||||
}
|
214
configs/zkit-arm-1769/src/up_ssp.c
Normal file
214
configs/zkit-arm-1769/src/up_ssp.c
Normal file
|
@ -0,0 +1,214 @@
|
|||
/************************************************************************************
|
||||
* configs/zkit-arm-1769/src/up_ssp.c
|
||||
* arch/arm/src/board/up_ssp.c
|
||||
*
|
||||
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
|
||||
* Author: BabuSubashChandar <code@zilogic.com>
|
||||
*
|
||||
* Based on configs/lpcxpresso-lpc1768/src/up_ssp.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/spi.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "chip.h"
|
||||
#include "lpc17_internal.h"
|
||||
#include "zkitarm_internal.h"
|
||||
|
||||
#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1)
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* CONFIG_DEBUG_SPI enables debug output from this file (needs CONFIG_DEBUG too) */
|
||||
|
||||
#ifdef CONFIG_DEBUG_SPI
|
||||
# define sspdbg lldbg
|
||||
# ifdef CONFIG_DEBUG_VERBOSE
|
||||
# define sspvdbg lldbg
|
||||
# else
|
||||
# define sspvdbg(x...)
|
||||
# endif
|
||||
#else
|
||||
# define sspdbg(x...)
|
||||
# define sspvdbg(x...)
|
||||
#endif
|
||||
|
||||
/* Dump GPIO registers */
|
||||
|
||||
#if defined(CONFIG_DEBUG_SPI) && defined(CONFIG_DEBUG_VERBOSE)
|
||||
# define ssp_dumpgpio(m) lpc17_dumpgpio(SDCCS_GPIO, m)
|
||||
#else
|
||||
# define ssp_dumpgpio(m)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc17_sspinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins for the LM3S6965 Eval Kit.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function lpc17_sspinitialize(void)
|
||||
{
|
||||
/* Configure the SPI-based microSD CS GPIO */
|
||||
|
||||
ssp_dumpgpio("lpc17_sspinitialize() Entry)");
|
||||
|
||||
/* Configure card detect and chip select for the SD slot. NOTE: Jumper J55 must
|
||||
* be set correctly for the SD slot chip select.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LPC17_SSP0
|
||||
(void)lpc17_configgpio(ZKITARM_SD_CS);
|
||||
(void)lpc17_configgpio(ZKITARM_SD_CD);
|
||||
|
||||
/* Configure chip select for the OLED. For the SPI interface, insert jumpers in
|
||||
* J42, J43, J45 pin1-2 and J46 pin 1-2.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NX_LCDDRIVER
|
||||
(void)lpc17_configgpio(ZKITARM_OLED_CS);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ssp_dumpgpio("lpc17_sspinitialize() Exit");
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status
|
||||
*
|
||||
* Description:
|
||||
* The external functions, lpc17_ssp0/ssp1select and lpc17_ssp0/ssp1status
|
||||
* must be provided by board-specific logic. They are implementations of the select
|
||||
* and status methods of the SPI interface defined by struct spi_ops_s (see
|
||||
* include/nuttx/spi.h). All other methods (including up_spiinitialize())
|
||||
* 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 up_spiinitialize() in your low level application
|
||||
* initialization logic
|
||||
* 4. The handle returned by up_spiinitialize() 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_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_spi1select() Entry");
|
||||
|
||||
#warning "Assert CS here (false)"
|
||||
|
||||
ssp_dumpgpio("lpc17_spi1select() Exit");
|
||||
}
|
||||
|
||||
uint8_t lpc17_ssp1status(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_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_spi0select() Entry");
|
||||
|
||||
if (devid == SPIDEV_MMCSD)
|
||||
{
|
||||
/* Assert/de-assert the CS pin to the card */
|
||||
|
||||
(void)lpc17_gpiowrite(ZKITARM_SD_CS, !selected);
|
||||
}
|
||||
#ifdef CONFIG_NX_LCDDRIVER
|
||||
else if (devid == SPIDEV_DISPLAY)
|
||||
{
|
||||
/* Assert the CS pin to the OLED display */
|
||||
|
||||
(void)lpc17_gpiowrite(ZKITARM_OLED_CS, !selected);
|
||||
}
|
||||
#endif
|
||||
ssp_dumpgpio("lpc17_spi0select() Exit");
|
||||
}
|
||||
|
||||
uint8_t lpc17_ssp0status(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(ZKITARM_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 */
|
147
configs/zkit-arm-1769/src/up_usbmsc.c
Normal file
147
configs/zkit-arm-1769/src/up_usbmsc.c
Normal file
|
@ -0,0 +1,147 @@
|
|||
/****************************************************************************
|
||||
* configs/zkit-arm-1769/src/up_usbmsc.c
|
||||
*
|
||||
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
|
||||
* Author: BabuSubashChandar <code@zilogic.com>
|
||||
*
|
||||
* Based on configs/lpcxpresso-lpc1768/src/up_usbmsc.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi.h>
|
||||
#include <nuttx/mmcsd.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifndef CONFIG_EXAMPLES_USBMSC_DEVMINOR1
|
||||
# define CONFIG_EXAMPLES_USBMSC_DEVMINOR1 0
|
||||
#endif
|
||||
|
||||
/* PORT and SLOT number probably depend on the board configuration */
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_ZKITARM
|
||||
# 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
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lib_lowprintf(__VA_ARGS__)
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
# define msgflush() fflush(stdout)
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lib_lowprintf
|
||||
# define msgflush()
|
||||
# else
|
||||
# define message printf
|
||||
# define msgflush() fflush(stdout)
|
||||
# endif
|
||||
#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 */
|
||||
|
||||
message("usbmsc_archinitialize: Initializing SPI port %d\n",
|
||||
LPC17XX_MMCSDSPIPORTNO);
|
||||
|
||||
spi = up_spiinitialize(LPC17XX_MMCSDSPIPORTNO);
|
||||
if (!spi)
|
||||
{
|
||||
message("usbmsc_archinitialize: Failed to initialize SPI port %d\n",
|
||||
LPC17XX_MMCSDSPIPORTNO);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
message("usbmsc_archinitialize: Successfully initialized SPI port %d\n",
|
||||
LPC17XX_MMCSDSPIPORTNO);
|
||||
|
||||
/* Bind the SPI port to the slot */
|
||||
|
||||
message("usbmsc_archinitialize: Binding SPI port %d to MMC/SD slot %d\n",
|
||||
LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO);
|
||||
|
||||
ret = mmcsd_spislotinitialize(CONFIG_EXAMPLES_USBMSC_DEVMINOR1, LPC17XX_MMCSDSLOTNO, spi);
|
||||
if (ret < 0)
|
||||
{
|
||||
message("usbmsc_archinitialize: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
|
||||
LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
message("usbmsc_archinitialize: Successfuly bound SPI port %d to MMC/SD slot %d\n",
|
||||
LPC17XX_MMCSDSPIPORTNO, LPC17XX_MMCSDSLOTNO);
|
||||
return OK;
|
||||
}
|
236
configs/zkit-arm-1769/src/zkitarm_internal.h
Normal file
236
configs/zkit-arm-1769/src/zkitarm_internal.h
Normal file
|
@ -0,0 +1,236 @@
|
|||
/************************************************************************************
|
||||
* configs/zkit-arm-1769/src/zkitarm_internal.h
|
||||
* arch/arm/src/board/zkitarm_internal.n
|
||||
*
|
||||
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
|
||||
* Author: BabuSubashChandar <code@zilogic.com>
|
||||
*
|
||||
* Based on configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef _CONFIGS_ZKITARM_LPC1768_SRC_ZKITARM_INTERNAL_H
|
||||
#define _CONFIGS_ZKITARM_LPC1768_SRC_ZKITARM_INTERNAL_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
/************************************************************************************
|
||||
* ZKit-ARM-1769 Pin Usage
|
||||
************************************************************************************/
|
||||
/* Pin Description On Board Connector
|
||||
* -------------------------------- ---------------- -------------
|
||||
* P0.0/RD1/TXD3/SDA1 RD1 AUX-CON
|
||||
* P0.1/TD1/RXD3/SCL1 TD1
|
||||
* P0.2/TXD0/AD0.7 TXD0 COM0
|
||||
* P0.3/RXD0/AD0.6 RXD0
|
||||
* P0.4/I2SRX_CLK/RD2/CAP2.0 GPIO0
|
||||
* P0.5/I2SRX_WS/TD2/CAP2.1 GPIO1
|
||||
* P0.6/I2SRX_SDA/SSEL1/MAT2.0 SSEL1 SPI
|
||||
* P0.7/I2STX_CLK/SCK1/MAT2.1 SCK1
|
||||
* P0.8/I2STX_WS/MISO1/MAT2.2 MISO1
|
||||
* P0.9/I2STX_SDA/MOSI1/MAT2.3 MOSI1
|
||||
* P0.10/TXD2/SDA2/MAT3.0 TXD2 AUX-CON
|
||||
* P0.11/RXD2/SCL2/MAT3.1 RXD2
|
||||
* P0.15/TXD1/SCK0/SCK SD-SCK
|
||||
* P0.16/RXD1/SSEL0/SSEL SD-SSEL SD-CARD
|
||||
* P0.17/CTS1/MISO0/MISO SD-MISO
|
||||
* P0.18/DCD1/M0SI0/MOSI SD-MOSI
|
||||
* P0.19/DSR1/SDA1 LED1
|
||||
* P0.20/DTR1/SCL1 DTR1 COM1
|
||||
* P0.21/RI1/RD1 N.C LED2
|
||||
* P0.22/RTS1/TD1 RTS1 COM1
|
||||
* P0.23/AD0.0/I2SRX_CLK/CAP3.0 AD0
|
||||
* P0.24/AD0.1/I2SRX_WS/CAP3.1 AD1 AIN
|
||||
* P0.25/AD0.2/I2SRX_SDA/TXD3 AD2
|
||||
* P0.26/AD0.3/AOUT/RXD3 AD3
|
||||
* P0.27/SDA0/USB_SDA SDA0 I2C0
|
||||
* P0.28/SCL0/USB_SCL SCL0
|
||||
* P0.29/USB_D+ USB-D+ USB
|
||||
* P0.30/USB_D- USB-D-
|
||||
*
|
||||
* P1.0/ENET_TXD0 ETH-TXD0
|
||||
* P1.1/ENET_TXD1 ETH-TXD1
|
||||
* P1.4/ENET_TX_EN ETH-TXEN
|
||||
* P1.8/ENET_CRS ETH-CRS
|
||||
* P1.9/ENET_RXD0 ETH-RXD0 ETH
|
||||
* P1.10/ENET_RXD1 ETH-RXD1
|
||||
* P1.14/ENET_RX_ER ETH-RXER
|
||||
* P1.15/ENET_REF_CLK ETH-REFCLK
|
||||
* P1.16/ENET_MDC ETH-MDC
|
||||
* P1.17/ENET_MDIO ETH-MDIO
|
||||
* P1.18/USB_UP_LED/PWM1.1/CAP1.0 USB-UP-LED
|
||||
* P1.19/MCOA0/nUSB_PPWR/CAP1.1 KEY1
|
||||
* P1.20/MCFB0/PWM1.2/SCK0 LCD-SCK
|
||||
* P1.21/MCABORT/PWM1.3/SSEL0 LCD-SSEL
|
||||
* P1.22/MCOB0/USB_PWRD/MAT1.0 LCD-A0 LCD
|
||||
* P1.23/MCFB1/PWM1.4/MISO0 NC
|
||||
* P1.24/MCFB2/PWM1.5/MOSI0 LCD_MOSI
|
||||
* P1.25/MCOA1/MAT1.1 LCD-RST
|
||||
* P1.26/MCOB1/PWM1.6/CAP0.0 LCD-AO
|
||||
* P1.27/CLKOUT/nUSB_OVRCR/CAP0.1 KEY2
|
||||
* P1.28/MCOA2/MAT0.0 KEY3
|
||||
* P1.29/MCOB2/PCAP1.1/MAT0.1 CAP1 PWM-CON
|
||||
* P1.30/VBUS/AD0.4 VBUS USB
|
||||
* P1.31/SCK1/AD0.5 KEY4
|
||||
*
|
||||
* P2.0/PWM1.1/TXD1 TXD1
|
||||
* P2.1/PWM1.2/RXD1 RXD1 COM1
|
||||
* P2.2/PWM1.3/CTS1/TRACEDATA3 CTS1
|
||||
* P2.3/PWM1.4/DCD1/TRACEDATA2 PWM4
|
||||
* P2.4/PWM1.5/DSR1/TRACEDATA1 PWM5 PWM
|
||||
* P2.5/PWM1.6/DTR1/TRACEDATA0 PWM6
|
||||
* P2.6/PCAP1.0/RI1/TRACECLK CAP0
|
||||
* P2.7/RD2/RTS1 RD2 RD2 CAN2
|
||||
* P2.8/TD2/TXD2 TD2 TD2
|
||||
* P2.9/USB_CONNECT/RXD2 USB_CONNECT USB
|
||||
* P2.10/nEINT0/NMI ISP
|
||||
* P2.11/nEINT1/I2STX_CLK INT1 I2C
|
||||
* P2.12/nEINT2/I2STX_WS SD-DET SD-CARD
|
||||
* P2.13/nEINT3/I2STX_SDA KEY5
|
||||
*
|
||||
* P3.25/MAT0.0/PWM1.2 PWM2 PWM
|
||||
* P3.26/STCLK/MAT0.1/PWM1.3 PWM3
|
||||
*
|
||||
* P4.28/RX_MCLK/MAT2.0/TXD3 GPIO2 SPI
|
||||
* P4.28/RX_MCLK/MAT2.0/TXD3 GPIO3
|
||||
*/
|
||||
|
||||
#define ZKITARM_I2C1_EPROM_SDA GPIO_I2C1_SDA
|
||||
#define ZKITARM_I2C1_EPROM_SDL GPIO_I2C1_SCL
|
||||
|
||||
#define ZKITARM_LED1 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN19)
|
||||
#define ZKITARM_LED2 (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN21)
|
||||
|
||||
#define ZKITARM_KEY5 (GPIO_INTBOTH | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN13)
|
||||
|
||||
#define ZKITARM_KEY5_IRQ LPC17_IRQ_P2p13
|
||||
|
||||
/* SD Slot
|
||||
*
|
||||
* Board LPC1768
|
||||
* SD Signal Pin
|
||||
* --- ----------- ----------
|
||||
* CS SD-SSEL P0.16
|
||||
* DIN SD-MOSI P0.18 MOSI0
|
||||
* DOUT SD-MISO P0.17 MISO0
|
||||
* CLK SD-SCK P0.15 SCK0
|
||||
* CD SD-DET P2.12
|
||||
*/
|
||||
|
||||
#define ZKITARM_SD_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN16)
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
# define ZKITARM_SD_CD (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12)
|
||||
#else
|
||||
# define ZKITARM_SD_CD (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12)
|
||||
#endif
|
||||
|
||||
#define ZKITARM_SD_CDIRQ LPC17_IRQ_P2p12
|
||||
|
||||
/* USB:
|
||||
*
|
||||
* Board LPC1768
|
||||
* Signal Pin
|
||||
* ------------------- --------
|
||||
* USB_CONNECT P2.9 USB_CONNECT
|
||||
* USB_DM P0.29 USB_D-
|
||||
* USB_DP P0.30 USB_D+
|
||||
* USB_VBUS P1.30 USB_VBUS
|
||||
* USB_UPLED P1.18 USB_UPLED
|
||||
*
|
||||
*/
|
||||
|
||||
#define ZKITARM_USB_CONNECT (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT2 | GPIO_PIN9)
|
||||
#ifdef CONFIG_GPIO_IRQ
|
||||
# define ZKITARM_USB_VBUSSENSE (GPIO_INTBOTH | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30)
|
||||
#else
|
||||
# define ZKITARM_USB_VBUSSENSE (GPIO_INPUT | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30)
|
||||
#endif
|
||||
|
||||
/* 128x64 LCD with SPI interface
|
||||
* ---------------------------------------
|
||||
* The LCD display is connected to the SPI-bus.
|
||||
*
|
||||
* ZKit-ARM Signals
|
||||
*
|
||||
* ----------------------------+---------------+--------------------------------------------
|
||||
* LPC1758 Pin | Board Signal | Description
|
||||
* ----------------------------+---------------+--------------------------------------------
|
||||
* P1.20/MCFB0/PWM1.2/SCK0 | LCD-SCK | LCD Clock signal (D6)
|
||||
* P1.21/MCABORT/PWM1.3/SSEL0 | LCD-SSEL | LCD Chip Select (CSB)
|
||||
* P1.22/MCOB0/USB_PWRD/MAT1.0 | LCD-A0 | LCD-A0 (A0)
|
||||
* P1.23/MCFB1/PWM1.4/MISO0 | N.C |
|
||||
* P1.24/MCFB2/PWM1.5/MOSI0 | LCD-MOSI | LCD Data (D7)
|
||||
* P1.25/MCOA1/MAT1.1 | LCD-RST | LCD Reset (RSTB) - Resets Everything in LCD
|
||||
* ----------------------------+---------------+--------------------------------------------
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#define ZKITARM_OLED_POWER (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN1)
|
||||
#define ZKITARM_OLED_CS (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT0 | GPIO_PIN6)
|
||||
#define ZKITARM_OLED_DC (GPIO_OUTPUT | GPIO_VALUE_ZERO | GPIO_PORT2 | GPIO_PIN7)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public data
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: lpc17_sspinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins for the LPCXpresso board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function lpc17_sspinitialize(void);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* _CONFIGS_ZKITARM_LPC1768_SRC_ZKITARM_INTERNAL_H */
|
Loading…
Reference in a new issue