summaryrefslogtreecommitdiffstats
path: root/nuttx/arch
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2011-08-05 19:33:13 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2011-08-05 19:33:13 +0000
commitf81668c52d805c15c2ba75d9ac95551e60ea94b8 (patch)
treefbb26e9e98d595d4ecae4c372b920b29638b4fd6 /nuttx/arch
parentda38437ce438de291a1a4e8362b73234e329459a (diff)
Add directory structure to support the port to the Kinesis KwikStik-K40
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3845 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/arch')
-rw-r--r--nuttx/arch/arm/include/kinetis/irq.h107
-rwxr-xr-xnuttx/arch/arm/src/kinetis/Make.defs90
-rwxr-xr-xnuttx/arch/arm/src/kinetis/chip.h93
-rwxr-xr-xnuttx/arch/arm/src/kinetis/kinetis_internal.h447
-rwxr-xr-xnuttx/arch/arm/src/kinetis/kinetis_memorymap.h136
5 files changed, 873 insertions, 0 deletions
diff --git a/nuttx/arch/arm/include/kinetis/irq.h b/nuttx/arch/arm/include/kinetis/irq.h
new file mode 100644
index 0000000000..4561994052
--- /dev/null
+++ b/nuttx/arch/arm/include/kinetis/irq.h
@@ -0,0 +1,107 @@
+/************************************************************************************
+ * arch/arm/include/kinetis/irq.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * 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.
+ *
+ ************************************************************************************/
+
+/* This file should never be included directed but, rather, only indirectly through
+ * nuttx/irq.h
+ */
+
+#ifndef __ARCH_ARM_INCLUDE_KINETIS_IRQ_H
+#define __ARCH_ARM_INCLUDE_KINETIS_IRQ_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/irq.h>
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* IRQ numbers. The IRQ number corresponds vector number and hence map directly to
+ * bits in the NVIC. This does, however, waste several words of memory in the IRQ
+ * to handle mapping tables.
+ */
+
+/* Processor Exceptions (vectors 0-15) */
+
+#define KINETIS_IRQ_RESERVED (0) /* Reserved vector (only used with CONFIG_DEBUG) */
+ /* Vector 0: Reset stack pointer value */
+ /* Vector 1: Reset (not handler as an IRQ) */
+#define KINETIS_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */
+#define KINETIS_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */
+#define KINETIS_IRQ_MEMFAULT (4) /* Vector 4: Memory management (MPU) */
+#define KINETIS_IRQ_BUSFAULT (5) /* Vector 5: Bus fault */
+#define KINETIS_IRQ_USAGEFAULT (6) /* Vector 6: Usage fault */
+#define KINETIS_IRQ_SVCALL (11) /* Vector 11: SVC call */
+#define KINETIS_IRQ_DBGMONITOR (12) /* Vector 12: Debug Monitor */
+ /* Vector 13: Reserved */
+#define KINETIS_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */
+#define KINETIS_IRQ_SYSTICK (15) /* Vector 15: System tick */
+
+/* External interrupts (vectors >= 16) */
+
+#warning "Missing logic"
+#define NR_IRQS (16)
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+#ifdef __cplusplus
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#undef EXTERN
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#endif /* __ARCH_ARM_INCLUDE_KINETIS_IRQ_H */
+
diff --git a/nuttx/arch/arm/src/kinetis/Make.defs b/nuttx/arch/arm/src/kinetis/Make.defs
new file mode 100755
index 0000000000..3bf914308c
--- /dev/null
+++ b/nuttx/arch/arm/src/kinetis/Make.defs
@@ -0,0 +1,90 @@
+############################################################################
+# arch/arm/src/kinetis/Make.defs
+#
+# Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+#
+# 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 start-up, "head", file
+
+HEAD_ASRC = kinetis_vectors.S
+
+# Common ARM and Cortex-M3 files
+
+CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
+CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \
+ up_mdelay.c up_udelay.c up_exit.c up_initialize.c up_memfault.c \
+ up_initialstate.c up_interruptcontext.c up_modifyreg8.c \
+ up_modifyreg16.c up_modifyreg32.c up_releasepending.c \
+ up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c \
+ up_sigdeliver.c up_unblocktask.c up_usestack.c up_doirq.c \
+ up_hardfault.c up_svcall.c up_checkstack.c
+
+ifeq ($(CONFIG_NET),y)
+ifneq ($(CONFIG_KINETIS_ETHERNET),y)
+CMN_CSRCS += up_etherstub.c
+endif
+endif
+
+# Required Kinetis files
+
+CHIP_ASRCS =
+CHIP_CSRCS = kinetis_allocateheap.c kinetis_can.c kinetis_clockconfig.c \
+ kinetis_clrpend.c kinetis_gpio.c kinetis_idle.c kinetis_irq.c kinetis_lowputc.c \
+ kinetis_serial.c kinetis_spi.c kinetis_ssp.c kinetis_start.c kinetis_timerisr.c
+
+# Configuration-dependent Kinetis files
+
+ifeq ($(CONFIG_GPIO_IRQ),y)
+CHIP_CSRCS += kinetis_gpioint.c
+endif
+
+ifeq ($(CONFIG_DEBUG_GPIO),y)
+CHIP_CSRCS += kinetis_gpiodbg.c
+endif
+
+ifeq ($(CONFIG_USBDEV),y)
+CHIP_CSRCS += kinetis_usbdev.c
+endif
+
+ifeq ($(CONFIG_USBHOST),y)
+CHIP_CSRCS += kinetis_usbhost.c
+endif
+
+ifeq ($(CONFIG_KINETIS_GPDMA),y)
+CHIP_CSRCS += kinetis_gpdma.c
+endif
+
+ifeq ($(CONFIG_NET),y)
+ifeq ($(CONFIG_KINETIS_ETHERNET),y)
+CHIP_CSRCS += kinetis_ethernet.c
+endif
+endif
diff --git a/nuttx/arch/arm/src/kinetis/chip.h b/nuttx/arch/arm/src/kinetis/chip.h
new file mode 100755
index 0000000000..18ff0a00e6
--- /dev/null
+++ b/nuttx/arch/arm/src/kinetis/chip.h
@@ -0,0 +1,93 @@
+/************************************************************************************
+ * arch/arm/src/kinetis/chip.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_KINETIS_CHIP_H
+#define __ARCH_ARM_SRC_KINETIS_CHIP_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Get customizations for each supported chip */
+
+#if defined(CONFIG_ARCH_CHIP_K40X256VLQ100)
+# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */
+# define KINETIS_SRAM_SIZE (256*1024) /* 64Kb */
+# undef KINETIS_NETHCONTROLLERS /* No Ethernet controller */
+# undef KINETIS_NUSBHOST /* No USB host controller */
+# undef KINETIS_NUSBOTG /* No USB OTG controller */
+# define KINETIS_NUSBDEV 1 /* One USB device controller */
+# define KINETIS_NCAN 2 /* Two CAN controllers */
+# define KINETIS_NI2S 1 /* One I2S module */
+# define KINETIS_NDAC 1 /* One DAC module */
+#else
+# error "Unsupported Kinetis chip"
+#endif
+
+/* Include only the memory map. Other chip hardware files should then include this
+ * file for the proper setup
+ */
+
+#include "kinetis_memorymap.h"
+
+/* NVIC priority levels *************************************************************/
+/* Each priority field holds a priority value, 0-31. The lower the value, the greater
+ * the priority of the corresponding interrupt. The processor implements only
+ * bits[7:3] of each field, bits[2:0] read as zero and ignore writes.
+ */
+
+#define NVIC_SYSH_PRIORITY_MIN 0xf8 /* All bits[7:3] set is minimum priority */
+#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */
+#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_KINETIS_CHIP_H */
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_internal.h b/nuttx/arch/arm/src/kinetis/kinetis_internal.h
new file mode 100755
index 0000000000..a23a3c89a6
--- /dev/null
+++ b/nuttx/arch/arm/src/kinetis/kinetis_internal.h
@@ -0,0 +1,447 @@
+/************************************************************************************
+ * arch/arm/src/kinetis/kinetis_internal.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_KINETIS_KINETIS_INTERNAL_H
+#define __ARCH_ARM_SRC_KINETIS_KINETIS_INTERNAL_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <nuttx/compiler.h>
+
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "up_internal.h"
+#include "chip.h"
+
+/************************************************************************************
+ * Definitions
+ ************************************************************************************/
+
+/* Configuration ********************************************************************/
+
+/* Bit-encoded input to kinetis_configgpio() ******************************************/
+#warning "Missing logic"
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+typedef FAR void *DMA_HANDLE;
+typedef void (*dma_callback_t)(DMA_HANDLE handle, void *arg, int result);
+
+/* The following is used for sampling DMA registers when CONFIG DEBUG_DMA is selected */
+
+#ifdef CONFIG_DEBUG_DMA
+struct kinetis_dmaglobalregs_s
+{
+#warning "Missing logic"
+ /* Global Registers */
+};
+
+struct kinetis_dmachanregs_s
+{
+#warning "Missing logic"
+ /* Channel Registers */
+};
+
+struct kinetis_dmaregs_s
+{
+ /* Global Registers */
+
+ struct kinetis_dmaglobalregs_s gbl;
+
+ /* Channel Registers */
+
+ struct kinetis_dmachanregs_s ch;
+};
+#endif
+
+/************************************************************************************
+ * Inline Functions
+ ************************************************************************************/
+
+#ifndef __ASSEMBLY__
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+/************************************************************************************
+ * Name: kinetis_clockconfig
+ *
+ * Description:
+ * Called to initialize the KINETIS. This does whatever setup is needed to put the
+ * MCU in a usable state. This includes the initialization of clocking using the
+ * settings in board.h.
+ *
+ ************************************************************************************/
+
+EXTERN void kinetis_clockconfig(void);
+
+/************************************************************************************
+ * Name: kinetis_lowsetup
+ *
+ * Description:
+ * Called at the very beginning of _start. Performs low level initialization
+ * including setup of the console UART. This UART done early so that the serial
+ * console is available for debugging very early in the boot sequence.
+ *
+ ************************************************************************************/
+
+EXTERN void kinetis_lowsetup(void);
+
+/************************************************************************************
+ * Name: kinetis_gpioirqinitialize
+ *
+ * Description:
+ * Initialize logic to support a second level of interrupt decoding for GPIO pins.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_GPIO_IRQ
+EXTERN void kinetis_gpioirqinitialize(void);
+#else
+# define kinetis_gpioirqinitialize()
+#endif
+
+/************************************************************************************
+ * Name: kinetis_configgpio
+ *
+ * Description:
+ * Configure a GPIO pin based on bit-encoded description of the pin.
+ *
+ ************************************************************************************/
+
+EXTERN int kinetis_configgpio(uint16_t cfgset);
+
+/************************************************************************************
+ * Name: kinetis_gpiowrite
+ *
+ * Description:
+ * Write one or zero to the selected GPIO pin
+ *
+ ************************************************************************************/
+
+EXTERN void kinetis_gpiowrite(uint16_t pinset, bool value);
+
+/************************************************************************************
+ * Name: kinetis_gpioread
+ *
+ * Description:
+ * Read one or zero from the selected GPIO pin
+ *
+ ************************************************************************************/
+
+EXTERN bool kinetis_gpioread(uint16_t pinset);
+
+/************************************************************************************
+ * Name: kinetis_gpioirqenable
+ *
+ * Description:
+ * Enable the interrupt for specified GPIO IRQ
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_GPIO_IRQ
+EXTERN void kinetis_gpioirqenable(int irq);
+#else
+# define kinetis_gpioirqenable(irq)
+#endif
+
+/************************************************************************************
+ * Name: kinetis_gpioirqdisable
+ *
+ * Description:
+ * Disable the interrupt for specified GPIO IRQ
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_GPIO_IRQ
+EXTERN void kinetis_gpioirqdisable(int irq);
+#else
+# define kinetis_gpioirqdisable(irq)
+#endif
+
+/************************************************************************************
+ * Function: kinetis_dumpgpio
+ *
+ * Description:
+ * Dump all GPIO registers associated with the base address of the provided pinset.
+ *
+ ************************************************************************************/
+
+#ifdef CONFIG_DEBUG_GPIO
+EXTERN int kinetis_dumpgpio(uint16_t pinset, const char *msg);
+#else
+# define kinetis_dumpgpio(p,m)
+#endif
+
+/************************************************************************************
+ * Name: kinetis_clrpend
+ *
+ * Description:
+ * Clear a pending interrupt at the NVIC. This does not seem to be required
+ * for most interrupts.
+ *
+ ************************************************************************************/
+
+EXTERN void kinetis_clrpend(int irq);
+
+/************************************************************************************
+ * Name: kinetis_spi/ssp0/ssp1select, kinetis_spi/ssp0/ssp1status, and
+ * kinetis_spi/ssp0/ssp1cmddata
+ *
+ * Description:
+ * These external functions must be provided by board-specific logic. They are
+ * implementations of the select, status, and cmddata 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 Kinetis logic. To use
+ * this common SPI logic on your board:
+ *
+ * 1. Provide logic in kinetis_boardinitialize() to configure SPI/SSP chip select
+ * pins.
+ * 2. Provide kinetis_spi/ssp0/ssp1select() and kinetis_spi/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.
+ * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide
+ * kinetis_spi/ssp0/ssp1cmddata() functions in your board-specific logic. These
+ * functions will perform cmd/data selection operations using GPIOs in the way
+ * your board is configured.
+ * 3. Add a call 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).
+ *
+ ************************************************************************************/
+
+struct spi_dev_s;
+enum spi_dev_e;
+
+#ifdef CONFIG_KINETIS_SPI
+EXTERN void kinetis_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
+EXTERN uint8_t kinetis_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+#ifdef CONFIG_SPI_CMDDATA
+EXTERN int kinetis_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+#endif
+#endif
+#ifdef CONFIG_KINETIS_SSP0
+EXTERN void kinetis_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
+EXTERN uint8_t kinetis_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+#ifdef CONFIG_SPI_CMDDATA
+EXTERN int kinetis_ssp0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+#endif
+#endif
+#ifdef CONFIG_KINETIS_SSP1
+EXTERN void kinetis_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected);
+EXTERN uint8_t kinetis_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid);
+#ifdef CONFIG_SPI_CMDDATA
+EXTERN int kinetis_ssp1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd);
+#endif
+#endif
+
+/****************************************************************************
+ * Name: ssp_flush
+ *
+ * Description:
+ * Flush and discard any words left in the RX fifo. This can be called
+ * from ssp0/1select after a device is deselected (if you worry about such
+ * things).
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+struct spi_dev_s;
+#ifdef CONFIG_KINETIS_SPI
+EXTERN void spi_flush(FAR struct spi_dev_s *dev);
+#endif
+#if defined(CONFIG_KINETIS_SSP0) || defined(CONFIG_KINETIS_SSP1)
+EXTERN void ssp_flush(FAR struct spi_dev_s *dev);
+#endif
+
+/****************************************************************************
+ * Name: kinetis_dmainitialize
+ *
+ * Description:
+ * Initialize the GPDMA subsystem.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_GPDMA
+EXTERN void kinetis_dmainitilaize(void);
+#endif
+
+/****************************************************************************
+ * Name: kinetis_dmachannel
+ *
+ * Description:
+ * Allocate a DMA channel. This function sets aside a DMA channel and
+ * gives the caller exclusive access to the DMA channel.
+ *
+ * Returned Value:
+ * One success, this function returns a non-NULL, void* DMA channel
+ * handle. NULL is returned on any failure. This function can fail only
+ * if no DMA channel is available.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_GPDMA
+EXTERN DMA_HANDLE kinetis_dmachannel(void);
+#endif
+
+/****************************************************************************
+ * Name: kinetis_dmafree
+ *
+ * Description:
+ * Release a DMA channel. NOTE: The 'handle' used in this argument must
+ * NEVER be used again until kinetis_dmachannel() is called again to re-gain
+ * a valid handle.
+ *
+ * Returned Value:
+ * None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_GPDMA
+EXTERN void kinetis_dmafree(DMA_HANDLE handle);
+#endif
+
+/****************************************************************************
+ * Name: kinetis_dmasetup
+ *
+ * Description:
+ * Configure DMA for one transfer.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_GPDMA
+EXTERN int kinetis_dmarxsetup(DMA_HANDLE handle,
+ uint32_t control, uint32_t config,
+ uint32_t srcaddr, uint32_t destaddr,
+ size_t nbytes);
+#endif
+
+/****************************************************************************
+ * Name: kinetis_dmastart
+ *
+ * Description:
+ * Start the DMA transfer
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_GPDMA
+EXTERN int kinetis_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg);
+#endif
+
+/****************************************************************************
+ * Name: kinetis_dmastop
+ *
+ * Description:
+ * Cancel the DMA. After kinetis_dmastop() is called, the DMA channel is
+ * reset and kinetis_dmasetup() must be called before kinetis_dmastart() can be
+ * called again
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_GPDMA
+EXTERN void kinetis_dmastop(DMA_HANDLE handle);
+#endif
+
+/****************************************************************************
+ * Name: kinetis_dmasample
+ *
+ * Description:
+ * Sample DMA register contents
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_GPDMA
+#ifdef CONFIG_DEBUG_DMA
+EXTERN void kinetis_dmasample(DMA_HANDLE handle, struct kinetis_dmaregs_s *regs);
+#else
+# define kinetis_dmasample(handle,regs)
+#endif
+#endif
+
+/****************************************************************************
+ * Name: kinetis_dmadump
+ *
+ * Description:
+ * Dump previously sampled DMA register contents
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_GPDMA
+#ifdef CONFIG_DEBUG_DMA
+EXTERN void kinetis_dmadump(DMA_HANDLE handle, const struct kinetis_dmaregs_s *regs,
+ const char *msg);
+#else
+# define kinetis_dmadump(handle,regs,msg)
+#endif
+#endif
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ASSEMBLY__ */
+#endif /* __ARCH_ARM_SRC_KINETIS_KINETIS_INTERNAL_H */
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_memorymap.h b/nuttx/arch/arm/src/kinetis/kinetis_memorymap.h
new file mode 100755
index 0000000000..b8a81f1e4d
--- /dev/null
+++ b/nuttx/arch/arm/src/kinetis/kinetis_memorymap.h
@@ -0,0 +1,136 @@
+/************************************************************************************
+ * arch/arm/src/kinetis/kinetis_memorymap.h
+ *
+ * Copyright (C) 2010 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ************************************************************************************/
+
+#ifndef __ARCH_ARM_SRC_KINETIS_KINETIS_MEMORYMAP_H
+#define __ARCH_ARM_SRC_KINETIS_KINETIS_MEMORYMAP_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+
+#include "chip.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Memory Map ***********************************************************************/
+
+#define KINETIS_FLASH_BASE 0x00000000 /* -0x1fffffff: On-chip non-volatile memory */
+#define KINETIS_SRAM_BASE 0x10000000 /* -0x10007fff: On-chip SRAM (devices <=32Kb) */
+#define KINETIS_ROM_BASE 0x1fff0000 /* -0x1fffffff: 8Kb Boot ROM with flash services */
+#define KINETIS_AHBSRAM_BASE 0x20000000 /* -0x3fffffff: On-chip AHB SRAM (devices >32Kb) */
+# define KINETIS_SRAM_BANK0 0x2007c000 /* -0x2007ffff: On-chip AHB SRAM Bank0 (devices >=32Kb) */
+# define KINETIS_SRAM_BANK1 0x20080000 /* -0x2008ffff: On-chip AHB SRAM Bank1 (devices 64Kb) */
+#define KINETIS_GPIO_BASE 0x2009c000 /* -0x2009ffff: GPIO */
+#define KINETIS_APB_BASE 0x40000000 /* -0x5fffffff: APB Peripherals */
+# define KINETIS_APB0_BASE 0x40000000 /* -0x4007ffff: APB0 Peripherals */
+# define KINETIS_APB1_BASE 0x40080000 /* -0x400fffff: APB1 Peripherals */
+# define KINETIS_AHB_BASE 0x50000000 /* -0x501fffff: DMA Controller, Ethernet, and USB */
+#define KINETIS_CORTEXM3_BASE 0xe0000000 /* -0xe00fffff: (see cortexm3/nvic.h) */
+#define KINETIS_SCS_BASE 0xe000e000
+#define KINETIS_DEBUGMCU_BASE 0xe0042000
+
+/* AHB SRAM Bank sizes **************************************************************/
+
+#define KINETIS_BANK0_SIZE (16*1024) /* Size of AHB SRAM Bank0 (if present) */
+#define KINETIS_BANK1_SIZE (16*1024) /* Size of AHB SRAM Bank1 (if present) */
+
+/* APB0 Peripherals *****************************************************************/
+
+#define KINETIS_WDT_BASE 0x40000000 /* -0x40003fff: Watchdog timer */
+#define KINETIS_TMR0_BASE 0x40004000 /* -0x40007fff: Timer 0 */
+#define KINETIS_TMR1_BASE 0x40008000 /* -0x4000bfff: Timer 1 */
+#define KINETIS_UART0_BASE 0x4000c000 /* -0x4000ffff: UART 0 */
+#define KINETIS_UART1_BASE 0x40010000 /* -0x40013fff: UART 1 */
+ /* -0x40017fff: Reserved */
+#define KINETIS_PWM1_BASE 0x40018000 /* -0x4001bfff: PWM 1 */
+#define KINETIS_I2C0_BASE 0x4001c000 /* -0x4001ffff: I2C 0 */
+#define KINETIS_SPI_BASE 0x40020000 /* -0x40023fff: SPI */
+#define KINETIS_RTC_BASE 0x40024000 /* -0x40027fff: RTC + backup registers */
+#define KINETIS_GPIOINT_BASE 0x40028000 /* -0x4002bfff: GPIO interrupts */
+#define KINETIS_PINCONN_BASE 0x4002c000 /* -0x4002ffff: Pin connect block */
+#define KINETIS_SSP1_BASE 0x40030000 /* -0x40033fff: SSP 1 */
+#define KINETIS_ADC_BASE 0x40034000 /* -0x40037fff: ADC */
+#define KINETIS_CANAFRAM_BASE 0x40038000 /* -0x4003bfff: CAN acceptance filter (AF) RAM */
+#define KINETIS_CANAF_BASE 0x4003c000 /* -0x4003ffff: CAN acceptance filter (AF) registers */
+#define KINETIS_CAN_BASE 0x40040000 /* -0x40043fff: CAN common registers */
+#define KINETIS_CAN1_BASE 0x40044000 /* -0x40047fff: CAN controller l */
+#define KINETIS_CAN2_BASE 0x40048000 /* -0x4004bfff: CAN controller 2 */
+ /* -0x4005bfff: Reserved */
+#define KINETIS_I2C1_BASE 0x4005c000 /* -0x4005ffff: I2C 1 */
+ /* -0x4007ffff: Reserved */
+
+/* APB1 Peripherals *****************************************************************/
+
+ /* -0x40087fff: Reserved */
+#define KINETIS_SSP0_BASE 0x40088000 /* -0x4008bfff: SSP 0 */
+#define KINETIS_DAC_BASE 0x4008c000 /* -0x4008ffff: DAC */
+#define KINETIS_TMR2_BASE 0x40090000 /* -0x40093fff: Timer 2 */
+#define KINETIS_TMR3_BASE 0x40094000 /* -0x40097fff: Timer 3 */
+#define KINETIS_UART2_BASE 0x40098000 /* -0x4009bfff: UART 2 */
+#define KINETIS_UART3_BASE 0x4009c000 /* -0x4009ffff: UART 3 */
+#define KINETIS_I2C2_BASE 0x400a0000 /* -0x400a3fff: I2C 2 */
+ /* -0x400a7fff: Reserved */
+#define KINETIS_I2S_BASE 0x400a8000 /* -0x400abfff: I2S */
+ /* -0x400affff: Reserved */
+#define KINETIS_RIT_BASE 0x400b0000 /* -0x400b3fff: Repetitive interrupt timer */
+ /* -0x400b7fff: Reserved */
+#define KINETIS_MCPWM_BASE 0x400b8000 /* -0x400bbfff: Motor control PWM */
+#define KINETIS_QEI_BASE 0x400bc000 /* -0x400bffff: Quadrature encoder interface */
+ /* -0x400fbfff: Reserved */
+#define KINETIS_SYSCON_BASE 0x400fc000 /* -0x400fffff: System control */
+
+/* AHB Peripherals ******************************************************************/
+
+#define KINETIS_ETH_BASE 0x50000000 /* -0x50003fff: Ethernet controller */
+#define KINETIS_GPDMA_BASE 0x50004000 /* -0x50007fff: GPDMA controller */
+#define KINETIS_USB_BASE 0x5000c000 /* -0x5000cfff: USB controller */
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_KINETIS_KINETIS_MEMORYMAP_H */