Merged in david_s5/nuttx/upstream_kinetis (pull request #210)
Upstream kinetis Approved-by: Gregory Nutt
This commit is contained in:
commit
c8b8818bfe
@ -131,42 +131,56 @@ config ARCH_CHIP_MK64FN1M0VLL12
|
||||
select ARCH_FAMILY_K64
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
select KINETIS_HAVE_SPI1
|
||||
select KINETIS_HAVE_SPI2
|
||||
|
||||
config ARCH_CHIP_MK64FX512VLL12
|
||||
bool "MK64FX512VLL12"
|
||||
select ARCH_FAMILY_K64
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
select KINETIS_HAVE_SPI1
|
||||
select KINETIS_HAVE_SPI2
|
||||
|
||||
config ARCH_CHIP_MK64FX512VDC12
|
||||
bool "MK64FX512VDC12"
|
||||
select ARCH_FAMILY_K64
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
select KINETIS_HAVE_SPI1
|
||||
select KINETIS_HAVE_SPI2
|
||||
|
||||
config ARCH_CHIP_MK64FN1M0VDC12
|
||||
bool "MK64FN1M0VDC12"
|
||||
select ARCH_FAMILY_K64
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
select KINETIS_HAVE_SPI1
|
||||
select KINETIS_HAVE_SPI2
|
||||
|
||||
config ARCH_CHIP_MK64FX512VLQ12
|
||||
bool "MK64FX512VLQ12"
|
||||
select ARCH_FAMILY_K64
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
select KINETIS_HAVE_SPI1
|
||||
select KINETIS_HAVE_SPI2
|
||||
|
||||
config ARCH_CHIP_MK64FX512VMD12
|
||||
bool "MK64FX512VMD12"
|
||||
select ARCH_FAMILY_K64
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
select KINETIS_HAVE_SPI1
|
||||
select KINETIS_HAVE_SPI2
|
||||
|
||||
config ARCH_CHIP_MK64FN1M0VMD12
|
||||
bool "MK64FN1M0VMD12"
|
||||
select ARCH_FAMILY_K64
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
select KINETIS_HAVE_SPI1
|
||||
select KINETIS_HAVE_SPI2
|
||||
|
||||
config ARCH_CHIP_MK66FX1M0VMD18
|
||||
bool "MK66FX1M0VMD18"
|
||||
@ -174,7 +188,8 @@ config ARCH_CHIP_MK66FX1M0VMD18
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
select KINETIS_HAVE_I2C3
|
||||
select KINETIS_HAVE_I2C4
|
||||
select KINETIS_HAVE_SPI1
|
||||
select KINETIS_HAVE_SPI2
|
||||
|
||||
config ARCH_CHIP_MK66FN2M0VMD18
|
||||
bool "MK66FN2M0VMD18"
|
||||
@ -182,7 +197,8 @@ config ARCH_CHIP_MK66FN2M0VMD18
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
select KINETIS_HAVE_I2C3
|
||||
select KINETIS_HAVE_I2C4
|
||||
select KINETIS_HAVE_SPI1
|
||||
select KINETIS_HAVE_SPI2
|
||||
|
||||
config ARCH_CHIP_MK66FX1M0VLQ18
|
||||
bool "MK66FX1M0VLQ18"
|
||||
@ -190,7 +206,8 @@ config ARCH_CHIP_MK66FX1M0VLQ18
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
select KINETIS_HAVE_I2C3
|
||||
select KINETIS_HAVE_I2C4
|
||||
select KINETIS_HAVE_SPI1
|
||||
select KINETIS_HAVE_SPI2
|
||||
|
||||
config ARCH_CHIP_MK66FN2M0VLQ18
|
||||
bool "MK66FN2M0VLQ18"
|
||||
@ -198,7 +215,8 @@ config ARCH_CHIP_MK66FN2M0VLQ18
|
||||
select KINETIS_HAVE_I2C1
|
||||
select KINETIS_HAVE_I2C2
|
||||
select KINETIS_HAVE_I2C3
|
||||
select KINETIS_HAVE_I2C4
|
||||
select KINETIS_HAVE_SPI1
|
||||
select KINETIS_HAVE_SPI2
|
||||
|
||||
endchoice
|
||||
|
||||
@ -238,7 +256,11 @@ config KINETIS_HAVE_I2C3
|
||||
bool
|
||||
default n
|
||||
|
||||
config KINETIS_HAVE_I2C4
|
||||
config KINETIS_HAVE_SPI1
|
||||
bool
|
||||
default n
|
||||
|
||||
config KINETIS_HAVE_SPI2
|
||||
bool
|
||||
default n
|
||||
|
||||
@ -330,18 +352,23 @@ config KINETIS_FLEXCAN1
|
||||
config KINETIS_SPI0
|
||||
bool "SPI0"
|
||||
default n
|
||||
select SPI
|
||||
---help---
|
||||
Support SPI0
|
||||
|
||||
config KINETIS_SPI1
|
||||
bool "SPI1"
|
||||
default n
|
||||
select SPI
|
||||
depends on KINETIS_HAVE_SPI1
|
||||
---help---
|
||||
Support SPI1
|
||||
|
||||
config KINETIS_SPI2
|
||||
bool "SPI2"
|
||||
default n
|
||||
select SPI
|
||||
depends on KINETIS_HAVE_SPI2
|
||||
---help---
|
||||
Support SPI2
|
||||
|
||||
@ -366,7 +393,15 @@ config KINETIS_I2C2
|
||||
select I2C
|
||||
depends on KINETIS_HAVE_I2C2
|
||||
---help---
|
||||
Support I2C1
|
||||
Support I2C2
|
||||
|
||||
config KINETIS_I2C3
|
||||
bool "I2C3"
|
||||
default n
|
||||
select I2C
|
||||
depends on KINETIS_HAVE_I2C3
|
||||
---help---
|
||||
Support I2C3
|
||||
|
||||
config KINETIS_I2S
|
||||
bool "I2S"
|
||||
|
@ -52,6 +52,8 @@
|
||||
# include "chip/kinetis_k20k40k60fmc.h"
|
||||
#elif defined(KINETIS_K64)
|
||||
# include "chip/kinetis_k64fmc.h"
|
||||
#elif defined(KINETIS_K66)
|
||||
# include "chip/kinetis_k66fmc.h"
|
||||
#else
|
||||
# error "No FMC definitions for this Kinetis part"
|
||||
#endif
|
||||
|
364
arch/arm/src/kinetis/chip/kinetis_k66fmc.h
Normal file
364
arch/arm/src/kinetis/chip/kinetis_k66fmc.h
Normal file
@ -0,0 +1,364 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/kinetis/kinetis_k66fmc.h
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* 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_KINETIS_K66FMC_H
|
||||
#define __ARCH_ARM_SRC_KINETIS_CHIP_KINETIS_K66FMC_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "chip.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Register Offsets *****************************************************************/
|
||||
|
||||
#define KINETIS_FMC_PFAPR_OFFSET 0x0000 /* Flash Access Protection Register */
|
||||
#define KINETIS_FMC_PFB01CR_OFFSET 0x0004 /* Flash Bank 0-1 Control Register */
|
||||
#define KINETIS_FMC_PFB23CR_OFFSET 0x0008 /* Flash Bank 2-3 Control Register */
|
||||
|
||||
/* Cache Directory Storage for way=w and set=s, w=0..3, s=0..7 */
|
||||
|
||||
#define KINETIS_FMC_TAGVD_OFFSET(w,s) (0x100 + ((w) << 5) + ((s) << 2))
|
||||
|
||||
#define KINETIS_FMC_TAGVDW0S0_OFFSET 0x0100 /* Cache Directory Storage */
|
||||
#define KINETIS_FMC_TAGVDW0S1_OFFSET 0x0104 /* Cache Directory Storage */
|
||||
#define KINETIS_FMC_TAGVDW0S2_OFFSET 0x0108 /* Cache Directory Storage */
|
||||
#define KINETIS_FMC_TAGVDW0S3_OFFSET 0x010c /* Cache Directory Storage */
|
||||
|
||||
#define KINETIS_FMC_TAGVDW1S0_OFFSET 0x0110 /* Cache Directory Storage */
|
||||
#define KINETIS_FMC_TAGVDW1S1_OFFSET 0x0114 /* Cache Directory Storage */
|
||||
#define KINETIS_FMC_TAGVDW1S2_OFFSET 0x0118 /* Cache Directory Storage */
|
||||
#define KINETIS_FMC_TAGVDW1S3_OFFSET 0x011c /* Cache Directory Storage */
|
||||
|
||||
#define KINETIS_FMC_TAGVDW2S0_OFFSET 0x0120 /* Cache Directory Storage */
|
||||
#define KINETIS_FMC_TAGVDW2S1_OFFSET 0x0124 /* Cache Directory Storage */
|
||||
#define KINETIS_FMC_TAGVDW2S2_OFFSET 0x0128 /* Cache Directory Storage */
|
||||
#define KINETIS_FMC_TAGVDW2S3_OFFSET 0x012c /* Cache Directory Storage */
|
||||
|
||||
#define KINETIS_FMC_TAGVDW3S0_OFFSET 0x0130 /* Cache Directory Storage */
|
||||
#define KINETIS_FMC_TAGVDW3S1_OFFSET 0x0134 /* Cache Directory Storage */
|
||||
#define KINETIS_FMC_TAGVDW3S2_OFFSET 0x0138 /* Cache Directory Storage */
|
||||
#define KINETIS_FMC_TAGVDW3S3_OFFSET 0x013c /* Cache Directory Storage */
|
||||
|
||||
/* Cache Data Storage (UpperMost, MidUpper, MidLower LowerMost) for way=w and set=s, w=0..3, s=0..7 */
|
||||
|
||||
#define KINETIS_FMC_DATAUM_OFFSET(w,s) (0x200 + ((w) << 6) + ((s) << 2))
|
||||
#define KINETIS_FMC_DATAMU_OFFSET(w,s) (0x204 + ((w) << 6) + ((s) << 2))
|
||||
#define KINETIS_FMC_DATAML_OFFSET(w,s) (0x208 + ((w) << 6) + ((s) << 2))
|
||||
#define KINETIS_FMC_DATALM_OFFSET(w,s) (0x20c + ((w) << 6) + ((s) << 2))
|
||||
|
||||
#define KINETIS_FMC_DATAW0S0UM_OFFSET 0x0200 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW0S0MU_OFFSET 0x0204 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW0S0ML_OFFSET 0x0208 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW0S0LM_OFFSET 0x020c /* Cache Data Storage (lowermost word) */
|
||||
#define KINETIS_FMC_DATAW0S1UM_OFFSET 0x0210 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW0S1MU_OFFSET 0x0214 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW0S1ML_OFFSET 0x0218 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW0S1LM_OFFSET 0x021c /* Cache Data Storage (lowermost word) */
|
||||
|
||||
#define KINETIS_FMC_DATAW0S2UM_OFFSET 0x0220 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW0S2MU_OFFSET 0x0224 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW0S2ML_OFFSET 0x0228 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW0S2LM_OFFSET 0x022c /* Cache Data Storage (lowermost word) */
|
||||
#define KINETIS_FMC_DATAW0S3UM_OFFSET 0x0230 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW0S3MU_OFFSET 0x0234 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW0S3ML_OFFSET 0x0238 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW0S3LM_OFFSET 0x023c /* Cache Data Storage (lowermost word) */
|
||||
#define KINETIS_FMC_DATAW1S0UM_OFFSET 0x0240 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW1S0MU_OFFSET 0x0244 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW1S0ML_OFFSET 0x0248 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW1S0LM_OFFSET 0x024c /* Cache Data Storage (lowermost word) */
|
||||
#define KINETIS_FMC_DATAW1S1UM_OFFSET 0x0250 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW1S1MU_OFFSET 0x0254 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW1S1ML_OFFSET 0x0258 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW1S1LM_OFFSET 0x025c /* Cache Data Storage (lowermost word) */
|
||||
#define KINETIS_FMC_DATAW1S2UM_OFFSET 0x0260 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW1S2MU_OFFSET 0x0264 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW1S2ML_OFFSET 0x0268 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW1S2LM_OFFSET 0x026c /* Cache Data Storage (lowermost word) */
|
||||
#define KINETIS_FMC_DATAW1S3UM_OFFSET 0x0270 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW1S3MU_OFFSET 0x0274 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW1S3ML_OFFSET 0x0278 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW1S3LM_OFFSET 0x027c /* Cache Data Storage (lowermost word) */
|
||||
|
||||
#define KINETIS_FMC_DATAW2S0UM_OFFSET 0x0280 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW2S0MU_OFFSET 0x0284 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW2S0ML_OFFSET 0x0288 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW2S0LM_OFFSET 0x028c /* Cache Data Storage (lowermost word) */
|
||||
#define KINETIS_FMC_DATAW2S1UM_OFFSET 0x0290 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW2S1MU_OFFSET 0x0294 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW2S1ML_OFFSET 0x0298 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW2S1LM_OFFSET 0x029c /* Cache Data Storage (lowermost word) */
|
||||
#define KINETIS_FMC_DATAW2S2UM_OFFSET 0x02a0 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW2S2MU_OFFSET 0x02a4 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW2S2ML_OFFSET 0x02a8 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW2S2LM_OFFSET 0x02ac /* Cache Data Storage (lowermost word) */
|
||||
#define KINETIS_FMC_DATAW2S3UM_OFFSET 0x02b0 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW2S3MU_OFFSET 0x02b4 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW2S3ML_OFFSET 0x02b8 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW2S3LM_OFFSET 0x02bc /* Cache Data Storage (lowermost word) */
|
||||
|
||||
#define KINETIS_FMC_DATAW3S0UM_OFFSET 0x02c0 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW3S0MU_OFFSET 0x02c4 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW3S0ML_OFFSET 0x02c8 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW3S0LM_OFFSET 0x02cc /* Cache Data Storage (lowermost word) */
|
||||
#define KINETIS_FMC_DATAW3S1UM_OFFSET 0x02d0 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW3S1MU_OFFSET 0x02d4 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW3S1ML_OFFSET 0x02d8 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW3S1LM_OFFSET 0x02dc /* Cache Data Storage (lowermost word) */
|
||||
#define KINETIS_FMC_DATAW3S2UM_OFFSET 0x02e0 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW3S2MU_OFFSET 0x02e4 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW3S2ML_OFFSET 0x02e8 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW3S2LM_OFFSET 0x02ec /* Cache Data Storage (lowermost word) */
|
||||
#define KINETIS_FMC_DATAW3S3UM_OFFSET 0x02f0 /* Cache Data Storage (uppermost word) */
|
||||
#define KINETIS_FMC_DATAW3S3MU_OFFSET 0x02f4 /* Cache Data Storage (mid-upper word) */
|
||||
#define KINETIS_FMC_DATAW3S3ML_OFFSET 0x02f8 /* Cache Data Storage (mid-lower word) */
|
||||
#define KINETIS_FMC_DATAW3S3LM_OFFSET 0x02fc /* Cache Data Storage (lowermost word) */
|
||||
|
||||
/* Register Addresses ***************************************************************/
|
||||
|
||||
#define KINETIS_FMC_PFAPR (KINETIS_FMC_BASE+KINETIS_FMC_PFAPR_OFFSET)
|
||||
#define KINETIS_FMC_PFB01CR (KINETIS_FMC_BASE+KINETIS_FMC_PFB01CR_OFFSET)
|
||||
#define KINETIS_FMC_PFB23CR (KINETIS_FMC_BASE+KINETIS_FMC_PFB23CR_OFFSET)
|
||||
|
||||
/* Cache Directory Storage for way=w and set=s, w=0..3, s=0..7 */
|
||||
|
||||
#define KINETIS_FMC_TAGVD(w,s) (KINETIS_FMC_BASE+KINETIS_FMC_TAGVD_OFFSET(w,s))
|
||||
|
||||
#define KINETIS_FMC_TAGVDW0S0 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW0S0_OFFSET)
|
||||
#define KINETIS_FMC_TAGVDW0S1 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW0S1_OFFSET)
|
||||
#define KINETIS_FMC_TAGVDW0S2 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW0S2_OFFSET)
|
||||
#define KINETIS_FMC_TAGVDW0S3 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW0S3_OFFSET)
|
||||
|
||||
#define KINETIS_FMC_TAGVDW1S0 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW1S0_OFFSET)
|
||||
#define KINETIS_FMC_TAGVDW1S1 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW1S1_OFFSET)
|
||||
#define KINETIS_FMC_TAGVDW1S2 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW1S2_OFFSET)
|
||||
#define KINETIS_FMC_TAGVDW1S3 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW1S3_OFFSET)
|
||||
|
||||
#define KINETIS_FMC_TAGVDW2S0 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW2S0_OFFSET)
|
||||
#define KINETIS_FMC_TAGVDW2S1 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW2S1_OFFSET)
|
||||
#define KINETIS_FMC_TAGVDW2S2 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW2S2_OFFSET)
|
||||
#define KINETIS_FMC_TAGVDW2S3 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW2S3_OFFSET)
|
||||
|
||||
#define KINETIS_FMC_TAGVDW3S0 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW3S0_OFFSET)
|
||||
#define KINETIS_FMC_TAGVDW3S1 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW3S1_OFFSET)
|
||||
#define KINETIS_FMC_TAGVDW3S2 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW3S2_OFFSET)
|
||||
#define KINETIS_FMC_TAGVDW3S3 (KINETIS_FMC_BASE+KINETIS_FMC_TAGVDW3S3_OFFSET)
|
||||
|
||||
/* Cache Data Storage (UpperMost, MidUpper, MidLower LowerMost) for way=w and set=s, w=0..3, s=0..7 */
|
||||
|
||||
#define KINETIS_FMC_DATAUM(w,s) (KINETIS_FMC_BASE+KINETIS_FMC_DATAUM_OFFSET(w,s))
|
||||
#define KINETIS_FMC_DATAMU(w,s) (KINETIS_FMC_BASE+KINETIS_FMC_DATAMU_OFFSET(w,s))
|
||||
#define KINETIS_FMC_DATAML(w,s) (KINETIS_FMC_BASE+KINETIS_FMC_DATAML_OFFSET(w,s))
|
||||
#define KINETIS_FMC_DATALM(w,s) (KINETIS_FMC_BASE+KINETIS_FMC_DATALM_OFFSET(w,s))
|
||||
|
||||
#define KINETIS_FMC_DATAW0S0UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S0UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S0MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S0MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S0ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S0ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S0LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S0LM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S1UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S1UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S1MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S1MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S1ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S1ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S1LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S1LM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S2UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S2UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S2MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S2MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S2ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S2ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S2LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S2LM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S3UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S3UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S3MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S3MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S3ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S3ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW0S3LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW0S3LM_OFFSET)
|
||||
|
||||
#define KINETIS_FMC_DATAW1S0UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S0UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S0MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S0MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S0ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S0ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S0LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S0LM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S1UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S1UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S1MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S1MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S1ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S1ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S1LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S1LM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S2UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S2UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S2MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S2MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S2ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S2ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S2LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S2LM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S3UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S3UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S3MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S3MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S3ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S3ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW1S3LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW1S3LM_OFFSET)
|
||||
|
||||
#define KINETIS_FMC_DATAW2S0UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S0UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S0MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S0MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S0ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S0ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S0LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S0LM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S1UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S1UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S1MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S1MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S1ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S1ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S1LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S1LM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S2UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S2UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S2MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S2MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S2ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S2ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S2LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S2LM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S3UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S3UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S3MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S3MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S3ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S3ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW2S3LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW2S3LM_OFFSET)
|
||||
|
||||
#define KINETIS_FMC_DATAW3S0UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S0UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S0MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S0MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S0ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S0ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S0LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S0LM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S1UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S1UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S1MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S1MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S1ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S1ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S1LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S1LM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S2UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S2UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S2MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S2MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S2ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S2ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S2LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S2LM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S3UM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S3UM_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S3MU (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S3MU_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S3ML (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S3ML_OFFSET)
|
||||
#define KINETIS_FMC_DATAW3S3LM (KINETIS_FMC_BASE+KINETIS_FMC_DATAW3S3LM_OFFSET)
|
||||
|
||||
/* Register Bit Definitions *********************************************************/
|
||||
|
||||
/* Flash Access Protection Register */
|
||||
/* Access protection bits (all masters) */
|
||||
|
||||
#define FMC_PFAPR_NONE 0 /* No access may be performed by this master */
|
||||
#define FMC_PFAPR_RDONLY 1 /* Only read accesses may be performed by this master */
|
||||
#define FMC_PFAPR_WRONLY 2 /* Only write accesses may be performed by this master */
|
||||
#define FMC_PFAPR_RDWR 3 /* Both read and write accesses may be performed by this master */
|
||||
|
||||
#define FMC_PFAPR_M0AP_SHIFT (0) /* Bits 0-1: Master 0 Access Protection */
|
||||
#define FMC_PFAPR_M0AP_MASK (3 << FMC_PFAPR_M0AP_SHIFT)
|
||||
#define FMC_PFAPR_M1AP_SHIFT (2) /* Bits 2-3: Master 1 Access Protection */
|
||||
#define FMC_PFAPR_M1AP_MASK (3 << FMC_PFAPR_M1AP_SHIFT)
|
||||
#define FMC_PFAPR_M2AP_SHIFT (4) /* Bits 4-5: Master 2 Access Protection */
|
||||
#define FMC_PFAPR_M2AP_MASK (3 << FMC_PFAPR_M2AP_SHIFT)
|
||||
#define FMC_PFAPR_M3AP_SHIFT (6) /* Bits 6-7: Master 3 Access Protection */
|
||||
#define FMC_PFAPR_M3AP_MASK (3 << FMC_PFAPR_M3AP_SHIFT)
|
||||
#define FMC_PFAPR_M4AP_SHIFT (8) /* Bits 8-9: Master 4 Access Protection */
|
||||
#define FMC_PFAPR_M4AP_MASK (3 << FMC_PFAPR_M4AP_SHIFT)
|
||||
#define FMC_PFAPR_M5AP_SHIFT (10) /* Bits 10-11: Master 5 Access Protection */
|
||||
#define FMC_PFAPR_M5AP_MASK (3 << FMC_PFAPR_M5AP_SHIFT)
|
||||
#define FMC_PFAPR_M6AP_SHIFT (12) /* Bits 12-13: Master 6 Access Protection */
|
||||
#define FMC_PFAPR_M6AP_MASK (3 << FMC_PFAPR_M6AP_SHIFT)
|
||||
#define FMC_PFAPR_M7AP_SHIFT (14) /* Bits 14-15: Master 7 Access Protection */
|
||||
#define FMC_PFAPR_M7AP_MASK (3 << FMC_PFAPR_M7AP_SHIFT)
|
||||
#define FMC_PFAPR_M0PFD (1 << 16) /* Bit 16: Master 0 Prefetch Disable */
|
||||
#define FMC_PFAPR_M1PFD (1 << 17) /* Bit 17: Master 1 Prefetch Disable */
|
||||
#define FMC_PFAPR_M2PFD (1 << 18) /* Bit 18: Master 2 Prefetch Disable */
|
||||
#define FMC_PFAPR_M3PFD (1 << 19) /* Bit 19: Master 3 Prefetch Disable */
|
||||
#define FMC_PFAPR_M4PFD (1 << 20) /* Bit 20: Master 4 Prefetch Disable */
|
||||
#define FMC_PFAPR_M5PFD (1 << 21) /* Bit 21: Master 5 Prefetch Disable */
|
||||
#define FMC_PFAPR_M6PFD (1 << 22) /* Bit 22: Master 6 Prefetch Disable */
|
||||
#define FMC_PFAPR_M7PFD (1 << 23) /* Bit 23: Master 7 Prefetch Disable */
|
||||
/* Bits 24-31: Reserved */
|
||||
/* Flash Bank 0-1 Control Register */
|
||||
|
||||
#define FMC_PFB01CR_RFU (1 << 0) /* Bit 0: Reserved for future use */
|
||||
#define FMC_PFB01CR_B0IPE (1 << 1) /* Bit 1: Bank 0 Instruction Prefetch Enable */
|
||||
#define FMC_PFB01CR_B0DPE (1 << 2) /* Bit 2: Bank 0 Data Prefetch Enable */
|
||||
#define FMC_PFB01CR_B0ICE (1 << 3) /* Bit 3: Bank 0 Instruction Cache Enable */
|
||||
#define FMC_PFB01CR_B0DCE (1 << 4) /* Bit 4: Bank 0 Data Cache Enable */
|
||||
#define FMC_PFB01CR_CRC_SHIFT (5) /* Bits 5-7: Cache Replacement Control */
|
||||
#define FMC_PFB01CR_CRC_MASK (7 << FMC_PFB01CR_CRC_SHIFT)
|
||||
# define FMC_PFB01CR_CRC_ALL (0 << FMC_PFB01CR_CRC_SHIFT) /* LRU all four ways */
|
||||
# define FMC_PFB01CR_CRC_I01D23 (2 << FMC_PFB01CR_CRC_SHIFT) /* LRU ifetches 0-1 data 2-3 */
|
||||
# define FMC_PFB01CR_CRC_I012D3 (3 << FMC_PFB01CR_CRC_SHIFT) /* LRU ifetches 0-3 data 3 */
|
||||
/* Bits 8-16: Reserved */
|
||||
#define FMC_PFB01CR_B0MW_SHIFT (17) /* Bits 17-18: Bank 0 Memory Width */
|
||||
#define FMC_PFB01CR_B0MW_MASK (3 << FMC_PFB01CR_B0MW_SHIFT)
|
||||
# define FMC_PFB01CR_B0MW_32BITS (0 << FMC_PFB01CR_B0MW_SHIFT) /* 32 bits */
|
||||
# define FMC_PFB01CR_B0MW_64BITS (1 << FMC_PFB01CR_B0MW_SHIFT) /* 64 bits */
|
||||
# define FMC_PFB01CR_B0MW_128BITS (2 << FMC_PFB01CR_B0MW_SHIFT) /* 128 bits */
|
||||
#define FMC_PFB01CR_S_B_INV (1 << 19) /* Bit 19: Invalidate Prefetch Speculation Buffer */
|
||||
#define FMC_PFB01CR_CINV_WAY_SHIFT (20) /* Bits 20-23: Cache Invalidate Way x */
|
||||
#define FMC_PFB01CR_CINV_WAY_MASK (15 << FMC_PFB01CR_CINV_WAY_SHIFT)
|
||||
#define FMC_PFB01CR_CLCK_WAY_SHIFT (24) /* Bits 24-27: Cache Lock Way x */
|
||||
#define FMC_PFB01CR_CLCK_WAY_MASK (15 << FMC_PFB01CR_CLCK_WAY_SHIFT)
|
||||
#define FMC_PFB01CR_B0RWSC_SHIFT (28) /* Bits 28-31: Bank 0 Read Wait State Control */
|
||||
#define FMC_PFB01CR_B0RWSC_MASK (15 << FMC_PFB01CR_B0RWSC_SHIFT)
|
||||
|
||||
/* Flash Bank 2-3 Control Register */
|
||||
|
||||
#define FMC_PFB23CR_RFU (1 << 0) /* Bit 0: served for future use */
|
||||
#define FMC_PFB23CR_B1IPE (1 << 1) /* Bit 1: Bank 1 Instruction Prefetch Enable */
|
||||
#define FMC_PFB23CR_B1DPE (1 << 2) /* Bit 2: Bank 1 Data Prefetch Enable */
|
||||
#define FMC_PFB23CR_B1ICE (1 << 3) /* Bit 3: Bank 1 Instruction Cache Enable */
|
||||
#define FMC_PFB23CR_B1DCE (1 << 4) /* Bit 4: Bank 1 Data Cache Enable */
|
||||
/* Bits 5-16: Reserved */
|
||||
#define FMC_PFB23CR_B1MW_SHIFT (17) /* Bits 17-18: Bank 1 Memory Width */
|
||||
#define FMC_PFB23CR_B1MW_MASK (3 << FMC_PFB23CR_B1MW_SHIFT)
|
||||
# define FMC_PFB23CR_B1MW_32BITS (0 << FMC_PFB23CR_B1MW_SHIFT) /* 32 bits */
|
||||
# define FMC_PFB23CR_B1MW_64BITS (1 << FMC_PFB23CR_B1MW_SHIFT) /* 64 bits */
|
||||
# define FMC_PFB23CR_B1MW_128BITS (2 << FMC_PFB23CR_B1MW_SHIFT) /* 128 bits */
|
||||
/* Bits 19-27: Reserved */
|
||||
#define FMC_PFB23CR_B1RWSC_SHIFT (28) /* Bits 28-31: Bank 1 Read Wait State Control */
|
||||
#define FMC_PFB23CR_B1RWSC_MASK (15 << FMC_PFB23CR_B0RWSC_SHIFT)
|
||||
|
||||
/* Cache Directory Storage for way=w and set=s, w=0..3, s=0..7 */
|
||||
|
||||
#define FMC_TAGVD_VALID (1 << 0) /* Bit 0: 1-bit valid for cache entry */
|
||||
/* Bits 1-5: Reserved */
|
||||
#define FMC_TAGVD_TAG_SHIFT (6) /* Bits 6-21: 16-bit tag for cache entry */
|
||||
#define FMC_TAGVD_TAG_MASK (0xffff << FMC_TAGVD_TAG_SHIFT)
|
||||
/* Bits 19-31: Reserved */
|
||||
|
||||
/* Cache Data Storage (UpperMost, MidUpper, MidLower LowerMost) for way=w and set=s,
|
||||
* w=0..3, s=0..7 128-bit data in four 32-bit registers.
|
||||
*/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_KINETIS_CHIP_KINETIS_K66FMC_H */
|
@ -170,21 +170,21 @@
|
||||
/* Peripheral Bridge 1 Memory Map ***************************************************/
|
||||
|
||||
# define KINETIS_AIPS1_BASE 0x40080000 /* Peripheral bridge 1 (AIPS-Lite 1) */
|
||||
# define KINETIS_RNGB_BASE 0x400a0000 /* Random number generator (RNGB) */
|
||||
# define KINETIS_RNGA_ALT_BASE 0x400a0000 /* Alternate address Random number generator (RNGA) */
|
||||
# define KINETIS_USBHS_BASE 0x400a1000 /* USB OTG HS/FS/LS */
|
||||
# define KINETIS_USBHSPHY_BASE 0x400a2000 /* USBHS PHY */
|
||||
# define KINETIS_USBHSDCD_BASE 0x400a3000 /* USBHS DCD */
|
||||
# define KINETIS_CAN1_BASE 0x400a4000 /* FlexCAN 1 */
|
||||
# define KINETIS_SPI2_BASE 0x400ac000 /* DSPI 2 */
|
||||
# define KINETIS_SDHC_BASE 0x400b1000 /* eSDHC */
|
||||
/* define KINETIS_FTM2_BASE 0x400b8000 /* FlexTimer 2 */
|
||||
# define KINETIS_FTM2_ALT_BASE 0x400b8000 /* Alternate address FlexTimer 2 */
|
||||
# define KINETIS_FTM3_BASE 0x400b9000 /* FlexTimer 3 */
|
||||
# define KINETIS_ADC1_BASE 0x400bb000 /* Analog-to-digital converter (ADC) 1 */
|
||||
# define KINETIS_EMAC_BASE 0x400c0000 /* Ethernet MAC and IEEE 1588 timers */
|
||||
# define KINETIS_LPUART0_BASE 0x400c4000 /* LPUART0 */
|
||||
# define KINETIS_TPM1_BASE 0x400c9000 /* TPM1 */
|
||||
# define KINETIS_TPM2_BASE 0x400ca000 /* TPM2 */
|
||||
# define KINETIS_DAC0_BASE 0x400cc000 /* 12-bit digital-to-analog converter (DAC) 0 */
|
||||
# define KINETIS_DAC0_ALT_BASE 0x400cc000 /* Alternate address 12-bit digital-to-analog converter (DAC) 0 */
|
||||
# define KINETIS_DAC1_BASE 0x400cd000 /* 12-bit digital-to-analog converter (DAC) 1 */
|
||||
# define KINETIS_I2C2_BASE 0x400e6000 /* I2C 2 */
|
||||
# define KINETIS_I2C3_BASE 0x400e7000 /* I2C 3 */
|
||||
|
764
arch/arm/src/kinetis/chip/kinetis_k66pinmux.h
Normal file
764
arch/arm/src/kinetis/chip/kinetis_k66pinmux.h
Normal file
@ -0,0 +1,764 @@
|
||||
/********************************************************************************************
|
||||
* arch/arm/src/kinetis/chip/kinetis_k66pinmux.h
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* 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_CHP_KINETIS_K66PINMUX_H
|
||||
#define __ARCH_ARM_SRC_KINETIS_CHP_KINETIS_K66PINMUX_H
|
||||
|
||||
/********************************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "chip.h"
|
||||
|
||||
#ifdef KINETIS_K66
|
||||
|
||||
/********************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
********************************************************************************************/
|
||||
/* In most cases, there are alternative configurations for various pins. Those alternative
|
||||
* pins are labeled with a suffix like _1, _2, etc. in order to distinguish them. Logic in
|
||||
* the board.h file must select the correct pin configuration for the board by defining a pin
|
||||
* configuration (with no suffix) that maps to the correct alternative.
|
||||
*
|
||||
* WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!! WARNING!!!
|
||||
* Additional effort is required to select specific GPIO options such as frequency,
|
||||
* open-drain/push-pull, and pull-up/down! Just the basics are defined for most
|
||||
* pins in the initial version of this file.
|
||||
*/
|
||||
|
||||
/* ADC */
|
||||
|
||||
#define PIN_ADC0_SE4B (PIN_ANALOG | PIN_PORTC | PIN2)
|
||||
#define PIN_ADC0_SE5B (PIN_ANALOG | PIN_PORTD | PIN1)
|
||||
#define PIN_ADC0_SE6B (PIN_ANALOG | PIN_PORTD | PIN5)
|
||||
#define PIN_ADC0_SE7B (PIN_ANALOG | PIN_PORTD | PIN6)
|
||||
#define PIN_ADC0_SE8 (PIN_ANALOG | PIN_PORTB | PIN0)
|
||||
#define PIN_ADC0_SE9 (PIN_ANALOG | PIN_PORTB | PIN1)
|
||||
#define PIN_ADC0_SE10 (PIN_ANALOG | PIN_PORTA | PIN7)
|
||||
#define PIN_ADC0_SE11 (PIN_ANALOG | PIN_PORTA | PIN8)
|
||||
#define PIN_ADC0_SE12 (PIN_ANALOG | PIN_PORTB | PIN2)
|
||||
#define PIN_ADC0_SE13 (PIN_ANALOG | PIN_PORTB | PIN3)
|
||||
#define PIN_ADC0_SE14 (PIN_ANALOG | PIN_PORTC | PIN0)
|
||||
#define PIN_ADC0_SE15 (PIN_ANALOG | PIN_PORTC | PIN1)
|
||||
#define PIN_ADC0_SE17 (PIN_ANALOG | PIN_PORTE | PIN24)
|
||||
#define PIN_ADC0_SE18 (PIN_ANALOG | PIN_PORTE | PIN25)
|
||||
|
||||
#define PIN_ADC1_SE4A (PIN_ANALOG | PIN_PORTE | PIN0)
|
||||
#define PIN_ADC1_SE4B (PIN_ANALOG | PIN_PORTC | PIN8)
|
||||
#define PIN_ADC1_SE5A (PIN_ANALOG | PIN_PORTE | PIN1)
|
||||
#define PIN_ADC1_SE5B (PIN_ANALOG | PIN_PORTC | PIN9)
|
||||
#define PIN_ADC1_SE6A (PIN_ANALOG | PIN_PORTE | PIN2)
|
||||
#define PIN_ADC1_SE6B (PIN_ANALOG | PIN_PORTC | PIN10)
|
||||
#define PIN_ADC1_SE7A (PIN_ANALOG | PIN_PORTE | PIN3)
|
||||
#define PIN_ADC1_SE7B (PIN_ANALOG | PIN_PORTC | PIN11)
|
||||
#define PIN_ADC1_SE8 (PIN_ANALOG | PIN_PORTB | PIN0)
|
||||
#define PIN_ADC1_SE9 (PIN_ANALOG | PIN_PORTB | PIN1)
|
||||
#define PIN_ADC1_SE10 (PIN_ANALOG | PIN_PORTB | PIN4)
|
||||
#define PIN_ADC1_SE11 (PIN_ANALOG | PIN_PORTB | PIN5)
|
||||
#define PIN_ADC1_SE12 (PIN_ANALOG | PIN_PORTB | PIN6)
|
||||
#define PIN_ADC1_SE13 (PIN_ANALOG | PIN_PORTB | PIN7)
|
||||
#define PIN_ADC1_SE14 (PIN_ANALOG | PIN_PORTB | PIN10)
|
||||
#define PIN_ADC1_SE15 (PIN_ANALOG | PIN_PORTB | PIN11)
|
||||
#define PIN_ADC1_SE17 (PIN_ANALOG | PIN_PORTA | PIN17)
|
||||
|
||||
/* CAN */
|
||||
|
||||
#define PIN_CAN0_RX_1 (PIN_ALT2 | PIN_PORTA | PIN13)
|
||||
#define PIN_CAN0_RX_2 (PIN_ALT2 | PIN_PORTB | PIN19)
|
||||
#define PIN_CAN0_TX_1 (PIN_ALT2 | PIN_PORTA | PIN12)
|
||||
#define PIN_CAN0_TX_2 (PIN_ALT2 | PIN_PORTB | PIN18)
|
||||
|
||||
#define PIN_CAN1_TX_1 (PIN_ALT2 | PIN_PORTE | PIN24)
|
||||
#define PIN_CAN1_TX_2 (PIN_ALT2 | PIN_PORTC | PIN17)
|
||||
#define PIN_CAN1_RX_1 (PIN_ALT2 | PIN_PORTE | PIN25)
|
||||
#define PIN_CAN1_RX_2 (PIN_ALT2 | PIN_PORTC | PIN16)
|
||||
|
||||
/* Output clock */
|
||||
|
||||
#define PIN_CLKOUT_1 (PIN_ALT5 | PIN_PORTA | PIN6)
|
||||
#define PIN_CLKOUT_2 (PIN_ALT5 | PIN_PORTC | PIN3)
|
||||
|
||||
/* Comparators */
|
||||
|
||||
#define PIN_CMP0_IN0 (PIN_ANALOG | PIN_PORTC | PIN6)
|
||||
#define PIN_CMP0_IN1 (PIN_ANALOG | PIN_PORTC | PIN7)
|
||||
#define PIN_CMP0_IN2 (PIN_ANALOG | PIN_PORTC | PIN8)
|
||||
#define PIN_CMP0_IN3 (PIN_ANALOG | PIN_PORTC | PIN9)
|
||||
#define PIN_CMP0_OUT_1 (PIN_ALT6 | PIN_PORTB | PIN20)
|
||||
#define PIN_CMP0_OUT_2 (PIN_ALT6 | PIN_PORTC | PIN5)
|
||||
|
||||
#define PIN_CMP1_IN0 (PIN_ANALOG | PIN_PORTC | PIN2)
|
||||
#define PIN_CMP1_IN1 (PIN_ANALOG | PIN_PORTC | PIN3)
|
||||
#define PIN_CMP1_OUT_1 (PIN_ALT6 | PIN_PORTB | PIN21)
|
||||
#define PIN_CMP1_OUT_2 (PIN_ALT6 | PIN_PORTC | PIN4)
|
||||
|
||||
#define PIN_CMP2_IN0 (PIN_ANALOG | PIN_PORTA | PIN12)
|
||||
#define PIN_CMP2_IN1 (PIN_ANALOG | PIN_PORTA | PIN13)
|
||||
#define PIN_CMP2_OUT_1 (PIN_ALT5 | PIN_PORTA | PIN5)
|
||||
#define PIN_CMP2_OUT_2 (PIN_ALT6 | PIN_PORTB | PIN22)
|
||||
|
||||
#define PIN_CMP3_IN1 (PIN_ANALOG | PIN_PORTA | PIN15)
|
||||
#define PIN_CMP3_IN2 (PIN_ANALOG | PIN_PORTA | PIN16)
|
||||
#define PIN_CMP3_IN4 (PIN_ANALOG | PIN_PORTA | PIN24)
|
||||
#define PIN_CMP3_IN5 (PIN_ANALOG | PIN_PORTA | PIN25)
|
||||
#define PIN_CMP3_OUT_1 (PIN_ALT6 | PIN_PORTB | PIN23)
|
||||
|
||||
/* Carrier Modulator Transmittor (CMT) */
|
||||
|
||||
#define PIN_CMT_IRO (PIN_ALT2 | PIN_PORTD | PIN7)
|
||||
|
||||
/* Ethernet */
|
||||
|
||||
#define PIN_ENET_1588_CLKIN (PIN_ALT2 | PIN_PORTE | PIN26)
|
||||
#define PIN_ENET0_1588_TMR0_1 (PIN_ALT4 | PIN_PORTB | PIN2)
|
||||
#define PIN_ENET0_1588_TMR0_2 (PIN_ALT4 | PIN_PORTC | PIN16)
|
||||
#define PIN_ENET0_1588_TMR1_1 (PIN_ALT4 | PIN_PORTB | PIN3)
|
||||
#define PIN_ENET0_1588_TMR1_2 (PIN_ALT4 | PIN_PORTC | PIN17)
|
||||
#define PIN_ENET0_1588_TMR2_1 (PIN_ALT4 | PIN_PORTB | PIN4)
|
||||
#define PIN_ENET0_1588_TMR2_2 (PIN_ALT4 | PIN_PORTC | PIN18)
|
||||
#define PIN_ENET0_1588_TMR3_1 (PIN_ALT4 | PIN_PORTB | PIN5)
|
||||
#define PIN_ENET0_1588_TMR3_2 (PIN_ALT4 | PIN_PORTC | PIN19)
|
||||
|
||||
/* External Watchdog Monitor (EWM) */
|
||||
|
||||
#define PIN_EWM_IN_1 (PIN_ALT6 | PIN_PORTB | PIN16)
|
||||
#define PIN_EWM_IN_2 (PIN_ALT6 | PIN_PORTD | PIN4)
|
||||
#define PIN_EWM_IN_3 (PIN_ALT6 | PIN_PORTE | PIN25)
|
||||
#define PIN_EWM_OUT_1 (PIN_ALT6 | PIN_PORTB | PIN17)
|
||||
#define PIN_EWM_OUT_2 (PIN_ALT6 | PIN_PORTD | PIN5)
|
||||
#define PIN_EWM_OUT_3 (PIN_ALT6 | PIN_PORTE | PIN24)
|
||||
|
||||
/* FlexBus */
|
||||
|
||||
#define PIN_FB_A16 (PIN_ALT6 | PIN_PORTD | PIN8)
|
||||
#define PIN_FB_A17 (PIN_ALT6 | PIN_PORTD | PIN9)
|
||||
#define PIN_FB_A18 (PIN_ALT6 | PIN_PORTD | PIN10)
|
||||
#define PIN_FB_A19 (PIN_ALT6 | PIN_PORTD | PIN11)
|
||||
#define PIN_FB_A20 (PIN_ALT6 | PIN_PORTD | PIN12)
|
||||
#define PIN_FB_A21 (PIN_ALT6 | PIN_PORTD | PIN13)
|
||||
#define PIN_FB_A22 (PIN_ALT6 | PIN_PORTD | PIN14)
|
||||
#define PIN_FB_A23 (PIN_ALT6 | PIN_PORTD | PIN15)
|
||||
#define PIN_FB_A24 (PIN_ALT6 | PIN_PORTA | PIN29)
|
||||
#define PIN_FB_A25 (PIN_ALT6 | PIN_PORTA | PIN28)
|
||||
#define PIN_FB_A26 (PIN_ALT6 | PIN_PORTA | PIN27)
|
||||
#define PIN_FB_A27 (PIN_ALT6 | PIN_PORTA | PIN26)
|
||||
#define PIN_FB_A28 (PIN_ALT6 | PIN_PORTA | PIN25)
|
||||
#define PIN_FB_A29 (PIN_ALT6 | PIN_PORTA | PIN24)
|
||||
#define PIN_FB_AD0 (PIN_ALT5 | PIN_PORTD | PIN6)
|
||||
#define PIN_FB_AD1 (PIN_ALT5 | PIN_PORTD | PIN5)
|
||||
#define PIN_FB_AD2 (PIN_ALT5 | PIN_PORTD | PIN4)
|
||||
#define PIN_FB_AD3 (PIN_ALT5 | PIN_PORTD | PIN3)
|
||||
#define PIN_FB_AD4 (PIN_ALT5 | PIN_PORTD | PIN2)
|
||||
#define PIN_FB_AD5 (PIN_ALT5 | PIN_PORTC | PIN10)
|
||||
#define PIN_FB_AD6 (PIN_ALT5 | PIN_PORTC | PIN9)
|
||||
#define PIN_FB_AD7 (PIN_ALT5 | PIN_PORTC | PIN8)
|
||||
#define PIN_FB_AD8 (PIN_ALT5 | PIN_PORTC | PIN7)
|
||||
#define PIN_FB_AD9 (PIN_ALT5 | PIN_PORTC | PIN6)
|
||||
#define PIN_FB_AD10 (PIN_ALT5 | PIN_PORTC | PIN5)
|
||||
#define PIN_FB_AD11 (PIN_ALT5 | PIN_PORTC | PIN4)
|
||||
#define PIN_FB_AD12 (PIN_ALT5 | PIN_PORTC | PIN2)
|
||||
#define PIN_FB_AD13 (PIN_ALT5 | PIN_PORTC | PIN1)
|
||||
#define PIN_FB_AD14 (PIN_ALT5 | PIN_PORTC | PIN0)
|
||||
#define PIN_FB_AD15 (PIN_ALT5 | PIN_PORTB | PIN18)
|
||||
#define PIN_FB_AD16 (PIN_ALT5 | PIN_PORTB | PIN17)
|
||||
#define PIN_FB_AD17 (PIN_ALT5 | PIN_PORTB | PIN16)
|
||||
#define PIN_FB_AD18 (PIN_ALT5 | PIN_PORTB | PIN11)
|
||||
#define PIN_FB_AD19 (PIN_ALT5 | PIN_PORTB | PIN10)
|
||||
#define PIN_FB_AD20 (PIN_ALT5 | PIN_PORTB | PIN9)
|
||||
#define PIN_FB_AD21 (PIN_ALT5 | PIN_PORTB | PIN8)
|
||||
#define PIN_FB_AD22 (PIN_ALT5 | PIN_PORTB | PIN7)
|
||||
#define PIN_FB_AD23 (PIN_ALT5 | PIN_PORTB | PIN6)
|
||||
#define PIN_FB_AD24 (PIN_ALT5 | PIN_PORTC | PIN15)
|
||||
#define PIN_FB_AD25 (PIN_ALT5 | PIN_PORTC | PIN14)
|
||||
#define PIN_FB_AD26 (PIN_ALT5 | PIN_PORTC | PIN13)
|
||||
#define PIN_FB_AD27 (PIN_ALT5 | PIN_PORTC | PIN12)
|
||||
#define PIN_FB_AD28 (PIN_ALT5 | PIN_PORTB | PIN23)
|
||||
#define PIN_FB_AD29 (PIN_ALT5 | PIN_PORTB | PIN22)
|
||||
#define PIN_FB_AD30 (PIN_ALT5 | PIN_PORTB | PIN21)
|
||||
#define PIN_FB_AD31 (PIN_ALT5 | PIN_PORTB | PIN20)
|
||||
#define PIN_FB_ALE (PIN_ALT5 | PIN_PORTD | PIN0)
|
||||
#define PIN_FB_BE15_8_BLS23_16 (PIN_ALT5 | PIN_PORTC | PIN18)
|
||||
#define PIN_FB_BE23_16_BLS15_8 (PIN_ALT5 | PIN_PORTC | PIN16)
|
||||
#define PIN_FB_BE31_24_BLS7_0 (PIN_ALT5 | PIN_PORTC | PIN17)
|
||||
#define PIN_FB_BE7_0_BLS31_24 (PIN_ALT5 | PIN_PORTC | PIN19)
|
||||
#define PIN_FB_CS0 (PIN_ALT5 | PIN_PORTD | PIN1)
|
||||
#define PIN_FB_CS1 (PIN_ALT5 | PIN_PORTD | PIN0)
|
||||
#define PIN_FB_CS2 (PIN_ALT5 | PIN_PORTC | PIN18)
|
||||
#define PIN_FB_CS3 (PIN_ALT5 | PIN_PORTC | PIN19)
|
||||
#define PIN_FB_CS4 (PIN_ALT5 | PIN_PORTC | PIN17)
|
||||
#define PIN_FB_CS5 (PIN_ALT5 | PIN_PORTC | PIN16)
|
||||
#define PIN_FB_OE (PIN_ALT5 | PIN_PORTB | PIN19)
|
||||
#define PIN_FB_RW (PIN_ALT5 | PIN_PORTC | PIN11)
|
||||
#define PIN_FB_TA (PIN_ALT6 | PIN_PORTC | PIN19)
|
||||
#define PIN_FB_TBST (PIN_ALT5 | PIN_PORTC | PIN18)
|
||||
#define PIN_FB_TS (PIN_ALT5 | PIN_PORTD | PIN0)
|
||||
#define PIN_FB_TSIZ0 (PIN_ALT5 | PIN_PORTC | PIN17)
|
||||
#define PIN_FB_TSIZ1 (PIN_ALT5 | PIN_PORTC | PIN16)
|
||||
|
||||
/* FlexTimer Module (FTM) */
|
||||
|
||||
#define PIN_FTM_CLKIN0_1 (PIN_ALT4 | PIN_PORTA | PIN18)
|
||||
#define PIN_FTM_CLKIN0_2 (PIN_ALT4 | PIN_PORTB | PIN16)
|
||||
#define PIN_FTM_CLKIN0_3 (PIN_ALT4 | PIN_PORTC | PIN12)
|
||||
#define PIN_FTM_CLKIN1_1 (PIN_ALT4 | PIN_PORTA | PIN19)
|
||||
#define PIN_FTM_CLKIN1_2 (PIN_ALT4 | PIN_PORTB | PIN17)
|
||||
#define PIN_FTM_CLKIN1_3 (PIN_ALT4 | PIN_PORTC | PIN13)
|
||||
|
||||
#define PIN_FTM0_CH0_1 (PIN_ALT3 | PIN_PORTA | PIN3)
|
||||
#define PIN_FTM0_CH0_2 (PIN_ALT4 | PIN_PORTC | PIN1)
|
||||
#define PIN_FTM0_CH1_1 (PIN_ALT3 | PIN_PORTA | PIN4)
|
||||
#define PIN_FTM0_CH1_2 (PIN_ALT4 | PIN_PORTC | PIN2)
|
||||
#define PIN_FTM0_CH2_1 (PIN_ALT3 | PIN_PORTA | PIN5)
|
||||
#define PIN_FTM0_CH2_2 (PIN_ALT4 | PIN_PORTC | PIN3)
|
||||
#define PIN_FTM0_CH2_3 (PIN_ALT7 | PIN_PORTC | PIN5)
|
||||
#define PIN_FTM0_CH3_1 (PIN_ALT3 | PIN_PORTA | PIN6)
|
||||
#define PIN_FTM0_CH3_2 (PIN_ALT4 | PIN_PORTC | PIN4)
|
||||
#define PIN_FTM0_CH4_1 (PIN_ALT3 | PIN_PORTA | PIN7)
|
||||
#define PIN_FTM0_CH4_2 (PIN_ALT4 | PIN_PORTB | PIN12)
|
||||
#define PIN_FTM0_CH4_3 (PIN_ALT4 | PIN_PORTD | PIN4)
|
||||
#define PIN_FTM0_CH5_1 (PIN_ALT3 | PIN_PORTA | PIN0)
|
||||
#define PIN_FTM0_CH5_2 (PIN_ALT4 | PIN_PORTB | PIN13)
|
||||
#define PIN_FTM0_CH5_3 (PIN_ALT4 | PIN_PORTD | PIN5)
|
||||
#define PIN_FTM0_CH6_1 (PIN_ALT3 | PIN_PORTA | PIN1)
|
||||
#define PIN_FTM0_CH6_2 (PIN_ALT4 | PIN_PORTD | PIN6)
|
||||
#define PIN_FTM0_CH7_1 (PIN_ALT3 | PIN_PORTA | PIN2)
|
||||
#define PIN_FTM0_CH7_2 (PIN_ALT4 | PIN_PORTD | PIN7)
|
||||
#define PIN_FTM0_FLT0_1 (PIN_ALT6 | PIN_PORTB | PIN3)
|
||||
#define PIN_FTM0_FLT0_2 (PIN_ALT6 | PIN_PORTD | PIN6)
|
||||
#define PIN_FTM0_FLT1_1 (PIN_ALT6 | PIN_PORTB | PIN10)
|
||||
#define PIN_FTM0_FLT1_2 (PIN_ALT6 | PIN_PORTD | PIN7)
|
||||
#define PIN_FTM0_FLT2_1 (PIN_ALT3 | PIN_PORTA | PIN18)
|
||||
#define PIN_FTM0_FLT2_2 (PIN_ALT6 | PIN_PORTB | PIN11)
|
||||
#define PIN_FTM0_FLT3 (PIN_ALT6 | PIN_PORTB | PIN2)
|
||||
|
||||
#define PIN_FTM1_CH0_1 (PIN_ALT3 | PIN_PORTA | PIN12)
|
||||
#define PIN_FTM1_CH0_2 (PIN_ALT3 | PIN_PORTA | PIN8)
|
||||
#define PIN_FTM1_CH0_3 (PIN_ALT3 | PIN_PORTB | PIN0)
|
||||
#define PIN_FTM1_CH0_4 (PIN_ALT3 | PIN_PORTB | PIN12)
|
||||
#define PIN_FTM1_CH1_1 (PIN_ALT3 | PIN_PORTA | PIN13)
|
||||
#define PIN_FTM1_CH1_2 (PIN_ALT3 | PIN_PORTA | PIN9)
|
||||
#define PIN_FTM1_CH1_3 (PIN_ALT3 | PIN_PORTB | PIN1)
|
||||
#define PIN_FTM1_CH1_4 (PIN_ALT3 | PIN_PORTB | PIN13)
|
||||
#define PIN_FTM1_FLT0_1 (PIN_ALT3 | PIN_PORTA | PIN19)
|
||||
#define PIN_FTM1_FLT0_2 (PIN_ALT6 | PIN_PORTB | PIN4)
|
||||
#define PIN_FTM1_QD_PHA_1 (PIN_ALT6 | PIN_PORTA | PIN8)
|
||||
#define PIN_FTM1_QD_PHA_2 (PIN_ALT6 | PIN_PORTB | PIN0)
|
||||
#define PIN_FTM1_QD_PHA_3 (PIN_ALT6 | PIN_PORTB | PIN12)
|
||||
#define PIN_FTM1_QD_PHA_4 (PIN_ALT7 | PIN_PORTA | PIN12)
|
||||
#define PIN_FTM1_QD_PHB_1 (PIN_ALT6 | PIN_PORTA | PIN9)
|
||||
#define PIN_FTM1_QD_PHB_2 (PIN_ALT6 | PIN_PORTB | PIN1)
|
||||
#define PIN_FTM1_QD_PHB_3 (PIN_ALT6 | PIN_PORTB | PIN13)
|
||||
#define PIN_FTM1_QD_PHB_4 (PIN_ALT7 | PIN_PORTA | PIN13)
|
||||
|
||||
#define PIN_FTM2_CH0_1 (PIN_ALT3 | PIN_PORTA | PIN10)
|
||||
#define PIN_FTM2_CH0_2 (PIN_ALT3 | PIN_PORTB | PIN18)
|
||||
#define PIN_FTM2_CH1_1 (PIN_ALT3 | PIN_PORTA | PIN11)
|
||||
#define PIN_FTM2_CH1_2 (PIN_ALT3 | PIN_PORTB | PIN19)
|
||||
#define PIN_FTM2_FLT0_1 (PIN_ALT6 | PIN_PORTB | PIN5)
|
||||
#define PIN_FTM2_FLT0_2 (PIN_ALT6 | PIN_PORTC | PIN9)
|
||||
#define PIN_FTM2_QD_PHA_1 (PIN_ALT6 | PIN_PORTA | PIN10)
|
||||
#define PIN_FTM2_QD_PHA_2 (PIN_ALT6 | PIN_PORTB | PIN18)
|
||||
#define PIN_FTM2_QD_PHB_1 (PIN_ALT6 | PIN_PORTA | PIN11)
|
||||
#define PIN_FTM2_QD_PHB_2 (PIN_ALT6 | PIN_PORTB | PIN19)
|
||||
|
||||
#define PIN_FTM3_CH0_1 (PIN_ALT4 | PIN_PORTD | PIN0)
|
||||
#define PIN_FTM3_CH0_2 (PIN_ALT6 | PIN_PORTE | PIN5)
|
||||
#define PIN_FTM3_CH1_1 (PIN_ALT4 | PIN_PORTD | PIN1)
|
||||
#define PIN_FTM3_CH1_2 (PIN_ALT6 | PIN_PORTE | PIN6)
|
||||
#define PIN_FTM3_CH2_1 (PIN_ALT4 | PIN_PORTD | PIN2)
|
||||
#define PIN_FTM3_CH2_2 (PIN_ALT6 | PIN_PORTE | PIN7)
|
||||
#define PIN_FTM3_CH3_1 (PIN_ALT4 | PIN_PORTD | PIN3)
|
||||
#define PIN_FTM3_CH3_2 (PIN_ALT6 | PIN_PORTE | PIN8)
|
||||
#define PIN_FTM3_CH4_1 (PIN_ALT3 | PIN_PORTC | PIN8)
|
||||
#define PIN_FTM3_CH4_2 (PIN_ALT6 | PIN_PORTE | PIN9)
|
||||
#define PIN_FTM3_CH5_1 (PIN_ALT3 | PIN_PORTC | PIN9)
|
||||
#define PIN_FTM3_CH5_2 (PIN_ALT6 | PIN_PORTE | PIN10)
|
||||
#define PIN_FTM3_CH6_1 (PIN_ALT3 | PIN_PORTC | PIN10)
|
||||
#define PIN_FTM3_CH6_2 (PIN_ALT6 | PIN_PORTE | PIN11)
|
||||
#define PIN_FTM3_CH7_1 (PIN_ALT3 | PIN_PORTC | PIN11)
|
||||
#define PIN_FTM3_CH7_2 (PIN_ALT6 | PIN_PORTE | PIN12)
|
||||
#define PIN_FTM3_FLT0_1 (PIN_ALT3 | PIN_PORTD | PIN12)
|
||||
#define PIN_FTM3_FLT0_2 (PIN_ALT6 | PIN_PORTC | PIN12)
|
||||
|
||||
/* I2C */
|
||||
|
||||
#define PIN_I2C0_SCL_1 (PIN_ALT2 | PIN_PORTB | PIN0)
|
||||
#define PIN_I2C0_SCL_2 (PIN_ALT2 | PIN_PORTB | PIN2)
|
||||
#define PIN_I2C0_SCL_3 (PIN_ALT2 | PIN_PORTD | PIN8)
|
||||
#define PIN_I2C0_SCL_4 (PIN_ALT5 | PIN_PORTE | PIN24)
|
||||
#define PIN_I2C0_SCL_5 (PIN_ALT7 | PIN_PORTD | PIN2)
|
||||
#define PIN_I2C0_SDA_1 (PIN_ALT2 | PIN_PORTB | PIN1)
|
||||
#define PIN_I2C0_SDA_2 (PIN_ALT2 | PIN_PORTB | PIN3)
|
||||
#define PIN_I2C0_SDA_3 (PIN_ALT2 | PIN_PORTD | PIN9)
|
||||
#define PIN_I2C0_SDA_4 (PIN_ALT5 | PIN_PORTE | PIN25)
|
||||
#define PIN_I2C0_SDA_5 (PIN_ALT7 | PIN_PORTD | PIN3)
|
||||
|
||||
#define PIN_I2C1_SCL_1 (PIN_ALT2 | PIN_PORTC | PIN10)
|
||||
#define PIN_I2C1_SCL_2 (PIN_ALT6 | PIN_PORTE | PIN1)
|
||||
#define PIN_I2C1_SDA_1 (PIN_ALT2 | PIN_PORTC | PIN11)
|
||||
#define PIN_I2C1_SDA_2 (PIN_ALT6 | PIN_PORTE | PIN0)
|
||||
|
||||
#define PIN_I2C2_SCL_1 (PIN_ALT5 | PIN_PORTA | PIN12)
|
||||
#define PIN_I2C2_SCL_2 (PIN_ALT5 | PIN_PORTA | PIN14)
|
||||
#define PIN_I2C2_SDA_1 (PIN_ALT5 | PIN_PORTA | PIN11)
|
||||
#define PIN_I2C2_SDA_2 (PIN_ALT5 | PIN_PORTA | PIN13)
|
||||
|
||||
#define PIN_I2C3_SCL_1 (PIN_ALT2 | PIN_PORTE | PIN11)
|
||||
#define PIN_I2C3_SCL_2 (PIN_ALT4 | PIN_PORTA | PIN2)
|
||||
#define PIN_I2C3_SDA_1 (PIN_ALT2 | PIN_PORTE | PIN10)
|
||||
#define PIN_I2C3_SDA_2 (PIN_ALT4 | PIN_PORTA | PIN1)
|
||||
|
||||
/* I2S */
|
||||
|
||||
#define PIN_I2S0_MCLK_1 (PIN_ALT4 | PIN_PORTC | PIN8)
|
||||
#define PIN_I2S0_MCLK_2 (PIN_ALT4 | PIN_PORTE | PIN6)
|
||||
#define PIN_I2S0_MCLK_3 (PIN_ALT6 | PIN_PORTA | PIN17)
|
||||
#define PIN_I2S0_MCLK_4 (PIN_ALT6 | PIN_PORTC | PIN6)
|
||||
#define PIN_I2S0_RX_BCLK_1 (PIN_ALT4 | PIN_PORTC | PIN6)
|
||||
#define PIN_I2S0_RX_BCLK_2 (PIN_ALT4 | PIN_PORTC | PIN9)
|
||||
#define PIN_I2S0_RX_BCLK_3 (PIN_ALT4 | PIN_PORTE | PIN9)
|
||||
#define PIN_I2S0_RX_BCLK_4 (PIN_ALT6 | PIN_PORTA | PIN14)
|
||||
#define PIN_I2S0_RX_FS_1 (PIN_ALT4 | PIN_PORTC | PIN10)
|
||||
#define PIN_I2S0_RX_FS_2 (PIN_ALT4 | PIN_PORTC | PIN7)
|
||||
#define PIN_I2S0_RX_FS_3 (PIN_ALT4 | PIN_PORTE | PIN8)
|
||||
#define PIN_I2S0_RX_FS_4 (PIN_ALT6 | PIN_PORTA | PIN16)
|
||||
#define PIN_I2S0_RXD0_1 (PIN_ALT4 | PIN_PORTC | PIN5)
|
||||
#define PIN_I2S0_RXD0_2 (PIN_ALT4 | PIN_PORTE | PIN7)
|
||||
#define PIN_I2S0_RXD0_3 (PIN_ALT6 | PIN_PORTA | PIN15)
|
||||
#define PIN_I2S0_RXD1_1 (PIN_ALT2 | PIN_PORTE | PIN8)
|
||||
#define PIN_I2S0_RXD1_2 (PIN_ALT4 | PIN_PORTC | PIN11)
|
||||
#define PIN_I2S0_RXD1_3 (PIN_ALT7 | PIN_PORTA | PIN16)
|
||||
#define PIN_I2S0_TX_BCLK_1 (PIN_ALT4 | PIN_PORTB | PIN18)
|
||||
#define PIN_I2S0_TX_BCLK_2 (PIN_ALT4 | PIN_PORTE | PIN12)
|
||||
#define PIN_I2S0_TX_BCLK_3 (PIN_ALT6 | PIN_PORTA | PIN5)
|
||||
#define PIN_I2S0_TX_BCLK_4 (PIN_ALT6 | PIN_PORTC | PIN3)
|
||||
#define PIN_I2S0_TX_FS_1 (PIN_ALT4 | PIN_PORTB | PIN19)
|
||||
#define PIN_I2S0_TX_FS_2 (PIN_ALT4 | PIN_PORTE | PIN11)
|
||||
#define PIN_I2S0_TX_FS_3 (PIN_ALT6 | PIN_PORTA | PIN13)
|
||||
#define PIN_I2S0_TX_FS_4 (PIN_ALT6 | PIN_PORTC | PIN2)
|
||||
#define PIN_I2S0_TXD0_1 (PIN_ALT4 | PIN_PORTE | PIN10)
|
||||
#define PIN_I2S0_TXD0_2 (PIN_ALT6 | PIN_PORTA | PIN12)
|
||||
#define PIN_I2S0_TXD0_3 (PIN_ALT6 | PIN_PORTC | PIN1)
|
||||
#define PIN_I2S0_TXD1_1 (PIN_ALT2 | PIN_PORTE | PIN9)
|
||||
#define PIN_I2S0_TXD1_2 (PIN_ALT6 | PIN_PORTC | PIN0)
|
||||
#define PIN_I2S0_TXD1_3 (PIN_ALT7 | PIN_PORTA | PIN14)
|
||||
|
||||
/* JTAG */
|
||||
|
||||
#define PIN_JTAG_TCLK (PIN_ALT7 | PIN_PORTA | PIN0)
|
||||
#define PIN_JTAG_TDI (PIN_ALT7 | PIN_PORTA | PIN1)
|
||||
#define PIN_JTAG_TDO (PIN_ALT7 | PIN_PORTA | PIN2)
|
||||
#define PIN_JTAG_TMS (PIN_ALT7 | PIN_PORTA | PIN3)
|
||||
#define PIN_JTAG_TRST (PIN_ALT7 | PIN_PORTA | PIN5)
|
||||
|
||||
/* Low-leakage wakeup module (LLWU, actually GPIO configurations) */
|
||||
|
||||
#define PIN_LLWU_P0 (PIN_ALT1 | PIN_PORTE | PIN1)
|
||||
#define PIN_LLWU_P1 (PIN_ALT1 | PIN_PORTE | PIN2)
|
||||
#define PIN_LLWU_P2 (PIN_ALT1 | PIN_PORTE | PIN4)
|
||||
#define PIN_LLWU_P3 (PIN_ALT1 | PIN_PORTA | PIN4)
|
||||
#define PIN_LLWU_P4 (PIN_ALT1 | PIN_PORTA | PIN13)
|
||||
#define PIN_LLWU_P5 (PIN_ALT1 | PIN_PORTB | PIN0)
|
||||
#define PIN_LLWU_P6 (PIN_ALT1 | PIN_PORTC | PIN1)
|
||||
#define PIN_LLWU_P7 (PIN_ALT1 | PIN_PORTC | PIN3)
|
||||
#define PIN_LLWU_P8 (PIN_ALT1 | PIN_PORTC | PIN4)
|
||||
#define PIN_LLWU_P9 (PIN_ALT1 | PIN_PORTC | PIN5)
|
||||
#define PIN_LLWU_P10 (PIN_ALT1 | PIN_PORTC | PIN6)
|
||||
#define PIN_LLWU_P11 (PIN_ALT1 | PIN_PORTC | PIN11)
|
||||
#define PIN_LLWU_P12 (PIN_ALT1 | PIN_PORTD | PIN0)
|
||||
#define PIN_LLWU_P13 (PIN_ALT1 | PIN_PORTD | PIN2)
|
||||
#define PIN_LLWU_P14 (PIN_ALT1 | PIN_PORTD | PIN4)
|
||||
#define PIN_LLWU_P15 (PIN_ALT1 | PIN_PORTD | PIN6)
|
||||
#define PIN_LLWU_P16 (PIN_ALT1 | PIN_PORTE | PIN6)
|
||||
#define PIN_LLWU_P17 (PIN_ALT1 | PIN_PORTE | PIN9)
|
||||
#define PIN_LLWU_P18 (PIN_ALT1 | PIN_PORTE | PIN10)
|
||||
#define PIN_LLWU_P21 (PIN_ALT1 | PIN_PORTE | PIN25)
|
||||
#define PIN_LLWU_P22 (PIN_ALT1 | PIN_PORTA | PIN10)
|
||||
#define PIN_LLWU_P23 (PIN_ALT1 | PIN_PORTA | PIN11)
|
||||
#define PIN_LLWU_P24 (PIN_ALT1 | PIN_PORTD | PIN8)
|
||||
#define PIN_LLWU_P25 (PIN_ALT1 | PIN_PORTD | PIN11)
|
||||
|
||||
/* Low-Power Timer (LPTMR) */
|
||||
|
||||
#define PIN_LPTMR0_ALT1 (PIN_ALT6 | PIN_PORTA | PIN19)
|
||||
#define PIN_LPTMR0_ALT2 (PIN_ALT3 | PIN_PORTC | PIN5)
|
||||
|
||||
/* MII */
|
||||
|
||||
#define PIN_MII0_COL (PIN_ALT4 | PIN_PORTA | PIN29)
|
||||
#define PIN_MII0_CRS (PIN_ALT4 | PIN_PORTA | PIN27)
|
||||
#define PIN_MII0_MDC_1 (PIN_ALT4 | PIN_PORTB | PIN1)
|
||||
#define PIN_MII0_MDC_2 (PIN_ALT5 | PIN_PORTA | PIN8)
|
||||
#ifdef CONFIG_KINETIS_ENET_MDIOPULLUP
|
||||
# define PIN_MII0_MDIO_1 (PIN_ALT4_PULLUP | PIN_PORTB | PIN0)
|
||||
# define PIN_MII0_MDIO_2 (PIN_ALT5_PULLUP | PIN_PORTA | PIN7)
|
||||
#else
|
||||
# define PIN_MII0_MDIO_1 (PIN_ALT4 | PIN_PORTB | PIN0)
|
||||
# define PIN_MII0_MDIO_2 (PIN_ALT5 | PIN_PORTA | PIN7)
|
||||
#endif
|
||||
#define PIN_MII0_RXCLK (PIN_ALT4 | PIN_PORTA | PIN11)
|
||||
#define PIN_MII0_RXD0 (PIN_ALT4 | PIN_PORTA | PIN13)
|
||||
#define PIN_MII0_RXD1 (PIN_ALT4 | PIN_PORTA | PIN12)
|
||||
#define PIN_MII0_RXD2 (PIN_ALT4 | PIN_PORTA | PIN10)
|
||||
#define PIN_MII0_RXD3 (PIN_ALT4 | PIN_PORTA | PIN9)
|
||||
#define PIN_MII0_RXDV (PIN_ALT4 | PIN_PORTA | PIN14)
|
||||
#ifdef CONFIG_KINETIS_ENET_NORXER
|
||||
# define PIN_MII0_RXER (GPIO_PULLDOWN | PIN_PORTA | PIN5)
|
||||
#else
|
||||
# define PIN_MII0_RXER (PIN_ALT4 | PIN_PORTA | PIN5)
|
||||
#endif
|
||||
#define PIN_MII0_TXCLK (PIN_ALT4 | PIN_PORTA | PIN25)
|
||||
#define PIN_MII0_TXD0 (PIN_ALT4 | PIN_PORTA | PIN16)
|
||||
#define PIN_MII0_TXD1 (PIN_ALT4 | PIN_PORTA | PIN17)
|
||||
#define PIN_MII0_TXD2 (PIN_ALT4 | PIN_PORTA | PIN24)
|
||||
#define PIN_MII0_TXD3 (PIN_ALT4 | PIN_PORTA | PIN26)
|
||||
#define PIN_MII0_TXEN (PIN_ALT4 | PIN_PORTA | PIN15)
|
||||
#define PIN_MII0_TXER (PIN_ALT4 | PIN_PORTA | PIN28)
|
||||
|
||||
/* NMI */
|
||||
|
||||
#define PIN_NMI (PIN_ALT7 | PIN_PORTA | PIN4)
|
||||
|
||||
/* Programmable Delay Block (PDB) */
|
||||
|
||||
#define PIN_PDB0_EXTRG_1 (PIN_ALT3 | PIN_PORTC | PIN0)
|
||||
#define PIN_PDB0_EXTRG_2 (PIN_ALT3 | PIN_PORTC | PIN6)
|
||||
|
||||
/* RMII */
|
||||
|
||||
#define PIN_RMII0_CRS_DV (PIN_ALT4 | PIN_PORTA | PIN14)
|
||||
#define PIN_RMII0_MDC_1 (PIN_ALT4 | PIN_PORTB | PIN1)
|
||||
#define PIN_RMII0_MDC_2 (PIN_ALT5 | PIN_PORTA | PIN8)
|
||||
#ifdef CONFIG_KINETIS_ENET_MDIOPULLUP
|
||||
# define PIN_RMII0_MDIO_1 (PIN_ALT4_PULLUP | PIN_PORTB | PIN0)
|
||||
# define PIN_RMII0_MDIO_2 (PIN_ALT5_PULLUP | PIN_PORTA | PIN7)
|
||||
#else
|
||||
# define PIN_RMII0_MDIO_1 (PIN_ALT4 | PIN_PORTB | PIN0)
|
||||
# define PIN_RMII0_MDIO_2 (PIN_ALT5 | PIN_PORTA | PIN7)
|
||||
#endif
|
||||
#define PIN_RMII0_RXD0 (PIN_ALT4 | PIN_PORTA | PIN13)
|
||||
#define PIN_RMII0_RXD1 (PIN_ALT4 | PIN_PORTA | PIN12)
|
||||
#ifdef CONFIG_KINETIS_ENET_NORXER
|
||||
# define PIN_RMII0_RXER (GPIO_PULLDOWN | PIN_PORTA | PIN5)
|
||||
#else
|
||||
# define PIN_RMII0_RXER (PIN_ALT4 | PIN_PORTA | PIN5)
|
||||
#endif
|
||||
#define PIN_RMII0_TXD0 (PIN_ALT4 | PIN_PORTA | PIN16)
|
||||
#define PIN_RMII0_TXD1 (PIN_ALT4 | PIN_PORTA | PIN17)
|
||||
#define PIN_RMII0_TXEN (PIN_ALT4 | PIN_PORTA | PIN15)
|
||||
|
||||
/* Real-Time Clock (RTC) */
|
||||
|
||||
#define PIN_RTC_CLKOUT_1 (PIN_ALT6 | PIN_PORTE | PIN26)
|
||||
#define PIN_RTC_CLKOUT_2 (PIN_ALT7 | PIN_PORTE | PIN0)
|
||||
|
||||
/* Synchronous DRAM Controller Module (SDRAM) */
|
||||
|
||||
#define PIN_SDRAM_CAS_B (PIN_ALT5 | PIN_PORTB | PIN0)
|
||||
#define PIN_SDRAM_RAS_B (PIN_ALT5 | PIN_PORTB | PIN1)
|
||||
#define PIN_SDRAM_WE (PIN_ALT5 | PIN_PORTB | PIN2)
|
||||
#define PIN_SDRAM_CKE (PIN_ALT5 | PIN_PORTD | PIN7)
|
||||
#define PIN_SDRAM_CS0_B (PIN_ALT5 | PIN_PORTB | PIN3)
|
||||
#define PIN_SDRAM_CS1_B (PIN_ALT5 | PIN_PORTB | PIN4)
|
||||
#define PIN_SDRAM_D16 (PIN_ALT5 | PIN_PORTB | PIN17)
|
||||
#define PIN_SDRAM_D17 (PIN_ALT5 | PIN_PORTB | PIN16)
|
||||
#define PIN_SDRAM_D18 (PIN_ALT5 | PIN_PORTB | PIN11)
|
||||
#define PIN_SDRAM_D19 (PIN_ALT5 | PIN_PORTB | PIN10)
|
||||
#define PIN_SDRAM_D20 (PIN_ALT5 | PIN_PORTB | PIN9)
|
||||
#define PIN_SDRAM_D21 (PIN_ALT5 | PIN_PORTB | PIN8)
|
||||
#define PIN_SDRAM_D22 (PIN_ALT5 | PIN_PORTB | PIN7)
|
||||
#define PIN_SDRAM_D23 (PIN_ALT5 | PIN_PORTB | PIN6)
|
||||
#define PIN_SDRAM_D24 (PIN_ALT5 | PIN_PORTC | PIN15)
|
||||
#define PIN_SDRAM_D25 (PIN_ALT5 | PIN_PORTC | PIN14)
|
||||
#define PIN_SDRAM_D26 (PIN_ALT5 | PIN_PORTC | PIN13)
|
||||
#define PIN_SDRAM_D27 (PIN_ALT5 | PIN_PORTC | PIN12)
|
||||
#define PIN_SDRAM_D28 (PIN_ALT5 | PIN_PORTB | PIN23)
|
||||
#define PIN_SDRAM_D29 (PIN_ALT5 | PIN_PORTB | PIN22)
|
||||
#define PIN_SDRAM_D30 (PIN_ALT5 | PIN_PORTB | PIN21)
|
||||
#define PIN_SDRAM_D31 (PIN_ALT5 | PIN_PORTB | PIN20)
|
||||
|
||||
#define PIN_SDRAM_DQM0 (PIN_ALT5 | PIN_PORTC | PIN19)
|
||||
#define PIN_SDRAM_DQM1 (PIN_ALT5 | PIN_PORTC | PIN18)
|
||||
#define PIN_SDRAM_DQM2 (PIN_ALT5 | PIN_PORTC | PIN16)
|
||||
#define PIN_SDRAM_DQM3 (PIN_ALT5 | PIN_PORTC | PIN17)
|
||||
|
||||
#define PIN_SDRAM_A9 (PIN_ALT5 | PIN_PORTD | PIN5)
|
||||
#define PIN_SDRAM_A10 (PIN_ALT5 | PIN_PORTD | PIN4)
|
||||
#define PIN_SDRAM_A11 (PIN_ALT5 | PIN_PORTD | PIN3)
|
||||
#define PIN_SDRAM_A12 (PIN_ALT5 | PIN_PORTD | PIN2)
|
||||
#define PIN_SDRAM_A13 (PIN_ALT5 | PIN_PORTC | PIN10)
|
||||
#define PIN_SDRAM_A14 (PIN_ALT5 | PIN_PORTC | PIN9)
|
||||
#define PIN_SDRAM_A15 (PIN_ALT5 | PIN_PORTC | PIN8)
|
||||
#define PIN_SDRAM_A16 (PIN_ALT5 | PIN_PORTC | PIN7)
|
||||
#define PIN_SDRAM_A17 (PIN_ALT5 | PIN_PORTC | PIN6)
|
||||
#define PIN_SDRAM_A18 (PIN_ALT5 | PIN_PORTC | PIN5)
|
||||
#define PIN_SDRAM_A19 (PIN_ALT5 | PIN_PORTC | PIN4)
|
||||
#define PIN_SDRAM_A20 (PIN_ALT5 | PIN_PORTC | PIN2)
|
||||
#define PIN_SDRAM_A21 (PIN_ALT5 | PIN_PORTC | PIN1)
|
||||
#define PIN_SDRAM_A22 (PIN_ALT5 | PIN_PORTC | PIN0)
|
||||
#define PIN_SDRAM_A23 (PIN_ALT5 | PIN_PORTB | PIN18)
|
||||
|
||||
|
||||
/* Secured digital host controller (SDHC) */
|
||||
|
||||
#define PIN_SDHC0_CLKIN (PIN_ALT4 | PIN_PORTD | PIN11)
|
||||
#define PIN_SDHC0_CMD (PIN_ALT4 | PIN_PORTE | PIN3)
|
||||
#define PIN_SDHC0_D0 (PIN_ALT4 | PIN_PORTE | PIN1)
|
||||
#define PIN_SDHC0_D1 (PIN_ALT4 | PIN_PORTE | PIN0)
|
||||
#define PIN_SDHC0_D2 (PIN_ALT4 | PIN_PORTE | PIN5)
|
||||
#define PIN_SDHC0_D3 (PIN_ALT4 | PIN_PORTE | PIN4)
|
||||
#define PIN_SDHC0_D4 (PIN_ALT4 | PIN_PORTD | PIN12)
|
||||
#define PIN_SDHC0_D5 (PIN_ALT4 | PIN_PORTD | PIN13)
|
||||
#define PIN_SDHC0_D6 (PIN_ALT4 | PIN_PORTD | PIN14)
|
||||
#define PIN_SDHC0_D7 (PIN_ALT4 | PIN_PORTD | PIN15)
|
||||
#define PIN_SDHC0_DCLK (PIN_ALT4 | PIN_PORTE | PIN2)
|
||||
|
||||
/* SPI */
|
||||
|
||||
#define PIN_SPI0_PCS0_1 (PIN_ALT2 | PIN_PORTA | PIN14)
|
||||
#define PIN_SPI0_PCS0_2 (PIN_ALT2 | PIN_PORTC | PIN4)
|
||||
#define PIN_SPI0_PCS0_3 (PIN_ALT2 | PIN_PORTD | PIN0)
|
||||
#define PIN_SPI0_PCS1_1 (PIN_ALT2 | PIN_PORTC | PIN3)
|
||||
#define PIN_SPI0_PCS1_2 (PIN_ALT2 | PIN_PORTD | PIN4)
|
||||
#define PIN_SPI0_PCS2_1 (PIN_ALT2 | PIN_PORTC | PIN2)
|
||||
#define PIN_SPI0_PCS2_3 (PIN_ALT2 | PIN_PORTD | PIN5)
|
||||
#define PIN_SPI0_PCS3_1 (PIN_ALT2 | PIN_PORTC | PIN1)
|
||||
#define PIN_SPI0_PCS3_2 (PIN_ALT2 | PIN_PORTD | PIN6)
|
||||
#define PIN_SPI0_PCS4 (PIN_ALT2 | PIN_PORTC | PIN0)
|
||||
#define PIN_SPI0_PCS5 (PIN_ALT3 | PIN_PORTB | PIN23)
|
||||
#define PIN_SPI0_SCK_1 (PIN_ALT2 | PIN_PORTA | PIN15)
|
||||
#define PIN_SPI0_SCK_2 (PIN_ALT2 | PIN_PORTC | PIN5)
|
||||
#define PIN_SPI0_SCK_3 (PIN_ALT2 | PIN_PORTD | PIN1)
|
||||
#define PIN_SPI0_SIN_1 (PIN_ALT2 | PIN_PORTA | PIN17)
|
||||
#define PIN_SPI0_SIN_2 (PIN_ALT2 | PIN_PORTC | PIN7)
|
||||
#define PIN_SPI0_SIN_3 (PIN_ALT2 | PIN_PORTD | PIN3)
|
||||
#define PIN_SPI0_SOUT_1 (PIN_ALT2 | PIN_PORTA | PIN16)
|
||||
#define PIN_SPI0_SOUT_2 (PIN_ALT2 | PIN_PORTC | PIN6)
|
||||
#define PIN_SPI0_SOUT_3 (PIN_ALT2 | PIN_PORTD | PIN2)
|
||||
|
||||
#define PIN_SPI1_PCS0_1 (PIN_ALT2 | PIN_PORTB | PIN10)
|
||||
#define PIN_SPI1_PCS0_2 (PIN_ALT2 | PIN_PORTE | PIN4)
|
||||
#define PIN_SPI1_PCS0_3 (PIN_ALT7 | PIN_PORTD | PIN4)
|
||||
#define PIN_SPI1_PCS1_1 (PIN_ALT2 | PIN_PORTB | PIN9)
|
||||
#define PIN_SPI1_PCS1_2 (PIN_ALT2 | PIN_PORTE | PIN0)
|
||||
#define PIN_SPI1_PCS2 (PIN_ALT2 | PIN_PORTE | PIN5)
|
||||
#define PIN_SPI1_PCS3 (PIN_ALT2 | PIN_PORTE | PIN6)
|
||||
#define PIN_SPI1_SCK_1 (PIN_ALT2 | PIN_PORTB | PIN11)
|
||||
#define PIN_SPI1_SCK_2 (PIN_ALT2 | PIN_PORTE | PIN2)
|
||||
#define PIN_SPI1_SCK_3 (PIN_ALT7 | PIN_PORTD | PIN5)
|
||||
#define PIN_SPI1_SIN_1 (PIN_ALT2 | PIN_PORTB | PIN17)
|
||||
#define PIN_SPI1_SIN_2 (PIN_ALT2 | PIN_PORTE | PIN3)
|
||||
#define PIN_SPI1_SIN_3 (PIN_ALT7 | PIN_PORTD | PIN7)
|
||||
#define PIN_SPI1_SIN_4 (PIN_ALT7 | PIN_PORTE | PIN1)
|
||||
#define PIN_SPI1_SOUT_1 (PIN_ALT2 | PIN_PORTB | PIN16)
|
||||
#define PIN_SPI1_SOUT_2 (PIN_ALT2 | PIN_PORTE | PIN1)
|
||||
#define PIN_SPI1_SOUT_3 (PIN_ALT7 | PIN_PORTD | PIN6)
|
||||
#define PIN_SPI1_SOUT_4 (PIN_ALT7 | PIN_PORTE | PIN3)
|
||||
|
||||
#define PIN_SPI2_PCS0_1 (PIN_ALT2 | PIN_PORTB | PIN20)
|
||||
#define PIN_SPI2_PCS0_2 (PIN_ALT2 | PIN_PORTD | PIN11)
|
||||
#define PIN_SPI2_PCS1 (PIN_ALT2 | PIN_PORTD | PIN15)
|
||||
#define PIN_SPI2_SCK_1 (PIN_ALT2 | PIN_PORTB | PIN21)
|
||||
#define PIN_SPI2_SCK_2 (PIN_ALT2 | PIN_PORTD | PIN12)
|
||||
#define PIN_SPI2_SIN_1 (PIN_ALT2 | PIN_PORTB | PIN23)
|
||||
#define PIN_SPI2_SIN_2 (PIN_ALT2 | PIN_PORTD | PIN14)
|
||||
#define PIN_SPI2_SOUT_1 (PIN_ALT2 | PIN_PORTB | PIN22)
|
||||
#define PIN_SPI2_SOUT_2 (PIN_ALT2 | PIN_PORTD | PIN13)
|
||||
|
||||
/* SWD */
|
||||
|
||||
#define PIN_SWD_CLK (PIN_ALT7 | PIN_PORTA | PIN0)
|
||||
#define PIN_SWD_DIO (PIN_ALT7 | PIN_PORTA | PIN3)
|
||||
|
||||
/* Timer/PWM Module (TPM) */
|
||||
|
||||
#define PIN_TPM1_CH0_1 (PIN_ALT6 | PIN_PORTA | PIN8)
|
||||
#define PIN_TPM1_CH0_2 (PIN_ALT7 | PIN_PORTA | PIN12)
|
||||
#define PIN_TPM1_CH0_3 (PIN_ALT6 | PIN_PORTB | PIN0)
|
||||
#define PIN_TPM1_CH1_1 (PIN_ALT6 | PIN_PORTA | PIN9)
|
||||
#define PIN_TPM1_CH1_2 (PIN_ALT7 | PIN_PORTA | PIN13)
|
||||
#define PIN_TPM1_CH1_3 (PIN_ALT6 | PIN_PORTB | PIN1)
|
||||
#define PIN_TPM2_CH0_1 (PIN_ALT6 | PIN_PORTA | PIN10)
|
||||
#define PIN_TPM2_CH0_2 (PIN_ALT6 | PIN_PORTB | PIN18)
|
||||
#define PIN_TPM2_CH1_1 (PIN_ALT1 | PIN_PORTA | PIN11)
|
||||
#define PIN_TPM2_CH1_2 (PIN_ALT6 | PIN_PORTB | PIN19)
|
||||
|
||||
#define PIN_TPM_CLKIN0_1 (PIN_ALT7 | PIN_PORTA | PIN18)
|
||||
#define PIN_TPM_CLKIN0_2 (PIN_ALT7 | PIN_PORTB | PIN16)
|
||||
#define PIN_TPM_CLKIN0_3 (PIN_ALT7 | PIN_PORTC | PIN12)
|
||||
#define PIN_TPM_CLKIN1_1 (PIN_ALT7 | PIN_PORTA | PIN17)
|
||||
#define PIN_TPM_CLKIN1_2 (PIN_ALT7 | PIN_PORTB | PIN17)
|
||||
#define PIN_TPM_CLKIN1_3 (PIN_ALT7 | PIN_PORTC | PIN13)
|
||||
|
||||
|
||||
/* Touch Sensing Input (TSI) */
|
||||
|
||||
#define PIN_TSI0_CH0_1 (PIN_ANALOG | PIN_PORTB | PIN0)
|
||||
#define PIN_TSI0_CH1_1 (PIN_ANALOG | PIN_PORTA | PIN0)
|
||||
#define PIN_TSI0_CH2_1 (PIN_ANALOG | PIN_PORTA | PIN1)
|
||||
#define PIN_TSI0_CH3_1 (PIN_ANALOG | PIN_PORTA | PIN2)
|
||||
#define PIN_TSI0_CH4_1 (PIN_ANALOG | PIN_PORTA | PIN3)
|
||||
#define PIN_TSI0_CH5_1 (PIN_ANALOG | PIN_PORTA | PIN4)
|
||||
#define PIN_TSI0_CH6_1 (PIN_ANALOG | PIN_PORTB | PIN1)
|
||||
#define PIN_TSI0_CH7_1 (PIN_ANALOG | PIN_PORTB | PIN2)
|
||||
#define PIN_TSI0_CH8_1 (PIN_ANALOG | PIN_PORTB | PIN3)
|
||||
#define PIN_TSI0_CH9_1 (PIN_ANALOG | PIN_PORTB | PIN16)
|
||||
#define PIN_TSI0_CH10_1 (PIN_ANALOG | PIN_PORTB | PIN17)
|
||||
#define PIN_TSI0_CH11_1 (PIN_ANALOG | PIN_PORTB | PIN18)
|
||||
#define PIN_TSI0_CH12_1 (PIN_ANALOG | PIN_PORTB | PIN19)
|
||||
#define PIN_TSI0_CH13_1 (PIN_ANALOG | PIN_PORTC | PIN0)
|
||||
#define PIN_TSI0_CH14_1 (PIN_ANALOG | PIN_PORTC | PIN1)
|
||||
#define PIN_TSI0_CH15_1 (PIN_ANALOG | PIN_PORTC | PIN2)
|
||||
|
||||
/* Trace */
|
||||
|
||||
#define PIN_TRACE_CLKOUT_1 (PIN_ALT5 | PIN_PORTE | PIN0)
|
||||
#define PIN_TRACE_CLKOUT_2 (PIN_ALT7 | PIN_PORTA | PIN6)
|
||||
#define PIN_TRACE_D0_1 (PIN_ALT5 | PIN_PORTE | PIN4)
|
||||
#define PIN_TRACE_D0_2 (PIN_ALT7 | PIN_PORTA | PIN10)
|
||||
#define PIN_TRACE_D1_1 (PIN_ALT5 | PIN_PORTE | PIN3)
|
||||
#define PIN_TRACE_D1_2 (PIN_ALT7 | PIN_PORTA | PIN9)
|
||||
#define PIN_TRACE_D2_1 (PIN_ALT5 | PIN_PORTE | PIN2)
|
||||
#define PIN_TRACE_D2_2 (PIN_ALT7 | PIN_PORTA | PIN8)
|
||||
#define PIN_TRACE_D3_1 (PIN_ALT5 | PIN_PORTE | PIN1)
|
||||
#define PIN_TRACE_D3_2 (PIN_ALT7 | PIN_PORTA | PIN7)
|
||||
#define PIN_TRACE_SWO (PIN_ALT7 | PIN_PORTA | PIN2)
|
||||
|
||||
/* UARTs */
|
||||
|
||||
#define PIN_UART0_COL_1 (PIN_ALT2 | PIN_PORTA | PIN0)
|
||||
#define PIN_UART0_COL_2 (PIN_ALT3 | PIN_PORTA | PIN16)
|
||||
#define PIN_UART0_COL_3 (PIN_ALT3 | PIN_PORTB | PIN3)
|
||||
#define PIN_UART0_COL_4 (PIN_ALT3 | PIN_PORTD | PIN5)
|
||||
#define PIN_UART0_CTS_1 (PIN_ALT2 | PIN_PORTA | PIN0)
|
||||
#define PIN_UART0_CTS_2 (PIN_ALT3 | PIN_PORTA | PIN16)
|
||||
#define PIN_UART0_CTS_3 (PIN_ALT3 | PIN_PORTB | PIN3)
|
||||
#define PIN_UART0_CTS_4 (PIN_ALT3 | PIN_PORTD | PIN5)
|
||||
#define PIN_UART0_RTS_1 (PIN_ALT2 | PIN_PORTA | PIN3)
|
||||
#define PIN_UART0_RTS_2 (PIN_ALT3 | PIN_PORTA | PIN17)
|
||||
#define PIN_UART0_RTS_3 (PIN_ALT3 | PIN_PORTB | PIN2)
|
||||
#define PIN_UART0_RTS_4 (PIN_ALT3 | PIN_PORTD | PIN4)
|
||||
#define PIN_UART0_RX_1 (PIN_ALT2 | PIN_PORTA | PIN1)
|
||||
#define PIN_UART0_RX_2 (PIN_ALT3 | PIN_PORTA | PIN15)
|
||||
#define PIN_UART0_RX_3 (PIN_ALT3 | PIN_PORTB | PIN16)
|
||||
#define PIN_UART0_RX_4 (PIN_ALT3 | PIN_PORTD | PIN6)
|
||||
#define PIN_UART0_TX_1 (PIN_ALT2 | PIN_PORTA | PIN2)
|
||||
#define PIN_UART0_TX_2 (PIN_ALT3 | PIN_PORTA | PIN14)
|
||||
#define PIN_UART0_TX_3 (PIN_ALT3 | PIN_PORTB | PIN17)
|
||||
#define PIN_UART0_TX_4 (PIN_ALT3 | PIN_PORTD | PIN7)
|
||||
|
||||
#define PIN_UART1_CTS_1 (PIN_ALT3 | PIN_PORTC | PIN2)
|
||||
#define PIN_UART1_CTS_2 (PIN_ALT3 | PIN_PORTE | PIN2)
|
||||
#define PIN_UART1_RTS_1 (PIN_ALT3 | PIN_PORTC | PIN1)
|
||||
#define PIN_UART1_RTS_2 (PIN_ALT3 | PIN_PORTE | PIN3)
|
||||
#define PIN_UART1_RX_1 (PIN_ALT3 | PIN_PORTC | PIN3)
|
||||
#define PIN_UART1_RX_2 (PIN_ALT3 | PIN_PORTE | PIN1)
|
||||
#define PIN_UART1_TX_1 (PIN_ALT3 | PIN_PORTC | PIN4)
|
||||
#define PIN_UART1_TX_2 (PIN_ALT3 | PIN_PORTE | PIN0)
|
||||
|
||||
#define PIN_UART2_CTS (PIN_ALT3 | PIN_PORTD | PIN1)
|
||||
#define PIN_UART2_RTS (PIN_ALT3 | PIN_PORTD | PIN0)
|
||||
#define PIN_UART2_RX (PIN_ALT3 | PIN_PORTD | PIN2)
|
||||
#define PIN_UART2_TX (PIN_ALT3 | PIN_PORTD | PIN3)
|
||||
|
||||
#define PIN_UART3_CTS_1 (PIN_ALT2 | PIN_PORTB | PIN13)
|
||||
#define PIN_UART3_CTS_2 (PIN_ALT3 | PIN_PORTB | PIN9)
|
||||
#define PIN_UART3_CTS_3 (PIN_ALT3 | PIN_PORTC | PIN19)
|
||||
#define PIN_UART3_CTS_4 (PIN_ALT3 | PIN_PORTE | PIN6)
|
||||
#define PIN_UART3_RTS_1 (PIN_ALT2 | PIN_PORTB | PIN12)
|
||||
#define PIN_UART3_RTS_2 (PIN_ALT3 | PIN_PORTB | PIN8)
|
||||
#define PIN_UART3_RTS_3 (PIN_ALT3 | PIN_PORTC | PIN18)
|
||||
#define PIN_UART3_RTS_4 (PIN_ALT3 | PIN_PORTE | PIN7)
|
||||
#define PIN_UART3_RX_1 (PIN_ALT3 | PIN_PORTB | PIN10)
|
||||
#define PIN_UART3_RX_2 (PIN_ALT3 | PIN_PORTC | PIN16)
|
||||
#define PIN_UART3_RX_3 (PIN_ALT3 | PIN_PORTE | PIN5)
|
||||
#define PIN_UART3_TX_1 (PIN_ALT3 | PIN_PORTB | PIN11)
|
||||
#define PIN_UART3_TX_2 (PIN_ALT3 | PIN_PORTC | PIN17)
|
||||
#define PIN_UART3_TX_3 (PIN_ALT3 | PIN_PORTE | PIN4)
|
||||
|
||||
#define PIN_UART4_CTS_1 (PIN_ALT3 | PIN_PORTC | PIN13)
|
||||
#define PIN_UART4_CTS_2 (PIN_ALT3 | PIN_PORTE | PIN26)
|
||||
#define PIN_UART4_RTS_1 (PIN_ALT3 | PIN_PORTC | PIN12)
|
||||
#define PIN_UART4_RTS_2 (PIN_ALT3 | PIN_PORTE | PIN27)
|
||||
#define PIN_UART4_RX_1 (PIN_ALT3 | PIN_PORTC | PIN14)
|
||||
#define PIN_UART4_RX_2 (PIN_ALT3 | PIN_PORTE | PIN25)
|
||||
#define PIN_UART4_TX_1 (PIN_ALT3 | PIN_PORTC | PIN15)
|
||||
#define PIN_UART4_TX_2 (PIN_ALT3 | PIN_PORTE | PIN24)
|
||||
|
||||
#define PIN_LPUART0_CTS_B_1 (PIN_ALT5 | PIN_PORTE | PIN10)
|
||||
#define PIN_LPUART0_CTS_B_2 (PIN_ALT5 | PIN_PORTA | PIN0)
|
||||
#define PIN_LPUART0_CTS_B_3 (PIN_ALT5 | PIN_PORTD | PIN11)
|
||||
#define PIN_LPUART0_RTS_B_1 (PIN_ALT5 | PIN_PORTE | PIN11)
|
||||
#define PIN_LPUART0_RTS_B_2 (PIN_ALT5 | PIN_PORTA | PIN3)
|
||||
#define PIN_LPUART0_RTS_B_3 (PIN_ALT5 | PIN_PORTD | PIN10)
|
||||
#define PIN_LPUART0_RX_1 (PIN_ALT5 | PIN_PORTE | PIN9)
|
||||
#define PIN_LPUART0_RX_2 (PIN_ALT5 | PIN_PORTA | PIN1)
|
||||
#define PIN_LPUART0_RX_3 (PIN_ALT5 | PIN_PORTD | PIN8)
|
||||
#define PIN_LPUART0_TX_1 (PIN_ALT5 | PIN_PORTE | PIN8)
|
||||
#define PIN_LPUART0_TX_2 (PIN_ALT5 | PIN_PORTA | PIN2)
|
||||
#define PIN_LPUART0_TX_3 (PIN_ALT5 | PIN_PORTD | PIN9)
|
||||
|
||||
/* USB */
|
||||
|
||||
#define PIN_USB0_CLKIN_1 (PIN_ALT2 | PIN_PORTA | PIN5)
|
||||
#define PIN_USB0_CLKIN_2 (PIN_ALT7 | PIN_PORTE | PIN26)
|
||||
#define PIN_USB0_SOF_OUT_1 (PIN_ALT3 | PIN_PORTC | PIN7)
|
||||
#define PIN_USB0_SOF_OUT_2 (PIN_ALT4 | PIN_PORTC | PIN0)
|
||||
#define PIN_USB0_SOF_OUT_3 (PIN_ALT7 | PIN_PORTE | PIN6)
|
||||
|
||||
#define PIN_USB1_ID_1 (PIN_ALT7 | PIN_PORTE | PIN10)
|
||||
|
||||
/* External Crystal */
|
||||
|
||||
#define PIN_EXTAL0 (PIN_ANALOG | PIN_PORTA | PIN18)
|
||||
#define PIN_XTAL0 (PIN_ANALOG | PIN_PORTA | PIN19)
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Types
|
||||
********************************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Data
|
||||
********************************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
* Public Functions
|
||||
********************************************************************************************/
|
||||
|
||||
#endif /* KINETIS_K66 */
|
||||
#endif /* __ARCH_ARM_SRC_KINETIS_CHP_KINETIS_K66PINMUX_H */
|
@ -56,6 +56,8 @@
|
||||
# include "chip/kinetis_k60memorymap.h"
|
||||
#elif defined(KINETIS_K64)
|
||||
# include "chip/kinetis_k64memorymap.h"
|
||||
#elif defined(KINETIS_K66)
|
||||
# include "chip/kinetis_k66memorymap.h"
|
||||
#else
|
||||
# error "No memory map for this Kinetis part"
|
||||
#endif
|
||||
|
@ -56,6 +56,8 @@
|
||||
# include "chip/kinetis_k60pinmux.h"
|
||||
#elif defined(KINETIS_K64)
|
||||
# include "chip/kinetis_k64pinmux.h"
|
||||
#elif defined(KINETIS_K66)
|
||||
# include "chip/kinetis_k66pinmux.h"
|
||||
#else
|
||||
# error "No pin multiplexing for this Kinetis part"
|
||||
#endif
|
||||
|
@ -278,7 +278,8 @@ void kinetis_pllconfig(void)
|
||||
*
|
||||
* Either the external clock or crystal frequency is used to select the
|
||||
* PRDIV value. Only reference clock frequencies are supported that will
|
||||
* produce a 2MHz reference clock to the PLL.
|
||||
* produce a KINETIS_MCG_PLL_REF_MIN >= PLLIN <= KINETIS_MCG_PLL_REF_MAX
|
||||
* reference clock to the PLL.
|
||||
*/
|
||||
|
||||
putreg8(MCG_C5_PRDIV(BOARD_PRDIV), KINETIS_MCG_C5);
|
||||
|
@ -2808,15 +2808,6 @@ FAR struct sdio_dev_s *sdhc_initialize(int slotno)
|
||||
priv->waitwdog = wd_create();
|
||||
DEBUGASSERT(priv->waitwdog);
|
||||
|
||||
/* Enable clocking to the SDHC module. Clocking is still diabled in
|
||||
* the SYSCTRL register.
|
||||
*/
|
||||
|
||||
regval = getreg32(KINETIS_SIM_SCGC3);
|
||||
regval |= SIM_SCGC3_SDHC;
|
||||
putreg32(regval, KINETIS_SIM_SCGC3);
|
||||
mcinfo("SIM_SCGC3: %08x\n", regval);
|
||||
|
||||
/* In addition to the system clock, the SDHC module needs a clock for the
|
||||
* base for the external card clock. There are four possible sources for
|
||||
* this clock, selected by the SIM's SOPT2 register:
|
||||
@ -2833,6 +2824,16 @@ FAR struct sdio_dev_s *sdhc_initialize(int slotno)
|
||||
putreg32(regval, KINETIS_SIM_SOPT2);
|
||||
mcinfo("SIM_SOPT2: %08x\n", regval);
|
||||
|
||||
/* Enable clocking to the SDHC module. Clocking is still disabled in
|
||||
* the SYSCTRL register.
|
||||
*/
|
||||
|
||||
regval = getreg32(KINETIS_SIM_SCGC3);
|
||||
regval |= SIM_SCGC3_SDHC;
|
||||
putreg32(regval, KINETIS_SIM_SCGC3);
|
||||
mcinfo("SIM_SCGC3: %08x\n", regval);
|
||||
|
||||
|
||||
/* Configure pins for 1 or 4-bit, wide-bus operation (the chip is capable
|
||||
* of 8-bit wide bus operation but D4-D7 are not configured).
|
||||
*
|
||||
|
@ -188,6 +188,17 @@ config ARCH_BOARD_FREEDOM_K64F
|
||||
This port uses the FreeScale FREEDOM-K64F development board. This
|
||||
board uses the Kinetis K64 MK64FN1M0VLL12 Cortex-M4 MCU.
|
||||
|
||||
config ARCH_BOARD_FREEDOM_K66F
|
||||
bool "NXP Freedom-k66f development board"
|
||||
depends on ARCH_CHIP_MK66FN2M0VMD18
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
---help---
|
||||
development board.
|
||||
This port uses the FreeScale FREEDOM-K66F development board. This
|
||||
board uses the Kinetis K66 MK66FN2M0VMD18 Cortex-M4 MCU.
|
||||
|
||||
config ARCH_BOARD_FREEDOM_KL25Z
|
||||
bool "Freescale Freedom KL25Z"
|
||||
depends on ARCH_CHIP_MKL25Z128
|
||||
@ -1377,6 +1388,7 @@ config ARCH_BOARD
|
||||
default "ez80f910200zco" if ARCH_BOARD_EZ80F910200ZCO
|
||||
default "fire-stm32v2" if ARCH_BOARD_FIRE_STM32
|
||||
default "freedom-k64f" if ARCH_BOARD_FREEDOM_K64F
|
||||
default "freedom-k66f" if ARCH_BOARD_FREEDOM_K66F
|
||||
default "freedom-kl25z" if ARCH_BOARD_FREEDOM_KL25Z
|
||||
default "freedom-kl26z" if ARCH_BOARD_FREEDOM_KL26Z
|
||||
default "hymini-stm32v" if ARCH_BOARD_HYMINI_STM32V
|
||||
@ -1581,6 +1593,9 @@ endif
|
||||
if ARCH_BOARD_FREEDOM_K64F
|
||||
source "configs/freedom-k64f/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_FREEDOM_K66F
|
||||
source "configs/freedom-k66f/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_FREEDOM_KL25Z
|
||||
source "configs/freedom-kl25z/Kconfig"
|
||||
endif
|
||||
|
@ -257,7 +257,7 @@ f Application Configuration -> Network Utilities
|
||||
you can enable like DHCP client (or server) or network name
|
||||
resolution.
|
||||
|
||||
By default, the IP address of the DK-TM4C129X will be 10.0.0.2 and
|
||||
By default, the IP address of the FRDM-K64F will be 10.0.0.2 and
|
||||
it will assume that your host is the gateway and has the IP address
|
||||
10.0.0.1.
|
||||
|
||||
@ -287,7 +287,7 @@ f Application Configuration -> Network Utilities
|
||||
the first time you ping due to the default handling of the ARP
|
||||
table.
|
||||
|
||||
On the host side, you should also be able to ping the DK-TM4C129X:
|
||||
On the host side, you should also be able to ping the FRDM-K64F:
|
||||
|
||||
$ ping 10.0.0.2
|
||||
|
||||
@ -424,8 +424,8 @@ SD Card Support
|
||||
------------ ------------- --------
|
||||
SD Card Slot Board Signal K64F Pin
|
||||
------------ ------------- --------
|
||||
DAT0 SDHC0_D0 PTE0
|
||||
DAT1 SDHC0_D1 PTE1
|
||||
DAT0 SDHC0_D0 PTE1
|
||||
DAT1 SDHC0_D1 PTE0
|
||||
DAT2 SDHC0_D2 PTE5
|
||||
CD/DAT3 SDHC0_D3 PTE4
|
||||
CMD SDHC0_CMD PTE3
|
||||
|
@ -526,7 +526,7 @@ CONFIG_MMCSD_SDIO=y
|
||||
# CONFIG_SDIO_PREFLIGHT is not set
|
||||
# CONFIG_SDIO_MUXBUS is not set
|
||||
# CONFIG_SDIO_WIDTH_D1_ONLY is not set
|
||||
CONFIG_SDIO_BLOCKSETUP=y
|
||||
# CONFIG_SDIO_BLOCKSETUP is not set
|
||||
# CONFIG_MODEM is not set
|
||||
# CONFIG_MTD is not set
|
||||
# CONFIG_EEPROM is not set
|
||||
|
@ -51,7 +51,8 @@
|
||||
#include "kinetis.h"
|
||||
#include "freedom-k64f.h"
|
||||
|
||||
#if defined(CONFIG_KINETIS_SPI1) || defined(CONFIG_KINETIS_SPI2)
|
||||
#if defined(CONFIG_KINETIS_SPI0) || defined(CONFIG_KINETIS_SPI1) || \
|
||||
defined(CONFIG_KINETIS_SPI2)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
@ -98,6 +99,20 @@ void weak_function k64_spidev_initialize(void)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI0
|
||||
void kinetis_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI1
|
||||
void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
@ -126,18 +141,4 @@ uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI3
|
||||
void kinetis_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
|
||||
#endif /* CONFIG_KINETIS_SPI0 || CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
|
||||
|
36
configs/freedom-k66f/Kconfig
Normal file
36
configs/freedom-k66f/Kconfig
Normal file
@ -0,0 +1,36 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_FREEDOM_K66F
|
||||
|
||||
config FRDMK66F_SDHC_AUTOMOUNT
|
||||
bool "SDHC automounter"
|
||||
default n
|
||||
depends on FS_AUTOMOUNTER && KINETIS_SDHC
|
||||
|
||||
if FRDMK66F_SDHC_AUTOMOUNT
|
||||
|
||||
config FRDMK66F_SDHC_AUTOMOUNT_FSTYPE
|
||||
string "SDHC file system type"
|
||||
default "vfat"
|
||||
|
||||
config FRDMK66F_SDHC_AUTOMOUNT_BLKDEV
|
||||
string "SDHC block device"
|
||||
default "/dev/mmcsd0"
|
||||
|
||||
config FRDMK66F_SDHC_AUTOMOUNT_MOUNTPOINT
|
||||
string "SDHC mount point"
|
||||
default "/mnt/sdcard"
|
||||
|
||||
config FRDMK66F_SDHC_AUTOMOUNT_DDELAY
|
||||
int "SDHC debounce delay (milliseconds)"
|
||||
default 1000
|
||||
|
||||
config FRDMK66F_SDHC_AUTOMOUNT_UDELAY
|
||||
int "SDHC unmount retry delay (milliseconds)"
|
||||
default 2000
|
||||
|
||||
endif # FRDMK66F_SDHC_AUTOMOUNT
|
||||
endif # ARCH_BOARD_FREEDOM_K66F
|
972
configs/freedom-k66f/README.txt
Normal file
972
configs/freedom-k66f/README.txt
Normal file
@ -0,0 +1,972 @@
|
||||
README.txt
|
||||
==========
|
||||
|
||||
This is the README file for the port of NuttX to the Freescale Freedom-K66F
|
||||
develoment board.
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
o Freedom K66F Features
|
||||
o Serial Console
|
||||
o LEDs and Buttons
|
||||
o Networking Support
|
||||
o SD Card Support
|
||||
o USB Device Controller Support
|
||||
o Development Environment
|
||||
o GNU Toolchain Options
|
||||
o Freedom K66F Configuration Options
|
||||
o Configurations
|
||||
o Status
|
||||
|
||||
Kinetis Freedom K66F Features:
|
||||
=============================
|
||||
|
||||
The features of the FRDM-K66F hardware are as follows:
|
||||
|
||||
- MK66FN2M0VMD18 MCU (180 MHz, 2MB Flash, 256KB RAM, 144MBGA package)
|
||||
- Dual role USB interface with micro-B USB connector
|
||||
- RGB LED
|
||||
- FXOS8700CQ - accelerometer and magnetometer
|
||||
- FXAS21002 - Gyroscope
|
||||
- Two user push buttons
|
||||
- Flexible power supply options – OpenSDAv2.1 USB, K66F USB, and external
|
||||
sources
|
||||
- Easy access to MCU input/output through Arduino R3TM compatible I/O
|
||||
connectors
|
||||
- Programmable OpenSDAv2.1 debug interface with multiple applications
|
||||
available
|
||||
including:
|
||||
o SWD debug interface over a USB HID connection providing run-control
|
||||
debugging and compatibility with IDE tools
|
||||
o Virtual serial port interface
|
||||
- Ethernet
|
||||
- Micro SD
|
||||
- Audio features
|
||||
o Digital MEMS microphone
|
||||
o Auxiliary input jack
|
||||
o Headset/Analog microphone jack
|
||||
o Two optional input for analogue microphone
|
||||
- Optional header for add-on RF module: RF24L01+ Nordic 2.4 GHz Radio
|
||||
- Optional header for add-on Bluetooth module: JY-MCU BT Board V1.05 BT
|
||||
|
||||
OpenSDAv2.1
|
||||
=========
|
||||
|
||||
The FRDM-K66F platform features OpenSDAv2.1, the NXP open-source hardware
|
||||
embedded serial and debug adapter running an open-source bootloader.
|
||||
This circuit offers several options for serial communication, flash
|
||||
programming and run-control debugging. The openSDAv2.1 is loaded with
|
||||
JLink firmware for rapid prototyping and product development, with a focus
|
||||
on connected Internet of Things devices.
|
||||
|
||||
To use set raw binary output for nuttx.bin
|
||||
|
||||
Serial Console
|
||||
==============
|
||||
|
||||
USB VCOM Console
|
||||
----------------
|
||||
The primary serial port interface signals are PTB16 UART0_RX and PTB17
|
||||
UART0_TX. These signals are connected to the OpenSDAv2.1 VCOM circuit.
|
||||
|
||||
Serial Shield Console
|
||||
---------------------
|
||||
An alternative serial port might use a standard serial shield mounted
|
||||
on the Freedom Board. In this case, Arduino pin D1 provides UART TX and
|
||||
pin D0 privides UART RX.
|
||||
|
||||
The I/O headers on the FRDM-K66F board are arranged to enable
|
||||
compatibility with Arduino shield. The outer rows of pins (even numbered
|
||||
pins) on the headers, share the same mechanical spacing and placement with
|
||||
the I/O headers on the Arduino Revision 3 (R3) standard.
|
||||
|
||||
The Arduino D0 and D1 pins then correspond to pins 2 and 4 on the J1 I/O
|
||||
connector:
|
||||
|
||||
Arduino Pin FRDM-K66F J1 Connector
|
||||
------------------------ -----------------------
|
||||
UART RX, Arduino D0 pin Pin 2, PTC3, UART1_RX
|
||||
UART TX, Arduino D1 pin Pin 4, PTC4, UART1_TX
|
||||
|
||||
Default Serial Console
|
||||
----------------------
|
||||
By default, these configuration are setup to use the Serial Console on
|
||||
UART1. That, however, is easily reconfigured.
|
||||
|
||||
LEDs and Buttons
|
||||
================
|
||||
|
||||
RGB LED
|
||||
-------
|
||||
An RGB LED is connected through GPIO as shown below:
|
||||
|
||||
LED K66
|
||||
------ -------------------------------------------------------
|
||||
RED PTC9/ADC1_SE5B/CMP0_IN3/FTM3_CH5/I2S0_RX_BCLK/FB_AD6/SDRAM_A14/FTM_FLT0
|
||||
GREEN PTE6/LLWU_P16/SPI1_PCS3/UART3_CTS/I2S0_MCLK/FTM3_CH1/USB0_SOF_OUT
|
||||
BLUE PTA11/LLWU_P23/FTM2_CH1/MII0_RXCLK/I2C2_SDA/FTM2_QD_PHB/TPM2_CH1
|
||||
|
||||
If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board the
|
||||
Freedom K66. Usage of these LEDs is defined in include/board.h and
|
||||
src/K66_leds.c. The following definitions describe how NuttX controls the LEDs:
|
||||
|
||||
SYMBOL Meaning LED state
|
||||
RED GREEN BLUE
|
||||
------------------- ----------------------- -----------------
|
||||
LED_STARTED NuttX has been started OFF OFF OFF
|
||||
LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
|
||||
LED_IRQSENABLED Interrupts enabled OFF OFF ON
|
||||
LED_STACKCREATED Idle stack created OFF ON OFF
|
||||
LED_INIRQ In an interrupt (no change)
|
||||
LED_SIGNAL In a signal handler (no change)
|
||||
LED_ASSERTION An assertion failed (no change)
|
||||
LED_PANIC The system has crashed FLASH OFF OFF
|
||||
LED_IDLE K66 is in sleep mode (Optional, not used)
|
||||
|
||||
Buttons
|
||||
-------
|
||||
Two push button switches, SW2 and SW3, are available on the FRDM-K66F
|
||||
board. SW2 is connected to PTD11 and SW3 is connected to PTA10.
|
||||
Beside the general purpose IO function, both SW2 and SW3 can be used
|
||||
as a low-leakage wakeup (LLWU) source.
|
||||
|
||||
Switch GPIO Function
|
||||
--------- ---------------------------------------------------------------
|
||||
SW2 PTD11/LLWU_P25/SPI2_PCS0/SDHC0_CLKIN/LPUART0_CTS/FB_A19
|
||||
SW3 PTA10/LLWU_P22/FTM2_CH0/MII0_RXD2/FTM2_QD_PHA/TPM2_CH0/TRACE_D0
|
||||
|
||||
Networking Support
|
||||
==================
|
||||
|
||||
Ethernet MAC/KSZ8081 PHY
|
||||
------------------------
|
||||
------------ ----------------- --------------------------------------------
|
||||
KSZ8081 Board Signal(s) K66F Pin
|
||||
Pin Signal Function pinmux Name
|
||||
--- -------- ----------------- --------------------------------------------
|
||||
1 VDD_1V2 VDDPLL_1.2V --- ---
|
||||
2 VDDA_3V3 VDDA_ENET --- ---
|
||||
3 RXM ENET1_RX- --- ---
|
||||
4 RXP ENET1_RX+ --- ---
|
||||
5 TXM ENET1_TX- --- ---
|
||||
6 TXP ENET1_TX+ --- ---
|
||||
7 X0 RMII_XTAL0 --- ---
|
||||
8 XI RMII_XTAL1 --- ---
|
||||
9 REXT --- ---, Apparently not connected ---
|
||||
10 MDIO RMII0_MDIO PTB0/RMII0_MDIO PIN_RMII0_MDIO
|
||||
11 MDC RMII0_MDC PTB1/RMII0_MDC PIN_RMII0_MDC
|
||||
12 RXD1 RMII0_RXD_1 PTA12/RMII0_RXD1 PIN_RMII0_RXD1
|
||||
13 RXD0 RMII0_RXD_0 PTA13/RMII0_RXD0 PIN_RMII0_RXD0
|
||||
14 VDDIO VDDIO_ENET --- ---
|
||||
15 CRS_DIV PTA14/RMII0_CRS_DV PIN_RMII0_CRS_DV
|
||||
16 REF_CLK PTE26 PTE26(Ethernet clock) PTE26/ENET_1588_CLKIN
|
||||
17 RXER RMII0_RXER PTA5/RMII0_RXER PIN_RMII0_RXER
|
||||
18 INTRP RMII0_INT_B, J14 Pin 2, Apparently not ---
|
||||
PHY_INT_1 available unless jumpered
|
||||
19 TXEN RMII0_TXEN PTA15/RMII0_TXEN PIN_RMII0_TXEN
|
||||
20 TXD0 RMII0_TXD_0 PTA16/RMII0_TXD0 PIN_RMII0_TXD0
|
||||
21 TXD1 RMII0_TXD_1 PTA17/RMII0_TXD1 PIN_RMII0_TXD1
|
||||
22 GND1 --- --- ---
|
||||
24 nRST PHY_RST_B --- ---
|
||||
25 GND2 --- --- ---
|
||||
--- -------- ----------------- --------------------------------------------
|
||||
|
||||
There is no external pull up on MDIO signal when MK66FN2M0VMD18 is
|
||||
requesting status of the Ethernet link connection. Internal pull is
|
||||
required when enabled in port configuration for MDIO signal.
|
||||
|
||||
CONFIG_KINETIS_ENET_MDIOPULLUP=y
|
||||
|
||||
Networking support can be added to NSH by selecting the following
|
||||
configuration options.
|
||||
|
||||
Selecting the EMAC peripheral
|
||||
-----------------------------
|
||||
|
||||
System Type -> Kinetis Peripheral Support
|
||||
CONFIG_KINETIS_ENET=y : Enable the EThernet MAC peripheral
|
||||
|
||||
System Type -> Ethernet Configuration
|
||||
CONFIG_KINETIS_ENETNETHIFS=1
|
||||
CONFIG_KINETIS_ENETNRXBUFFERS=6
|
||||
CONFIG_KINETIS_ENETNTXBUFFERS=2
|
||||
CONFIG_KINETIS_ENET_MDIOPULLUP=y
|
||||
|
||||
Networking Support
|
||||
CONFIG_NET=y : Enable Neworking
|
||||
CONFIG_NET_ETHERNET=y : Support Ethernet data link
|
||||
CONFIG_NET_SOCKOPTS=y : Enable socket operations
|
||||
CONFIG_NET_ETH_MTU=590 : Maximum packet size (MTU) 1518 is more standard
|
||||
CONFIG_NET_ETH_TCP_RECVWNDO=536 : Should be the same as CONFIG_NET_ETH_MTU
|
||||
CONFIG_NET_ARP=y : Enable ARP
|
||||
CONFIG_NET_ARPTAB_SIZE=16 : ARP table size
|
||||
CONFIG_NET_ARP_IPIN=y : Enable ARP address harvesting
|
||||
CONFIG_NET_ARP_SEND=y : Send ARP request before sending data
|
||||
CONFIG_NET_TCP=y : Enable TCP/IP networking
|
||||
CONFIG_NET_TCP_READAHEAD=y : Support TCP read-ahead
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y : Support TCP write-buffering
|
||||
CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog
|
||||
CONFIG_NET_MAX_LISTENPORTS=20 :
|
||||
CONFIG_NET_TCP_READAHEAD_BUFSIZE=536 Read-ahead buffer size
|
||||
CONFIG_NET_UDP=y : Enable UDP networking
|
||||
CONFIG_NET_BROADCAST=y : Needed for DNS name resolution
|
||||
CONFIG_NET_ICMP=y : Enable ICMP networking
|
||||
CONFIG_NET_ICMP_PING=y : Needed for NSH ping command
|
||||
: Defaults should be okay for other options
|
||||
Application Configuration -> Network Utilities
|
||||
CONFIG_NETDB_DNSCLIENT=y : Enable host address resolution
|
||||
CONFIG_NETUTILS_TELNETD=y : Enable the Telnet daemon
|
||||
CONFIG_NETUTILS_TFTPC=y : Enable TFTP data file transfers for get and put commands
|
||||
CONFIG_NETUTILS_NETLIB=y : Network library support is needed
|
||||
CONFIG_NETUTILS_WEBCLIENT=y : Needed for wget support
|
||||
: Defaults should be okay for other options
|
||||
Application Configuration -> NSH Library
|
||||
CONFIG_NSH_TELNET=y : Enable NSH session via Telnet
|
||||
CONFIG_NSH_IPADDR=0x0a000002 : Select a fixed IP address
|
||||
CONFIG_NSH_DRIPADDR=0x0a000001 : IP address of gateway/host PC
|
||||
CONFIG_NSH_NETMASK=0xffffff00 : Netmask
|
||||
CONFIG_NSH_NOMAC=y : Need to make up a bogus MAC address
|
||||
: Defaults should be okay for other options
|
||||
|
||||
You can also enable enable the DHCPC client for networks that use
|
||||
dynamically assigned address:
|
||||
|
||||
Application Configuration -> Network Utilities
|
||||
CONFIG_NETUTILS_DHCPC=y : Enables the DHCP client
|
||||
|
||||
Networking Support
|
||||
CONFIG_NET_UDP=y : Depends on broadcast UDP
|
||||
|
||||
Application Configuration -> NSH Library
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NSH_DHCPC=y : Tells NSH to use DHCPC, not
|
||||
: the fixed addresses
|
||||
|
||||
Using the network with NSH
|
||||
--------------------------
|
||||
|
||||
So what can you do with this networking support? First you see that
|
||||
NSH has several new network related commands:
|
||||
|
||||
ifconfig, ifdown, ifup: Commands to help manage your network
|
||||
get and put: TFTP file transfers
|
||||
wget: HTML file transfers
|
||||
ping: Check for access to peers on the network
|
||||
Telnet console: You can access the NSH remotely via telnet.
|
||||
|
||||
You can also enable other add on features like full FTP or a Web
|
||||
Server or XML RPC and others. There are also other features that
|
||||
you can enable like DHCP client (or server) or network name
|
||||
resolution.
|
||||
|
||||
By default, the IP address of the FRDM-K66F will be 10.0.0.2 and
|
||||
it will assume that your host is the gateway and has the IP address
|
||||
10.0.0.1.
|
||||
|
||||
nsh> ifconfig
|
||||
eth0 HWaddr 00:e0:de:ad:be:ef at UP
|
||||
IPaddr:10.0.0.2 DRaddr:10.0.0.1 Mask:255.255.255.0
|
||||
|
||||
You can use ping to test for connectivity to the host (Careful,
|
||||
Window firewalls usually block ping-related ICMP traffic). On the
|
||||
target side, you can:
|
||||
|
||||
nsh> ping 10.0.0.1
|
||||
PING 10.0.0.1 56 bytes of data
|
||||
56 bytes from 10.0.0.1: icmp_seq=1 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=2 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=3 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=4 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=5 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=6 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=7 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=8 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=9 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=10 time=0 ms
|
||||
10 packets transmitted, 10 received, 0% packet loss, time 10100 ms
|
||||
|
||||
NOTE: In this configuration is is normal to have packet loss > 0%
|
||||
the first time you ping due to the default handling of the ARP
|
||||
table.
|
||||
|
||||
On the host side, you should also be able to ping the FRDM-K66F:
|
||||
|
||||
$ ping 10.0.0.2
|
||||
|
||||
You can also log into the NSH from the host PC like this:
|
||||
|
||||
$ telnet 10.0.0.2
|
||||
Trying 10.0.0.2...
|
||||
Connected to 10.0.0.2.
|
||||
Escape character is '^]'.
|
||||
sh_telnetmain: Session [3] Started
|
||||
|
||||
NuttShell (NSH) NuttX-7.19
|
||||
nsh> help
|
||||
help usage: help [-v] [<cmd>]
|
||||
|
||||
[ echo ifconfig mkdir mw sleep
|
||||
? exec ifdown mkfatfs ping test
|
||||
cat exit ifup mkfifo ps umount
|
||||
cp free kill mkrd put usleep
|
||||
cmp get losetup mh rm wget
|
||||
dd help ls mount rmdir xd
|
||||
df hexdump mb mv sh
|
||||
|
||||
Builtin Apps:
|
||||
nsh>
|
||||
|
||||
NOTE: If you enable this networking as described above, you will
|
||||
experience a delay on booting NSH. That is because the start-up logic
|
||||
waits for the network connection to be established before starting
|
||||
NuttX. In a real application, you would probably want to do the
|
||||
network bringup on a separate thread so that access to the NSH prompt
|
||||
is not delayed.
|
||||
|
||||
This delay will be especially long if the board is not connected to
|
||||
a network. On the order of minutes! You will probably think that
|
||||
NuttX has crashed! And then, when it finally does come up after
|
||||
numerous timeouts and retries, the network will not be available --
|
||||
even if the network cable is plugged in later.
|
||||
|
||||
The long delays can be eliminated by using a separate the network
|
||||
initialization thread discussed below. Recovering after the network
|
||||
becomes available requires the network monitor feature, also discussed
|
||||
below.
|
||||
|
||||
Network Initialization Thread
|
||||
-----------------------------
|
||||
There is a configuration option enabled by CONFIG_NSH_NETINIT_THREAD
|
||||
that will do the NSH network bring-up asynchronously in parallel on
|
||||
a separate thread. This eliminates the (visible) networking delay
|
||||
altogether. This current implementation, however, has some limitations:
|
||||
|
||||
- If no network is connected, the network bring-up will fail and
|
||||
the network initialization thread will simply exit. There are no
|
||||
retries and no mechanism to know if the network initialization was
|
||||
successful (it could perform a network Ioctl to see if the link is
|
||||
up and it now, keep trying, but it does not do that now).
|
||||
|
||||
- Furthermore, there is currently no support for detecting loss of
|
||||
network connection and recovery of the connection (similarly, this
|
||||
thread could poll periodically for network status, but does not).
|
||||
|
||||
Both of these shortcomings could be eliminated by enabling the network
|
||||
monitor:
|
||||
|
||||
Network Monitor
|
||||
---------------
|
||||
By default the network initialization thread will bring-up the network
|
||||
then exit, freeing all of the resources that it required. This is a
|
||||
good behavior for systems with limited memory.
|
||||
|
||||
If the CONFIG_NSH_NETINIT_MONITOR option is selected, however, then the
|
||||
network initialization thread will persist forever; it will monitor the
|
||||
network status. In the event that the network goes down (for example, if
|
||||
a cable is removed), then the thread will monitor the link status and
|
||||
attempt to bring the network back up. In this case the resources
|
||||
required for network initialization are never released.
|
||||
|
||||
Pre-requisites:
|
||||
|
||||
- CONFIG_NSH_NETINIT_THREAD as described above.
|
||||
|
||||
- The K66F EMAC block does not support PHY interrupts. The KSZ8081
|
||||
PHY interrupt line is brought to a jumper block and it should be
|
||||
possible to connect that some some interrupt port pin. You would
|
||||
need to provide some custom logic in the Freedcom K66F
|
||||
configuration to set up that PHY interrupt.
|
||||
|
||||
- In addtion to the PHY interrupt, the Network Monitor also requires the
|
||||
following setting:
|
||||
|
||||
CONFIG_NETDEV_PHY_IOCTL. Enable PHY IOCTL commands in the Ethernet
|
||||
device driver. Special IOCTL commands must be provided by the Ethernet
|
||||
driver to support certain PHY operations that will be needed for link
|
||||
management. There operations are not complex and are implemented for
|
||||
the Atmel SAMA5 family.
|
||||
|
||||
CONFIG_ARCH_PHY_INTERRUPT. This is not a user selectable option.
|
||||
Rather, it is set when you select a board that supports PHY
|
||||
interrupts. For the K66F, like most other architectures, the PHY
|
||||
interrupt must be provided via some board-specific GPIO. In any
|
||||
event, the board-specific logic must provide support for the PHY
|
||||
interrupt. To do this, the board logic must do two things: (1) It
|
||||
must provide the function arch_phy_irq() as described and prototyped
|
||||
in the nuttx/include/nuttx/arch.h, and (2) it must select
|
||||
CONFIG_ARCH_PHY_INTERRUPT in the board configuration file to
|
||||
advertise that it supports arch_phy_irq().
|
||||
|
||||
And a few other things: UDP support is required (CONFIG_NET_UDP) and
|
||||
signals must not be disabled (CONFIG_DISABLE_SIGNALS).
|
||||
|
||||
Given those prerequisites, the network monitor can be selected with these
|
||||
additional settings.
|
||||
|
||||
System Type -> Kinetis Ethernet Configuration
|
||||
CONFIG_ARCH_PHY_INTERRUPT=y : (auto-selected)
|
||||
CONFIG_NETDEV_PHY_IOCTL=y : (auto-selected)
|
||||
|
||||
Application Configuration -> NSH Library -> Networking Configuration
|
||||
CONFIG_NSH_NETINIT_THREAD : Enable the network initialization thread
|
||||
CONFIG_NSH_NETINIT_MONITOR=y : Enable the network monitor
|
||||
CONFIG_NSH_NETINIT_RETRYMSEC=2000 : Configure the network monitor as you like
|
||||
CONFIG_NSH_NETINIT_SIGNO=18
|
||||
|
||||
SD Card Support
|
||||
===============
|
||||
|
||||
Card Slot
|
||||
---------
|
||||
A micro Secure Digital (SD) card slot is available on the FRDM-K66F connected to
|
||||
the SD Host Controller (SDHC) signals of the MCU. This slot will accept micro
|
||||
format SD memory cards. The SD card detect pin (PTD10) is an open switch that
|
||||
shorts with VDD when card is inserted.
|
||||
|
||||
------------ ------------- --------
|
||||
SD Card Slot Board Signal K66F Pin
|
||||
------------ ------------- --------
|
||||
DAT0 SDHC0_D0 PTE1
|
||||
DAT1 SDHC0_D1 PTE0
|
||||
DAT2 SDHC0_D2 PTE5
|
||||
CD/DAT3 SDHC0_D3 PTE4
|
||||
CMD SDHC0_CMD PTE3
|
||||
CLK SDHC0_DCLK PTE2
|
||||
SWITCH D_CARD_DETECT PTD10
|
||||
------------ ------------- --------
|
||||
|
||||
There is no Write Protect pin available to the K66F.
|
||||
|
||||
Configuration Settings
|
||||
----------------------
|
||||
Enabling SDHC support. The Freedom K66F provides one microSD memory card
|
||||
slot. Support for the SD slots can be enabled with the following
|
||||
settings:
|
||||
|
||||
System Type->Kinetic Peripheral Selection
|
||||
CONFIG_KINETIS_SDHC=y : To enable SDHC0 support
|
||||
CONFIG_KINETIS_SDHC_DMA=y : Use SDIO DMA
|
||||
|
||||
System Type
|
||||
CONFIG_KINETIS_GPIOIRQ=y : GPIO interrupts needed
|
||||
CONFIG_KINETIS_PORTEINTS=y : Card detect pin is on PTE6
|
||||
|
||||
Device Drivers -> MMC/SD Driver Support
|
||||
CONFIG_MMCSD=y : Enable MMC/SD support
|
||||
CONFIG_MMSCD_NSLOTS=1 : One slot per driver instance
|
||||
CONFIG_MMCSD_MULTIBLOCK_DISABLE=y : (REVISIT)
|
||||
CONFIG_MMCSD_HAVECARDDETECT=y : Supports card-detect PIOs
|
||||
CONFIG_MMCSD_MMCSUPPORT=n : Interferes with some SD cards
|
||||
CONFIG_MMCSD_SPI=n : No SPI-based MMC/SD support
|
||||
CONFIG_MMCSD_SDIO=y : SDIO-based MMC/SD support
|
||||
CONFIG_SDIO_BLOCKSETUP=y : Needs to know block sizes
|
||||
|
||||
RTOS Features -> Work Queue Support
|
||||
CONFIG_SCHED_WORKQUEUE=y : Driver needs work queue support
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
|
||||
Application Configuration -> NSH Library
|
||||
CONFIG_NSH_ARCHINIT=y : NSH board-initialization, and
|
||||
CONFIG_LIB_BOARDCTL=y : Or
|
||||
CONFIG_BOARD_INITIALIZE=y
|
||||
|
||||
Using the SD card
|
||||
-----------------
|
||||
|
||||
1. After booting, the SDHC device will appear as /dev/mmcsd0.
|
||||
2. If you try mounting an SD card with nothing in the slot, the mount will
|
||||
fail:
|
||||
|
||||
nsh> mount -t vfat /dev/mmcsd0 /mnt/sd0
|
||||
nsh: mount: mount failed: 19
|
||||
|
||||
NSH can be configured to provide errors as strings instead of
|
||||
numbers. But in this case, only the error number is reported. The
|
||||
error numbers can be found in nuttx/include/errno.h:
|
||||
|
||||
#define ENODEV 19
|
||||
#define ENODEV_STR "No such device"
|
||||
|
||||
So the mount command is saying that there is no device or, more
|
||||
correctly, that there is no card in the SD card slot.
|
||||
|
||||
3. Insert the SD card. Then the mount should succeed.
|
||||
|
||||
nsh> mount -t vfat /dev/mmcsd0 /mnt/sd0
|
||||
nsh> ls /mnt/sd1
|
||||
/mnt/sd1:
|
||||
atest.txt
|
||||
nsh> cat /mnt/sd1/atest.txt
|
||||
This is a test
|
||||
|
||||
NOTE: See the next section entitled "Auto-Mounter" for another way
|
||||
to mount your SD card.
|
||||
|
||||
4. Before removing the card, you must umount the file system. This is
|
||||
equivalent to "ejecting" or "safely removing" the card on Windows: It
|
||||
flushes any cached data to an SD card and makes the SD card unavailable
|
||||
to the applications.
|
||||
|
||||
nsh> umount -t /mnt/sd0
|
||||
|
||||
It is now safe to remove the card. NuttX provides into callbacks
|
||||
that can be used by an application to automatically unmount the
|
||||
volume when it is removed. But those callbacks are not used in
|
||||
these configurations.
|
||||
|
||||
Auto-Mounter
|
||||
------------
|
||||
NuttX implements an auto-mounter than can make working with SD cards
|
||||
easier. With the auto-mounter, the file system will be automatically
|
||||
mounted when the SD card is inserted into the SDHC slot and automatically
|
||||
unmounted when the SD card is removed.
|
||||
|
||||
Here is a sample configuration for the auto-mounter:
|
||||
|
||||
File System Configuration
|
||||
CONFIG_FS_AUTOMOUNTER=y
|
||||
|
||||
Board-Specific Options
|
||||
CONFIG_FRDMK66F_SDHC_AUTOMOUNT=y
|
||||
CONFIG_FRDMK66F_SDHC_AUTOMOUNT_FSTYPE="vfat"
|
||||
CONFIG_FRDMK66F_SDHC_AUTOMOUNT_BLKDEV="/dev/mmcsd0"
|
||||
CONFIG_FRDMK66F_SDHC_AUTOMOUNT_MOUNTPOINT="/mnt/sdcard"
|
||||
CONFIG_FRDMK66F_SDHC_AUTOMOUNT_DDELAY=1000
|
||||
CONFIG_FRDMK66F_SDHC_AUTOMOUNT_UDELAY=2000
|
||||
|
||||
WARNING: SD cards should never be removed without first unmounting
|
||||
them. This is to avoid data and possible corruption of the file
|
||||
system. Certainly this is the case if you are writing to the SD card
|
||||
at the time of the removal. If you use the SD card for read-only access,
|
||||
however, then I cannot think of any reason why removing the card without
|
||||
mounting would be harmful.
|
||||
|
||||
USB Device Controller Support
|
||||
==============================
|
||||
|
||||
USB Device Controller Support
|
||||
-----------------------------
|
||||
The USBHS device controller driver is enabled with he following
|
||||
configurationsettings:
|
||||
|
||||
Device Drivers -> USB Device Driver Support
|
||||
CONFIG_USBDEV=y : Enable USB device support
|
||||
For full-speed/low-power mode:
|
||||
CONFIG_USBDEV_DUALSPEED=n : Disable High speed support
|
||||
For high-speed/normal mode:
|
||||
CONFIG_USBDEV_DUALSPEED=y : Enable High speed support
|
||||
CONFIG_USBDEV_DMA=y : Enable DMA methods
|
||||
CONFIG_USBDEV_MAXPOWER=100 : Maximum power consumption
|
||||
CONFIG_USBDEV_SELFPOWERED=y : Self-powered device
|
||||
|
||||
System Type -> Kinetis Peripheral Selection
|
||||
CONFIG_KINETIS_USBOTG=y
|
||||
|
||||
CDC/ACM Device Class
|
||||
--------------------
|
||||
In order to be usable, you must all enabled some class driver(s) for the
|
||||
USBHS device controller. Here, for example, is how to configure the CDC/ACM
|
||||
serial device class:
|
||||
|
||||
Device Drivers -> USB Device Driver Support
|
||||
CONFIG_CDCACM=y : USB Modem (CDC ACM) support
|
||||
CONFIG_CDCACM_EP0MAXPACKET=64 : Enpoint 0 packet size
|
||||
CONFIG_CDCACM_EPINTIN=1 : Interrupt IN endpoint number
|
||||
CONFIG_CDCACM_EPINTIN_FSSIZE=64 : Full speed packet size
|
||||
CONFIG_CDCACM_EPINTIN_HSSIZE=64 : High speed packet size
|
||||
CONFIG_CDCACM_EPBULKOUT=3 : Bulk OUT endpoint number
|
||||
CONFIG_CDCACM_EPBULKOUT_FSSIZE=64 : Full speed packet size
|
||||
CONFIG_CDCACM_EPBULKOUT_HSSIZE=512 : High speed packet size
|
||||
CONFIG_CDCACM_EPBULKIN=2 : Bulk IN endpoint number
|
||||
CONFIG_CDCACM_EPBULKIN_FSSIZE=64 : Full speed packet size
|
||||
CONFIG_CDCACM_EPBULKIN_HSSIZE=512 : High speed packet size
|
||||
CONFIG_CDCACM_NWRREQS=4 : Number of write requests
|
||||
CONFIG_CDCACM_NRDREQS=8 : Number of read requests
|
||||
CONFIG_CDCACM_BULKIN_REQLEN=96 : Size of write request buffer (for full speed)
|
||||
CONFIG_CDCACM_BULKIN_REQLEN=768 : Size of write request buffer (for high speed)
|
||||
CONFIG_CDCACM_RXBUFSIZE=257 : Serial read buffer size
|
||||
CONFIG_CDCACM_TXBUFSIZE=193 : Serial transmit buffer size (for full speed)
|
||||
CONFIG_CDCACM_TXBUFSIZE=769 : Serial transmit buffer size (for high speed)
|
||||
CONFIG_CDCACM_VENDORID=0x0525 : Vendor ID
|
||||
CONFIG_CDCACM_PRODUCTID=0xa4a7 : Product ID
|
||||
CONFIG_CDCACM_VENDORSTR="NuttX" : Vendor string
|
||||
CONFIG_CDCACM_PRODUCTSTR="CDC/ACM Serial" : Product string
|
||||
|
||||
Device Drivers -> Serial Driver Support
|
||||
CONFIG_SERIAL_REMOVABLE=y : Support for removable serial device
|
||||
|
||||
The CDC/ACM application provides commands to connect and disconnect the
|
||||
CDC/ACM serial device:
|
||||
|
||||
CONFIG_SYSTEM_CDCACM=y : Enable connect/disconnect support
|
||||
CONFIG_SYSTEM_CDCACM_DEVMINOR=0 : Use device /dev/ttyACM0
|
||||
CONFIG_CDCACM_RXBUFSIZE=??? : A large RX may be needed
|
||||
|
||||
If you include this CDC/ACM application, then you can connect the CDC/ACM
|
||||
serial device to the host by entering the command 'sercon' and you detach
|
||||
the serial device with the command 'serdis'. If you do no use this
|
||||
application, they you will have to write logic in your board initialization
|
||||
code to initialize and attach the USB device.
|
||||
|
||||
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 supports several GNU-based toolchains under Linux,
|
||||
Cygwin under Windows, and Windoes native. To select a toolchain:
|
||||
|
||||
1. Use 'make menuconfig' and select the toolchain that you are using
|
||||
under the System Type menu.
|
||||
2. The default toolchain is the NuttX buildroot under Linux or Cygwin:
|
||||
|
||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y
|
||||
|
||||
If you are not using CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT, then you may
|
||||
also have to modify the PATH in the setenv.h file if your make cannot
|
||||
find the tools.
|
||||
|
||||
NOTE: Using native Windows toolchains under Cygwin has some limitations.
|
||||
This incuudes the CodeSourcery (for Windows) and devkitARM toolchains are
|
||||
Windows native toolchains. The biggest limitations 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.
|
||||
|
||||
Freedom K66F Configuration Options
|
||||
==================================
|
||||
|
||||
CONFIG_ARCH - Identifies the arch/ subdirectory. This sould
|
||||
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_CORTEXM4=y
|
||||
|
||||
CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory
|
||||
|
||||
CONFIG_ARCH_CHIP=kinetis
|
||||
|
||||
CONFIG_ARCH_CHIP_name - For use in C code to identify the exact
|
||||
chip:
|
||||
|
||||
CONFIG_ARCH_CHIP_MK66FN2M0VMD18
|
||||
|
||||
CONFIG_ARCH_BOARD - Identifies the configs subdirectory and
|
||||
hence, the board that supports the particular chip or SoC.
|
||||
|
||||
CONFIG_ARCH_BOARD="freedom-K66F" (for the Freedom K66F development board)
|
||||
|
||||
CONFIG_ARCH_BOARD_name - For use in C code
|
||||
|
||||
CONFIG_ARCH_BOARD_FREEDOM_K66F=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_RAM_SIZE - Describes the installed DRAM (SRAM in this case):
|
||||
|
||||
CONFIG_RAM_SIZE=0x00040000 (256Kb)
|
||||
|
||||
CONFIG_RAM_START - The start address of installed DRAM
|
||||
|
||||
CONFIG_RAM_START=0x1fff0000
|
||||
|
||||
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_KINETIS_TRACE -- Enable trace clocking on power up.
|
||||
CONFIG_KINETIS_FLEXBUS -- Enable flexbus clocking on power up.
|
||||
CONFIG_KINETIS_UART0 -- Support UART0
|
||||
CONFIG_KINETIS_UART1 -- Support UART1
|
||||
CONFIG_KINETIS_UART2 -- Support UART2
|
||||
CONFIG_KINETIS_UART3 -- Support UART3
|
||||
CONFIG_KINETIS_UART4 -- Support UART4
|
||||
CONFIG_KINETIS_UART5 -- Support UART5
|
||||
CONFIG_KINETIS_ENET -- Support Ethernet (K5x, K6x, and K7x only)
|
||||
CONFIG_KINETIS_RNGB -- Support the random number generator(K6x only)
|
||||
CONFIG_KINETIS_FLEXCAN0 -- Support FlexCAN0
|
||||
CONFIG_KINETIS_FLEXCAN1 -- Support FlexCAN1
|
||||
CONFIG_KINETIS_SPI0 -- Support SPI0
|
||||
CONFIG_KINETIS_SPI1 -- Support SPI1
|
||||
CONFIG_KINETIS_SPI2 -- Support SPI2
|
||||
CONFIG_KINETIS_I2C0 -- Support I2C0
|
||||
CONFIG_KINETIS_I2C1 -- Support I2C1
|
||||
CONFIG_KINETIS_I2C2 -- Support I2C2
|
||||
CONFIG_KINETIS_I2C3 -- Support I2C3
|
||||
CONFIG_KINETIS_I2S -- Support I2S
|
||||
CONFIG_KINETIS_DAC0 -- Support DAC0
|
||||
CONFIG_KINETIS_DAC1 -- Support DAC1
|
||||
CONFIG_KINETIS_ADC0 -- Support ADC0
|
||||
CONFIG_KINETIS_ADC1 -- Support ADC1
|
||||
CONFIG_KINETIS_CMP -- Support CMP
|
||||
CONFIG_KINETIS_VREF -- Support VREF
|
||||
CONFIG_KINETIS_SDHC -- Support SD host controller
|
||||
CONFIG_KINETIS_FTM0 -- Support FlexTimer 0
|
||||
CONFIG_KINETIS_FTM1 -- Support FlexTimer 1
|
||||
CONFIG_KINETIS_FTM2 -- Support FlexTimer 2
|
||||
CONFIG_KINETIS_FTM3 -- Support FlexTimer 3
|
||||
CONFIG_KINETIS_LPTIMER -- Support the low power timer
|
||||
CONFIG_KINETIS_RTC -- Support RTC
|
||||
CONFIG_KINETIS_SLCD -- Support the segment LCD (K3x, K4x, and K5x only)
|
||||
CONFIG_KINETIS_EWM -- Support the external watchdog
|
||||
CONFIG_KINETIS_CMT -- Support Carrier Modulator Transmitter
|
||||
CONFIG_KINETIS_USBOTG -- Support USB OTG (see also CONFIG_USBHOST and CONFIG_USBDEV)
|
||||
CONFIG_KINETIS_USBDCD -- Support the USB Device Charger Detection module
|
||||
CONFIG_KINETIS_LLWU -- Support the Low Leakage Wake-Up Unit
|
||||
CONFIG_KINETIS_TSI -- Support the touch screeen interface
|
||||
CONFIG_KINETIS_FTFL -- Support FLASH
|
||||
CONFIG_KINETIS_DMA -- Support DMA
|
||||
CONFIG_KINETIS_CRC -- Support CRC
|
||||
CONFIG_KINETIS_PDB -- Support the Programmable Delay Block
|
||||
CONFIG_KINETIS_PIT -- Support Programmable Interval Timers
|
||||
CONFIG_ARM_MPU -- Support the MPU
|
||||
CONFIG_ARM_CAU -- Support the Cryptographic Acceleration Unit
|
||||
|
||||
Kinetis interrupt priorities (Default is the mid priority). These should
|
||||
not be set because they can cause unhandled, nested interrupts. All
|
||||
interrupts need to be at the default priority in the current design.
|
||||
|
||||
CONFIG_KINETIS_UART0PRIO
|
||||
CONFIG_KINETIS_UART1PRIO
|
||||
CONFIG_KINETIS_UART2PRIO
|
||||
CONFIG_KINETIS_UART3PRIO
|
||||
CONFIG_KINETIS_UART4PRIO
|
||||
CONFIG_KINETIS_UART5PRIO
|
||||
|
||||
CONFIG_KINETIS_EMACTMR_PRIO
|
||||
CONFIG_KINETIS_EMACTX_PRIO
|
||||
CONFIG_KINETIS_EMACRX_PRIO
|
||||
CONFIG_KINETIS_EMACMISC_PRIO
|
||||
|
||||
CONFIG_KINETIS_SDHC_PRIO
|
||||
|
||||
PIN Interrupt Support
|
||||
|
||||
CONFIG_KINETIS_GPIOIRQ -- Enable pin interrupt support. Also needs
|
||||
one or more of the following:
|
||||
CONFIG_KINETIS_PORTAINTS -- Support 32 Port A interrupts
|
||||
CONFIG_KINETIS_PORTBINTS -- Support 32 Port B interrupts
|
||||
CONFIG_KINETIS_PORTCINTS -- Support 32 Port C interrupts
|
||||
CONFIG_KINETIS_PORTDINTS -- Support 32 Port D interrupts
|
||||
CONFIG_KINETIS_PORTEINTS -- Support 32 Port E interrupts
|
||||
|
||||
Kinetis K66 specific device driver settings
|
||||
|
||||
CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn (n=0..5) for the
|
||||
console and ttys0 (default is the UART1).
|
||||
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.
|
||||
CONFIG_UARTn_BITS - The number of bits. Must be either 8 or 8.
|
||||
CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
|
||||
|
||||
Kenetis ethernet controller settings
|
||||
|
||||
CONFIG_ENET_NRXBUFFERS - Number of RX buffers. The size of one
|
||||
buffer is determined by CONFIG_NET_ETH_MTU. Default: 6
|
||||
CONFIG_ENET_NTXBUFFERS - Number of TX buffers. The size of one
|
||||
buffer is determined by CONFIG_NET_ETH_MTU. Default: 2
|
||||
CONFIG_ENET_USEMII - Use MII mode. Default: RMII mode.
|
||||
CONFIG_ENET_PHYADDR - PHY address
|
||||
|
||||
Configurations
|
||||
==============
|
||||
|
||||
Each Freedom K66F configuration is maintained in a sub-directory and
|
||||
can be selected as follow:
|
||||
|
||||
cd tools
|
||||
./configure.sh freedom-K66F/<subdir>
|
||||
cd -
|
||||
. ./setenv.sh
|
||||
|
||||
Where <subdir> is one of the following:
|
||||
|
||||
netnsh:
|
||||
------
|
||||
This configuration is identical to the nsh configuration described
|
||||
below except that networking support is enabled.
|
||||
|
||||
NOTES:
|
||||
|
||||
1. This configuration uses the mconf-based configuration tool. To
|
||||
change this configuration using that tool, you should:
|
||||
|
||||
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
||||
see additional README.txt files in the NuttX tools repository.
|
||||
|
||||
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
||||
reconfiguration process.
|
||||
|
||||
2. Default platform/toolchain:
|
||||
|
||||
CONFIG_HOST_WINDOWS=y : Cygwin under Windows
|
||||
CONFIG_WINDOWS_CYGWIN=y
|
||||
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : ARM/mbed toolcahin (arm-none-elf-gcc)
|
||||
CONFIG_INTELHEX_BINARY=y : Output formats: Intel hex binary
|
||||
|
||||
3. The Serial Console is provided on UART1 with the correct pin
|
||||
configuration for use with an Arduino Serial Shield.
|
||||
|
||||
4. SDHC support is not enabled in this configuration. Refer to the
|
||||
configuration settings listed above under "SD Card Support".
|
||||
|
||||
5. Support for NSH built-in applications is enabled, but no built-in
|
||||
applications have been configured in.
|
||||
|
||||
6. No external pullup is available on MDIO signal when MK66FN1M0VLL12 MCU
|
||||
is requests status of the Ethernet link connection. Internal pullup is
|
||||
required when port configuration for MDIO signal is enabled:
|
||||
|
||||
CONFIG_KINETIS_ENET_MDIOPULLUP=y
|
||||
|
||||
7. Configured to use a fixed IPv4 address:
|
||||
|
||||
CONFIG_NSH_IPADDR=0x0a000002
|
||||
CONFIG_NSH_DRIPADDR=0x0a000001
|
||||
CONFIG_NSH_NETMASK=0xffffff00
|
||||
|
||||
And a bogus MAC address:
|
||||
|
||||
CONFIG_NSH_NOMAC=y
|
||||
CONFIG_NSH_SWMAC=y
|
||||
CONFIG_NSH_MACADDR=0x00e0deadbeef
|
||||
|
||||
nsh:
|
||||
---
|
||||
Configures the NuttShell (nsh) located at apps/examples/nsh using a
|
||||
serial console on UART1.
|
||||
|
||||
NOTES:
|
||||
|
||||
1. This configuration uses the mconf-based configuration tool. To
|
||||
change this configuration using that tool, you should:
|
||||
|
||||
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
||||
see additional README.txt files in the NuttX tools repository.
|
||||
|
||||
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
||||
reconfiguration process.
|
||||
|
||||
2. Default platform/toolchain:
|
||||
|
||||
CONFIG_HOST_WINDOWS=y : Cygwin under Windows
|
||||
CONFIG_WINDOWS_CYGWIN=y
|
||||
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : ARM/mbed toolcahin (arm-none-elf-gcc)
|
||||
CONFIG_INTELHEX_BINARY=y : Output formats: Intel hex binary
|
||||
|
||||
3. The Serial Console is provided on UART1 with the correct pin
|
||||
configuration to use a RS-232 shield. This can be switched to UART0
|
||||
for use with the OpenSDAv2.1 VCOM by reconfiguring the serial console.
|
||||
|
||||
+CONFIG_KINETIS_UART0=y
|
||||
-CONFIG_KINETIS_UART1=y
|
||||
+CONFIG_UART0_SERIALDRIVER=y
|
||||
-CONFIG_UART1_SERIALDRIVER=y
|
||||
+CONFIG_UART0_SERIAL_CONSOLE=y
|
||||
-CONFIG_UART1_SERIAL_CONSOLE=y
|
||||
+CONFIG_UART0_RXBUFSIZE=256
|
||||
-CONFIG_UART1_RXBUFSIZE=256
|
||||
+CONFIG_UART0_TXBUFSIZE=256
|
||||
-CONFIG_UART1_TXBUFSIZE=256
|
||||
+CONFIG_UART0_BAUD=115200
|
||||
1CONFIG_UART1_BAUD=115200
|
||||
+CONFIG_UART0_BITS=8
|
||||
-CONFIG_UART1_BITS=8
|
||||
+CONFIG_UART0_PARITY=0
|
||||
-CONFIG_UART1_PARITY=0
|
||||
+CONFIG_UART0_2STOP=0
|
||||
-CONFIG_UART1_2STOP=0
|
||||
|
||||
NOTE: On my Windows 10 / Cygwin64 system, the OpenSDAv2.1 VCOM is not
|
||||
recognized. I probably need to install a driver?
|
||||
|
||||
There is a serial USB driver on the mbed web site. However, this
|
||||
driver would not install on Windows 10 for me. I understand that
|
||||
it installs OK on Windows 7.
|
||||
|
||||
4. Support for NSH built-in applications is enabled, but no built-in
|
||||
applications have been configured in.
|
||||
|
||||
5. An SDHC driver is enabled in this configuration but does not yet work.
|
||||
The basic problem seems to be that it does not sense the presence of
|
||||
the SD card on PTD10. No interrupts are generated when the SD card is
|
||||
inserted or removed. You might want to disable SDHC and MMC/SD if
|
||||
you are using this configuration. Refer to the configuration
|
||||
settings listed above under "SD Card Support".
|
||||
TODO:Verify Claim
|
||||
|
||||
Status
|
||||
======
|
||||
|
||||
2016-07-12: Added support for the KSZ8081 PHY and added the netnsh
|
||||
configuration. The network is basically functional. More testing is
|
||||
needed, but I have not seen any obvious network failures.
|
||||
|
||||
In testing, I notice a strange thing. If I run at full optimization the
|
||||
code runs (albeit with bugs-to-be-solved). But with no optimization or
|
||||
even at -O1, the system fails to boot. This seems to be related to the
|
||||
watchdog timer - this is due to the fact that in-lined get/putreg are
|
||||
not inlined and the delay allows for the WD to timeout.
|
||||
|
||||
2016-07-13: Add SD automounter logic; broke out SDHC logic into a separate
|
||||
file. The nsh configuration now has SDHC enabled be default. Does not
|
||||
yet work. The basic problem seems to be that it does not sense the
|
||||
presence of the SD card on PTE6. No interrupts are generated when the
|
||||
SD card is inserted or removed. You might want to disable SDHC and
|
||||
MMC/SD if you are using this configuration.
|
||||
|
||||
The nsh configuration now builds successfully with USB device enabled.
|
||||
USB device, however, has not yet been tested. I have not yet looked
|
||||
into 48MHz clocking requirements.
|
317
configs/freedom-k66f/include/board.h
Normal file
317
configs/freedom-k66f/include/board.h
Normal file
@ -0,0 +1,317 @@
|
||||
/************************************************************************************
|
||||
* configs/freedom-k66f/include/board.h
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* 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 __CONFIG_FREEDOM_K66F_INCLUDE_BOARD_H
|
||||
#define __CONFIG_FREEDOM_K66F_INCLUDE_BOARD_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Clocking *************************************************************************/
|
||||
/* The Freedom K66F uses a 12Mhz external Oscillator. The Kinetis MCU startup from an
|
||||
* internal digitally-controlled oscillator (DCO). Nuttx will enable the main external
|
||||
* oscillator (EXTAL0/XTAL0). The external oscillator/resonator can range from
|
||||
* 32.768 KHz up to 50 MHz. The default external source for the MCG oscillator inputs
|
||||
* is 12 MHz oscillator
|
||||
*
|
||||
* X501 a High-frequency, low-power Xtal
|
||||
*
|
||||
*/
|
||||
|
||||
#define BOARD_EXTAL_LP 1
|
||||
#define BOARD_EXTAL_FREQ 12000000 /* 12MHz Oscillator */
|
||||
#define BOARD_XTAL32_FREQ 32768 /* 32KHz RTC Oscillator */
|
||||
|
||||
/* PLL Configuration. Either the external clock or crystal frequency is used to
|
||||
* select the PRDIV value. Only reference clock frequencies are supported that will
|
||||
* produce a KINETIS_MCG_PLL_REF_MIN >= PLLIN <=KINETIS_MCG_PLL_REF_MAX reference
|
||||
* clock to the PLL.
|
||||
*
|
||||
* PLL Input frequency: PLLIN = REFCLK / PRDIV = 12 Mhz / 1 = 12 MHz
|
||||
* PLL Output frequency: PLLOUT = PLLIN * VDIV = 12 Mhz * 30 = 360 MHz
|
||||
* MCG Frequency: PLLOUT = 180 Mhz = 360 MHz / KINETIS_MCG_PLL_INTERNAL_DIVBY
|
||||
*
|
||||
* PRDIV register value is the divider minus KINETIS_MCG_C5_PRDIV_BASE.
|
||||
* VDIV register value is offset by KINETIS_MCG_C6_VDIV_BASE.
|
||||
*/
|
||||
|
||||
#define BOARD_PRDIV 1 /* PLL External Reference Divider */
|
||||
#define BOARD_VDIV 30 /* PLL VCO Divider (frequency multiplier) */
|
||||
|
||||
/* Define additional MCG_C2 Setting */
|
||||
|
||||
#define BOARD_MCG_C2_FCFTRIM 0 /* Do not enable FCFTRIM */
|
||||
#define BOARD_MCG_C2_LOCRE0 MCG_C2_LOCRE0 /* Enable reset on loss of clock */
|
||||
|
||||
#define BOARD_PLLIN_FREQ (BOARD_EXTAL_FREQ / BOARD_PRDIV)
|
||||
#define BOARD_PLLOUT_FREQ (BOARD_PLLIN_FREQ * BOARD_VDIV)
|
||||
#define BOARD_MCG_FREQ (BOARD_PLLOUT_FREQ/KINETIS_MCG_PLL_INTERNAL_DIVBY)
|
||||
|
||||
/* SIM CLKDIV1 dividers */
|
||||
|
||||
#define BOARD_OUTDIV1 1 /* Core = MCG, 180 MHz */
|
||||
#define BOARD_OUTDIV2 3 /* Bus = MCG / 3, 60 MHz */
|
||||
#define BOARD_OUTDIV3 3 /* FlexBus = MCG / 3, 60 MHz */
|
||||
#define BOARD_OUTDIV4 7 /* Flash clock = MCG / 7, 25.7 MHz */
|
||||
|
||||
#define BOARD_CORECLK_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV1)
|
||||
#define BOARD_BUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV2)
|
||||
#define BOARD_FLEXBUS_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV3)
|
||||
#define BOARD_FLASHCLK_FREQ (BOARD_MCG_FREQ / BOARD_OUTDIV4)
|
||||
|
||||
/* SDHC clocking ********************************************************************/
|
||||
|
||||
/* SDCLK configurations corresponding to various modes of operation. Formula is:
|
||||
*
|
||||
* SDCLK frequency = (base clock) / (prescaler * divisor)
|
||||
*
|
||||
* The SDHC module is always configure configured so that the core clock is the base
|
||||
* clock. Possible values for presscaler and divisor are:
|
||||
*
|
||||
* SDCLKFS: {2, 4, 8, 16, 32, 63, 128, 256}
|
||||
* DVS: {1..16}
|
||||
*/
|
||||
|
||||
/* Identification mode: Optimal 400KHz, Actual 180MHz / (32 * 15) = 375 Khz */
|
||||
|
||||
#define BOARD_SDHC_IDMODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV32
|
||||
#define BOARD_SDHC_IDMODE_DIVISOR SDHC_SYSCTL_DVS_DIV(15)
|
||||
|
||||
/* MMC normal mode: Optimal 20MHz, Actual 180MHz / (2 * 5) = 18 MHz */
|
||||
|
||||
#define BOARD_SDHC_MMCMODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
|
||||
#define BOARD_SDHC_MMCMODE_DIVISOR SDHC_SYSCTL_DVS_DIV(5)
|
||||
|
||||
/* SD normal mode (1-bit): Optimal 20MHz, Actual 180MHz / (2 * 5) = 18 MHz */
|
||||
|
||||
#define BOARD_SDHC_SD1MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
|
||||
#define BOARD_SDHC_SD1MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(5)
|
||||
|
||||
/* SD normal mode (4-bit): Optimal 25MHz, Actual 180MHz / (2 * 4) = 22.5 MHz (with DMA)
|
||||
* SD normal mode (4-bit): Optimal 20MHz, Actual 180MHz / (2 * 4) = 22.5 MHz (no DMA)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SDIO_DMA
|
||||
# define BOARD_SDHC_SD4MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
|
||||
# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(4)
|
||||
#else
|
||||
# define BOARD_SDHC_SD4MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
|
||||
# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(4)
|
||||
#endif
|
||||
|
||||
/* PWM Configuration */
|
||||
/* FTM0 Channels */
|
||||
/* Channels can be modified using kinetis_k66pinmux.h */
|
||||
|
||||
#define GPIO_FTM0_CH0OUT PIN_FTM0_CH0_1
|
||||
#define GPIO_FTM0_CH1OUT PIN_FTM0_CH1_1
|
||||
#define GPIO_FTM0_CH2OUT PIN_FTM0_CH2_2
|
||||
#define GPIO_FTM0_CH3OUT PIN_FTM0_CH3_1
|
||||
#define GPIO_FTM0_CH4OUT PIN_FTM0_CH4_1
|
||||
#define GPIO_FTM0_CH5OUT PIN_FTM0_CH5_1
|
||||
|
||||
/* LED definitions ******************************************************************/
|
||||
/* The Freedom K66F has a single RGB LED driven by the K66F as follows:
|
||||
*
|
||||
* LED K66
|
||||
* ------ -------------------------------------------------------
|
||||
* RED PTB22/SPI2_SOUT/FB_AD29/CMP2_OUT
|
||||
* BLUE PTB21/SPI2_SCK/FB_AD30/CMP1_OUT
|
||||
* GREEN PTE26/ENET_1588_CLKIN/UART4_CTS_b/RTC_CLKOUT/USB0_CLKIN
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* LED index values for use with board_userled() */
|
||||
|
||||
#define BOARD_LED_R 0
|
||||
#define BOARD_LED_G 1
|
||||
#define BOARD_LED_B 2
|
||||
#define BOARD_NLEDS 3
|
||||
|
||||
/* LED bits for use with board_userled_all() */
|
||||
|
||||
#define BOARD_LED_R_BIT (1 << BOARD_LED_R)
|
||||
#define BOARD_LED_G_BIT (1 << BOARD_LED_G)
|
||||
#define BOARD_LED_B_BIT (1 << BOARD_LED_B)
|
||||
|
||||
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board
|
||||
* the Freedom K66F. The following definitions describe how NuttX controls
|
||||
* the LEDs:
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* RED GREEN BLUE
|
||||
* ------------------- ---------------------------- ----------------- */
|
||||
#define LED_STARTED 1 /* NuttX has been started OFF OFF OFF */
|
||||
#define LED_HEAPALLOCATE 2 /* Heap has been allocated OFF OFF ON */
|
||||
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF ON */
|
||||
#define LED_STACKCREATED 3 /* Idle stack created OFF ON OFF */
|
||||
#define LED_INIRQ 0 /* In an interrupt (no change) */
|
||||
#define LED_SIGNAL 0 /* In a signal handler (no change) */
|
||||
#define LED_ASSERTION 0 /* An assertion failed (no change) */
|
||||
#define LED_PANIC 4 /* The system has crashed FLASH OFF OFF */
|
||||
#undef LED_IDLE /* K66 is in sleep mode (Not used) */
|
||||
|
||||
/* Button definitions ***************************************************************/
|
||||
/* Two push buttons, SW2 and SW3, are available on FRDM-K66F board, where SW2 is
|
||||
* connected to PTC6 and SW3 is connected to PTA4. Besides the general purpose
|
||||
* input/output functions, SW2 and SW3 can be low-power wake up signal. Also, only
|
||||
* SW3 can be a non-maskable interrupt.
|
||||
*
|
||||
* Switch GPIO Function
|
||||
* --------- ---------------------------------------------------------------
|
||||
* SW2 PTC6/SPI0_SOUT/PD0_EXTRG/I2S0_RX_BCLK/FB_AD9/I2S0_MCLK/LLWU_P10
|
||||
* SW3 PTA4/FTM0_CH1/NMI_b/LLWU_P3
|
||||
*/
|
||||
|
||||
#define BUTTON_SW2 0
|
||||
#define BUTTON_SW3 1
|
||||
#define NUM_BUTTONS 2
|
||||
|
||||
#define BUTTON_SW2_BIT (1 << BUTTON_SW2)
|
||||
#define BUTTON_SW3_BIT (1 << BUTTON_SW3)
|
||||
|
||||
/* Alternative pin resolution *******************************************************/
|
||||
/* If there are alternative configurations for various pins in the
|
||||
* kinetis_k66pinmux.h header file, those alternative pins will be labeled with a
|
||||
* suffix like _1, _2, etc. The logic in this file must select the correct pin
|
||||
* configuration for the board by defining a pin configuration (with no suffix) that
|
||||
* maps to the correct alternative.
|
||||
*/
|
||||
|
||||
/* The primary serial port interface signals are PTB16 UART0_RX and PTB17 UART0_TX.
|
||||
* These signals are connected to the OpenSDAv2 circuit.
|
||||
*/
|
||||
|
||||
#define PIN_UART0_RX PIN_UART0_RX_3
|
||||
#define PIN_UART0_TX PIN_UART0_TX_3
|
||||
|
||||
/* An alternative serial port might use a standard serial shield mounted
|
||||
* on the Freedom Board. In this case, Arduino pin D1 provides UART TX and
|
||||
* pin D0 privies UART RX.
|
||||
*
|
||||
* The I/O headers on the FRDM-K66F board are arranged to enable
|
||||
* compatibility with Arduino shield. The outer rows of pins (even numbered
|
||||
* pins) on the headers, share the same mechanical spacing and placement with
|
||||
* the I/O headers on the Arduino Revision 3 (R3) standard.
|
||||
*
|
||||
* The Arduino D0 and D1 pins then correspond to pins 2 and 4 on the J1 I/O
|
||||
* connector:
|
||||
*
|
||||
* Arduino Pin FRDM-K66F J1 Connector
|
||||
* ------------------------ -----------------------
|
||||
* UART RX, Arduino D0 pin Pin 2, PTC3, UART1_RX
|
||||
* UART TX, Arduino D1 pin Pin 4, PTC4, UART1_TX
|
||||
* ------------------------ -----------------------
|
||||
*
|
||||
*/
|
||||
|
||||
#define PIN_UART1_RX PIN_UART1_RX_1
|
||||
#define PIN_UART1_TX PIN_UART1_TX_1
|
||||
|
||||
/* Bluetooth header
|
||||
*
|
||||
* J199 Pin Name K66 Name
|
||||
* -------- ----- ------ ---------
|
||||
* 3 BT_TX PTC14 UART4_RX
|
||||
* 4 BT_RX PTC15 UART4_TX
|
||||
* -------- ----- ------ ---------
|
||||
*/
|
||||
|
||||
#define PIN_UART4_RX PIN_UART4_RX_1
|
||||
#define PIN_UART4_TX PIN_UART4_TX_1
|
||||
|
||||
/* I2C INERTIAL SENSOR (Gyroscope)
|
||||
*
|
||||
* Pin Name K66 Name
|
||||
* ---- ----- ------ ---------
|
||||
* 11 SCL PTD8 2C0_SCL
|
||||
* 12 SDA PTD9 2C0_SDA
|
||||
*/
|
||||
|
||||
#define PIN_I2C0_SCL PIN_I2C0_SCL_3
|
||||
#define PIN_I2C0_SDA PIN_I2C0_SDA_3
|
||||
|
||||
/************************************************************************************
|
||||
* Public Data
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: kinetis_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* All STM32 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 kinetis_boardinitialize(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIG_FREEDOM_K66F_INCLUDE_BOARD_H */
|
112
configs/freedom-k66f/netnsh/Make.defs
Normal file
112
configs/freedom-k66f/netnsh/Make.defs
Normal file
@ -0,0 +1,112 @@
|
||||
############################################################################
|
||||
# configs/freedom-k66f/netnsh/Make.defs
|
||||
#
|
||||
# Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
# Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
# David Sidrane <david_s5@nscdg.com>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/flash.ld}"
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/flash.ld
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
ARCHDEFINES =
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
ASMEXT = .S
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
|
1186
configs/freedom-k66f/netnsh/defconfig
Normal file
1186
configs/freedom-k66f/netnsh/defconfig
Normal file
File diff suppressed because it is too large
Load Diff
77
configs/freedom-k66f/netnsh/setenv.sh
Normal file
77
configs/freedom-k66f/netnsh/setenv.sh
Normal file
@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
# configs/freedom-k66f/netnsh/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
if [ "$_" = "$0" ] ; then
|
||||
echo "You must source this script, not run it!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WD=`pwd`
|
||||
if [ ! -x "setenv.sh" ]; then
|
||||
echo "This script must be executed from the top-level NuttX build directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${PATH_ORIG}" ]; then
|
||||
export PATH_ORIG="${PATH}"
|
||||
fi
|
||||
|
||||
# This is the Cygwin path to the location where I installed the Atmel GCC
|
||||
# toolchain under Windows. You will also have to edit this if you install
|
||||
# this toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin"
|
||||
|
||||
# This is the Cygwin path to the location where I installed the CodeSourcery
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the CodeSourcery toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
|
||||
# export TOOLCHAIN_BIN="/cygdrive/c/Users/MyName/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
|
||||
|
||||
# This is the location where I installed the ARM "GNU Tools for ARM Embedded Processors"
|
||||
# You can this free toolchain here https://launchpad.net/gcc-arm-embedded
|
||||
export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q2/bin"
|
||||
|
||||
# This is the path to the location where I installed the devkitARM toolchain
|
||||
# You can get this free toolchain from http://devkitpro.org/ or http://sourceforge.net/projects/devkitpro/
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/devkitARM/bin"
|
||||
|
||||
# This is the Cygwin path to the location where I build the buildroot
|
||||
# toolchain.
|
||||
#export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
|
||||
|
||||
# Add the path to the toolchain to the PATH varialble
|
||||
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||
|
||||
echo "PATH : ${PATH}"
|
112
configs/freedom-k66f/nsh/Make.defs
Normal file
112
configs/freedom-k66f/nsh/Make.defs
Normal file
@ -0,0 +1,112 @@
|
||||
############################################################################
|
||||
# configs/freedom-k66f/nsh/Make.defs
|
||||
#
|
||||
# Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
# Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
# David Sidrane <david_s5@nscdg.com>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/flash.ld}"
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/flash.ld
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
ARCHDEFINES =
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
ASMEXT = .S
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
|
1110
configs/freedom-k66f/nsh/defconfig
Normal file
1110
configs/freedom-k66f/nsh/defconfig
Normal file
File diff suppressed because it is too large
Load Diff
77
configs/freedom-k66f/nsh/setenv.sh
Normal file
77
configs/freedom-k66f/nsh/setenv.sh
Normal file
@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
# configs/freedom-k66f/nsh/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
if [ "$_" = "$0" ] ; then
|
||||
echo "You must source this script, not run it!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WD=`pwd`
|
||||
if [ ! -x "setenv.sh" ]; then
|
||||
echo "This script must be executed from the top-level NuttX build directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${PATH_ORIG}" ]; then
|
||||
export PATH_ORIG="${PATH}"
|
||||
fi
|
||||
|
||||
# This is the Cygwin path to the location where I installed the Atmel GCC
|
||||
# toolchain under Windows. You will also have to edit this if you install
|
||||
# this toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin"
|
||||
|
||||
# This is the Cygwin path to the location where I installed the CodeSourcery
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the CodeSourcery toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
|
||||
# export TOOLCHAIN_BIN="/cygdrive/c/Users/MyName/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
|
||||
|
||||
# This is the location where I installed the ARM "GNU Tools for ARM Embedded Processors"
|
||||
# You can this free toolchain here https://launchpad.net/gcc-arm-embedded
|
||||
export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q2/bin"
|
||||
|
||||
# This is the path to the location where I installed the devkitARM toolchain
|
||||
# You can get this free toolchain from http://devkitpro.org/ or http://sourceforge.net/projects/devkitpro/
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/devkitARM/bin"
|
||||
|
||||
# This is the Cygwin path to the location where I build the buildroot
|
||||
# toolchain.
|
||||
# export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
|
||||
|
||||
# Add the path to the toolchain to the PATH varialble
|
||||
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||
|
||||
echo "PATH : ${PATH}"
|
139
configs/freedom-k66f/scripts/flash.ld
Normal file
139
configs/freedom-k66f/scripts/flash.ld
Normal file
@ -0,0 +1,139 @@
|
||||
/****************************************************************************
|
||||
* configs/freedom-k66f/scripts/flash.ld
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* 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 MK66FN2M0VMD18 has 2M of FLASH beginning at address 0x0000:0000 and
|
||||
* 256Kb of SRAM beginning at address 0x1fff:0000 (SRAM_L)(64Kb) and
|
||||
* 0x2000:0000 (SRAM_U) (192Kb).
|
||||
*
|
||||
* NOTE: that the first part of the K66 FLASH region is reserved for
|
||||
* interrupt vectflash and, following that, is a region from 0x0000:0400
|
||||
* to 0x0000:040f that is reserved for the FLASH control fields (FCF).
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
vectflash (rx) : ORIGIN = 0x00000000, LENGTH = 1K
|
||||
cfmprotect (rx) : ORIGIN = 0x00000400, LENGTH = 16
|
||||
progflash (rx) : ORIGIN = 0x00000410, LENGTH = 2M - (1K + 16)
|
||||
datasram (rwx) : ORIGIN = 0x1fff0000, LENGTH = 256K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
ENTRY(_stext)
|
||||
EXTERN(__flashconfigbytes)
|
||||
SECTIONS
|
||||
{
|
||||
.vectors : {
|
||||
_svectors = ABSOLUTE(.);
|
||||
*(.vectors)
|
||||
_evectors = ABSOLUTE(.);
|
||||
} > vectflash
|
||||
|
||||
.cfmprotect : {
|
||||
KEEP(*(.cfmconfig))
|
||||
} > cfmprotect
|
||||
|
||||
.text : {
|
||||
_stext = ABSOLUTE(.);
|
||||
*(.text .text.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.rodata .rodata.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
} > progflash
|
||||
|
||||
.init_section : {
|
||||
_sinit = ABSOLUTE(.);
|
||||
*(.init_array .init_array.*)
|
||||
_einit = ABSOLUTE(.);
|
||||
} > progflash
|
||||
|
||||
.ARM.extab : {
|
||||
*(.ARM.extab*)
|
||||
} > progflash
|
||||
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx : {
|
||||
*(.ARM.exidx*)
|
||||
} > progflash
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
.data : {
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
_edata = ABSOLUTE(.);
|
||||
} > datasram AT > progflash
|
||||
|
||||
_eronly = LOADADDR(.data);
|
||||
|
||||
.ramfunc ALIGN(4): {
|
||||
_sramfuncs = ABSOLUTE(.);
|
||||
*(.ramfunc .ramfunc.*)
|
||||
_eramfuncs = ABSOLUTE(.);
|
||||
} > datasram AT > progflash
|
||||
|
||||
_framfuncs = LOADADDR(.ramfunc);
|
||||
|
||||
.bss : {
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > datasram
|
||||
|
||||
/* Stabs debugging sections. */
|
||||
.stab 0 : { *(.stab) }
|
||||
.stabstr 0 : { *(.stabstr) }
|
||||
.stab.excl 0 : { *(.stab.excl) }
|
||||
.stab.exclstr 0 : { *(.stab.exclstr) }
|
||||
.stab.index 0 : { *(.stab.index) }
|
||||
.stab.indexstr 0 : { *(.stab.indexstr) }
|
||||
.comment 0 : { *(.comment) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
85
configs/freedom-k66f/src/Makefile
Normal file
85
configs/freedom-k66f/src/Makefile
Normal file
@ -0,0 +1,85 @@
|
||||
############################################################################
|
||||
# configs/freedom-k66f/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
# David Sidrane <david_s5@nscdg.com>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
ASRCS =
|
||||
CSRCS = k66_boot.c k66_spi.c
|
||||
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += k66_autoleds.c
|
||||
else
|
||||
CSRCS += k66_userleds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||
CSRCS += k66_buttons.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += k66_appinit.c k66_bringup.c
|
||||
else ifeq ($(CONFIG_BOARD_INITIALIZE),y)
|
||||
CSRCS += k66_bringup.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_KINETIS_SDHC),y)
|
||||
CSRCS += k66_sdhc.c
|
||||
ifeq ($(CONFIG_FS_AUTOMOUNTER),y)
|
||||
CSRCS += k66_automount.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_KINETIS_RTC),y)
|
||||
CSRCS += k66_rtc.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USBDEV),y)
|
||||
CSRCS += k66_usbdev.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_USBMSC),y)
|
||||
CSRCS += k66_usbmsc.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PWM),y)
|
||||
CSRCS += k66_pwm.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BOARDCTL_UNIQUEID),y)
|
||||
CSRCS += k66_uid.c
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/configs/Board.mk
|
378
configs/freedom-k66f/src/freedom-k66f.h
Normal file
378
configs/freedom-k66f/src/freedom-k66f.h
Normal file
@ -0,0 +1,378 @@
|
||||
/************************************************************************************
|
||||
* configs/freedom-k66f/src/freedom-k66f.h
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* 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_FREEDOM_K66F_SRC_FREEDOM_K66F_H
|
||||
#define __CONFIGS_FREEDOM_K66F_SRC_FREEDOM_K66F_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
#include <stdint.h>
|
||||
#include <arch/kinetis/chip.h>
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Application Configuration ********************************************************/
|
||||
|
||||
/* Assume we have everything */
|
||||
|
||||
#define HAVE_PROC 1
|
||||
#define HAVE_MMCSD 1
|
||||
#define HAVE_AUTOMOUNTER 1
|
||||
#define HAVE_USBDEV 1
|
||||
|
||||
#if defined(CONFIG_KINETIS_RTC)
|
||||
#define HAVE_RTC_DRIVER 1
|
||||
#endif
|
||||
|
||||
/* Automount procfs */
|
||||
|
||||
#if !defined(CONFIG_FS_PROCFS)
|
||||
# undef HAVE_PROC
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PROC) && defined(CONFIG_DISABLE_MOUNTPOINT)
|
||||
# warning Mountpoints disabled. No procfs support
|
||||
# undef HAVE_PROC
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NSH_PROC_MOUNTPOINT)
|
||||
# define PROCFS_MOUNTPOUNT CONFIG_NSH_PROC_MOUNTPOINT
|
||||
#else
|
||||
# define PROCFS_MOUNTPOUNT "/proc"
|
||||
#endif
|
||||
|
||||
/* SD card support */
|
||||
|
||||
#define MMCSD_SLOTNO 0
|
||||
|
||||
/* Can't support MMC/SD features if mountpoints are disabled or if SDHC support
|
||||
* is not enabled.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_KINETIS_SDHC)
|
||||
# undef HAVE_MMCSD
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MMCSD
|
||||
# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
|
||||
# error Only one MMC/SD slot, slot 0
|
||||
# endif
|
||||
|
||||
# ifdef CONFIG_NSH_MMCSDMINOR
|
||||
# define MMSCD_MINOR CONFIG_NSH_MMCSDMINOR
|
||||
# else
|
||||
# define MMSCD_MINOR 0
|
||||
# endif
|
||||
|
||||
/* We expect to receive GPIO interrupts for card insertion events */
|
||||
|
||||
# ifndef CONFIG_KINETIS_GPIOIRQ
|
||||
# error "CONFIG_KINETIS_GPIOIRQ required for card detect interrupt"
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_KINETIS_PORTDINTS
|
||||
# error "CONFIG_KINETIS_PORTDINTS required for card detect interrupt"
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Automounter */
|
||||
|
||||
#if !defined(CONFIG_FS_AUTOMOUNTER) || !defined(HAVE_MMCSD)
|
||||
# undef HAVE_AUTOMOUNTER
|
||||
# undef CONFIG_FRDMK66F_SDHC_AUTOMOUNT
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_FRDMK66F_SDHC_AUTOMOUNT
|
||||
# undef HAVE_AUTOMOUNTER
|
||||
#endif
|
||||
|
||||
/* Automounter defaults */
|
||||
|
||||
#ifdef HAVE_AUTOMOUNTER
|
||||
|
||||
# ifndef CONFIG_FRDMK66F_SDHC_AUTOMOUNT_FSTYPE
|
||||
# define CONFIG_FRDMK66F_SDHC_AUTOMOUNT_FSTYPE "vfat"
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_FRDMK66F_SDHC_AUTOMOUNT_BLKDEV
|
||||
# define CONFIG_FRDMK66F_SDHC_AUTOMOUNT_BLKDEV "/dev/mmcds0"
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_FRDMK66F_SDHC_AUTOMOUNT_MOUNTPOINT
|
||||
# define CONFIG_FRDMK66F_SDHC_AUTOMOUNT_MOUNTPOINT "/mnt/sdcard"
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_FRDMK66F_SDHC_AUTOMOUNT_DDELAY
|
||||
# define CONFIG_FRDMK66F_SDHC_AUTOMOUNT_DDELAY 1000
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_FRDMK66F_SDHC_AUTOMOUNT_UDELAY
|
||||
# define CONFIG_FRDMK66F_SDHC_AUTOMOUNT_UDELAY 2000
|
||||
# endif
|
||||
#endif /* HAVE_AUTOMOUNTER */
|
||||
|
||||
/* Can't support USB features if USB is not enabled */
|
||||
|
||||
#ifndef CONFIG_USBDEV
|
||||
# undef HAVE_USBDEV
|
||||
#endif
|
||||
|
||||
/* How many SPI modules does this chip support? The LM3S6918 supports 2 SPI
|
||||
* modules (others may support more -- in such case, the following must be
|
||||
* expanded).
|
||||
*/
|
||||
|
||||
#if KINETIS_NSPI < 1
|
||||
# undef CONFIG_KINETIS_SPI0
|
||||
# undef CONFIG_KINETIS_SPI1
|
||||
# undef CONFIG_KINETIS_SPI2
|
||||
#elif KINETIS_NSPI < 2
|
||||
# undef CONFIG_KINETIS_SPI1
|
||||
# undef CONFIG_KINETIS_SPI2
|
||||
#elif KINETIS_NSPI < 3
|
||||
# undef CONFIG_KINETIS_SPI2
|
||||
#endif
|
||||
|
||||
/* FREEDOM-K66F GPIOs ****************************************************************/
|
||||
/* A micro Secure Digital (SD) card slot is available on the FRDM-K66F connected to
|
||||
* the SD Host Controller (SDHC) signals of the MCU. This slot will accept micro
|
||||
* format SD memory cards. The SD card detect pin (PTD10) is an open switch that
|
||||
* shorts with VDD when card is inserted.
|
||||
*
|
||||
* ------------ ------------- --------
|
||||
* SD Card Slot Board Signal K66F Pin
|
||||
* ------------ ------------- --------
|
||||
* DAT0 SDHC0_D0 PTE1
|
||||
* DAT1 SDHC0_D1 PTE0
|
||||
* DAT2 SDHC0_D2 PTE5
|
||||
* CD/DAT3 SDHC0_D3 PTE4
|
||||
* CMD SDHC0_CMD PTE3
|
||||
* CLK SDHC0_DCLK PTE2
|
||||
* SWITCH D_CARD_DETECT PTD10
|
||||
* ------------ ------------- --------
|
||||
*
|
||||
* There is no Write Protect pin available to the K66F.
|
||||
*/
|
||||
|
||||
#define GPIO_SD_CARDDETECT (GPIO_PULLDOWN | PIN_INT_BOTH | PIN_PORTD | PIN10)
|
||||
|
||||
/* Two push buttons, SW2 and SW3, are available on FRDM-K66F board, where SW2 is
|
||||
* connected to PTC6 and SW3 is connected to PTA4. Besides the general purpose
|
||||
* input/output functions, SW2 and SW3 can be low-power wake up signal. Also, only
|
||||
* SW3 can be a non-maskable interrupt.
|
||||
*
|
||||
* Switch GPIO Function
|
||||
* --------- ---------------------------------------------------------------
|
||||
* SW2 PTD11/LLWU_P25/SPI2_PCS0/SDHC0_CLKIN/LPUART0_CTS/FB_A19
|
||||
* SW3 PTA10/LLWU_P22/FTM2_CH0/MII0_RXD2/FTM2_QD_PHA/TPM2_CH0/TRACE_D0
|
||||
*/
|
||||
|
||||
#define GPIO_SW2 (GPIO_PULLUP | PIN_INT_BOTH | PIN_PORTD | PIN11)
|
||||
#define GPIO_SW3 (GPIO_PULLUP | PIN_INT_BOTH | PIN_PORTA | PIN10)
|
||||
|
||||
/* An RGB LED is connected through GPIO as shown below:
|
||||
*
|
||||
* LED K66
|
||||
* ------ -------------------------------------------------------
|
||||
* RED PTC9/ADC1_SE5B/CMP0_IN3/FTM3_CH5/I2S0_RX_BCLK/FB_AD6/SDRAM_A14/FTM_FLT0
|
||||
* GREEN PTE6/LLWU_P16/SPI1_PCS3/UART3_CTS/I2S0_MCLK/FTM3_CH1/USB0_SOF_OUT
|
||||
* BLUE PTA11/LLWU_P23/FTM2_CH1/MII0_RXCLK/I2C2_SDA/FTM2_QD_PHB/TPM2_CH1
|
||||
*/
|
||||
|
||||
#define GPIO_LED_R (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTC | PIN9)
|
||||
#define GPIO_LED_G (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTE | PIN6)
|
||||
#define GPIO_LED_B (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTA | PIN11)
|
||||
|
||||
/************************************************************************************
|
||||
* Public data
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_spidev_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins for the FREEDOM-K66F board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function k66_spidev_initialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_rtc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to initialize the RTC FREEDOM-K66F board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(HAVE_RTC_DRIVER)
|
||||
int k66_rtc_initialize(void);
|
||||
#else
|
||||
# define k66_rtc_initialize() (OK)
|
||||
#endif
|
||||
/************************************************************************************
|
||||
* Name: k66_usbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to setup USB-related GPIO pins for the FREEDOM-K66F board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function k66_usbinitialize(void);
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_bringup
|
||||
*
|
||||
* Description:
|
||||
* Bring up board features
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(CONFIG_LIB_BOARDCTL) || defined(CONFIG_BOARD_INITIALIZE)
|
||||
int k66_bringup(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: k66_sdhc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Inititialize the SDHC SD card slot
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_MMCSD
|
||||
int k66_sdhc_initialize(void);
|
||||
#else
|
||||
# define k66_sdhc_initialize() (OK)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_cardinserted
|
||||
*
|
||||
* Description:
|
||||
* Check if a card is inserted into the SDHC slot
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef HAVE_AUTOMOUNTER
|
||||
bool k66_cardinserted(void);
|
||||
#else
|
||||
# define k66_cardinserted() (false)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_writeprotected
|
||||
*
|
||||
* Description:
|
||||
* Check if the card in the MMC/SD slot is write protected
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef HAVE_AUTOMOUNTER
|
||||
bool k66_writeprotected(void);
|
||||
#else
|
||||
# define k66_writeprotected() (false)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_automount_initialize
|
||||
*
|
||||
* Description:
|
||||
* Configure auto-mounter for the configured SDHC slot
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef HAVE_AUTOMOUNTER
|
||||
void k66_automount_initialize(void);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_automount_event
|
||||
*
|
||||
* Description:
|
||||
* The SDHC card detection logic has detected an insertion or removal event. It
|
||||
* has already scheduled the MMC/SD block driver operations. Now we need to
|
||||
* schedule the auto-mount event which will occur with a substantial delay to make
|
||||
* sure that everything has settle down.
|
||||
*
|
||||
* Input Parameters:
|
||||
* inserted - True if the card is inserted in the slot. False otherwise.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Interrupts are disabled.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef HAVE_AUTOMOUNTER
|
||||
void k66_automount_event(bool inserted);
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_pwm_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize PWM and register the PWM device.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_PWM
|
||||
int k66_pwm_setup(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIGS_FREEDOM_K66F_SRC_FREEDOM_K66F_H */
|
91
configs/freedom-k66f/src/k66_appinit.c
Normal file
91
configs/freedom-k66f/src/k66_appinit.c
Normal file
@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
* config/freedom-k66f/src/k66_appinit.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "freedom-k66f.h"
|
||||
|
||||
#ifdef CONFIG_LIB_BOARDCTL
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform application specific initialization. This function is never
|
||||
* called directly from application code, but only indirectly via the
|
||||
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||
* implementation without modification. The argument has no
|
||||
* meaning to NuttX; the meaning of the argument is a contract
|
||||
* between the board-specific initalization logic and the the
|
||||
* matching application logic. The value cold be such things as a
|
||||
* mode enumeration value, a set of DIP switch switch settings, a
|
||||
* pointer to configuration data read from a file or serial FLASH,
|
||||
* or whatever you would like to do with it. Every implementation
|
||||
* should accept zero/NULL as a default configuration.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#ifndef CONFIG_BOARD_INITIALIZE
|
||||
/* Perform board initialization */
|
||||
|
||||
return k66_bringup();
|
||||
#else
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_LIB_BOARDCTL */
|
164
configs/freedom-k66f/src/k66_autoleds.c
Normal file
164
configs/freedom-k66f/src/k66_autoleds.c
Normal file
@ -0,0 +1,164 @@
|
||||
/****************************************************************************
|
||||
* configs/freedom-k66f/src/k66_autoleds.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* 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 Freedom K66F has a single RGB LED driven by the K66F as follows:
|
||||
*
|
||||
* LED K66
|
||||
* ------ -------------------------------------------------------
|
||||
* RED PTB22/SPI2_SOUT/FB_AD29/CMP2_OUT
|
||||
* BLUE PTB21/SPI2_SCK/FB_AD30/CMP1_OUT
|
||||
* GREEN PTE26/ENET_1588_CLKIN/UART4_CTS_b/RTC_CLKOUT/USB0_CLKIN
|
||||
*
|
||||
*
|
||||
* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board
|
||||
* the Freedom K66F. The following definitions describe how NuttX controls
|
||||
* the LEDs:
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* RED GREEN BLUE
|
||||
* ------------------- ----------------------- -----------------
|
||||
* LED_STARTED NuttX has been started OFF OFF OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
|
||||
* LED_IRQSENABLED Interrupts enabled OFF OFF ON
|
||||
* LED_STACKCREATED Idle stack created OFF ON OFF
|
||||
* LED_INIRQ In an interrupt (no change)
|
||||
* LED_SIGNAL In a signal handler (no change)
|
||||
* LED_ASSERTION An assertion failed (no change)
|
||||
* LED_PANIC The system has crashed FLASH OFF OFF
|
||||
* LED_IDLE K66 is in sleep mode (Optional, not used)
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "kinetis.h"
|
||||
#include "freedom-k66f.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Summary of all possible settings */
|
||||
|
||||
#define LED_NOCHANGE 0 /* LED_IRQSENABLED, LED_INIRQ, LED_SIGNAL, LED_ASSERTION */
|
||||
#define LED_OFF_OFF_OFF 1 /* LED_STARTED */
|
||||
#define LED_OFF_OFF_ON 2 /* LED_HEAPALLOCATE */
|
||||
#define LED_OFF_ON_OFF 3 /* LED_STACKCREATED */
|
||||
#define LED_ON_OFF_OFF 4 /* LED_PANIC */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the on-board LED
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
kinetis_pinconfig(GPIO_LED_R);
|
||||
kinetis_pinconfig(GPIO_LED_G);
|
||||
kinetis_pinconfig(GPIO_LED_B);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
if (led != LED_NOCHANGE)
|
||||
{
|
||||
bool redoff = true;
|
||||
bool greenoff = true;
|
||||
bool blueoff = true;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
default:
|
||||
case LED_OFF_OFF_OFF:
|
||||
break;
|
||||
|
||||
case LED_OFF_OFF_ON:
|
||||
blueoff = false;
|
||||
break;
|
||||
|
||||
case LED_OFF_ON_OFF:
|
||||
greenoff = false;
|
||||
break;
|
||||
|
||||
case LED_ON_OFF_OFF:
|
||||
redoff = false;
|
||||
break;
|
||||
}
|
||||
|
||||
kinetis_gpiowrite(GPIO_LED_R, redoff);
|
||||
kinetis_gpiowrite(GPIO_LED_G, greenoff);
|
||||
kinetis_gpiowrite(GPIO_LED_B, blueoff);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
if (led == LED_ON_OFF_OFF)
|
||||
{
|
||||
kinetis_gpiowrite(GPIO_LED_R, true);
|
||||
kinetis_gpiowrite(GPIO_LED_G, true);
|
||||
kinetis_gpiowrite(GPIO_LED_B, true);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
323
configs/freedom-k66f/src/k66_automount.c
Normal file
323
configs/freedom-k66f/src/k66_automount.c
Normal file
@ -0,0 +1,323 @@
|
||||
/************************************************************************************
|
||||
* configs/freedom-k66f/src/k66_automount.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* 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>
|
||||
|
||||
#if defined(CONFIG_FS_AUTOMOUNTER_DEBUG) && !defined(CONFIG_DEBUG_FS)
|
||||
# define CONFIG_DEBUG_FS 1
|
||||
#endif
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/clock.h>
|
||||
#include <nuttx/fs/automount.h>
|
||||
|
||||
#include "freedom-k66f.h"
|
||||
|
||||
#ifdef HAVE_AUTOMOUNTER
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL (FAR void *)0
|
||||
#endif
|
||||
|
||||
#ifndef OK
|
||||
# define OK 0
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Types
|
||||
************************************************************************************/
|
||||
/* This structure represents the changeable state of the automounter */
|
||||
|
||||
struct k66_automount_state_s
|
||||
{
|
||||
volatile automount_handler_t handler; /* Upper half handler */
|
||||
FAR void *arg; /* Handler argument */
|
||||
bool enable; /* Fake interrupt enable */
|
||||
bool pending; /* Set if there an event while disabled */
|
||||
};
|
||||
|
||||
/* This structure represents the static configuration of an automounter */
|
||||
|
||||
struct k66_automount_config_s
|
||||
{
|
||||
/* This must be first thing in structure so that we can simply cast from struct
|
||||
* automount_lower_s to struct k66_automount_config_s
|
||||
*/
|
||||
|
||||
struct automount_lower_s lower; /* Publicly visible part */
|
||||
FAR struct k66_automount_state_s *state; /* Changeable state */
|
||||
};
|
||||
|
||||
/************************************************************************************
|
||||
* Private Function Prototypes
|
||||
************************************************************************************/
|
||||
|
||||
static int k66_attach(FAR const struct automount_lower_s *lower,
|
||||
automount_handler_t isr, FAR void *arg);
|
||||
static void k66_enable(FAR const struct automount_lower_s *lower, bool enable);
|
||||
static bool k66_inserted(FAR const struct automount_lower_s *lower);
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
static struct k66_automount_state_s g_sdhc_state;
|
||||
static const struct k66_automount_config_s g_sdhc_config =
|
||||
{
|
||||
.lower =
|
||||
{
|
||||
.fstype = CONFIG_FRDMK66F_SDHC_AUTOMOUNT_FSTYPE,
|
||||
.blockdev = CONFIG_FRDMK66F_SDHC_AUTOMOUNT_BLKDEV,
|
||||
.mountpoint = CONFIG_FRDMK66F_SDHC_AUTOMOUNT_MOUNTPOINT,
|
||||
.ddelay = MSEC2TICK(CONFIG_FRDMK66F_SDHC_AUTOMOUNT_DDELAY),
|
||||
.udelay = MSEC2TICK(CONFIG_FRDMK66F_SDHC_AUTOMOUNT_UDELAY),
|
||||
.attach = k66_attach,
|
||||
.enable = k66_enable,
|
||||
.inserted = k66_inserted
|
||||
},
|
||||
.state = &g_sdhc_state
|
||||
};
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_attach
|
||||
*
|
||||
* Description:
|
||||
* Attach a new SDHC event handler
|
||||
*
|
||||
* Input Parameters:
|
||||
* lower - An instance of the auto-mounter lower half state structure
|
||||
* isr - The new event handler to be attach
|
||||
* arg - Client data to be provided when the event handler is invoked.
|
||||
*
|
||||
* Returned Value:
|
||||
* Always returns OK
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
static int k66_attach(FAR const struct automount_lower_s *lower,
|
||||
automount_handler_t isr, FAR void *arg)
|
||||
{
|
||||
FAR const struct k66_automount_config_s *config;
|
||||
FAR struct k66_automount_state_s *state;
|
||||
|
||||
/* Recover references to our structure */
|
||||
|
||||
config = (FAR struct k66_automount_config_s *)lower;
|
||||
DEBUGASSERT(config != NULL && config->state != NULL);
|
||||
|
||||
state = config->state;
|
||||
|
||||
/* Save the new handler info (clearing the handler first to eliminate race
|
||||
* conditions).
|
||||
*/
|
||||
|
||||
state->handler = NULL;
|
||||
state->pending = false;
|
||||
state->arg = arg;
|
||||
state->handler = isr;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_enable
|
||||
*
|
||||
* Description:
|
||||
* Enable card insertion/removal event detection
|
||||
*
|
||||
* Input Parameters:
|
||||
* lower - An instance of the auto-mounter lower half state structure
|
||||
* enable - True: enable event detection; False: disable
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
static void k66_enable(FAR const struct automount_lower_s *lower, bool enable)
|
||||
{
|
||||
FAR const struct k66_automount_config_s *config;
|
||||
FAR struct k66_automount_state_s *state;
|
||||
irqstate_t flags;
|
||||
|
||||
/* Recover references to our structure */
|
||||
|
||||
config = (FAR struct k66_automount_config_s *)lower;
|
||||
DEBUGASSERT(config != NULL && config->state != NULL);
|
||||
|
||||
state = config->state;
|
||||
|
||||
/* Save the fake enable setting */
|
||||
|
||||
flags = enter_critical_section();
|
||||
state->enable = enable;
|
||||
|
||||
/* Did an interrupt occur while interrupts were disabled? */
|
||||
|
||||
if (enable && state->pending)
|
||||
{
|
||||
/* Yes.. perform the fake interrupt if the interrutp is attached */
|
||||
|
||||
if (state->handler)
|
||||
{
|
||||
bool inserted = k66_cardinserted();
|
||||
(void)state->handler(&config->lower, state->arg, inserted);
|
||||
}
|
||||
|
||||
state->pending = false;
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_inserted
|
||||
*
|
||||
* Description:
|
||||
* Check if a card is inserted into the slot.
|
||||
*
|
||||
* Input Parameters:
|
||||
* lower - An instance of the auto-mounter lower half state structure
|
||||
*
|
||||
* Returned Value:
|
||||
* True if the card is inserted; False otherwise
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
static bool k66_inserted(FAR const struct automount_lower_s *lower)
|
||||
{
|
||||
return k66_cardinserted();
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_automount_initialize
|
||||
*
|
||||
* Description:
|
||||
* Configure auto-mounters for each enable and so configured SDHC
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void k66_automount_initialize(void)
|
||||
{
|
||||
FAR void *handle;
|
||||
|
||||
finfo("Initializing automounter(s)\n");
|
||||
|
||||
/* Initialize the SDHC0 auto-mounter */
|
||||
|
||||
handle = automount_initialize(&g_sdhc_config.lower);
|
||||
if (!handle)
|
||||
{
|
||||
ferr("ERROR: Failed to initialize auto-mounter for SDHC0\n");
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_automount_event
|
||||
*
|
||||
* Description:
|
||||
* The SDHC card detection logic has detected an insertion or removal event. It
|
||||
* has already scheduled the MMC/SD block driver operations. Now we need to
|
||||
* schedule the auto-mount event which will occur with a substantial delay to make
|
||||
* sure that everything has settle down.
|
||||
*
|
||||
* Input Parameters:
|
||||
* slotno - Identifies the SDHC0 slot: SDHC0_SLOTNO or SDHC1_SLOTNO. There is a
|
||||
* terminology problem here: Each SDHC supports two slots, slot A and slot B.
|
||||
* Only slot A is used. So this is not a really a slot, but an HSCMI peripheral
|
||||
* number.
|
||||
* inserted - True if the card is inserted in the slot. False otherwise.
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Interrupts are disabled.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void k66_automount_event(bool inserted)
|
||||
{
|
||||
FAR const struct k66_automount_config_s *config = &g_sdhc_config;
|
||||
FAR struct k66_automount_state_s *state = &g_sdhc_state;
|
||||
|
||||
/* Is the auto-mounter interrupt attached? */
|
||||
|
||||
if (state->handler)
|
||||
{
|
||||
/* Yes.. Have we been asked to hold off interrupts? */
|
||||
|
||||
if (!state->enable)
|
||||
{
|
||||
/* Yes.. just remember the there is a pending interrupt. We will
|
||||
* deliver the interrupt when interrupts are "re-enabled."
|
||||
*/
|
||||
|
||||
state->pending = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No.. forward the event to the handler */
|
||||
|
||||
(void)state->handler(&config->lower, state->arg, inserted);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_AUTOMOUNTER */
|
119
configs/freedom-k66f/src/k66_boot.c
Normal file
119
configs/freedom-k66f/src/k66_boot.c
Normal file
@ -0,0 +1,119 @@
|
||||
/************************************************************************************
|
||||
* configs/freedom-k66f/src/k66_boot.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "freedom-k66f.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: kinetis_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* All Kinetis architectures must provide the following entry point. This entry
|
||||
* point is called early in the initialization -- after all memory has been
|
||||
* configured and mapped but before any devices have been initialized.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void kinetis_boardinitialize(void)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
board_autoled_initialize();
|
||||
#endif
|
||||
#if defined(CONFIG_KINETIS_SPI0) || defined(CONFIG_KINETIS_SPI1) || \
|
||||
defined(CONFIG_KINETIS_SPI2)
|
||||
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak function
|
||||
* k66_spidev_initialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
if (k66_spidev_initialize)
|
||||
{
|
||||
k66_spidev_initialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USBDEV) && defined(CONFIG_KINETIS_USB)
|
||||
/* Initialize USB is 1) USBDEV is selected, 2) the USB controller is not
|
||||
* disabled, and 3) the weak function k66_usbinitialize() has been brought
|
||||
* into the build.
|
||||
*/
|
||||
|
||||
if (k66_usbinitialize)
|
||||
{
|
||||
k66_usbinitialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_initialize
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_BOARD_INITIALIZE is selected, then an additional
|
||||
* initialization call will be performed in the boot-up sequence to a
|
||||
* function called board_initialize(). board_initialize() will be
|
||||
* called immediately after up_intitialize() is called and just before the
|
||||
* initial application is started. This additional initialization phase
|
||||
* may be used, for example, to initialize board-specific device drivers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_INITIALIZE
|
||||
void board_initialize(void)
|
||||
{
|
||||
/* Perform board initialization */
|
||||
|
||||
(void)k66_bringup();
|
||||
}
|
||||
#endif /* CONFIG_BOARD_INITIALIZE */
|
||||
|
158
configs/freedom-k66f/src/k66_bringup.c
Normal file
158
configs/freedom-k66f/src/k66_bringup.c
Normal file
@ -0,0 +1,158 @@
|
||||
/****************************************************************************
|
||||
* config/freedom-k66f/src/k66_bringup.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include <nuttx/input/buttons.h>
|
||||
|
||||
#include "freedom-k66f.h"
|
||||
|
||||
#if defined(CONFIG_LIB_BOARDCTL) || defined(CONFIG_BOARD_INITIALIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: k66_bringup
|
||||
*
|
||||
* Description:
|
||||
* Bring up board features
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int k66_bringup(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef HAVE_PROC
|
||||
/* Mount the proc filesystem */
|
||||
|
||||
syslog(LOG_INFO, "Mounting procfs to /proc\n");
|
||||
|
||||
ret = mount(NULL, PROCFS_MOUNTPOUNT, "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to mount the PROC filesystem: %d (%d)\n",
|
||||
ret, errno);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MMCSD
|
||||
/* Initialize the SDHC driver */
|
||||
|
||||
ret = k66_sdhc_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: k66_sdhc_initialize() failed: %d\n", ret);
|
||||
}
|
||||
|
||||
# ifdef CONFIG_FRDMK66F_SDHC_MOUNT
|
||||
else
|
||||
{
|
||||
/* Mount the volume on HSMCI0 */
|
||||
|
||||
ret = mount(CONFIG_FRDMK66F_SDHC_MOUNT_BLKDEV,
|
||||
CONFIG_FRDMK66F_SDHC_MOUNT_MOUNTPOINT,
|
||||
CONFIG_FRDMK66F_SDHC_MOUNT_FSTYPE,
|
||||
0, NULL);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,"ERROR: Failed to mount %s: %d\n",
|
||||
CONFIG_FRDMK66F_SDHC_MOUNT_MOUNTPOINT, errno);
|
||||
}
|
||||
}
|
||||
|
||||
# endif /* CONFIG_FRDMK66F_SDHC_MOUNT */
|
||||
#endif /* HAVE_MMCSD */
|
||||
|
||||
#ifdef CONFIG_PWM
|
||||
/* Initialize PWM and register the PWM device. */
|
||||
|
||||
ret = k66_pwm_setup();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: k66_pwm_setup() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_AUTOMOUNTER
|
||||
/* Initialize the auto-mounter */
|
||||
|
||||
k66_automount_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RTC_DRIVER
|
||||
/* Initialize the RTC */
|
||||
|
||||
ret = k66_rtc_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to initalize the RTC driver: %d\n",
|
||||
ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BUTTONS
|
||||
/* Register the BUTTON driver */
|
||||
|
||||
ret = btn_lower_initialize("/dev/buttons");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_LIB_BOARDCTL CONFIG_BOARD_INITIALIZE */
|
174
configs/freedom-k66f/src/k66_buttons.c
Normal file
174
configs/freedom-k66f/src/k66_buttons.c
Normal file
@ -0,0 +1,174 @@
|
||||
/****************************************************************************
|
||||
* configs/freedom-k66f/src/k66_buttons.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* 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 <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "kinetis.h"
|
||||
|
||||
#include "freedom-k66f.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Two push buttons, SW2 and SW3, are available on FRDM-K66F board, where SW2 is
|
||||
* connected to PTC6 and SW3 is connected to PTA4. Besides the general purpose
|
||||
* input/output functions, SW2 and SW3 can be low-power wake up signal. Also, only
|
||||
* SW3 can be a non-maskable interrupt.
|
||||
*
|
||||
* Switch GPIO Function
|
||||
* --------- ---------------------------------------------------------------
|
||||
* SW2 PTD11/LLWU_P25/SPI2_PCS0/SDHC0_CLKIN/LPUART0_CTS/FB_A19
|
||||
* SW3 PTA10/LLWU_P22/FTM2_CH0/MII0_RXD2/FTM2_QD_PHA/TPM2_CH0/TRACE_D0
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_button_initialize(void)
|
||||
{
|
||||
/* Configure the two buttons as inputs */
|
||||
|
||||
kinetis_pinconfig(GPIO_SW2);
|
||||
kinetis_pinconfig(GPIO_SW3);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t board_buttons(void)
|
||||
{
|
||||
uint8_t ret = 0;
|
||||
|
||||
if (kinetis_gpioread(GPIO_SW2))
|
||||
{
|
||||
ret |= BUTTON_SW2_BIT;
|
||||
}
|
||||
|
||||
if (kinetis_gpioread(GPIO_SW3))
|
||||
{
|
||||
ret |= BUTTON_SW3_BIT;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button
|
||||
* resources. After that, board_buttons() may be called to collect the
|
||||
* current state of all buttons or board_button_irq() may be called to
|
||||
* register button interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may
|
||||
* be called to collect the state of all buttons. board_buttons() returns
|
||||
* an 8-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning
|
||||
* of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
* will be called when a button is depressed or released. The ID value is
|
||||
* a button enumeration value that uniquely identifies a button resource.
|
||||
* See the BUTTON_* and JOYSTICK_* definitions in board.h for the meaning
|
||||
* of enumeration value. The previous interrupt handler address is
|
||||
* returned (so that it may restored, if so desired).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t board_button_irq(int id, xcpt_t irqhandler)
|
||||
{
|
||||
xcpt_t oldhandler;
|
||||
uint32_t pinset;
|
||||
|
||||
/* Map the button id to the GPIO bit set. */
|
||||
|
||||
if (id == BUTTON_SW2)
|
||||
{
|
||||
pinset = GPIO_SW2;
|
||||
}
|
||||
else if (id == BUTTON_SW3)
|
||||
{
|
||||
pinset = GPIO_SW3;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* The button has already been configured as an interrupting input (by
|
||||
* board_button_initialize() above).
|
||||
*
|
||||
* Attach the new button handler.
|
||||
*/
|
||||
|
||||
oldhandler = kinetis_pinirqattach(pinset, irqhandler);
|
||||
|
||||
/* Then make sure that interrupts are enabled on the pin */
|
||||
|
||||
kinetis_pinirqenable(pinset);
|
||||
return oldhandler;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
106
configs/freedom-k66f/src/k66_pwm.c
Normal file
106
configs/freedom-k66f/src/k66_pwm.c
Normal file
@ -0,0 +1,106 @@
|
||||
/************************************************************************************
|
||||
* configs/freedom-k66f/src/k66_pwm.c
|
||||
*
|
||||
* Copyright (C) 2013, 2015, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Jordan MacIntyre <jordanroymax@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/drivers/pwm.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "up_arch.h"
|
||||
#include "kinetis_pwm.h"
|
||||
|
||||
#ifdef CONFIG_PWM
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_pwm_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize PWM and register the PWM device.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int k66_pwm_setup(void)
|
||||
{
|
||||
FAR struct pwm_lowerhalf_s *pwm;
|
||||
static bool initialized = false;
|
||||
int ret;
|
||||
|
||||
/* Have we already initialized? */
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
/* Call k66_pwminitialize() to get an instance of the PWM interface */
|
||||
|
||||
pwm = kinetis_pwminitialize(0);
|
||||
if (!pwm)
|
||||
{
|
||||
aerr("ERROR: Failed to get the K66 PWM lower half\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Register the PWM driver at "/dev/pwm0" */
|
||||
|
||||
ret = pwm_register("/dev/pwm0", pwm);
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: pwm_register failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_PWM */
|
92
configs/freedom-k66f/src/k66_rtc.c
Normal file
92
configs/freedom-k66f/src/k66_rtc.c
Normal file
@ -0,0 +1,92 @@
|
||||
/****************************************************************************
|
||||
* config/freedom-k66f/src/k66_bringup.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* 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 <syslog.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
#include <nuttx/timers/rtc.h>
|
||||
|
||||
#include "freedom-k66f.h"
|
||||
#include "kinetis_alarm.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_rtc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to initialize the RTC FREEDOM-K66F board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int k66_rtc_initialize(void)
|
||||
{
|
||||
int ret = -EIO;
|
||||
FAR struct rtc_lowerhalf_s *lower;
|
||||
|
||||
/* Instantiate the KINETIS lower-half RTC driver */
|
||||
|
||||
lower = kinetis_rtc_lowerhalf();
|
||||
if (!lower)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to instantiate the RTC lower-half driver\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bind the lower half driver and register the combined RTC driver
|
||||
* as /dev/rtc0
|
||||
*/
|
||||
|
||||
ret = rtc_initialize(0, lower);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to bind/register the RTC driver: %d\n",
|
||||
ret);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
250
configs/freedom-k66f/src/k66_sdhc.c
Normal file
250
configs/freedom-k66f/src/k66_sdhc.c
Normal file
@ -0,0 +1,250 @@
|
||||
/****************************************************************************
|
||||
* config/freedom-k66f/src/k66_sdhc.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* A micro Secure Digital (SD) card slot is available on the FRDM-K66F connected to
|
||||
* the SD Host Controller (SDHC) signals of the MCU. This slot will accept micro
|
||||
* format SD memory cards. The SD card detect pin (PTD10) is an open switch that
|
||||
* shorts with VDD when card is inserted.
|
||||
*
|
||||
* ------------ ------------- --------
|
||||
* SD Card Slot Board Signal K66F Pin
|
||||
* ------------ ------------- --------
|
||||
* DAT0 SDHC0_D0 PTE1
|
||||
* DAT1 SDHC0_D1 PTE0
|
||||
* DAT2 SDHC0_D2 PTE5
|
||||
* CD/DAT3 SDHC0_D3 PTE4
|
||||
* CMD SDHC0_CMD PTE3
|
||||
* CLK SDHC0_DCLK PTE2
|
||||
* SWITCH D_CARD_DETECT PTD10
|
||||
* ------------ ------------- --------
|
||||
*
|
||||
* There is no Write Protect pin available to the K66F.
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/sdio.h>
|
||||
#include <nuttx/mmcsd.h>
|
||||
|
||||
#include "kinetis.h"
|
||||
|
||||
#include "freedom-k66f.h"
|
||||
|
||||
#ifdef HAVE_MMCSD
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
/* This structure holds static information unique to one SDHC peripheral */
|
||||
|
||||
struct k66_sdhc_state_s
|
||||
{
|
||||
struct sdio_dev_s *sdhc; /* R/W device handle */
|
||||
bool inserted; /* TRUE: card is inserted */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* HSCMI device state */
|
||||
|
||||
static struct k66_sdhc_state_s g_sdhc;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: k66_mediachange
|
||||
****************************************************************************/
|
||||
|
||||
static void k66_mediachange(void)
|
||||
{
|
||||
bool inserted;
|
||||
|
||||
/* Get the current value of the card detect pin. This pin is pulled up on
|
||||
* board. So low means that a card is present.
|
||||
*/
|
||||
|
||||
inserted = k66_cardinserted();
|
||||
mcinfo("inserted: %s\n", inserted ? "Yes" : "No");
|
||||
|
||||
/* Has the pin changed state? */
|
||||
|
||||
if (inserted != g_sdhc.inserted)
|
||||
{
|
||||
mcinfo("Media change: %d->%d\n", g_sdhc.inserted, inserted);
|
||||
|
||||
/* Yes.. perform the appropriate action (this might need some debounce). */
|
||||
|
||||
g_sdhc.inserted = inserted;
|
||||
sdhc_mediachange(g_sdhc.sdhc, inserted);
|
||||
|
||||
#ifdef CONFIG_FRDMK66F_SDHC_AUTOMOUNT
|
||||
/* Let the automounter know about the insertion event */
|
||||
|
||||
k66_automount_event(k66_cardinserted());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: k66_cdinterrupt
|
||||
****************************************************************************/
|
||||
|
||||
static int k66_cdinterrupt(int irq, FAR void *context)
|
||||
{
|
||||
/* All of the work is done by k66_mediachange() */
|
||||
|
||||
k66_mediachange();
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: k66_sdhc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the SDHC SD card slot
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int k66_sdhc_initialize(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Configure GPIO pins */
|
||||
|
||||
kinetis_pinconfig(GPIO_SD_CARDDETECT);
|
||||
|
||||
/* Attached the card detect interrupt (but don't enable it yet) */
|
||||
|
||||
kinetis_pinirqattach(GPIO_SD_CARDDETECT, k66_cdinterrupt);
|
||||
|
||||
/* Configure the write protect GPIO -- None */
|
||||
|
||||
/* Mount the SDHC-based MMC/SD block driver */
|
||||
/* First, get an instance of the SDHC interface */
|
||||
|
||||
mcinfo("Initializing SDHC slot %d\n", MMCSD_SLOTNO);
|
||||
|
||||
g_sdhc.sdhc = sdhc_initialize(MMCSD_SLOTNO);
|
||||
if (!g_sdhc.sdhc)
|
||||
{
|
||||
mcerr("ERROR: Failed to initialize SDHC slot %d\n", MMCSD_SLOTNO);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Now bind the SDHC interface to the MMC/SD driver */
|
||||
|
||||
mcinfo("Bind SDHC to the MMC/SD driver, minor=%d\n", MMSCD_MINOR);
|
||||
|
||||
ret = mmcsd_slotinitialize(MMSCD_MINOR, g_sdhc.sdhc);
|
||||
if (ret != OK)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to bind SDHC to the MMC/SD driver: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
syslog(LOG_INFO, "Successfully bound SDHC to the MMC/SD driver\n");
|
||||
|
||||
/* Handle the initial card state */
|
||||
|
||||
k66_mediachange();
|
||||
|
||||
/* Enable CD interrupts to handle subsequent media changes */
|
||||
|
||||
kinetis_pinirqenable(GPIO_SD_CARDDETECT);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: k66_cardinserted
|
||||
*
|
||||
* Description:
|
||||
* Check if a card is inserted into the SDHC slot
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool k66_cardinserted(void)
|
||||
{
|
||||
bool inserted;
|
||||
|
||||
/* Get the current value of the card detect pin. This pin is pulled to VDD on
|
||||
* insert. So high means that a card is present.
|
||||
*/
|
||||
|
||||
inserted = kinetis_gpioread(GPIO_SD_CARDDETECT);
|
||||
mcinfo("inserted: %s\n", inserted ? "Yes" : "No");
|
||||
return inserted;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: k66_writeprotected
|
||||
*
|
||||
* Description:
|
||||
* Check if a card is inserted into the SDHC slot
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_AUTOMOUNTER
|
||||
bool k66_writeprotected(void)
|
||||
{
|
||||
/* There are no write protect pins */
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_MMCSD */
|
145
configs/freedom-k66f/src/k66_spi.c
Normal file
145
configs/freedom-k66f/src/k66_spi.c
Normal file
@ -0,0 +1,145 @@
|
||||
/************************************************************************************
|
||||
* configs/freedom-k66f/src/k66_spi.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "chip.h"
|
||||
#include "kinetis.h"
|
||||
#include "freedom-k66f.h"
|
||||
|
||||
#if defined(CONFIG_KINETIS_SPI0) || defined(CONFIG_KINETIS_SPI1) || \
|
||||
defined(CONFIG_KINETIS_SPI2)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_spidev_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins for the FREEDOM-K66F board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function k66_spidev_initialize(void)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: kinetis_spi[n]select, kinetis_spi[n]status, and kinetis_spi[n]cmddata
|
||||
*
|
||||
* 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/spi.h). All other methods
|
||||
* including kinetis_spibus_initialize()) are provided by common Kinetis logic.
|
||||
* To use this common SPI logic on your board:
|
||||
*
|
||||
* 1. Provide logic in kinetis_boardinitialize() to configure SPI chip select
|
||||
* pins.
|
||||
* 2. Provide kinetis_spi[n]select() and kinetis_spi[n]status() 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[n]cmddata() 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 kinetis_spibus_initialize() in your low level application
|
||||
* initialization logic
|
||||
* 4. The handle returned by kinetis_spibus_initialize() 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_KINETIS_SPI0
|
||||
void kinetis_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI1
|
||||
void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI2
|
||||
void kinetis_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_KINETIS_SPI0 || CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
|
74
configs/freedom-k66f/src/k66_uid.c
Normal file
74
configs/freedom-k66f/src/k66_uid.c
Normal file
@ -0,0 +1,74 @@
|
||||
/****************************************************************************
|
||||
* configs/freedom-k66/src/kinetis_uid.c
|
||||
*
|
||||
* Copyright (C) 2016 Neil Hancock. All rights reserved.
|
||||
*
|
||||
* 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 <chip/kinetis_k66memorymap.h>
|
||||
#include <chip/kinetis_sim.h>
|
||||
#include <stddef.h>
|
||||
#include <errno.h>
|
||||
#include "kinetis_uid.h"
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#if defined(CONFIG_BOARDCTL_UNIQUEID)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_uniqueid
|
||||
****************************************************************************/
|
||||
|
||||
int board_uniqueid(FAR uint8_t *uniqueid)
|
||||
{
|
||||
if (uniqueid == NULL)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
kinetis_get_uniqueid(uniqueid);
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BOARDCTL_UNIQUEID */
|
106
configs/freedom-k66f/src/k66_usbdev.c
Normal file
106
configs/freedom-k66f/src/k66_usbdev.c
Normal file
@ -0,0 +1,106 @@
|
||||
/************************************************************************************
|
||||
* configs/freedom-k66f/src/k66_usbdev.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/usb/usbdev.h>
|
||||
#include <nuttx/usb/usbdev_trace.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "kinetis.h"
|
||||
#include "freedom-k66f.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: k66_usbinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to setup USB-related GPIO pins for the FREEDOM-K66F board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void k66_usbinitialize(void)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: kinetis_usbpullup
|
||||
*
|
||||
* Description:
|
||||
* If USB is supported and the board supports a pullup via GPIO (for USB software
|
||||
* connect and disconnect), then the board software must provide kinetis_usbpullup.
|
||||
* See include/nuttx/usb/usbdev.h for additional description of this method.
|
||||
* Alternatively, if no pull-up GPIO the following EXTERN can be redefined to be
|
||||
* NULL.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
int kinetis_usbpullup(FAR struct usbdev_s *dev, bool enable)
|
||||
{
|
||||
usbtrace(TRACE_DEVPULLUP, (uint16_t)enable);
|
||||
# warning "Missing logic"
|
||||
return OK;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: kinetis_usbsuspend
|
||||
*
|
||||
* Description:
|
||||
* Board logic must provide the kinetis_usbsuspend logic if the USBDEV driver is
|
||||
* used. This function is called whenever the USB enters or leaves suspend mode.
|
||||
* This is an opportunity for the board logic to shutdown clocks, power, etc.
|
||||
* while the USB is suspended.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void kinetis_usbsuspend(FAR struct usbdev_s *dev, bool resume)
|
||||
{
|
||||
uinfo("resume: %d\n", resume);
|
||||
#warning "Missing logic"
|
||||
}
|
100
configs/freedom-k66f/src/k66_usbmsc.c
Normal file
100
configs/freedom-k66f/src/k66_usbmsc.c
Normal file
@ -0,0 +1,100 @@
|
||||
/****************************************************************************
|
||||
* configs/freedom-k66f/src/k66_usbmsc.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* Configure and register the Kinetis MMC/SD 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 <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/sdio.h>
|
||||
#include <nuttx/mmcsd.h>
|
||||
|
||||
#include "kinetis.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifndef CONFIG_SYSTEM_USBMSC_DEVMINOR1
|
||||
# define CONFIG_SYSTEM_USBMSC_DEVMINOR1 0
|
||||
#endif
|
||||
|
||||
/* SLOT number(s) could depend on the board configuration */
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_FREEDOM_K66F
|
||||
# undef k66_MMCSDSLOTNO
|
||||
# define k66_MMCSDSLOTNO 0
|
||||
#else
|
||||
/* Add configuration for new Kinetis boards here */
|
||||
# error "Unrecognized Kinetis board"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_usbmsc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture specific initialization as needed to establish
|
||||
* the mass storage device that will be exported by the USB MSC device.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_usbmsc_initialize(int port)
|
||||
{
|
||||
/* If system/usbmsc is built as an NSH command, then SD slot should
|
||||
* already have been initialized in board_app_initialize() (see k66_appinit.c).
|
||||
* In this case, there is nothing further to be done here.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NSH_BUILTIN_APPS
|
||||
# warning "Missing logic"
|
||||
#endif /* CONFIG_NSH_BUILTIN_APPS */
|
||||
|
||||
return OK;
|
||||
}
|
112
configs/freedom-k66f/src/k66_userleds.c
Normal file
112
configs/freedom-k66f/src/k66_userleds.c
Normal file
@ -0,0 +1,112 @@
|
||||
/****************************************************************************
|
||||
* configs/freedom-k66f/src/k66_userleds.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Authors: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David Sidrane <david_s5@nscdg.com>
|
||||
*
|
||||
* 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/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "kinetis.h"
|
||||
#include "freedom-k66f.h"
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_initialize(void)
|
||||
{
|
||||
kinetis_pinconfig(GPIO_LED_R);
|
||||
kinetis_pinconfig(GPIO_LED_G);
|
||||
kinetis_pinconfig(GPIO_LED_B);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
uint32_t ledcfg;
|
||||
|
||||
if (led == BOARD_LED_R)
|
||||
{
|
||||
ledcfg = GPIO_LED_R;
|
||||
}
|
||||
else if (led == BOARD_LED_G)
|
||||
{
|
||||
ledcfg = GPIO_LED_G;
|
||||
}
|
||||
else if (led == BOARD_LED_B)
|
||||
{
|
||||
ledcfg = GPIO_LED_B;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
kinetis_gpiowrite(ledcfg, !ledon); /* Low illuminates */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint8_t ledset)
|
||||
{
|
||||
/* Low illuminates */
|
||||
|
||||
kinetis_gpiowrite(GPIO_LED_R, (ledset & BOARD_LED_R_BIT) == 0);
|
||||
kinetis_gpiowrite(GPIO_LED_G, (ledset & BOARD_LED_G_BIT) == 0);
|
||||
kinetis_gpiowrite(GPIO_LED_B, (ledset & BOARD_LED_B_BIT) == 0);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
@ -51,7 +51,8 @@
|
||||
#include "kinetis.h"
|
||||
#include "kwikstik-k40.h"
|
||||
|
||||
#if defined(CONFIG_KINETIS_SPI1) || defined(CONFIG_KINETIS_SPI2)
|
||||
#if defined(CONFIG_KINETIS_SPI0) || defined(CONFIG_KINETIS_SPI1) || \
|
||||
defined(CONFIG_KINETIS_SPI2)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
@ -71,10 +72,10 @@ void weak_function kinetis_spidev_initialize(void)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kinetis_spi1/2/3select and kinetis_spi1/2/3status
|
||||
* Name: kinetis_spi0/1/2select and kinetis_spi0/1/2status
|
||||
*
|
||||
* Description:
|
||||
* The external functions, kinetis_spi1/2/3select and kinetis_spi1/2/3status must be
|
||||
* The external functions, kinetis_spi0/1/2select and kinetis_spi0/1/2status must be
|
||||
* provided by board-specific logic. They are implementations of the select
|
||||
* and status methods of the SPI interface defined by struct spi_ops_s (see
|
||||
* include/nuttx/spi/spi.h). All other methods (including kinetis_spibus_initialize())
|
||||
@ -83,7 +84,7 @@ void weak_function kinetis_spidev_initialize(void)
|
||||
*
|
||||
* 1. Provide logic in kinetis_boardinitialize() to configure SPI chip select
|
||||
* pins.
|
||||
* 2. Provide kinetis_spi1/2/3select() and kinetis_spi1/2/3status() functions in your
|
||||
* 2. Provide kinetis_spi0/1/2select() and kinetis_spi0/1/2status() 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 kinetis_spibus_initialize() in your low level application
|
||||
@ -95,6 +96,20 @@ void weak_function kinetis_spidev_initialize(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI0
|
||||
void kinetis_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI1
|
||||
void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
@ -123,18 +138,4 @@ uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI3
|
||||
void kinetis_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
|
||||
#endif /* CONFIG_KINETIS_SPI0 || CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
|
||||
|
@ -51,7 +51,8 @@
|
||||
#include "kinetis.h"
|
||||
#include "teensy-3x.h"
|
||||
|
||||
#if defined(CONFIG_KINETIS_SPI1) || defined(CONFIG_KINETIS_SPI2)
|
||||
#if defined(CONFIG_KINETIS_SPI0) || defined(CONFIG_KINETIS_SPI1) || \
|
||||
defined(CONFIG_KINETIS_SPI2)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
@ -71,10 +72,10 @@ void weak_function kinetis_spidev_initialize(void)
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: kinetis_spi1/2/3select and kinetis_spi1/2/3status
|
||||
* Name: kinetis_spi0/1/2select and kinetis_spi0/1/2status
|
||||
*
|
||||
* Description:
|
||||
* The external functions, kinetis_spi1/2/3select and kinetis_spi1/2/3status must be
|
||||
* The external functions, kinetis_spi0/1/2select and kinetis_spi0/1/2status must be
|
||||
* provided by board-specific logic. They are implementations of the select
|
||||
* and status methods of the SPI interface defined by struct spi_ops_s (see
|
||||
* include/nuttx/spi/spi.h). All other methods (including kinetis_spibus_initialize())
|
||||
@ -83,7 +84,7 @@ void weak_function kinetis_spidev_initialize(void)
|
||||
*
|
||||
* 1. Provide logic in kinetis_boardinitialize() to configure SPI chip select
|
||||
* pins.
|
||||
* 2. Provide kinetis_spi1/2/3select() and kinetis_spi1/2/3status() functions in your
|
||||
* 2. Provide kinetis_spi0/1/2select() and kinetis_spi0/1/2status() 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 kinetis_spibus_initialize() in your low level application
|
||||
@ -95,6 +96,20 @@ void weak_function kinetis_spidev_initialize(void)
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI0
|
||||
void kinetis_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI1
|
||||
void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
@ -123,18 +138,4 @@ uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI3
|
||||
void kinetis_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
|
||||
#endif /* CONFIG_KINETIS_SPI0 || CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
|
||||
|
@ -51,7 +51,8 @@
|
||||
#include "kinetis.h"
|
||||
#include "twr-k60n512.h"
|
||||
|
||||
#if defined(CONFIG_KINETIS_SPI1) || defined(CONFIG_KINETIS_SPI2)
|
||||
#if defined(CONFIG_KINETIS_SPI0) || defined(CONFIG_KINETIS_SPI1) || \
|
||||
defined(CONFIG_KINETIS_SPI2)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
@ -71,10 +72,10 @@ void weak_function kinetis_spidev_initialize(void)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kinetis_spi1/2/3select and kinetis_spi1/2/3status
|
||||
* Name: kinetis_spi0/1/2select and kinetis_spi0/1/2status
|
||||
*
|
||||
* Description:
|
||||
* The external functions, kinetis_spi1/2/3select and kinetis_spi1/2/3status must be
|
||||
* The external functions, kinetis_spi0/1/2select and kinetis_spi0/1/2status must be
|
||||
* provided by board-specific logic. They are implementations of the select
|
||||
* and status methods of the SPI interface defined by struct spi_ops_s (see
|
||||
* include/nuttx/spi/spi.h). All other methods (including kinetis_spibus_initialize())
|
||||
@ -83,7 +84,7 @@ void weak_function kinetis_spidev_initialize(void)
|
||||
*
|
||||
* 1. Provide logic in kinetis_boardinitialize() to configure SPI chip select
|
||||
* pins.
|
||||
* 2. Provide kinetis_spi1/2/3select() and kinetis_spi1/2/3status() functions in your
|
||||
* 2. Provide kinetis_spi0/1/2select() and kinetis_spi0/1/2status() 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 kinetis_spibus_initialize() in your low level application
|
||||
@ -95,6 +96,20 @@ void weak_function kinetis_spidev_initialize(void)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI0
|
||||
void kinetis_spi0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI1
|
||||
void kinetis_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
@ -123,18 +138,4 @@ uint8_t kinetis_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KINETIS_SPI3
|
||||
void kinetis_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spiinfo("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
# warning "Missing logic"
|
||||
}
|
||||
|
||||
uint8_t kinetis_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
# warning "Missing logic"
|
||||
return SPI_STATUS_PRESENT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
|
||||
#endif /* CONFIG_KINETIS_SPI0 || CONFIG_KINETIS_SPI1 || CONFIG_KINETIS_SPI2 */
|
||||
|
@ -2120,7 +2120,7 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer,
|
||||
}
|
||||
|
||||
#else
|
||||
/* Use either the single- or muliple-block transfer method */
|
||||
/* Use either the single- or multiple-block transfer method */
|
||||
|
||||
if (nsectors == 1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user