mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 22:20:01 +08:00
Spark configuration updates from David Sidrane
This commit is contained in:
+5
-1
@@ -338,6 +338,8 @@ config ARCH_BOARD_MAPLE
|
||||
bool "maple board"
|
||||
depends on ARCH_CHIP_STM32F103RB || ARCH_CHIP_STM32F103CB
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
---help---
|
||||
A configuration for the LeafLab's Maple and Maple Mini boards.
|
||||
These boards are based on the STM32F103RBT6 chip for the standard
|
||||
@@ -551,9 +553,11 @@ config ARCH_BOARD_SPARK
|
||||
bool "Spark Core"
|
||||
depends on ARCH_CHIP_STM32F103CB
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
---help---
|
||||
A configuration for the Spark Core from Spark Devices
|
||||
(http://www.sparkdevices.com). This board features the STM32103CBT6
|
||||
(http://www.spark.io). This board features the STM32103CBT6
|
||||
MCU from STMicro.
|
||||
|
||||
config ARCH_BOARD_STM32_TINY
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
############################################################################
|
||||
# configs/spark/composite/Make.defs
|
||||
#
|
||||
# Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||
|
||||
ifeq ($(CONFIG_STM32_DFU),y)
|
||||
LDSCRIPT = ld.script.dfu
|
||||
else
|
||||
LDSCRIPT = ld.script
|
||||
endif
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mknulldeps.sh
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
|
||||
MAXOPTIMIZATION = -O2
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
|
||||
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
|
||||
else
|
||||
ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHWARNINGSXX = -Wall -Wshadow
|
||||
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
|
||||
|
||||
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 -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
# configs/spark/composite/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2013 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 RIDE
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the RIDE toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/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"
|
||||
|
||||
# This is the Cygwin path to the location where I build the buildroot
|
||||
# toolchain.
|
||||
#export TOOLCHAIN_BIN="${WD}/../misc/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}"
|
||||
@@ -0,0 +1,298 @@
|
||||
/****************************************************************************
|
||||
* configs/spark/src/up_autoleds.c
|
||||
*
|
||||
* Copyright (C) 2012-2013 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "stm32.h"
|
||||
#include "spark.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
|
||||
* with CONFIG_DEBUG_VERBOSE too)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DEBUG_LEDS
|
||||
# define leddbg lldbg
|
||||
# define ledvdbg llvdbg
|
||||
#else
|
||||
# define leddbg(x...)
|
||||
# define ledvdbg(x...)
|
||||
#endif
|
||||
|
||||
/* The following definitions map the encoded LED setting to bit sets used to
|
||||
* manipulate the LEDs. All terms are in true logic, the led polarity is dealt
|
||||
* with in the phy_xxx operations
|
||||
*/
|
||||
|
||||
#define ON_SETBITS_SHIFT (0)
|
||||
#define ON_CLRBITS_SHIFT (4)
|
||||
#define OFF_SETBITS_SHIFT (8)
|
||||
#define OFF_CLRBITS_SHIFT (12)
|
||||
|
||||
#define ON_BITS(v) ((v) & 0xff)
|
||||
#define OFF_BITS(v) (((v) >> 8) & 0x0ff)
|
||||
#define SETBITS(b) ((b) & 0x0f)
|
||||
#define CLRBITS(b) (((b) >> 4) & 0x0f)
|
||||
|
||||
#define ON_SETBITS(v) (SETBITS(ON_BITS(v))
|
||||
#define ON_CLRBITS(v) (CLRBITS(ON_BITS(v))
|
||||
#define OFF_SETBITS(v) (SETBITS(OFF_BITS(v))
|
||||
#define OFF_CLRBITS(v) (CLRBITS(OFF_BITS(v))
|
||||
|
||||
#define LED_STARTED_ON_SETBITS ((BOARD_RED_LED_BIT) << ON_SETBITS_SHIFT)
|
||||
#define LED_STARTED_ON_CLRBITS ((BOARD_GREEN_LED_BIT|BOARD_BLUE_LED_BIT|BOARD_USR_LED_BIT) << ON_CLRBITS_SHIFT)
|
||||
#define LED_STARTED_OFF_SETBITS (0 << OFF_SETBITS_SHIFT)
|
||||
#define LED_STARTED_OFF_CLRBITS ((BOARD_RED_LED_BIT|BOARD_GREEN_LED_BIT|BOARD_BLUE_LED_BIT|BOARD_USR_LED_BIT) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
#define LED_HEAPALLOCATE_ON_SETBITS ((BOARD_BLUE_LED_BIT) << ON_SETBITS_SHIFT)
|
||||
#define LED_HEAPALLOCATE_ON_CLRBITS ((BOARD_RED_LED_BIT|BOARD_GREEN_LED_BIT|BOARD_USR_LED_BIT) << ON_CLRBITS_SHIFT)
|
||||
#define LED_HEAPALLOCATE_OFF_SETBITS ((BOARD_RED_LED_BIT) << OFF_SETBITS_SHIFT)
|
||||
#define LED_HEAPALLOCATE_OFF_CLRBITS ((BOARD_GREEN_LED_BIT|BOARD_BLUE_LED_BIT|BOARD_USR_LED_BIT) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
#define LED_IRQSENABLED_ON_SETBITS ((BOARD_RED_LED_BIT|BOARD_GREEN_LED_BIT) << ON_SETBITS_SHIFT)
|
||||
#define LED_IRQSENABLED_ON_CLRBITS ((BOARD_BLUE_LED_BIT|BOARD_USR_LED_BIT) << ON_CLRBITS_SHIFT)
|
||||
#define LED_IRQSENABLED_OFF_SETBITS ((BOARD_BLUE_LED_BIT) << OFF_SETBITS_SHIFT)
|
||||
#define LED_IRQSENABLED_OFF_CLRBITS ((BOARD_RED_LED_BIT|BOARD_GREEN_LED_BIT|BOARD_USR_LED_BIT) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
#define LED_STACKCREATED_ON_SETBITS ((BOARD_GREEN_LED_BIT) << ON_SETBITS_SHIFT)
|
||||
#define LED_STACKCREATED_ON_CLRBITS ((BOARD_RED_LED_BIT|BOARD_BLUE_LED_BIT|BOARD_USR_LED_BIT) << ON_CLRBITS_SHIFT)
|
||||
#define LED_STACKCREATED_OFF_SETBITS ((BOARD_RED_LED_BIT|BOARD_GREEN_LED_BIT) << OFF_SETBITS_SHIFT)
|
||||
#define LED_STACKCREATED_OFF_CLRBITS ((BOARD_BLUE_LED_BIT|BOARD_USR_LED_BIT) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
#define LED_INIRQ_ON_SETBITS ((BOARD_RED_LED_BIT) << ON_SETBITS_SHIFT)
|
||||
#define LED_INIRQ_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
||||
#define LED_INIRQ_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
||||
#define LED_INIRQ_OFF_CLRBITS ((BOARD_RED_LED_BIT) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
#define LED_SIGNAL_ON_SETBITS ((BOARD_BLUE_LED_BIT) << ON_SETBITS_SHIFT)
|
||||
#define LED_SIGNAL_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
||||
#define LED_SIGNAL_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
||||
#define LED_SIGNAL_OFF_CLRBITS ((BOARD_BLUE_LED_BIT) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
#define LED_ASSERTION_ON_SETBITS ((BOARD_RED_LED_BIT|BOARD_GREEN_LED_BIT|BOARD_BLUE_LED_BIT) << ON_SETBITS_SHIFT)
|
||||
#define LED_ASSERTION_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
||||
#define LED_ASSERTION_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
||||
#define LED_ASSERTION_OFF_CLRBITS ((BOARD_RED_LED_BIT|BOARD_GREEN_LED_BIT|BOARD_BLUE_LED_BIT) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
#define LED_PANIC_ON_SETBITS ((BOARD_RED_LED_BIT) << ON_SETBITS_SHIFT)
|
||||
#define LED_PANIC_ON_CLRBITS ((0) << ON_CLRBITS_SHIFT)
|
||||
#define LED_PANIC_OFF_SETBITS ((0) << OFF_SETBITS_SHIFT)
|
||||
#define LED_PANIC_OFF_CLRBITS ((BOARD_RED_LED_BIT) << OFF_CLRBITS_SHIFT)
|
||||
|
||||
/**************************************************************************************
|
||||
* Private Function Prototypes
|
||||
**************************************************************************************/
|
||||
|
||||
/* LED State Controls */
|
||||
|
||||
static inline void phy_led_on(unsigned int on_bitset);
|
||||
static inline void phy_led_off(unsigned int off_bitset);
|
||||
static void led_setonoff(unsigned int bitset);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const uint16_t g_ledbits[LED_NUM_CODES] =
|
||||
{
|
||||
(LED_STARTED_ON_SETBITS | LED_STARTED_ON_CLRBITS |
|
||||
LED_STARTED_OFF_SETBITS | LED_STARTED_OFF_CLRBITS),
|
||||
|
||||
(LED_HEAPALLOCATE_ON_SETBITS | LED_HEAPALLOCATE_ON_CLRBITS |
|
||||
LED_HEAPALLOCATE_OFF_SETBITS | LED_HEAPALLOCATE_OFF_CLRBITS),
|
||||
|
||||
(LED_IRQSENABLED_ON_SETBITS | LED_IRQSENABLED_ON_CLRBITS |
|
||||
LED_IRQSENABLED_OFF_SETBITS | LED_IRQSENABLED_OFF_CLRBITS),
|
||||
|
||||
(LED_STACKCREATED_ON_SETBITS | LED_STACKCREATED_ON_CLRBITS |
|
||||
LED_STACKCREATED_OFF_SETBITS | LED_STACKCREATED_OFF_CLRBITS),
|
||||
|
||||
(LED_INIRQ_ON_SETBITS | LED_INIRQ_ON_CLRBITS |
|
||||
LED_INIRQ_OFF_SETBITS | LED_INIRQ_OFF_CLRBITS),
|
||||
|
||||
(LED_SIGNAL_ON_SETBITS | LED_SIGNAL_ON_CLRBITS |
|
||||
LED_SIGNAL_OFF_SETBITS | LED_SIGNAL_OFF_CLRBITS),
|
||||
|
||||
(LED_ASSERTION_ON_SETBITS | LED_ASSERTION_ON_CLRBITS |
|
||||
LED_ASSERTION_OFF_SETBITS | LED_ASSERTION_OFF_CLRBITS),
|
||||
|
||||
(LED_PANIC_ON_SETBITS | LED_PANIC_ON_CLRBITS |
|
||||
LED_PANIC_OFF_SETBITS | LED_PANIC_OFF_CLRBITS)
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: phy_led_on
|
||||
*
|
||||
* Description:
|
||||
* Performs the physical IO to turn On LEDs to the bit encoded state
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void phy_led_on(unsigned int on_bitset)
|
||||
{
|
||||
/* All RGB LEDs are pulled up and, hence, active low */
|
||||
|
||||
if ((on_bitset & BOARD_RED_LED_BIT) != 0)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED1, false);
|
||||
}
|
||||
|
||||
if ((on_bitset & BOARD_GREEN_LED_BIT) != 0)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED2, false);
|
||||
}
|
||||
|
||||
if ((on_bitset & BOARD_BLUE_LED_BIT) != 0)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED3, false);
|
||||
}
|
||||
|
||||
/* USR LED is pulled down and, hence, active high */
|
||||
|
||||
if ((on_bitset & BOARD_USR_LED_BIT) != 0)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED4, true);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: phy_led_off
|
||||
*
|
||||
* Description:
|
||||
* Performs the physical IO to turn Off LEDs to the bit encoded state
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void phy_led_off(unsigned int off_bitset)
|
||||
{
|
||||
/* All RGB LEDs are pulled up and, hence, active low */
|
||||
|
||||
if ((off_bitset & BOARD_RED_LED_BIT) != 0)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED1, true);
|
||||
}
|
||||
|
||||
if ((off_bitset & BOARD_GREEN_LED_BIT) != 0)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED2, true);
|
||||
}
|
||||
|
||||
if ((off_bitset & BOARD_BLUE_LED_BIT) != 0)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED3, true);
|
||||
}
|
||||
|
||||
/* USR LED is pulled down and, hence, active high */
|
||||
|
||||
if ((off_bitset & BOARD_USR_LED_BIT) != 0)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED4, false);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: led_setonoff
|
||||
*
|
||||
* Description:
|
||||
* Set/clear all LEDs to the bit encoded state
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void led_setonoff(unsigned int bits)
|
||||
{
|
||||
phy_led_off(CLRBITS(bits));
|
||||
phy_led_on(SETBITS(bits));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ledinit
|
||||
****************************************************************************/
|
||||
|
||||
void up_ledinit(void)
|
||||
{
|
||||
/* Configure LED1-4 GPIOs for output */
|
||||
|
||||
stm32_configgpio(GPIO_LED1);
|
||||
stm32_configgpio(GPIO_LED2);
|
||||
stm32_configgpio(GPIO_LED3);
|
||||
stm32_configgpio(GPIO_LED4);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ledon
|
||||
****************************************************************************/
|
||||
|
||||
void up_ledon(int led)
|
||||
{
|
||||
led_setonoff(ON_BITS(g_ledbits[led]));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ledoff
|
||||
****************************************************************************/
|
||||
|
||||
void up_ledoff(int led)
|
||||
{
|
||||
led_setonoff(OFF_BITS(g_ledbits[led]));
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
||||
@@ -0,0 +1,133 @@
|
||||
/****************************************************************************
|
||||
* configs/spark/src/up_buttons.c
|
||||
*
|
||||
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
#include "spark.h"
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_buttoninit
|
||||
*
|
||||
* Description:
|
||||
* up_buttoninit() must be called to initialize button resources. After
|
||||
* that, up_buttons() may be called to collect the current state of all
|
||||
* buttons or up_irqbutton() may be called to register button interrupt
|
||||
* handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_buttoninit(void)
|
||||
{
|
||||
/* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are
|
||||
* configured for all pins.
|
||||
*/
|
||||
|
||||
stm32_configgpio(GPIO_BTN);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_buttons
|
||||
*
|
||||
* N.B The return state in true logic, the button polarity is dealt here in
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t up_buttons(void)
|
||||
{
|
||||
return stm32_gpioread(GPIO_BTN)==0 ? BUTTON_USER_BIT : 0;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* up_buttoninit() must be called to initialize button resources. After
|
||||
* that, up_buttons() may be called to collect the current state of all
|
||||
* buttons or up_irqbutton() may be called to register button interrupt
|
||||
* handlers.
|
||||
*
|
||||
* After up_buttoninit() has been called, up_buttons() may be called to
|
||||
* collect the state of all buttons. up_buttons() returns an 8-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* up_irqbutton() 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_* 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 up_irqbutton(int id, xcpt_t irqhandler)
|
||||
{
|
||||
xcpt_t oldhandler = NULL;
|
||||
|
||||
/* The following should be atomic */
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
oldhandler = stm32_gpiosetevent(GPIO_BTN, true, true, true, irqhandler);
|
||||
}
|
||||
return oldhandler;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
||||
@@ -0,0 +1,264 @@
|
||||
/****************************************************************************
|
||||
* config/spark/src/up_composite.c
|
||||
* arch/arm/src/board/up_composit.c
|
||||
*
|
||||
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David_s5 <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 <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
||||
#ifdef CONFIG_MTD_SST25
|
||||
# include <nuttx/spi/spi.h>
|
||||
# include <nuttx/mtd.h>
|
||||
# include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR
|
||||
# include <apps/usbmonitor.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
# include "stm32_usbdev.h"
|
||||
#endif
|
||||
|
||||
#include "stm32.h"
|
||||
#include "spark.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* Can't support the SST25 device if it SPI2 or SST25 support is not enabled */
|
||||
|
||||
#define HAVE_SST25 1
|
||||
#if !defined(CONFIG_STM32_SPI2) || !defined(CONFIG_MTD_SST25)
|
||||
# undef HAVE_SST25
|
||||
#endif
|
||||
|
||||
/* Can't support SST25 features if mountpoints are disabled */
|
||||
|
||||
#if defined(CONFIG_DISABLE_MOUNTPOINT)
|
||||
# undef HAVE_SST25
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SPARK_FLASH_MOUNT_POINT
|
||||
# define CONFIG_SPARK_FLASH_MOUNT_POINT "/mnt/p%d"
|
||||
#endif
|
||||
|
||||
/* Use minor device number 0 is not is provided */
|
||||
|
||||
#ifndef CONFIG_SPARK_FLASH_MINOR
|
||||
# define CONFIG_SPARK_FLASH_MINOR 0
|
||||
#endif
|
||||
|
||||
/* Can't support both FAT and NXFFS */
|
||||
|
||||
#if defined(CONFIG_FS_FAT) && defined(CONFIG_FS_NXFFS)
|
||||
# warning "Can't support both FAT and NXFFS -- using FAT"
|
||||
#endif
|
||||
|
||||
#define HAVE_USBDEV 1
|
||||
#define HAVE_USBMONITOR 1
|
||||
|
||||
/* Can't support USB device is USB device is not enabled */
|
||||
|
||||
#ifndef CONFIG_USBDEV
|
||||
# undef HAVE_USBDEV
|
||||
# undef HAVE_USBMONITOR
|
||||
#endif
|
||||
|
||||
/* Check if we should enable the USB monitor before starting NSH */
|
||||
|
||||
#if !defined(CONFIG_USBDEV_TRACE) || !defined(CONFIG_SYSTEM_USBMONITOR)
|
||||
# undef HAVE_USBMONITOR
|
||||
#endif
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lowsyslog(__VA_ARGS__)
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lowsyslog
|
||||
# else
|
||||
# define message printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_archinitialize
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture specific initialization
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int composite_archinitialize(void)
|
||||
{
|
||||
#ifdef HAVE_SST25
|
||||
FAR struct spi_dev_s *spi;
|
||||
FAR struct mtd_dev_s *mtd;
|
||||
int ret;
|
||||
|
||||
/* Configure SPI-based devices */
|
||||
|
||||
/* Get the SPI port */
|
||||
|
||||
message("nsh_archinitialize: Initializing SPI port %d\n",CONFIG_SPARK_FLASH_SPI);
|
||||
spi = up_spiinitialize(CONFIG_SPARK_FLASH_SPI);
|
||||
if (!spi)
|
||||
{
|
||||
message("nsh_archinitialize: ERROR: Failed to initialize SPI port %d\n",CONFIG_SPARK_FLASH_SPI);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
message("nsh_archinitialize: Successfully initialized SPI port %d\n",CONFIG_SPARK_FLASH_SPI);
|
||||
|
||||
/* Now bind the SPI interface to the SST25 SPI FLASH driver */
|
||||
|
||||
message("nsh_archinitialize: Bind SPI to the SPI flash driver\n");
|
||||
mtd = sst25_initialize((FAR struct spi_dev_s *)spi);
|
||||
if (!mtd)
|
||||
{
|
||||
message("nsh_archinitialize: Failed to bind SPI port %d to the SPI FLASH driver\n",CONFIG_SPARK_FLASH_SPI);
|
||||
return -ENODEV;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
message("nsh_archinitialize: Successfully bound SPI port %d to the SPI FLASH driver\n",CONFIG_SPARK_FLASH_SPI);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPARK_FLASH_PART
|
||||
{
|
||||
int partno;
|
||||
int partsize;
|
||||
int partoffset;
|
||||
const char *partstring = CONFIG_SPARK_FLASH_PART_LIST;
|
||||
const char *ptr;
|
||||
FAR struct mtd_dev_s *mtd_part;
|
||||
char partname[16];
|
||||
char mntpoint[16];
|
||||
|
||||
/* Now create a partition on the FLASH device */
|
||||
|
||||
partno = CONFIG_SPARK_FLASH_MINOR;
|
||||
ptr = partstring;
|
||||
partoffset = 0;
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
/* Get the partition size */
|
||||
|
||||
partsize = atoi(ptr);
|
||||
mtd_part = mtd_partition(mtd, partoffset, (partsize>>2)*16);
|
||||
partoffset += (partsize >> 2) * 16;
|
||||
|
||||
/* Use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(partno, mtd_part);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("ERROR: Initialize the FTL layer\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
snprintf(partname,sizeof(partname), "/dev/mtdblock%d", partno);
|
||||
snprintf(mntpoint,sizeof(mntpoint)-1,CONFIG_SPARK_FLASH_MOUNT_POINT,partno);
|
||||
|
||||
/* Mount the file system at /mnt/pn */
|
||||
|
||||
ret = mount(partname, mntpoint, "vfat", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("ERROR: Failed to mount the FAT volume: %d\n", errno);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Update the pointer to point to the next size in the list */
|
||||
|
||||
while ((*ptr >= '0') && (*ptr <= '9'))
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (*ptr == ',')
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
/* Increment the part number */
|
||||
|
||||
partno++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ONFIG_SPARK_FLASH_PART */
|
||||
#endif /* HAVE_SST25 */
|
||||
|
||||
#ifdef HAVE_USBMONITOR
|
||||
/* Start the USB Monitor */
|
||||
|
||||
ret = usbmonitor_start(0, NULL);
|
||||
if (ret != OK)
|
||||
{
|
||||
message("nsh_archinitialize: Start USB monitor: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
/************************************************************************************
|
||||
* configs/spark/src/up_cxxinitialize.c
|
||||
*
|
||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include <arch/stm32/chip.h>
|
||||
#include "chip.h"
|
||||
|
||||
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
/* Debug ****************************************************************************/
|
||||
/* Non-standard debug that may be enabled just for testing the static constructors */
|
||||
|
||||
#ifndef CONFIG_DEBUG
|
||||
# undef CONFIG_DEBUG_CXX
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG_CXX
|
||||
# define cxxdbg dbg
|
||||
# define cxxlldbg lldbg
|
||||
# ifdef CONFIG_DEBUG_VERBOSE
|
||||
# define cxxvdbg vdbg
|
||||
# define cxxllvdbg llvdbg
|
||||
# else
|
||||
# define cxxvdbg(x...)
|
||||
# define cxxllvdbg(x...)
|
||||
# endif
|
||||
#else
|
||||
# define cxxdbg(x...)
|
||||
# define cxxlldbg(x...)
|
||||
# define cxxvdbg(x...)
|
||||
# define cxxllvdbg(x...)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Types
|
||||
************************************************************************************/
|
||||
/* This type defines one entry in initialization array */
|
||||
|
||||
typedef void (*initializer_t)(void);
|
||||
|
||||
/************************************************************************************
|
||||
* External references
|
||||
************************************************************************************/
|
||||
/* _sinit and _einit are symbols exported by the linker script that mark the
|
||||
* beginning and the end of the C++ initialization section.
|
||||
*/
|
||||
|
||||
extern initializer_t _sinit;
|
||||
extern initializer_t _einit;
|
||||
|
||||
/* _stext and _etext are symbols exported by the linker script that mark the
|
||||
* beginning and the end of text.
|
||||
*/
|
||||
|
||||
extern uint32_t _stext;
|
||||
extern uint32_t _etext;
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_cxxinitialize
|
||||
*
|
||||
* Description:
|
||||
* If C++ and C++ static constructors are supported, then this function
|
||||
* must be provided by board-specific logic in order to perform
|
||||
* initialization of the static C++ class instances.
|
||||
*
|
||||
* This function should then be called in the application-specific
|
||||
* user_start logic in order to perform the C++ initialization. NOTE
|
||||
* that no component of the core NuttX RTOS logic is involved; This
|
||||
* function definition only provides the 'contract' between application
|
||||
* specific C++ code and platform-specific toolchain support
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
void up_cxxinitialize(void)
|
||||
{
|
||||
initializer_t *initp;
|
||||
|
||||
cxxdbg("_sinit: %p _einit: %p _stext: %p _etext: %p\n",
|
||||
&_sinit, &_einit, &_stext, &_etext);
|
||||
|
||||
/* Visit each entry in the initialzation table */
|
||||
|
||||
for (initp = &_sinit; initp != &_einit; initp++)
|
||||
{
|
||||
initializer_t initializer = *initp;
|
||||
cxxdbg("initp: %p initializer: %p\n", initp, initializer);
|
||||
|
||||
/* Make sure that the address is non-NULL and lies in the text region
|
||||
* defined by the linker script. Some toolchains may put NULL values
|
||||
* or counts in the initialization table
|
||||
*/
|
||||
|
||||
if ((void*)initializer > (void*)&_stext && (void*)initializer < (void*)&_etext)
|
||||
{
|
||||
cxxdbg("Calling %p\n", initializer);
|
||||
initializer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_HAVE_CXX && CONFIG_HAVE_CXXINITIALIZE */
|
||||
@@ -0,0 +1,260 @@
|
||||
/****************************************************************************
|
||||
* config/spark/src/up_nsh.c
|
||||
* arch/arm/src/board/up_nsh.c
|
||||
*
|
||||
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* David_s5 <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 <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
||||
#ifdef CONFIG_MTD_SST25
|
||||
# include <nuttx/spi/spi.h>
|
||||
# include <nuttx/mtd.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYSTEM_USBMONITOR
|
||||
# include <apps/usbmonitor.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBDEV
|
||||
# include "stm32_usbdev.h"
|
||||
#endif
|
||||
|
||||
#include "stm32.h"
|
||||
#include "spark.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* Can't support the SST25 device if it SPI2 or SST25 support is not enabled */
|
||||
|
||||
#define HAVE_SST25 1
|
||||
#if !defined(CONFIG_STM32_SPI2) || !defined(CONFIG_MTD_SST25)
|
||||
# undef HAVE_SST25
|
||||
#endif
|
||||
|
||||
/* Can't support SST25 features if mountpoints are disabled */
|
||||
|
||||
#if defined(CONFIG_DISABLE_MOUNTPOINT)
|
||||
# undef HAVE_SST25
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_SPARK_FLASH_MOUNT_POINT
|
||||
# define CONFIG_SPARK_FLASH_MOUNT_POINT "/mnt/p%d"
|
||||
#endif
|
||||
|
||||
/* Use minor device number 0 is not is provided */
|
||||
|
||||
#ifndef CONFIG_SPARK_FLASH_MINOR
|
||||
# define CONFIG_SPARK_FLASH_MINOR 0
|
||||
#endif
|
||||
|
||||
/* Can't support both FAT and NXFFS */
|
||||
|
||||
#if defined(CONFIG_FS_FAT) && defined(CONFIG_FS_NXFFS)
|
||||
# warning "Can't support both FAT and NXFFS -- using FAT"
|
||||
#endif
|
||||
|
||||
#define HAVE_USBDEV 1
|
||||
#define HAVE_USBMONITOR 1
|
||||
|
||||
/* Can't support USB device is USB device is not enabled */
|
||||
|
||||
#ifndef CONFIG_USBDEV
|
||||
# undef HAVE_USBDEV
|
||||
# undef HAVE_USBMONITOR
|
||||
#endif
|
||||
|
||||
/* Check if we should enable the USB monitor before starting NSH */
|
||||
|
||||
#if !defined(CONFIG_USBDEV_TRACE) || !defined(CONFIG_SYSTEM_USBMONITOR)
|
||||
# undef HAVE_USBMONITOR
|
||||
#endif
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
|
||||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message(...) lowsyslog(__VA_ARGS__)
|
||||
# else
|
||||
# define message(...) printf(__VA_ARGS__)
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG
|
||||
# define message lowsyslog
|
||||
# else
|
||||
# define message printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nsh_archinitialize
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture specific initialization
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nsh_archinitialize(void)
|
||||
{
|
||||
#ifdef HAVE_SST25
|
||||
FAR struct spi_dev_s *spi;
|
||||
FAR struct mtd_dev_s *mtd;
|
||||
int ret;
|
||||
|
||||
/* Configure SPI-based devices */
|
||||
|
||||
/* Get the SPI port */
|
||||
|
||||
message("nsh_archinitialize: Initializing SPI port %d\n",CONFIG_SPARK_FLASH_SPI);
|
||||
spi = up_spiinitialize(CONFIG_SPARK_FLASH_SPI);
|
||||
if (!spi)
|
||||
{
|
||||
message("nsh_archinitialize: ERROR: Failed to initialize SPI port %d\n",CONFIG_SPARK_FLASH_SPI);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
message("nsh_archinitialize: Successfully initialized SPI port %d\n",CONFIG_SPARK_FLASH_SPI);
|
||||
|
||||
/* Now bind the SPI interface to the SST25 SPI FLASH driver */
|
||||
|
||||
message("nsh_archinitialize: Bind SPI to the SPI flash driver\n");
|
||||
mtd = sst25_initialize(spi);
|
||||
if (!mtd)
|
||||
{
|
||||
message("nsh_archinitialize: Failed to bind SPI port %d to the SPI FLASH driver\n",CONFIG_SPARK_FLASH_SPI););
|
||||
}
|
||||
else
|
||||
{
|
||||
message("nsh_archinitialize: Successfully bound SPI port %d to the SPI FLASH driver\n",CONFIG_SPARK_FLASH_SPI);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPARK_FLASH_PART
|
||||
{
|
||||
int partno;
|
||||
int partsize;
|
||||
int partoffset;
|
||||
const char *partstring = CONFIG_SPARK_FLASH_PART_LIST;
|
||||
const char *ptr;
|
||||
FAR struct mtd_dev_s *mtd_part;
|
||||
char partname[16];
|
||||
char mntpoint[16];
|
||||
|
||||
/* Now create a partition on the FLASH device */
|
||||
|
||||
partno = CONFIG_SPARK_FLASH_MINOR;
|
||||
ptr = partstring;
|
||||
partoffset = 0;
|
||||
while (*ptr != '\0')
|
||||
{
|
||||
/* Get the partition size */
|
||||
|
||||
partsize = atoi(ptr);
|
||||
mtd_part = mtd_partition(mtd, partoffset, (partsize>>2)*16);
|
||||
partoffset += (partsize >> 2) * 16;
|
||||
|
||||
/* Use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(partno, mtd_part);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("ERROR: Initialize the FTL layer\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
snprintf(partname,sizeof(partname), "/dev/mtdblock%d", partno);
|
||||
snprintf(mntpoint,sizeof(mntpoint)-1,CONFIG_SPARK_FLASH_MOUNT_POINT,partno);
|
||||
|
||||
/* Mount the file system at /mnt/pn */
|
||||
|
||||
ret = mount(partname, mntpoint, "vfat", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
fdbg("ERROR: Failed to mount the FAT volume: %d\n", errno);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Update the pointer to point to the next size in the list */
|
||||
|
||||
while ((*ptr >= '0') && (*ptr <= '9'))
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (*ptr == ',')
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
/* Increment the part number */
|
||||
|
||||
partno++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_SST25 */
|
||||
|
||||
#ifdef HAVE_USBMONITOR
|
||||
/* Start the USB Monitor */
|
||||
|
||||
ret = usbmonitor_start(0, NULL);
|
||||
if (ret != OK)
|
||||
{
|
||||
message("nsh_archinitialize: Start USB monitor: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
/************************************************************************************
|
||||
* configs/spark/src/up_spi.c
|
||||
*
|
||||
* Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
* - 10/8/2013: David Sidrane
|
||||
* - Modified to support SPI2 on the Spark Core.
|
||||
*
|
||||
* 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 <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "chip.h"
|
||||
#include "stm32.h"
|
||||
#include "spark.h"
|
||||
|
||||
#if defined(CONFIG_STM32_SPI1) || defined(CONFIG_STM32_SPI2) || defined(CONFIG_STM32_SPI3)
|
||||
|
||||
/************************************************************************************
|
||||
* Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Enables debug output from this file (needs CONFIG_DEBUG too) */
|
||||
|
||||
#undef SPI_DEBUG /* Define to enable debug */
|
||||
#undef SPI_VERBOSE /* Define to enable verbose debug */
|
||||
|
||||
#ifdef SPI_DEBUG
|
||||
# define spidbg lldbg
|
||||
# ifdef SPI_VERBOSE
|
||||
# define spivdbg lldbg
|
||||
# else
|
||||
# define spivdbg(x...)
|
||||
# endif
|
||||
#else
|
||||
# undef SPI_VERBOSE
|
||||
# define spidbg(x...)
|
||||
# define spivdbg(x...)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_spiinitialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins for the Spark board.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
void weak_function stm32_spiinitialize(void)
|
||||
{
|
||||
#ifdef CONFIG_STM32_SPI2
|
||||
|
||||
/* Setup CS, EN & IRQ line IOs */
|
||||
|
||||
#ifdef CONFIG_WL_CC3000
|
||||
stm32_configgpio(GPIO_WIFI_CS);
|
||||
stm32_configgpio(GPIO_WIFI_EN);
|
||||
stm32_configgpio(GPIO_WIFI_INT);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MTD_SST25
|
||||
stm32_configgpio(GPIO_MEM_CS); /* FLASH chip select */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_spi1/2/3select and stm32_spi1/2/3status
|
||||
*
|
||||
* Description:
|
||||
* The external functions, stm32_spi1/2/3select and stm32_spi1/2/3status 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 up_spiinitialize())
|
||||
* are provided by common STM32 logic. To use this common SPI logic on your
|
||||
* board:
|
||||
*
|
||||
* 1. Provide logic in stm32_boardinitialize() to configure SPI chip select
|
||||
* pins.
|
||||
* 2. Provide stm32_spi1/2/3select() and stm32_spi1/2/3status() functions in your
|
||||
* board-specific logic. These functions will perform chip selection and
|
||||
* status operations using GPIOs in the way your board is configured.
|
||||
* 3. Add a calls to up_spiinitialize() in your low level application
|
||||
* initialization logic
|
||||
* 4. The handle returned by up_spiinitialize() may then be used to bind the
|
||||
* SPI driver to higher level logic (e.g., calling
|
||||
* mmcsd_spislotinitialize(), for example, will bind the SPI driver to
|
||||
* the SPI MMC/SD driver).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32_SPI1
|
||||
void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
}
|
||||
|
||||
uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_SPI2
|
||||
void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
{
|
||||
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
#if defined(CONFIG_MTD_SST25)
|
||||
|
||||
if (devid == SPIDEV_FLASH)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_MEM_CS, !selected);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_WL_CC3000)
|
||||
if (devid == SPIDEV_WIRELESS)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_WIFI_CS, !selected);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_SPI3
|
||||
void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||
|
||||
spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert");
|
||||
|
||||
}
|
||||
|
||||
uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_spi1cmddata
|
||||
*
|
||||
* Description:
|
||||
* Set or clear the SH1101A A0 or SD1306 D/C n bit to select data (true)
|
||||
* or command (false). This function must be provided by platform-specific
|
||||
* logic. This is an implementation of the cmddata method of the SPI
|
||||
* interface defined by struct spi_ops_s (see include/nuttx/spi/spi.h).
|
||||
*
|
||||
* Input Parameters:
|
||||
*
|
||||
* spi - SPI device that controls the bus the device that requires the CMD/
|
||||
* DATA selection.
|
||||
* devid - If there are multiple devices on the bus, this selects which one
|
||||
* to select cmd or data. NOTE: This design restricts, for example,
|
||||
* one one SPI display per SPI bus.
|
||||
* cmd - true: select command; false: select data
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SPI_CMDDATA
|
||||
#ifdef CONFIG_STM32_SPI1
|
||||
int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_SPI2
|
||||
int stm32_spi2cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32_SPI3
|
||||
int stm32_spi3cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_SPI_CMDDATA */
|
||||
|
||||
#endif /* CONFIG_STM32_SPI1 || CONFIG_STM32_SPI2 */
|
||||
@@ -0,0 +1,155 @@
|
||||
/****************************************************************************
|
||||
* configs/spark/src/up_leds.c
|
||||
*
|
||||
* Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <arch/board/board.h>
|
||||
#include <nuttx/power/pm.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "stm32.h"
|
||||
#include "spark.h"
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG
|
||||
* with CONFIG_DEBUG_VERBOSE too)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_DEBUG_LEDS
|
||||
# define leddbg lldbg
|
||||
# define ledvdbg llvdbg
|
||||
#else
|
||||
# define leddbg(x...)
|
||||
# define ledvdbg(x...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
/* This array maps an LED number to GPIO pin configuration */
|
||||
|
||||
static uint32_t g_ledcfg[BOARD_NLEDS] =
|
||||
{
|
||||
GPIO_LED1, GPIO_LED2, GPIO_LED3, GPIO_LED4
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_ledinit
|
||||
****************************************************************************/
|
||||
|
||||
void up_ledinit(void)
|
||||
{
|
||||
/* Configure LED1-4 GPIOs for output */
|
||||
|
||||
stm32_configgpio(GPIO_LED1);
|
||||
stm32_configgpio(GPIO_LED2);
|
||||
stm32_configgpio(GPIO_LED3);
|
||||
stm32_configgpio(GPIO_LED4);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_setled
|
||||
****************************************************************************/
|
||||
|
||||
void up_setled(int led, bool ledon)
|
||||
{
|
||||
if ((unsigned)led < BOARD_NLEDS)
|
||||
{
|
||||
bool active_low = (LED_ACTIVE_LOW & (1 << ledon)) != 0;
|
||||
stm32_gpiowrite(g_ledcfg[led], active_low ? !ledon : ledon);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_setleds
|
||||
* Description:
|
||||
* This function will be called to set the state of the Leds on the board
|
||||
*
|
||||
* Paramaters:
|
||||
* ledset: is a bit set of 1s for the LEDs to effect
|
||||
* led_states_set: a bit set of 1 for on 0 for off
|
||||
* N.B. The led_states_set terms are in true logic, the led polarity is
|
||||
* dealt herein
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_setleds(uint8_t ledset, uint8_t led_states_set)
|
||||
{
|
||||
led_states_set ^= LED_ACTIVE_LOW;
|
||||
if ((ledset & BOARD_USR_LED_BIT) == 0)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED1, (led_states_set & BOARD_USR_LED_BIT) == 0);
|
||||
}
|
||||
|
||||
if ((ledset & BOARD_RED_LED_BIT) == 0)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED2, (led_states_set & BOARD_RED_LED_BIT) == 0);
|
||||
}
|
||||
|
||||
if ((ledset & BOARD_BLUE_LED_BIT) == 0)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED3, (led_states_set & BOARD_BLUE_LED_BIT) == 0);
|
||||
}
|
||||
|
||||
if ((ledset & BOARD_GREEN_LED_BIT) == 0)
|
||||
{
|
||||
stm32_gpiowrite(GPIO_LED4, (led_states_set & BOARD_GREEN_LED_BIT) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
||||
@@ -0,0 +1,350 @@
|
||||
/************************************************************************************
|
||||
* configs/spark/src/up_wireless.c
|
||||
*
|
||||
* Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Laurent Latil <laurent@latil.nom.fr>
|
||||
* 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 <errno.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/wireless/wireless.h>
|
||||
#include <nuttx/wireless/cc3000.h>
|
||||
#include <nuttx/wireless/cc3000/include/cc3000_upif.h>
|
||||
|
||||
#include "stm32.h"
|
||||
#include "spark.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifdef CONFIG_WL_CC3000
|
||||
#ifndef CONFIG_WIRELESS
|
||||
# error "Wireless support requires CONFIG_WIRELESS"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_STM32_SPI2
|
||||
# error "CC3000 Wireless support requires CONFIG_STM32_SPI2"
|
||||
#endif
|
||||
|
||||
#ifndef CC3000_SPI_FREQUENCY
|
||||
# define CC3000_SPI_FREQUENCY 16000000
|
||||
#endif
|
||||
|
||||
#ifndef CC3000_SPIDEV
|
||||
# define CC3000_SPIDEV 2
|
||||
#endif
|
||||
|
||||
#if CC3000_SPIDEV != 2
|
||||
# error "CC3000_SPIDEV must be 2"
|
||||
#endif
|
||||
|
||||
#ifndef CC3000_DEVMINOR
|
||||
# define CC3000_DEVMINOR 0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct stm32_config_s
|
||||
{
|
||||
struct cc3000_config_s dev;
|
||||
xcpt_t handler;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* IRQ/GPIO access callbacks. These operations all hidden behind callbacks
|
||||
* to isolate the CC3000 driver from differences in GPIO interrupt handling
|
||||
* by varying boards and MCUs. If possible, interrupts should be configured
|
||||
* on falling edges to detect the Ready Condition At T2: The normal master
|
||||
* SPI write sequence is SPI_CS low, followed by SPI_IRQ low CC3000 to host,
|
||||
* indicating that the CC3000 core module is ready to accept data. T2
|
||||
* duration is approximately 7 ms.
|
||||
*
|
||||
* irq_attach - Attach the CC3000 interrupt handler to the GPIO interrupt
|
||||
* irq_enable - Enable or disable the GPIO interrupt
|
||||
* clear_irq - Acknowledge/clear any pending GPIO interrupt
|
||||
* power_enable - Enable or disable Module enable.
|
||||
* chip_select - The Chip Select
|
||||
* busy - Return the state of the interrupt GPIO input
|
||||
*/
|
||||
|
||||
static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler);
|
||||
static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable);
|
||||
static void wl_clear_irq(FAR struct cc3000_config_s *state);
|
||||
static void wl_select(FAR struct cc3000_config_s *state, bool enable);
|
||||
static void wl_enable_power(FAR struct cc3000_config_s *state, bool enable);
|
||||
static bool wl_busy(FAR struct cc3000_config_s *state);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* A reference to a structure of this type must be passed to the CC3000
|
||||
* driver. This structure provides information about the configuration
|
||||
* of the CC3000 and provides some board-specific hooks.
|
||||
*
|
||||
* Memory for this structure is provided by the caller. It is not copied
|
||||
* by the driver and is presumed to persist while the driver is active. The
|
||||
* memory must be writable because, under certain circumstances, the driver
|
||||
* may modify frequency or X plate resistance values.
|
||||
*/
|
||||
|
||||
static struct stm32_config_s g_cc3000_info =
|
||||
{
|
||||
.dev.spi_frequency = CONFIG_CC3000_SPI_FREQUENCY,
|
||||
.dev.spi_mode = CONFIG_CC3000_SPI_MODE,
|
||||
|
||||
.dev.irq_attach = wl_attach_irq,
|
||||
.dev.irq_enable = wl_enable_irq,
|
||||
.dev.irq_clear = wl_clear_irq,
|
||||
.dev.power_enable = wl_enable_power,
|
||||
.dev.chip_select = wl_select,
|
||||
.dev.busy = wl_busy,
|
||||
.handler = NULL,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/* IRQ/GPIO access callbacks. These operations all hidden behind
|
||||
* callbacks to isolate the CC3000 driver from differences in GPIO
|
||||
* interrupt handling by varying boards and MCUs. If possible,
|
||||
* interrupts should be configured on both rising and falling edges
|
||||
* so that contact and loss-of-contact events can be detected.
|
||||
*
|
||||
* attach - Attach the CC3000 interrupt handler to the GPIO interrupt
|
||||
* enable - Enable or disable the GPIO interrupt
|
||||
* clear - Acknowledge/clear any pending GPIO interrupt
|
||||
* pendown - Return the state of the pen down GPIO input
|
||||
*/
|
||||
|
||||
static int wl_attach_irq(FAR struct cc3000_config_s *state, xcpt_t handler)
|
||||
{
|
||||
FAR struct stm32_config_s *priv = (FAR struct stm32_config_s *)state;
|
||||
|
||||
/* Just save the handler for use when the interrupt is enabled */
|
||||
|
||||
priv->handler = handler;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static void wl_enable_irq(FAR struct cc3000_config_s *state, bool enable)
|
||||
{
|
||||
FAR struct stm32_config_s *priv = (FAR struct stm32_config_s *)state;
|
||||
|
||||
/* The caller should not attempt to enable interrupts if the handler
|
||||
* has not yet been 'attached'
|
||||
*/
|
||||
|
||||
DEBUGASSERT(priv->handler || !enable);
|
||||
|
||||
/* Attach and enable, or detach and disable */
|
||||
|
||||
ivdbg("enable:%d\n", enable);
|
||||
if (enable)
|
||||
{
|
||||
(void)stm32_gpiosetevent(GPIO_WIFI_INT, true, true, false, priv->handler);
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)stm32_gpiosetevent(GPIO_WIFI_INT, false, false, false, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void wl_enable_power(FAR struct cc3000_config_s *state, bool enable)
|
||||
{
|
||||
ivdbg("enable:%d\n", enable);
|
||||
|
||||
/* Active high enable */
|
||||
|
||||
stm32_gpiowrite(GPIO_WIFI_EN, enable);
|
||||
}
|
||||
|
||||
static void wl_select(FAR struct cc3000_config_s *state, bool enable)
|
||||
{
|
||||
ivdbg("enable:%d\n", enable);
|
||||
|
||||
/* Active high enable */
|
||||
|
||||
stm32_gpiowrite(GPIO_WIFI_CS, enable);
|
||||
}
|
||||
|
||||
static void wl_clear_irq(FAR struct cc3000_config_s *state)
|
||||
{
|
||||
/* Does nothing */
|
||||
}
|
||||
|
||||
static bool wl_busy(FAR struct cc3000_config_s *state)
|
||||
{
|
||||
return stm32_gpioread(GPIO_WIFI_INT);
|
||||
}
|
||||
|
||||
static long read_IRQ(void)
|
||||
{
|
||||
static long state = 0; /* Start as a 0 */
|
||||
state ^= 1;
|
||||
return state;
|
||||
}
|
||||
|
||||
void enable_nop(void)
|
||||
{
|
||||
}
|
||||
|
||||
void disable_nop(void)
|
||||
{
|
||||
}
|
||||
|
||||
void power_nop(unsigned char en)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arch_wlinitialize
|
||||
*
|
||||
* Description:
|
||||
* Each board that supports a wireless device must provide this function.
|
||||
* This function is called by application-specific, setup logic to
|
||||
* configure the wireless device. This function will register the driver
|
||||
* as /dev/wirelessN where N is the minor device number.
|
||||
*
|
||||
* Input Parameters:
|
||||
* minor - The input device minor number
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero is returned on success. Otherwise, a negated errno value is
|
||||
* returned to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int up_wlinitialize(int minor)
|
||||
{
|
||||
FAR struct spi_dev_s *spi;
|
||||
|
||||
/* Init SPI bus */
|
||||
|
||||
idbg("minor %d\n", minor);
|
||||
DEBUGASSERT(minor == 0);
|
||||
|
||||
/* Get an instance of the SPI interface */
|
||||
|
||||
spi = up_spiinitialize(CONFIG_CC3000_SPIDEV);
|
||||
if (!spi)
|
||||
{
|
||||
idbg("Failed to initialize SPI bus %d\n", CONFIG_CC3000_SPIDEV);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Initialize and register the SPI CC3000 device */
|
||||
|
||||
int ret = CC3000_register(spi, &g_cc3000_info.dev, CONFIG_CC3000_DEVMINOR);
|
||||
if (ret < 0)
|
||||
{
|
||||
idbg("Failed to initialize SPI bus %d\n", CONFIG_CC3000_SPIDEV);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Name: C3000_wlan_init
|
||||
*
|
||||
* Description:
|
||||
* Initialize wlan driver
|
||||
*
|
||||
* Warning: This function must be called before ANY other wlan driver
|
||||
* function
|
||||
*
|
||||
* Input Parmeters:
|
||||
* sWlanCB Asynchronous events callback.
|
||||
* 0 no event call back.
|
||||
* - Call back parameters:
|
||||
* 1) event_type: HCI_EVNT_WLAN_UNSOL_CONNECT connect event,
|
||||
* HCI_EVNT_WLAN_UNSOL_DISCONNECT disconnect event,
|
||||
* HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE config done,
|
||||
* HCI_EVNT_WLAN_UNSOL_DHCP dhcp report,
|
||||
* HCI_EVNT_WLAN_ASYNC_PING_REPORT ping report OR
|
||||
* HCI_EVNT_WLAN_KEEPALIVE keepalive.
|
||||
* 2) data: pointer to extra data that received by the event
|
||||
* (NULL no data).
|
||||
* 3) length: data length.
|
||||
* - Events with extra data:
|
||||
* HCI_EVNT_WLAN_UNSOL_DHCP: 4 bytes IP, 4 bytes Mask,
|
||||
* 4 bytes default gateway, 4 bytes DHCP server and 4 bytes
|
||||
* for DNS server.
|
||||
* HCI_EVNT_WLAN_ASYNC_PING_REPORT: 4 bytes Packets sent,
|
||||
* 4 bytes Packets received, 4 bytes Min round time,
|
||||
* 4 bytes Max round time and 4 bytes for Avg round time.
|
||||
*
|
||||
* sFWPatches 0 no patch or pointer to FW patches
|
||||
* sDriverPatches 0 no patch or pointer to driver patches
|
||||
* sBootLoaderPatches 0 no patch or pointer to bootloader patches
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void CC3000_wlan_init(tWlanCB sWlanCB, tFWPatches sFWPatches, tDriverPatches
|
||||
sDriverPatches, tBootLoaderPatches sBootLoaderPatches)
|
||||
{
|
||||
wlan_init(sWlanCB,
|
||||
sFWPatches, sDriverPatches, sBootLoaderPatches,
|
||||
read_IRQ,
|
||||
enable_nop,
|
||||
disable_nop,
|
||||
power_nop);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_WL_CC3000 */
|
||||
Reference in New Issue
Block a user