[qorvo] move to openthread/ot-qorvo (#6382)

This commit is contained in:
Jonathan Hui
2021-03-31 16:30:07 -07:00
committed by GitHub
parent f81eebeb48
commit 71097eeb0f
109 changed files with 13 additions and 8219 deletions
-3
View File
@@ -1,3 +0,0 @@
[submodule "third_party/Qorvo/repo"]
path = third_party/Qorvo/repo
url = https://github.com/Qorvo/qpg-openthread.git
+4 -16
View File
@@ -781,14 +781,14 @@ AC_MSG_CHECKING([whether to build examples])
AC_ARG_WITH(examples,
[AS_HELP_STRING([--with-examples=TARGET],
[Build example applications for one of: simulation, cc1352, cc2538, cc2650, cc2652, efr32mg1, efr32mg12, efr32mg13, efr32mg21,
gp712, jn5189, k32w061, kw41z, nrf52811, nrf52833, nrf52840, qpg6095, qpg6100, qpg7015m @<:@default=no@:>@.
jn5189, k32w061, kw41z, nrf52811, nrf52833, nrf52840 @<:@default=no@:>@.
Note that building example applications also builds the associated OpenThread platform libraries
and any third_party libraries needed to support the examples.])],
[
case "${with_examples}" in
no)
;;
simulation|cc1352|cc2538|cc2650|cc2652|efr32mg1|efr32mg12|efr32mg13|efr32mg21|gp712|jn5189|k32w061|kw41z|nrf52811|nrf52833|nrf52840|qpg6095|qpg6100|qpg7015m)
simulation|cc1352|cc2538|cc2650|cc2652|efr32mg1|efr32mg12|efr32mg13|efr32mg21|jn5189|k32w061|kw41z|nrf52811|nrf52833|nrf52840)
;;
*)
AC_MSG_RESULT(ERROR)
@@ -809,16 +809,12 @@ AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG1], [test "${with_examples}" = "efr3
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG12], [test "${with_examples}" = "efr32mg12"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG13], [test "${with_examples}" = "efr32mg13"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_EFR32MG21], [test "${with_examples}" = "efr32mg21"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_GP712], [test "${with_examples}" = "gp712"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_JN5189], [test "${with_examples}" = "jn5189"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_K32W061], [test "${with_examples}" = "k32w061"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_KW41Z], [test "${with_examples}" = "kw41z"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52811], [test "${with_examples}" = "nrf52811"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52833], [test "${with_examples}" = "nrf52833"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_NRF52840], [test "${with_examples}" = "nrf52840"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_QPG6095], [test "${with_examples}" = "qpg6095"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_QPG6100], [test "${with_examples}" = "qpg6100"])
AM_CONDITIONAL([OPENTHREAD_EXAMPLES_QPG7015M], [test "${with_examples}" = "qpg7015m"])
AM_COND_IF([OPENTHREAD_EXAMPLES_SIMULATION], CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_SIMULATION=1", CPPFLAGS="${CPPFLAGS} -DOPENTHREAD_EXAMPLES_SIMULATION=0")
@@ -843,11 +839,11 @@ AC_MSG_CHECKING([whether to build platform libraries])
AC_ARG_WITH(platform,
[AS_HELP_STRING([--with-platform=TARGET],
[Build OpenThread platform libraries for one of: cc1352, cc2538, cc2650, cc2652,
efr32mg1, efr32mg12, efr32mg13, efr32mg21, gp712, jn5189, kw41z, nrf52811, nrf52833, nrf52840, posix, qpg6095, qpg6100, qpg7015m, simulation @<:@default=simulation@:>@.])],
efr32mg1, efr32mg12, efr32mg13, efr32mg21, jn5189, kw41z, nrf52811, nrf52833, nrf52840, posix, simulation @<:@default=simulation@:>@.])],
[
# Make sure the given target is valid.
case "${with_platform}" in
no|cc1352|cc2538|cc2650|cc2652|efr32mg1|efr32mg12|efr32mg13|efr32mg21|gp712|jn5189|kw41z|nrf52811|nrf52833|nrf52840|posix|qpg6095|qpg6100|qpg7015m|simulation)
no|cc1352|cc2538|cc2650|cc2652|efr32mg1|efr32mg12|efr32mg13|efr32mg21|jn5189|kw41z|nrf52811|nrf52833|nrf52840|posix|simulation)
;;
*)
AC_MSG_RESULT(ERROR)
@@ -886,16 +882,12 @@ AM_CONDITIONAL([OPENTHREAD_PLATFORM_EFR32MG1], [test "${with_platform}" = "efr3
AM_CONDITIONAL([OPENTHREAD_PLATFORM_EFR32MG12], [test "${with_platform}" = "efr32mg12"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_EFR32MG13], [test "${with_platform}" = "efr32mg13"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_EFR32MG21], [test "${with_platform}" = "efr32mg21"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_GP712], [test "${with_platform}" = "gp712"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_JN5189], [test "${with_platform}" = "jn5189"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_KW41Z], [test "${with_platform}" = "kw41z"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_NRF52811], [test "${with_platform}" = "nrf52811"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_NRF52833], [test "${with_platform}" = "nrf52833"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_NRF52840], [test "${with_platform}" = "nrf52840"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_POSIX], [test "${with_platform}" = "posix"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_QPG6095], [test "${with_platform}" = "qpg6095"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_QPG6100], [test "${with_platform}" = "qpg6100"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_QPG7015M], [test "${with_platform}" = "qpg7015m"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_SIMULATION],[test "${with_platform}" = "simulation"])
AM_CONDITIONAL([OPENTHREAD_PLATFORM_NRF528XX], [test OPENTHREAD_PLATFORM_NRF52811 || test OPENTHREAD_PLATFORM_NRF52833 || test OPENTHREAD_PLATFORM_NRF52840])
@@ -1047,13 +1039,9 @@ examples/platforms/efr32/Makefile
examples/platforms/efr32/sleepy-demo/Makefile
examples/platforms/efr32/sleepy-demo/sleepy-demo-mtd/Makefile
examples/platforms/efr32/sleepy-demo/sleepy-demo-ftd/Makefile
examples/platforms/gp712/Makefile
examples/platforms/k32w/Makefile
examples/platforms/kw41z/Makefile
examples/platforms/nrf528xx/Makefile
examples/platforms/qpg6095/Makefile
examples/platforms/qpg6100/Makefile
examples/platforms/qpg7015m/Makefile
examples/platforms/simulation/Makefile
examples/platforms/utils/Makefile
tools/Makefile
-277
View File
@@ -1,277 +0,0 @@
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
.NOTPARALLEL:
TARGET ?= arm-linux-gnueabihf
NAME = GP712
PREFIX_UC = $(NAME)
PREFIX_LC := $(shell echo $(PREFIX_UC) | tr A-Z a-z)
CROSS_COMPILE ?= $(TARGET)-
AR = $(CROSS_COMPILE)ar
AS = $(CROSS_COMPILE)as
CPP = $(CROSS_COMPILE)cpp
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
LD = $(CROSS_COMPILE)ld
STRIP = $(CROSS_COMPILE)strip
NM = $(CROSS_COMPILE)nm
RANLIB = $(CROSS_COMPILE)ranlib
OBJCOPY = $(CROSS_COMPILE)objcopy
BuildJobs ?= 9
configure_OPTIONS = \
--disable-tools \
--enable-cli \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--enable-cli-app \
--enable-radio-only \
--with-ncp-vendor-hook-source=no \
--with-ncp-bus=uart \
--with-examples=$(PREFIX_LC) \
$(NULL)
ifeq ($(CLI_LOGGING),1)
configure_OPTIONS += --enable-cli-logging
endif
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-$(PREFIX_LC)-config.h\"'
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-$(PREFIX_LC)-config-check.h\"'
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/$(PREFIX_LC)/
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
$($(PREFIX_UC)_CONFIG_FILE_CPPFLAGS) \
-Wextra \
-Wall \
-Wno-psabi \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
-D_BSD_SOURCE=1 \
-D_DEFAULT_SOURCE=1 \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-Wl,--gc-sections \
-Wl,-Map=$(PREFIX_LC).map \
-lrt \
-pthread \
$(NULL)
ECHO := @echo
MAKE := make
MKDIR_P := mkdir -p
LN_S := ln -s
RM_F := rm -f
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = $(PREFIX_LC)
ifndef BuildJobs
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
endif
JOBSFLAG := -j$(BuildJobs)
#
# configure-arch <arch>
#
# Configure OpenThread for the specified architecture.
#
# arch - The architecture to configure.
#
define configure-arch
$(ECHO) " CONFIG $(1)"
(cd $(BuildPath)/$(1) && $(AbsTopSourceDir)/configure \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
--prefix=/$(TargetTuple) \
--host=$(TARGET) \
--target=$(TARGET) \
--exec-prefix=/$(TargetTuple) \
--program-prefix=$(TargetTuple)- \
$(configure_OPTIONS))
endef # configure-arch
#
# build-arch <arch>
#
# Build the OpenThread intermediate build products for the specified
# architecture.
#
# arch - The architecture to build.
#
define build-arch
$(ECHO) " BUILD $(1)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) -w \
all
endef # build-arch
#
# stage-arch <arch>
#
# Stage (install) the OpenThread final build products for the specified
# architecture.
#
# arch - The architecture to stage.
#
define stage-arch
$(ECHO) " STAGE $(1)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) -w \
DESTDIR=$(AbsTopResultDir) \
install
endef # stage-arch
#
# ARCH_template <arch>
#
# Define macros, targets and rules to configure, build, and stage the
# OpenThread for a single architecture.
#
# arch - The architecture to instantiate the template for.
#
define ARCH_template
CONFIGURE_TARGETS += configure-$(1)
BUILD_TARGETS += do-build-$(1)
STAGE_TARGETS += stage-$(1)
BUILD_DIRS += $(BuildPath)/$(1)
DIRECTORIES += $(BuildPath)/$(1)
configure-$(1): target_CPPFLAGS=$($(1)_target_CPPFLAGS)
configure-$(1): target_CFLAGS=$($(1)_target_CFLAGS)
configure-$(1): target_CXXFLAGS=$($(1)_target_CXXFLAGS)
configure-$(1): target_LDFLAGS=$($(1)_target_LDFLAGS)
configure-$(1): $(BuildPath)/$(1)/config.status
$(BuildPath)/$(1)/config.status: | $(BuildPath)/$(1)
$$(call configure-arch,$(1))
do-build-$(1): configure-$(1)
do-build-$(1):
+$$(call build-arch,$(1))
stage-$(1): do-build-$(1)
stage-$(1): | $(TopResultDir)
$$(call stage-arch,$(1))
$(1): stage-$(1)
endef # ARCH_template
.DEFAULT_GOAL := all
all: stage
#
# rpi_bcm2708
#
rpi_bcm2708_target_ABI = rpi_bcm2708
rpi_bcm2708_target_CPPFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
rpi_bcm2708_target_CFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
rpi_bcm2708_target_CXXFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
rpi_bcm2708_target_LDFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
# Instantiate an architecture-specific build template for each target
# architecture.
$(foreach arch,$(TargetTuple),$(eval $(call ARCH_template,$(arch))))
#
# Common / Finalization
#
configure: $(CONFIGURE_TARGETS)
build: $(BUILD_TARGETS)
stage: $(STAGE_TARGETS)
DIRECTORIES = $(TopResultDir) $(TopResultDir)/$(TargetTuple)/lib $(BUILD_DIRS)
CLEAN_DIRS = $(TopResultDir) $(BUILD_DIRS)
all: stage
$(DIRECTORIES):
$(ECHO) " MKDIR $@"
@$(MKDIR_P) "$@"
clean:
$(ECHO) " CLEAN"
@$(RM_F) -r $(CLEAN_DIRS)
help:
$(ECHO) "Simply type 'make -f $(firstword $(MAKEFILE_LIST))' to build OpenThread for the following "
$(ECHO) "architectures: "
$(ECHO) ""
$(ECHO) " $(TargetTuple)"
$(ECHO) ""
$(ECHO) "To build only a particular architecture, specify: "
$(ECHO) ""
$(ECHO) " make -f $(firstword $(MAKEFILE_LIST)) <architecture>"
$(ECHO) ""
-289
View File
@@ -1,289 +0,0 @@
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
.NOTPARALLEL:
NAME = QPG6095
PREFIX_UC = $(NAME)
PREFIX_LC := $(shell echo $(PREFIX_UC) | tr A-Z a-z)
AR = arm-none-eabi-ar
CCAS = arm-none-eabi-gcc
CPP = arm-none-eabi-cpp
CC = arm-none-eabi-gcc
CXX = arm-none-eabi-g++
LD = arm-none-eabi-ld
STRIP = arm-none-eabi-strip
NM = arm-none-eabi-nm
RANLIB = arm-none-eabi-ranlib
OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
GCCVersion = $(shell expr `$(CC) -dumpversion | cut -f1 -d.`)
configure_OPTIONS += \
--disable-tools \
--enable-cli \
--enable-ftd \
--enable-mtd \
--with-examples=$(PREFIX_LC) \
MBEDTLS_CPPFLAGS="$($(PREFIX_UC)_MBEDTLS_CPPFLAGS)" \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-$(PREFIX_LC)-config.h\"'
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-$(PREFIX_LC)-config-check.h\"'
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/$(PREFIX_LC)/
$(PREFIX_UC)_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"$(PREFIX_LC)-mbedtls-config.h\"'
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/examples/platforms/$(PREFIX_LC)/crypto
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include/mbedtls
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
$($(PREFIX_UC)_CONFIG_FILE_CPPFLAGS) \
-Wall \
-Wextra \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-specs=nano.specs \
-specs=nosys.specs \
-Wl,--gc-sections \
-nostdlib \
-Wl,-Map=$(PREFIX_LC).map,--cref \
$(NULL)
ECHO := @echo
MAKE := make
MKDIR_P := mkdir -p
LN_S := ln -s
RM_F := rm -f
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = $(PREFIX_LC)
ARCHS = cortex-m4
TopTargetLibDir = $(TopResultDir)/$(TargetTuple)/lib
ifndef BuildJobs
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
endif
JOBSFLAG := -j$(BuildJobs)
#
# configure-arch <arch>
#
# Configure OpenThread for the specified architecture.
#
# arch - The architecture to configure.
#
define configure-arch
$(ECHO) " CONFIG $(TargetTuple)"
(cd $(BuildPath)/$(TargetTuple) && $(AbsTopSourceDir)/configure \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" CCAS="$(CCAS)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CCASFLAGS="$(CCASFLAGS)" LDFLAGS="$(LDFLAGS)" \
--host=arm-none-eabi \
--prefix=/$(TargetTuple) \
--program-prefix=$(TargetTuple)- \
$(configure_OPTIONS))
endef # configure-arch
#
# build-arch <arch>
#
# Build the OpenThread intermediate build products for the specified
# architecture.
#
# arch - The architecture to build.
#
define build-arch
$(ECHO) " BUILD $(TargetTuple)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(TargetTuple) --no-print-directory \
all
endef # build-arch
#
# stage-arch <arch>
#
# Stage (install) the OpenThread final build products for the specified
# architecture.
#
# arch - The architecture to stage.
#
define stage-arch
$(ECHO) " STAGE $(TargetTuple)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(TargetTuple) --no-print-directory \
DESTDIR=$(AbsTopResultDir) \
install
endef # stage-arch
# @FIXME: get the filenames of the targets of OBJCOPY (now they are hardcoded)
define hex-arch
$(ECHO) " HEX $(TargetTuple)"
$(OBJCOPY) -O ihex $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-mtd $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-mtd.hex
$(OBJCOPY) -O ihex $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-ftd $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-ftd.hex
endef # hex-arch
#
# ARCH_template <arch>
#
# Define macros, targets and rules to configure, build, and stage the
# OpenThread for a single architecture.
#
# arch - The architecture to instantiate the template for.
#
define ARCH_template
CONFIGURE_TARGETS += configure-$(1)
BUILD_TARGETS += do-build-$(1)
HEX_TARGETS += hex-$(1)
STAGE_TARGETS += stage-$(1)
BUILD_DIRS += $(BuildPath)/$(TargetTuple)
DIRECTORIES += $(BuildPath)/$(TargetTuple)
configure-$(1): target_CPPFLAGS=$($(1)_target_CPPFLAGS)
configure-$(1): target_CFLAGS=$($(1)_target_CFLAGS)
configure-$(1): target_CXXFLAGS=$($(1)_target_CXXFLAGS)
configure-$(1): target_LDFLAGS=$($(1)_target_LDFLAGS)
configure-$(1): target_CCASFLAGS=$($(1)_target_CCASFLAGS)
configure-$(1): $(BuildPath)/$(TargetTuple)/config.status
$(BuildPath)/$(TargetTuple)/config.status: | $(BuildPath)/$(TargetTuple)
$$(call configure-arch,$(1))
do-build-$(1): configure-$(1)
do-build-$(1):
+$$(call build-arch,$(1))
hex-$(1): stage-$(1)
hex-$(1):
$$(call hex-arch,$(1))
$(1): hex-$(1)
stage-$(1): do-build-$(1)
stage-$(1): | $(TopResultDir)
$$(call stage-arch,$(1))
endef # ARCH_template
.DEFAULT_GOAL := all
all: hex
#
# cortex-m4
#
cortex-m4_target_ABI = cortex-m4
cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
# Instantiate an architecture-specific build template for each target
# architecture.
$(foreach arch,$(ARCHS),$(eval $(call ARCH_template,$(arch))))
#
# Common / Finalization
#
configure: $(CONFIGURE_TARGETS)
build: $(BUILD_TARGETS)
stage: $(STAGE_TARGETS)
hex: $(HEX_TARGETS)
DIRECTORIES = $(TopResultDir) $(TopResultDir)/$(TargetTuple)/lib $(BUILD_DIRS)
CLEAN_DIRS = $(TopResultDir) $(BUILD_DIRS)
all: hex
$(DIRECTORIES):
$(ECHO) " MKDIR $@"
@$(MKDIR_P) "$@"
clean:
$(ECHO) " CLEAN"
@$(RM_F) -r $(CLEAN_DIRS)
help:
$(ECHO) "Simply type 'make -f $(firstword $(MAKEFILE_LIST))' to build OpenThread for the following "
$(ECHO) "architectures: "
$(ECHO) ""
$(ECHO) " $(ARCHS)"
$(ECHO) ""
$(ECHO) "To build only a particular architecture, specify: "
$(ECHO) ""
$(ECHO) " make -f $(firstword $(MAKEFILE_LIST)) <architecture>"
$(ECHO) ""
-290
View File
@@ -1,290 +0,0 @@
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
.NOTPARALLEL:
NAME = QPG6100
PREFIX_UC = $(NAME)
PREFIX_LC := $(shell echo $(PREFIX_UC) | tr A-Z a-z)
AR = arm-none-eabi-ar
CCAS = arm-none-eabi-gcc
CPP = arm-none-eabi-cpp
CC = arm-none-eabi-gcc
CXX = arm-none-eabi-g++
LD = arm-none-eabi-ld
STRIP = arm-none-eabi-strip
NM = arm-none-eabi-nm
RANLIB = arm-none-eabi-ranlib
OBJCOPY = arm-none-eabi-objcopy
BuildJobs ?= 10
GCCVersion = $(shell expr `$(CC) -dumpversion | cut -f1 -d.`)
configure_OPTIONS += \
--disable-tools \
--enable-cli \
--enable-ftd \
--enable-mtd \
--with-examples=$(PREFIX_LC) \
MBEDTLS_CPPFLAGS="$($(PREFIX_UC)_MBEDTLS_CPPFLAGS)" \
$(NULL)
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-$(PREFIX_LC)-config.h\"'
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-$(PREFIX_LC)-config-check.h\"'
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/$(PREFIX_LC)/
$(PREFIX_UC)_MBEDTLS_CPPFLAGS = -DMBEDTLS_CONFIG_FILE='\"mbedtls-config.h\"'
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -DMBEDTLS_USER_CONFIG_FILE='\"$(PREFIX_LC)-mbedtls-config.h\"'
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/examples/platforms/$(PREFIX_LC)/crypto
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -DQORVO_CRYPTO_ENGINE
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include
$(PREFIX_UC)_MBEDTLS_CPPFLAGS += -I$(PWD)/third_party/mbedtls/repo/include/mbedtls
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
$($(PREFIX_UC)_CONFIG_FILE_CPPFLAGS) \
-Wall \
-Wextra \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-specs=nano.specs \
-specs=nosys.specs \
-Wl,--gc-sections \
-nostdlib \
-Wl,-Map=$(PREFIX_LC).map,--cref \
$(NULL)
ECHO := @echo
MAKE := make
MKDIR_P := mkdir -p
LN_S := ln -s
RM_F := rm -f
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = $(PREFIX_LC)
ARCHS = cortex-m4
TopTargetLibDir = $(TopResultDir)/$(TargetTuple)/lib
ifndef BuildJobs
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
endif
JOBSFLAG := -j$(BuildJobs)
#
# configure-arch <arch>
#
# Configure OpenThread for the specified architecture.
#
# arch - The architecture to configure.
#
define configure-arch
$(ECHO) " CONFIG $(TargetTuple)"
(cd $(BuildPath)/$(TargetTuple) && $(AbsTopSourceDir)/configure \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" CCAS="$(CCAS)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CCASFLAGS="$(CCASFLAGS)" LDFLAGS="$(LDFLAGS)" \
--host=arm-none-eabi \
--prefix=/$(TargetTuple) \
--program-prefix=$(TargetTuple)- \
$(configure_OPTIONS))
endef # configure-arch
#
# build-arch <arch>
#
# Build the OpenThread intermediate build products for the specified
# architecture.
#
# arch - The architecture to build.
#
define build-arch
$(ECHO) " BUILD $(TargetTuple)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(TargetTuple) --no-print-directory \
all
endef # build-arch
#
# stage-arch <arch>
#
# Stage (install) the OpenThread final build products for the specified
# architecture.
#
# arch - The architecture to stage.
#
define stage-arch
$(ECHO) " STAGE $(TargetTuple)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(TargetTuple) --no-print-directory \
DESTDIR=$(AbsTopResultDir) \
install
endef # stage-arch
# @FIXME: get the filenames of the targets of OBJCOPY (now they are hardcoded)
define hex-arch
$(ECHO) " HEX $(TargetTuple)"
$(OBJCOPY) -O ihex $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-mtd $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-mtd.hex
$(OBJCOPY) -O ihex $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-ftd $(AbsTopResultDir)/$(TargetTuple)/bin/$(TargetTuple)-ot-cli-ftd.hex
endef # hex-arch
#
# ARCH_template <arch>
#
# Define macros, targets and rules to configure, build, and stage the
# OpenThread for a single architecture.
#
# arch - The architecture to instantiate the template for.
#
define ARCH_template
CONFIGURE_TARGETS += configure-$(1)
BUILD_TARGETS += do-build-$(1)
HEX_TARGETS += hex-$(1)
STAGE_TARGETS += stage-$(1)
BUILD_DIRS += $(BuildPath)/$(TargetTuple)
DIRECTORIES += $(BuildPath)/$(TargetTuple)
configure-$(1): target_CPPFLAGS=$($(1)_target_CPPFLAGS)
configure-$(1): target_CFLAGS=$($(1)_target_CFLAGS)
configure-$(1): target_CXXFLAGS=$($(1)_target_CXXFLAGS)
configure-$(1): target_LDFLAGS=$($(1)_target_LDFLAGS)
configure-$(1): target_CCASFLAGS=$($(1)_target_CCASFLAGS)
configure-$(1): $(BuildPath)/$(TargetTuple)/config.status
$(BuildPath)/$(TargetTuple)/config.status: | $(BuildPath)/$(TargetTuple)
$$(call configure-arch,$(1))
do-build-$(1): configure-$(1)
do-build-$(1):
+$$(call build-arch,$(1))
hex-$(1): stage-$(1)
hex-$(1):
$$(call hex-arch,$(1))
$(1): hex-$(1)
stage-$(1): do-build-$(1)
stage-$(1): | $(TopResultDir)
$$(call stage-arch,$(1))
endef # ARCH_template
.DEFAULT_GOAL := all
all: hex
#
# cortex-m4
#
cortex-m4_target_ABI = cortex-m4
cortex-m4_target_CPPFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
cortex-m4_target_CFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
cortex-m4_target_CXXFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
cortex-m4_target_LDFLAGS = -mcpu=cortex-m4 -mthumb -ffunction-sections
# Instantiate an architecture-specific build template for each target
# architecture.
$(foreach arch,$(ARCHS),$(eval $(call ARCH_template,$(arch))))
#
# Common / Finalization
#
configure: $(CONFIGURE_TARGETS)
build: $(BUILD_TARGETS)
stage: $(STAGE_TARGETS)
hex: $(HEX_TARGETS)
DIRECTORIES = $(TopResultDir) $(TopResultDir)/$(TargetTuple)/lib $(BUILD_DIRS)
CLEAN_DIRS = $(TopResultDir) $(BUILD_DIRS)
all: hex
$(DIRECTORIES):
$(ECHO) " MKDIR $@"
@$(MKDIR_P) "$@"
clean:
$(ECHO) " CLEAN"
@$(RM_F) -r $(CLEAN_DIRS)
help:
$(ECHO) "Simply type 'make -f $(firstword $(MAKEFILE_LIST))' to build OpenThread for the following "
$(ECHO) "architectures: "
$(ECHO) ""
$(ECHO) " $(ARCHS)"
$(ECHO) ""
$(ECHO) "To build only a particular architecture, specify: "
$(ECHO) ""
$(ECHO) " make -f $(firstword $(MAKEFILE_LIST)) <architecture>"
$(ECHO) ""
-277
View File
@@ -1,277 +0,0 @@
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
.NOTPARALLEL:
TARGET ?= arm-linux-gnueabihf
NAME = QPG7015M
PREFIX_UC = $(NAME)
PREFIX_LC := $(shell echo $(PREFIX_UC) | tr A-Z a-z)
CROSS_COMPILE ?= $(TARGET)-
AR = $(CROSS_COMPILE)ar
AS = $(CROSS_COMPILE)as
CPP = $(CROSS_COMPILE)cpp
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
LD = $(CROSS_COMPILE)ld
STRIP = $(CROSS_COMPILE)strip
NM = $(CROSS_COMPILE)nm
RANLIB = $(CROSS_COMPILE)ranlib
OBJCOPY = $(CROSS_COMPILE)objcopy
BuildJobs ?= 9
configure_OPTIONS = \
--disable-tools \
--enable-cli \
--enable-ftd \
--enable-mtd \
--enable-ncp \
--enable-cli-app \
--enable-radio-only \
--with-ncp-vendor-hook-source=no \
--with-ncp-bus=uart \
--with-examples=$(PREFIX_LC) \
$(NULL)
ifeq ($(CLI_LOGGING),1)
configure_OPTIONS += --enable-cli-logging
endif
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS = -DOPENTHREAD_PROJECT_CORE_CONFIG_FILE='\"openthread-core-$(PREFIX_LC)-config.h\"'
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -DOPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE='\"openthread-core-$(PREFIX_LC)-config-check.h\"'
$(PREFIX_UC)_CONFIG_FILE_CPPFLAGS += -I$(PWD)/examples/platforms/$(PREFIX_LC)/
COMMONCFLAGS := \
-fdata-sections \
-ffunction-sections \
-Os \
$($(PREFIX_UC)_CONFIG_FILE_CPPFLAGS) \
-Wextra \
-Wall \
-Wno-psabi \
$(NULL)
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/common-switches.mk
CPPFLAGS += \
$(COMMONCFLAGS) \
$(target_CPPFLAGS) \
$(NULL)
CFLAGS += \
$(COMMONCFLAGS) \
-D_BSD_SOURCE=1 \
-D_DEFAULT_SOURCE=1 \
$(target_CFLAGS) \
$(NULL)
CXXFLAGS += \
$(COMMONCFLAGS) \
$(target_CXXFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS += \
$(COMMONCFLAGS) \
$(target_LDFLAGS) \
-Wl,--gc-sections \
-Wl,-Map=$(PREFIX_LC).map \
-lrt \
-pthread \
$(NULL)
ECHO := @echo
MAKE := make
MKDIR_P := mkdir -p
LN_S := ln -s
RM_F := rm -f
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
TopSourceDir := $(dir $(shell readlink $(firstword $(MAKEFILE_LIST))))..
AbsTopSourceDir := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))..
BuildPath = build
TopBuildDir = $(BuildPath)
AbsTopBuildDir = $(PWD)/$(TopBuildDir)
ResultPath = output
TopResultDir = $(ResultPath)
AbsTopResultDir = $(PWD)/$(TopResultDir)
TargetTuple = $(PREFIX_LC)
ifndef BuildJobs
BuildJobs := $(shell getconf _NPROCESSORS_ONLN)
endif
JOBSFLAG := -j$(BuildJobs)
#
# configure-arch <arch>
#
# Configure OpenThread for the specified architecture.
#
# arch - The architecture to configure.
#
define configure-arch
$(ECHO) " CONFIG $(1)"
(cd $(BuildPath)/$(1) && $(AbsTopSourceDir)/configure \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
CPP="$(CPP)" CC="$(CC)" CXX="$(CXX)" OBJC="$(OBJC)" OBJCXX="$(OBJCXX)" AR="$(AR)" RANLIB="$(RANLIB)" NM="$(NM)" STRIP="$(STRIP)" CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
--prefix=/$(TargetTuple) \
--host=$(TARGET) \
--target=$(TARGET) \
--exec-prefix=/$(TargetTuple) \
--program-prefix=$(TargetTuple)- \
$(configure_OPTIONS))
endef # configure-arch
#
# build-arch <arch>
#
# Build the OpenThread intermediate build products for the specified
# architecture.
#
# arch - The architecture to build.
#
define build-arch
$(ECHO) " BUILD $(1)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) -w \
all
endef # build-arch
#
# stage-arch <arch>
#
# Stage (install) the OpenThread final build products for the specified
# architecture.
#
# arch - The architecture to stage.
#
define stage-arch
$(ECHO) " STAGE $(1)"
$(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1) -w \
DESTDIR=$(AbsTopResultDir) \
install
endef # stage-arch
#
# ARCH_template <arch>
#
# Define macros, targets and rules to configure, build, and stage the
# OpenThread for a single architecture.
#
# arch - The architecture to instantiate the template for.
#
define ARCH_template
CONFIGURE_TARGETS += configure-$(1)
BUILD_TARGETS += do-build-$(1)
STAGE_TARGETS += stage-$(1)
BUILD_DIRS += $(BuildPath)/$(1)
DIRECTORIES += $(BuildPath)/$(1)
configure-$(1): target_CPPFLAGS=$($(1)_target_CPPFLAGS)
configure-$(1): target_CFLAGS=$($(1)_target_CFLAGS)
configure-$(1): target_CXXFLAGS=$($(1)_target_CXXFLAGS)
configure-$(1): target_LDFLAGS=$($(1)_target_LDFLAGS)
configure-$(1): $(BuildPath)/$(1)/config.status
$(BuildPath)/$(1)/config.status: | $(BuildPath)/$(1)
$$(call configure-arch,$(1))
do-build-$(1): configure-$(1)
do-build-$(1):
+$$(call build-arch,$(1))
stage-$(1): do-build-$(1)
stage-$(1): | $(TopResultDir)
$$(call stage-arch,$(1))
$(1): stage-$(1)
endef # ARCH_template
.DEFAULT_GOAL := all
all: stage
#
# rpi_bcm2708
#
rpi_bcm2708_target_ABI = rpi_bcm2708
rpi_bcm2708_target_CPPFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
rpi_bcm2708_target_CFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
rpi_bcm2708_target_CXXFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
rpi_bcm2708_target_LDFLAGS = -march=armv6j -fomit-frame-pointer -fno-strict-aliasing -fno-pic -ffreestanding -mfloat-abi=hard -mfpu=vfp -pipe
# Instantiate an architecture-specific build template for each target
# architecture.
$(foreach arch,$(TargetTuple),$(eval $(call ARCH_template,$(arch))))
#
# Common / Finalization
#
configure: $(CONFIGURE_TARGETS)
build: $(BUILD_TARGETS)
stage: $(STAGE_TARGETS)
DIRECTORIES = $(TopResultDir) $(TopResultDir)/$(TargetTuple)/lib $(BUILD_DIRS)
CLEAN_DIRS = $(TopResultDir) $(BUILD_DIRS)
all: stage
$(DIRECTORIES):
$(ECHO) " MKDIR $@"
@$(MKDIR_P) "$@"
clean:
$(ECHO) " CLEAN"
@$(RM_F) -r $(CLEAN_DIRS)
help:
$(ECHO) "Simply type 'make -f $(firstword $(MAKEFILE_LIST))' to build OpenThread for the following "
$(ECHO) "architectures: "
$(ECHO) ""
$(ECHO) " $(TargetTuple)"
$(ECHO) ""
$(ECHO) "To build only a particular architecture, specify: "
$(ECHO) ""
$(ECHO) " make -f $(firstword $(MAKEFILE_LIST)) <architecture>"
$(ECHO) ""
+4 -20
View File
@@ -29,6 +29,10 @@
include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
EXTRA_DIST = \
gp712 \
qpg6095 \
qpg6100 \
qpg7015m \
samr21 \
$(NULL)
@@ -40,14 +44,10 @@ DIST_SUBDIRS = \
cc2650 \
cc2652 \
efr32 \
gp712 \
k32w \
kw41z \
nrf528xx \
simulation \
qpg6095 \
qpg6100 \
qpg7015m \
utils \
$(NULL)
@@ -77,10 +77,6 @@ if OPENTHREAD_PLATFORM_EFR32
SUBDIRS += efr32
endif
if OPENTHREAD_PLATFORM_GP712
SUBDIRS += gp712
endif
if OPENTHREAD_PLATFORM_K32W
SUBDIRS += k32w
endif
@@ -97,18 +93,6 @@ if OPENTHREAD_PLATFORM_SIMULATION
SUBDIRS += simulation
endif
if OPENTHREAD_PLATFORM_QPG6095
SUBDIRS += qpg6095
endif
if OPENTHREAD_PLATFORM_QPG6100
SUBDIRS += qpg6100
endif
if OPENTHREAD_PLATFORM_QPG7015M
SUBDIRS += qpg7015m
endif
noinst_HEADERS = \
openthread-system.h \
$(NULL)
-16
View File
@@ -61,10 +61,6 @@ if OPENTHREAD_EXAMPLES_EFR32
include $(top_srcdir)/examples/platforms/efr32/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_GP712
include $(top_srcdir)/examples/platforms/gp712/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_JN5189
include $(top_srcdir)/examples/platforms/k32w/jn5189/Makefile.platform.am
endif
@@ -89,18 +85,6 @@ if OPENTHREAD_EXAMPLES_NRF52840
include $(top_srcdir)/examples/platforms/nrf528xx/nrf52840/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_QPG6095
include $(top_srcdir)/examples/platforms/qpg6095/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_QPG6100
include $(top_srcdir)/examples/platforms/qpg6100/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_QPG7015M
include $(top_srcdir)/examples/platforms/qpg7015m/Makefile.platform.am
endif
if OPENTHREAD_EXAMPLES_SIMULATION
include $(top_srcdir)/examples/platforms/simulation/Makefile.platform.am
endif
-105
View File
@@ -1,105 +0,0 @@
#
# Copyright (c) 2021, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
set(OT_PLATFORM_LIB "openthread-gp712" PARENT_SCOPE)
if(NOT OT_CONFIG)
set(OT_CONFIG "openthread-core-gp712-config.h")
set(OT_CONFIG ${OT_CONFIG} PARENT_SCOPE)
endif()
list(APPEND OT_PLATFORM_DEFINES
"OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-gp712-config-check.h\""
)
list(APPEND OT_PLATFORM_DEFINES
"_BSD_SOURCE=1"
"_DEFAULT_SOURCE=1"
)
set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)
set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE)
if(OT_CFLAGS MATCHES "-pedantic-errors")
string(REPLACE "-pedantic-errors" "" OT_CFLAGS "${OT_CFLAGS}")
endif()
if(OT_CFLAGS MATCHES "-Wno-c\\+\\+14-compat")
string(REPLACE "-Wno-c++14-compat" "" OT_CFLAGS "${OT_CFLAGS}")
endif()
list(APPEND OT_PLATFORM_DEFINES "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${OT_CONFIG}\"")
add_library(openthread-gp712
alarm.c
diag.c
entropy.c
flash.c
logging.c
misc.c
radio.c
system.c
uart-posix.c
)
set_target_properties(
openthread-gp712
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_link_libraries(openthread-gp712
PRIVATE
gp712-driver
${OT_MBEDTLS}
ot-config
PUBLIC
-lrt
-pthread
-Wl,--gc-sections
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
)
target_compile_definitions(openthread-gp712
PUBLIC
${OT_PLATFORM_DEFINES}
)
target_compile_options(openthread-gp712
PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-gp712
PRIVATE
${OT_PUBLIC_INCLUDES}
${PROJECT_SOURCE_DIR}/src/core
${PROJECT_SOURCE_DIR}/examples/platforms
)
-73
View File
@@ -1,73 +0,0 @@
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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 $(abs_top_nlbuild_autotools_dir)/automake/pre.am
# Do not enable -Wcast-align for this platform
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
lib_LIBRARIES = libopenthread-gp712.a
libopenthread_gp712_a_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/core \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/examples/platforms/gp712 \
-lrt \
-pthread \
$(NULL)
PLATFORM_SOURCES = \
alarm.c \
alarm_qorvo.h \
diag.c \
entropy.c \
flash.c \
logging.c \
misc.c \
openthread-core-gp712-config.h \
openthread-core-gp712-config-check.h \
platform_qorvo.h \
radio.c \
radio_qorvo.h \
random_qorvo.h \
system.c \
uart-posix.c \
uart_qorvo.h \
$(NULL)
libopenthread_gp712_a_SOURCES = \
$(PLATFORM_SOURCES) \
$(NULL)
if OPENTHREAD_BUILD_COVERAGE
CLEANFILES = $(wildcard *.gcda *.gcno)
endif # OPENTHREAD_BUILD_COVERAGE
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
@@ -1,46 +0,0 @@
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
#
# gp712 platform-specific Makefile
#
LDADD_COMMON += \
$(top_builddir)/examples/platforms/gp712/libopenthread-gp712.a \
$(NULL)
if OPENTHREAD_ENABLE_FTD
LDADD_COMMON += \
$(top_srcdir)/third_party/Qorvo/repo/gp712/lib/libQorvoGP712_ftd.a \
$(NULL)
else # OPENTHREAD_ENABLE_FTD
if OPENTHREAD_ENABLE_MTD
LDADD_COMMON += \
$(top_srcdir)/third_party/Qorvo/repo/gp712/lib/libQorvoGP712_mtd.a \
$(NULL)
endif # OPENTHREAD_ENABLE_MTD
endif
+1 -85
View File
@@ -1,85 +1 @@
# OpenThread on Qorvo gp712 Example
This directory contains example platform drivers for Qorvo gp712 on RPi.
## Toolchain
This example uses the GNU GCC toolchain on the Raspberry Pi. To build on the Pi:
1. Download the repo to the Pi
2. go to the subfolder in the openthread repo: third_party/nlbuild-autotools/repo/ and enter this command:
```bash
$ make tools
```
Note that you may need to install additional packages to make this build work, depending on your actual RPi OS version. The build process will complain if additional packages are required.
## Build Examples
```bash
$ cd <path-to-openthread>
$ ./script/bootstrap
$ ./bootstrap
$ REFERENCE_DEVICE=1 CLI_LOGGING=1 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 BORDER_ROUTER=1 make -f examples/Makefile-gp712
```
After a successful build, the `elf` files are found in `<path-to-openthread>/output/gp712/bin`.
## Cmake build
Make sure arm-linux-gnueabihf-gcc compiler installed in `$PATH`
```bash
cd <path-to-openthread>
./script/cmake-build gp712
```
After a successful build, binary files will be generated:
```
./build/gp712/examples/apps/ncp/ot-rcp
./build/gp712/examples/apps/cli/ot-cli-ftd
```
##
## Interact
1. Spawn the process:
```bash
$ cd <path-to-openthread>/output/gp712/bin
$ ./gp712-ot-cli-ftd
```
2. Type `help` for list of commands.
```bash
> help
help
channel
childtimeout
contextreusedelay
extaddr
extpanid
ipaddr
keysequence
leaderweight
masterkey
mode
netdata register
networkidtimeout
networkname
panid
ping
prefix
releaserouterid
rloc16
route
routerupgradethreshold
scan
start
state
stop
```
The OpenThread on GP712 example has moved to https://github.com/openthread/ot-qorvo
-73
View File
@@ -1,73 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file implements the OpenThread platform abstraction for the alarm.
*
*/
#include <stdbool.h>
#include <stdint.h>
#include <sys/time.h>
#include "alarm_qorvo.h"
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/diag.h>
uint32_t otPlatAlarmMilliGetNow(void)
{
return qorvoAlarmGetTimeMs();
}
static void qorvoAlarmFired(void *aInstance)
{
otPlatAlarmMilliFired((otInstance *)aInstance);
}
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
{
OT_UNUSED_VARIABLE(t0);
qorvoAlarmUnScheduleEventArg((qorvoAlarmCallback_t)qorvoAlarmFired, aInstance);
qorvoAlarmScheduleEventArg(dt, qorvoAlarmFired, aInstance);
}
void otPlatAlarmMilliStop(otInstance *aInstance)
{
qorvoAlarmUnScheduleEventArg((qorvoAlarmCallback_t)qorvoAlarmFired, aInstance);
}
void qorvoAlarmUpdateTimeout(struct timeval *aTimeout)
{
OT_UNUSED_VARIABLE(aTimeout);
}
void qorvoAlarmProcess(void)
{
}
-92
View File
@@ -1,92 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes the declarations of the Alarm functions from the Qorvo library.
*
*/
#ifndef ALARM_QORVO_H_
#define ALARM_QORVO_H_
#include <stdbool.h>
#include <stdint.h>
#include <sys/time.h>
#include <unistd.h>
typedef void (*qorvoAlarmCallback_t)(void *);
/**
* This function initializes the alarm service used by OpenThread.
*
*/
void qorvoAlarmInit(void);
/**
* This function retrieves the time remaining until the alarm fires.
*
* @param[out] aTimeval A pointer to the timeval struct.
*
*/
void qorvoAlarmUpdateTimeout(struct timeval *aTimeout);
/**
* This function performs alarm driver processing.
*
*/
void qorvoAlarmProcess(void);
/**
* This function retrieves the current time.
*
* @param[out] The current time in ms.
*
*/
uint32_t qorvoAlarmGetTimeMs(void);
/**
* This function schedules a callback after a relative amount of time.
*
* @param[in] rel_time The relative time in ms.
* @param[in] callback A callback function which will be called.
* @param[in] arg A context pointer which will be passed as an argument to the callback.
*
*/
void qorvoAlarmScheduleEventArg(uint32_t rel_time, qorvoAlarmCallback_t callback, void *arg);
/**
* This function unschedules the callback.
*
* @param[in] callback A callback function which will be removed from the list.
* @param[in] arg A context pointer which will be passed as an argument to the callback.
*
*/
bool qorvoAlarmUnScheduleEventArg(qorvoAlarmCallback_t callback, void *arg);
#endif // ALARM_QORVO_H_
@@ -1,43 +0,0 @@
#
# Copyright (c) 2021, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR ARM)
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
set(CMAKE_ASM_COMPILER arm-linux-gnueabihf-as)
set(CMAKE_RANLIB arm-linux-gnueabihf-ranlib)
set(COMMON_C_FLAGS "-fdata-sections -ffunction-sections")
set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS} -std=gnu99")
set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti")
set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS}")
-78
View File
@@ -1,78 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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 <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <openthread-core-config.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/radio.h>
#if OPENTHREAD_CONFIG_DIAG_ENABLE
/**
* Diagnostics mode variables.
*
*/
static bool sDiagMode = false;
void otPlatDiagModeSet(bool aMode)
{
sDiagMode = aMode;
}
bool otPlatDiagModeGet()
{
return sDiagMode;
}
void otPlatDiagChannelSet(uint8_t aChannel)
{
OT_UNUSED_VARIABLE(aChannel);
}
void otPlatDiagTxPowerSet(int8_t aTxPower)
{
OT_UNUSED_VARIABLE(aTxPower);
}
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aFrame);
OT_UNUSED_VARIABLE(aError);
}
void otPlatDiagAlarmCallback(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
}
#endif // OPENTHREAD_CONFIG_DIAG_ENABLE
-71
View File
@@ -1,71 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file implements an entropy source based on /dev/urandom or pseudo-random generator.
*
*/
#include <openthread/platform/entropy.h>
#include <assert.h>
#include <stdio.h>
#include <openthread/error.h>
#include "utils/code_utils.h"
void qorvoRandomInit(void)
{
}
otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
{
otError error = OT_ERROR_NONE;
FILE * file = NULL;
size_t readLength;
otEXPECT_ACTION(aOutput && aOutputLength, error = OT_ERROR_INVALID_ARGS);
file = fopen("/dev/urandom", "rb");
otEXPECT_ACTION(file != NULL, error = OT_ERROR_FAILED);
readLength = fread(aOutput, 1, aOutputLength, file);
otEXPECT_ACTION(readLength == aOutputLength, error = OT_ERROR_FAILED);
exit:
if (file != NULL)
{
fclose(file);
}
return error;
}
-149
View File
@@ -1,149 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
#define _XOPEN_SOURCE 500
#include "platform_qorvo.h"
#undef NDEBUG
#include <assert.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <openthread-core-config.h>
#include <openthread/platform/flash.h>
static int sFlashFd = -1;
enum
{
SWAP_SIZE = 2048,
SWAP_NUM = 2,
};
void otPlatFlashInit(otInstance *aInstance)
{
char fileName[20];
struct stat st;
bool create = false;
memset(&st, 0, sizeof(st));
if (stat("tmp", &st) == -1)
{
mkdir("tmp", 0777);
}
snprintf(fileName, sizeof(fileName), "tmp/node.flash");
if (access(fileName, 0))
{
create = true;
}
sFlashFd = open(fileName, O_RDWR | O_CREAT, 0600);
lseek(sFlashFd, 0, SEEK_SET);
assert(sFlashFd >= 0);
if (create)
{
for (uint8_t index = 0; index < SWAP_NUM; index++)
{
otPlatFlashErase(aInstance, index);
}
}
}
uint32_t otPlatFlashGetSwapSize(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return SWAP_SIZE;
}
void otPlatFlashErase(otInstance *aInstance, uint8_t aSwapIndex)
{
OT_UNUSED_VARIABLE(aInstance);
uint32_t address;
uint8_t buffer[SWAP_SIZE];
ssize_t r;
assert((sFlashFd) >= 0 && (aSwapIndex < SWAP_NUM));
address = aSwapIndex ? SWAP_SIZE : 0;
memset(buffer, 0xff, sizeof(buffer));
// Write the page
r = pwrite(sFlashFd, buffer, sizeof(buffer), (off_t)address);
assert(r == SWAP_SIZE);
}
void otPlatFlashRead(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, void *aData, uint32_t aSize)
{
OT_UNUSED_VARIABLE(aInstance);
uint32_t address;
ssize_t rval;
assert((sFlashFd >= 0) && (aSwapIndex < SWAP_NUM) && (aSize <= SWAP_SIZE) && (aOffset <= (SWAP_SIZE - aSize)));
address = aSwapIndex ? SWAP_SIZE : 0;
rval = pread(sFlashFd, aData, aSize, (off_t)(address + aOffset));
assert((uint32_t)rval == aSize);
}
void otPlatFlashWrite(otInstance *aInstance, uint8_t aSwapIndex, uint32_t aOffset, const void *aData, uint32_t aSize)
{
OT_UNUSED_VARIABLE(aInstance);
uint32_t address;
uint8_t byte;
ssize_t rval;
assert((sFlashFd >= 0) && (aSwapIndex < SWAP_NUM) && (aSize <= SWAP_SIZE) && (aOffset <= (SWAP_SIZE - aSize)));
address = aSwapIndex ? SWAP_SIZE : 0;
address += aOffset;
for (uint32_t offset = 0; offset < aSize; offset++)
{
rval = pread(sFlashFd, &byte, sizeof(byte), (off_t)(address + offset));
assert(rval == sizeof(byte));
// Use bitwise AND to emulate the behavior of flash memory
byte &= ((uint8_t *)aData)[offset];
rval = pwrite(sFlashFd, &byte, sizeof(byte), (off_t)(address + offset));
assert(rval == sizeof(byte));
}
}
-91
View File
@@ -1,91 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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 "platform_qorvo.h"
#include <openthread-core-config.h>
#include <ctype.h>
#include <inttypes.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <openthread/platform/logging.h>
#include <openthread/platform/toolchain.h>
#include "uart_qorvo.h"
#include "utils/code_utils.h"
// Macro to append content to end of the log string.
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
int PlatOtLogLevelToSysLogLevel(otLogLevel aLogLevel)
{
int sysloglevel;
switch (aLogLevel)
{
case OT_LOG_LEVEL_NONE:
sysloglevel = LOG_ERR;
break;
case OT_LOG_LEVEL_CRIT:
sysloglevel = LOG_CRIT;
break;
case OT_LOG_LEVEL_WARN:
sysloglevel = LOG_WARNING;
break;
case OT_LOG_LEVEL_INFO:
sysloglevel = LOG_INFO;
break;
case OT_LOG_LEVEL_DEBG:
sysloglevel = LOG_DEBUG;
break;
default:
sysloglevel = LOG_ERR;
}
return sysloglevel;
}
OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
{
va_list args;
va_start(args, aFormat);
qorvoUartLog(aLogLevel, aLogRegion, aFormat, args);
va_end(args);
}
#endif
-76
View File
@@ -1,76 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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 "platform_qorvo.h"
#include <stdio.h>
#include <unistd.h>
#include "radio_qorvo.h"
#include <stdlib.h>
#include <openthread/instance.h>
#include <openthread/platform/misc.h>
extern int gArgumentsCount;
extern char **gArguments;
extern void platformUartRestore(void);
void otPlatReset(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
char *argv[gArgumentsCount + 1];
for (int i = 0; i < gArgumentsCount; ++i)
{
argv[i] = gArguments[i];
}
argv[gArgumentsCount] = NULL;
qorvoRadioReset();
platformUartRestore();
execvp(argv[0], argv);
perror("reset failed");
exit(EXIT_FAILURE);
}
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_PLAT_RESET_REASON_POWER_ON;
}
void otPlatWakeHost(void)
{
// TODO: implement an operation to wake the host from sleep state.
}
@@ -1,40 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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 OPENTHREAD_CORE_GP712_CONFIG_CHECK_H_
#define OPENTHREAD_CORE_GP712_CONFIG_CHECK_H_
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
#error "Platform gp712 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
#endif
#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
#error "Platform gp712 doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
#endif
#endif /* OPENTHREAD_CORE_GP712_CONFIG_CHECK_H_ */
@@ -1,136 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes gp712 compile-time configuration constants for OpenThread.
*/
#ifndef OPENTHREAD_CORE_GP712_CONFIG_H_
#define OPENTHREAD_CORE_GP712_CONFIG_H_
/**
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
*
* The platform-specific string to insert into the OpenThread version string.
*
*/
#define OPENTHREAD_CONFIG_PLATFORM_INFO "GP712"
/**
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
*
* Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
*
* When defined to 1, the platform MUST implement the otPlatFlash* APIs
* instead of the otPlatSettings*
*
*/
#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
*
* Define to 1 if you want to enable software ACK timeout logic.
*
*/
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
*
* Define to 1 if you want to enable software retransmission logic.
*
*/
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
*
* Define to 1 if you want to enable software CSMA-CA backoff logic.
*
*/
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
*
* Define to 1 if you want to enable software transmission security logic.
*
*/
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
#endif
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE
*
* Define to 1 to enable software transmission target time logic.
*
*/
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
#endif
/**
* @def OPENTHREAD_CONFIG_DIAG_ENABLE
*
* Define as 1 to enable the diag feature.
*
*/
#ifndef OPENTHREAD_CONFIG_DIAG_ENABLE
#define OPENTHREAD_CONFIG_DIAG_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_NCP_SPI_ENABLE
*
* Define as 1 to enable SPI NCP interface.
*
*/
#ifndef OPENTHREAD_CONFIG_NCP_SPI_ENABLE
#define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
*
* Define as 1 to enable UART NCP interface.
*
*/
#ifndef OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
#define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1
#endif
#endif // OPENTHREAD_CORE_GP712_CONFIG_H_
-79
View File
@@ -1,79 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes the platform-specific initializers.
*
*/
#ifndef PLATFORM_QORVO_H_
#define PLATFORM_QORVO_H_
#include <openthread-core-config.h>
#include <stdbool.h>
#include <stdint.h>
typedef void (*qorvoPlatPollFunction_t)(uint8_t);
typedef uint8_t (*qorvoPlatGotoSleepCheckCallback_t)(void);
/**
* This function registers a callback to a file descriptor.
*
* @param[in] fd The file descriptor.
* @param[in] pollFunction The callback which should be called when data is ready or needed for the file descriptor.
*
*/
void qorvoPlatRegisterPollFunction(int fd, qorvoPlatPollFunction_t pollFunction);
/**
* This function unregisters a callback for a file descriptor.
*
* @param[in] fd The file descriptor.
*
*/
void qorvoPlatUnRegisterPollFunction(int fd);
/**
* This function initializes the platform.
*
* @param[in] gotoSleepCheckCallback The callback which needs to return if sleep is allowed.
*
*/
void qorvoPlatInit(qorvoPlatGotoSleepCheckCallback_t gotoSleepCheckCallback);
/**
* This function runs the main loop of the platform once.
*
* @param[in] canGoToSleep Indicates if the platform can got to sleep.
*
*/
void qorvoPlatMainLoop(bool canGoToSleep);
#endif // PLATFORM_QORVO_H_
-419
View File
@@ -1,419 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file implements the OpenThread platform abstraction for radio communication.
*
*/
#include <string.h>
#include <openthread/platform/diag.h>
#include <openthread/platform/radio.h>
#include "utils/code_utils.h"
#include "radio_qorvo.h"
enum
{
GP712_RECEIVE_SENSITIVITY = -100, // dBm
};
enum
{
IEEE802154_MIN_LENGTH = 5,
IEEE802154_MAX_LENGTH = 127,
IEEE802154_ACK_LENGTH = 5,
IEEE802154_FRAME_TYPE_MASK = 0x7,
IEEE802154_FRAME_TYPE_ACK = 0x2,
IEEE802154_FRAME_PENDING = 1 << 4,
IEEE802154_ACK_REQUEST = 1 << 5,
IEEE802154_DSN_OFFSET = 2,
};
enum
{
QORVO_RSSI_OFFSET = 73,
QORVO_CRC_BIT_MASK = 0x80,
QORVO_LQI_BIT_MASK = 0x7f,
};
extern otRadioFrame sTransmitFrame;
static otRadioState sState;
static otInstance * pQorvoInstance;
typedef struct otCachedSettings_s
{
uint16_t panid;
} otCachedSettings_t;
static otCachedSettings_t otCachedSettings;
/* Upper layer relies on txpower could be set before receive, but MAC have per-channel config for it.
Store txpower until channel set in Receive(). */
#define PENDING_TX_POWER_NONE (-1)
static int8_t pendingTxPower = PENDING_TX_POWER_NONE;
static uint8_t sScanstate = 0;
static int8_t sLastReceivedPower = 127;
void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioGetIeeeEui64(aIeeeEui64);
}
void otPlatRadioSetPanId(otInstance *aInstance, uint16_t panid)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioSetPanId(panid);
otCachedSettings.panid = panid;
}
void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *address)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioSetExtendedAddress(address->m8);
}
void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t address)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioSetShortAddress(address);
}
bool otPlatRadioIsEnabled(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (sState != OT_RADIO_STATE_DISABLED);
}
otError otPlatRadioEnable(otInstance *aInstance)
{
pQorvoInstance = aInstance;
memset(&otCachedSettings, 0x00, sizeof(otCachedSettings_t));
if (!otPlatRadioIsEnabled(aInstance))
{
sState = OT_RADIO_STATE_SLEEP;
}
return OT_ERROR_NONE;
}
otError otPlatRadioDisable(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
otEXPECT(otPlatRadioIsEnabled(aInstance));
if (sState == OT_RADIO_STATE_RECEIVE)
{
qorvoRadioSetRxOnWhenIdle(false);
}
sState = OT_RADIO_STATE_DISABLED;
exit:
return OT_ERROR_NONE;
}
otError otPlatRadioSleep(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_INVALID_STATE;
if (sState == OT_RADIO_STATE_RECEIVE || sState == OT_RADIO_STATE_SLEEP)
{
qorvoRadioSetRxOnWhenIdle(false);
error = OT_ERROR_NONE;
sState = OT_RADIO_STATE_SLEEP;
}
return error;
}
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
{
otError error = OT_ERROR_INVALID_STATE;
pQorvoInstance = aInstance;
if ((sState != OT_RADIO_STATE_DISABLED) && (sScanstate == 0))
{
qorvoRadioSetCurrentChannel(aChannel);
if (pendingTxPower != PENDING_TX_POWER_NONE)
{
qorvoRadioSetTransmitPower(pendingTxPower);
pendingTxPower = PENDING_TX_POWER_NONE;
}
error = OT_ERROR_NONE;
}
if (sState == OT_RADIO_STATE_SLEEP)
{
qorvoRadioSetRxOnWhenIdle(true);
error = OT_ERROR_NONE;
sState = OT_RADIO_STATE_RECEIVE;
}
return error;
}
otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aPacket)
{
otError err = OT_ERROR_NONE;
pQorvoInstance = aInstance;
otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, err = OT_ERROR_INVALID_STATE);
err = qorvoRadioTransmit(aPacket);
exit:
return err;
}
void cbQorvoRadioTransmitDone(otRadioFrame *aPacket, bool aFramePending, otError aError)
{
// TODO: pass received ACK frame instead of generating one.
otRadioFrame ackFrame;
uint8_t psdu[IEEE802154_ACK_LENGTH];
ackFrame.mPsdu = psdu;
ackFrame.mLength = IEEE802154_ACK_LENGTH;
ackFrame.mPsdu[0] = IEEE802154_FRAME_TYPE_ACK;
if (aFramePending)
{
ackFrame.mPsdu[0] |= IEEE802154_FRAME_PENDING;
}
ackFrame.mPsdu[1] = 0;
ackFrame.mPsdu[2] = aPacket->mPsdu[IEEE802154_DSN_OFFSET];
otPlatRadioTxDone(pQorvoInstance, aPacket, &ackFrame, aError);
}
void cbQorvoRadioReceiveDone(otRadioFrame *aPacket, otError aError)
{
if (aError == OT_ERROR_NONE)
{
sLastReceivedPower = aPacket->mInfo.mRxInfo.mRssi;
}
otPlatRadioReceiveDone(pQorvoInstance, aPacket, aError);
}
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return &sTransmitFrame;
}
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sLastReceivedPower;
}
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_TRANSMIT_RETRIES;
}
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return false;
}
void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aEnable);
}
void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioEnableSrcMatch(aEnable);
}
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
return qorvoRadioAddSrcMatchShortEntry(aShortAddress, otCachedSettings.panid);
}
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
return qorvoRadioAddSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid);
}
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
return qorvoRadioClearSrcMatchShortEntry(aShortAddress, otCachedSettings.panid);
}
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
return qorvoRadioClearSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid);
}
void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
/* clear both short and extended addresses here */
qorvoRadioClearSrcMatchEntries();
}
void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
/* not implemented */
/* assumes clearing of short and extended entries is done simultaniously by the openthread stack */
}
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
{
OT_UNUSED_VARIABLE(aInstance);
sScanstate = 1;
return qorvoRadioEnergyScan(aScanChannel, aScanDuration);
}
void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi)
{
sScanstate = 0;
otPlatRadioEnergyScanDone(pQorvoInstance, aEnergyScanMaxRssi);
}
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
{
OT_UNUSED_VARIABLE(aInstance);
otError result;
if (aPower == NULL)
{
return OT_ERROR_INVALID_ARGS;
}
if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0))
{
*aPower = (pendingTxPower == PENDING_TX_POWER_NONE) ? 0 : pendingTxPower;
return OT_ERROR_NONE;
}
result = qorvoRadioGetTransmitPower(aPower);
if (result == OT_ERROR_INVALID_STATE)
{
// Channel was not set, so txpower is ambigious
*aPower = (pendingTxPower == PENDING_TX_POWER_NONE) ? 0 : pendingTxPower;
return OT_ERROR_NONE;
}
return result;
}
otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
{
OT_UNUSED_VARIABLE(aInstance);
otError result;
if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0))
{
pendingTxPower = aPower;
return OT_ERROR_NONE;
}
result = qorvoRadioSetTransmitPower(aPower);
if (result == OT_ERROR_INVALID_STATE)
{
// Channel was not set, so txpower is ambigious
pendingTxPower = aPower;
result = OT_ERROR_NONE;
}
return result;
}
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aThreshold);
return OT_ERROR_NOT_IMPLEMENTED;
}
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aThreshold);
return OT_ERROR_NOT_IMPLEMENTED;
}
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return GP712_RECEIVE_SENSITIVITY;
}
const char *otPlatRadioGetVersionString(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return "OPENTHREAD/Qorvo/0.0";
}
-220
View File
@@ -1,220 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes the declarations of the radio functions from the Qorvo library.
*
*/
#ifndef RADIO_QORVO_H_
#define RADIO_QORVO_H_
#include <stdbool.h>
#include <stdint.h>
#include <openthread/error.h>
#include <openthread/platform/radio.h>
/**
* This function initializes the radio.
*
*/
void qorvoRadioInit(void);
/**
* This function resets the radio.
*
*/
void qorvoRadioReset(void);
/**
* This function processes event to/from the radio.
*
*/
void qorvoRadioProcess(void);
/**
* This function starts an ED scan.
*
* @param[in] aScanChannel The channel which needs to be scanned.
* @param[in] aScanDuration The amount of time in ms which needs to be scanned.
*
*/
otError qorvoRadioEnergyScan(uint8_t aScanChannel, uint16_t aScanDuration);
/**
* This function sets the current channel.
*
* @param[in] channel The channel index.
*
*/
void qorvoRadioSetCurrentChannel(uint8_t channel);
/**
* This function sets the idle behaviour of the radio.
*
* @param[in] rxOnWhenIdle If true, the radio remains on which not transmitting.
*
*/
void qorvoRadioSetRxOnWhenIdle(bool rxOnWhenIdle);
/**
* This function retrieves the MAC address of the radio.
*
* @param[out] aIeeeEui64 The MAC address of the radio.
*
*/
void qorvoRadioGetIeeeEui64(uint8_t *aIeeeEui64);
/**
* This function transmits a frame.
*
* @param[in] aPacket The frame which needs to be transmitted.
*
*/
otError qorvoRadioTransmit(otRadioFrame *aPacket);
/**
* This function sets the PanId.
*
* @param[in] panid The panId.
*
*/
void qorvoRadioSetPanId(uint16_t panid);
/**
* This function sets the short address.
*
* @param[in] address The short address.
*
*/
void qorvoRadioSetShortAddress(uint16_t address);
/**
* This function sets the extended address.
*
* @param[in] address The extended address.
*
*/
void qorvoRadioSetExtendedAddress(const uint8_t *address);
/**
* This function enables source address matching for indirect transmit.
*
* @param[in] aEnable if True will enable source address matching, false will disable.
*
*/
void qorvoRadioEnableSrcMatch(bool aEnable);
/**
* This function clears all entries from the source address match list.
*
*/
void qorvoRadioClearSrcMatchEntries(void);
/**
* This function adds an short address plus panid to the source address match list.
*
* @param[in] aShortAddress The short address which should be added.
* @param[in] panid The panid.
*
*/
otError qorvoRadioAddSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid);
/**
* This function adds an extended address plus panid to the source address match list.
*
* @param[in] aExtAddress The extended address which should be added.
* @param[in] panid The panid.
*
*/
otError qorvoRadioAddSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid);
/**
* This function removes an short address plus panid from the source address match list.
*
* @param[in] aShortAddress The short address which should be removed.
* @param[in] panid The panid.
*
*/
otError qorvoRadioClearSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid);
/**
* This function removes an extended address plus panid from the source address match list.
*
* @param[in] aExtAddress The extended address which should be removed.
* @param[in] panid The panid.
*
*/
otError qorvoRadioClearSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid);
/**
* This function gets the transmit power for current channel
*
* @param[out] aPower The transmit power
*
*/
otError qorvoRadioGetTransmitPower(int8_t *aPower);
/**
* This function sets the transmit power for current channel
*
* @param[in] aPower The transmit power
*
*/
otError qorvoRadioSetTransmitPower(int8_t aPower);
/**
* This callback is called when the energy scan is finished.
*
* @param[in] aEnergyScanMaxRssi The amount of energy detected during the ED scan.
*
*/
void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi);
/**
* This callback is called after a transmission is completed (and if required an ACK is received).
*
* @param[in] aPacket The packet which was transmitted.
* @param[in] aFramePending Indicates if the FP bit was set in the ACK frame or not.
* @param[in] aError Indicates if an error occurred during transmission.
*
*/
void cbQorvoRadioTransmitDone(otRadioFrame *aPacket, bool aFramePending, otError aError);
/**
* This callback is called after a frame is received.
*
* @param[in] aPacket The packet which was received.
* @param[in] aError Any error which occurred during reception of the packet.
*
*/
void cbQorvoRadioReceiveDone(otRadioFrame *aPacket, otError aError);
#endif // RADIO_QORVO_H_
-55
View File
@@ -1,55 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes the declarations of the random functions from the Qorvo library.
*
*/
#ifndef RANDOM_QORVO_H_
#define RANDOM_QORVO_H_
#include <stdint.h>
/**
* This function initializes the random number service used by OpenThread.
*
*/
void qorvoRandomInit(void);
/**
* This function returns an array of random numbers.
*
* @param[out] aOutput Pointer to an array which will be filled with random data.
* @param[in] aOutputLength number of bytes which will be written into the array.
*
*/
void qorvoRandomGet(uint8_t *aOutput, uint8_t aOutputLength);
#endif // RANDOM_QORVO_H_
-97
View File
@@ -1,97 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* @brief
* This file includes the platform-specific initializers.
*/
#include "platform_qorvo.h"
#include "stdio.h"
#include "stdlib.h"
#include <openthread/tasklet.h>
#include "alarm_qorvo.h"
#include "platform_qorvo.h"
#include "radio_qorvo.h"
#include "random_qorvo.h"
#include "uart_qorvo.h"
void platformUartInit(void);
void platformUartProcess(void);
otInstance *localInstance = NULL;
int gArgumentsCount = 0;
char **gArguments = NULL;
uint8_t qorvoPlatGotoSleepCheck(void)
{
bool canGotoSleep = false;
if (localInstance)
{
canGotoSleep = !otTaskletsArePending(localInstance);
}
return canGotoSleep;
}
void otSysInit(int argc, char *argv[])
{
gArgumentsCount = argc;
gArguments = argv;
qorvoPlatInit((qorvoPlatGotoSleepCheckCallback_t)qorvoPlatGotoSleepCheck);
platformUartInit();
qorvoAlarmInit();
qorvoRandomInit();
qorvoRadioInit();
}
bool otSysPseudoResetWasRequested(void)
{
return false;
}
void otSysProcessDrivers(otInstance *aInstance)
{
if (localInstance == NULL)
{
// local copy in case we need to perform a callback.
localInstance = aInstance;
}
qorvoPlatMainLoop(!otTaskletsArePending(aInstance));
platformUartProcess();
// qorvoRadioProcess();
// qorvoAlarmProcess();
}
-364
View File
@@ -1,364 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
#define _XOPEN_SOURCE 500
#include "alarm_qorvo.h"
#include "platform_qorvo.h"
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
#include "utils/code_utils.h"
#include "utils/uart.h"
#ifdef __linux__
#include <sys/prctl.h>
int posix_openpt(int oflag);
int grantpt(int fildes);
int unlockpt(int fd);
char *ptsname(int fd);
#endif // __linux__
static uint8_t s_receive_buffer[128];
static const uint8_t *s_write_buffer;
static uint16_t s_write_length;
static int s_in_fd;
static int s_out_fd;
static struct termios original_stdin_termios;
static struct termios original_stdout_termios;
static void restore_stdin_termios(void)
{
tcsetattr(s_in_fd, TCSAFLUSH, &original_stdin_termios);
}
static void restore_stdout_termios(void)
{
tcsetattr(s_out_fd, TCSAFLUSH, &original_stdout_termios);
}
void platformDummy(void *dummyPointer)
{
OT_UNUSED_VARIABLE(dummyPointer);
}
static void cbKeyPressed(uint8_t Param)
{
OT_UNUSED_VARIABLE(Param);
qorvoAlarmScheduleEventArg(0, platformDummy, (void *)&s_in_fd);
}
void platformUartRestore(void)
{
restore_stdin_termios();
restore_stdout_termios();
dup2(s_out_fd, STDOUT_FILENO);
qorvoPlatUnRegisterPollFunction(s_in_fd);
qorvoPlatUnRegisterPollFunction(s_out_fd);
otPlatUartDisable();
}
void platformUartInit(void)
{
s_in_fd = dup(STDIN_FILENO);
s_out_fd = dup(STDOUT_FILENO);
dup2(STDERR_FILENO, STDOUT_FILENO);
int res = fcntl(s_in_fd, F_SETFD, fcntl(s_in_fd, F_GETFD) | FD_CLOEXEC);
otEXPECT_ACTION(res != -1, perror("fcntl() FD_CLOEXEC failed"));
res = fcntl(s_out_fd, F_SETFD, fcntl(s_out_fd, F_GETFD) | FD_CLOEXEC);
otEXPECT_ACTION(res != -1, perror("fcntl() FD_CLOEXEC failed"));
qorvoPlatRegisterPollFunction(s_in_fd, cbKeyPressed);
qorvoPlatRegisterPollFunction(s_out_fd, cbKeyPressed);
return;
exit:
exit(1);
}
otError otPlatUartEnable(void)
{
otError error = OT_ERROR_NONE;
struct termios termios;
#ifdef __linux__
// Ensure we terminate this process if the
// parent process dies.
prctl(PR_SET_PDEATHSIG, SIGHUP);
#endif
// We need this signal to make sure that this
// process terminates properly.
signal(SIGPIPE, SIG_DFL);
if (isatty(s_in_fd))
{
tcgetattr(s_in_fd, &original_stdin_termios);
atexit(&restore_stdin_termios);
}
if (isatty(s_out_fd))
{
tcgetattr(s_out_fd, &original_stdout_termios);
atexit(&restore_stdout_termios);
}
if (isatty(s_in_fd))
{
// get current configuration
otEXPECT_ACTION(tcgetattr(s_in_fd, &termios) == 0, perror("tcgetattr"); error = OT_ERROR_GENERIC);
// Set up the termios settings for raw mode. This turns
// off input/output processing, line processing, and character processing.
cfmakeraw(&termios);
// Set up our cflags for local use. Turn on hangup-on-close.
termios.c_cflag |= HUPCL | CREAD | CLOCAL;
// "Minimum number of characters for noncanonical read"
termios.c_cc[VMIN] = 1;
// "Timeout in deciseconds for noncanonical read"
termios.c_cc[VTIME] = 0;
// configure baud rate
otEXPECT_ACTION(cfsetispeed(&termios, B115200) == 0, perror("cfsetispeed"); error = OT_ERROR_GENERIC);
// set configuration
otEXPECT_ACTION(tcsetattr(s_in_fd, TCSANOW, &termios) == 0, perror("tcsetattr"); error = OT_ERROR_GENERIC);
}
if (isatty(s_out_fd))
{
// get current configuration
otEXPECT_ACTION(tcgetattr(s_out_fd, &termios) == 0, perror("tcgetattr"); error = OT_ERROR_GENERIC);
// Set up the termios settings for raw mode. This turns
// off input/output processing, line processing, and character processing.
cfmakeraw(&termios);
// Absolutely obliterate all output processing.
termios.c_oflag = 0;
// Set up our cflags for local use. Turn on hangup-on-close.
termios.c_cflag |= HUPCL | CREAD | CLOCAL;
// configure baud rate
otEXPECT_ACTION(cfsetospeed(&termios, B115200) == 0, perror("cfsetospeed"); error = OT_ERROR_GENERIC);
// set configuration
otEXPECT_ACTION(tcsetattr(s_out_fd, TCSANOW, &termios) == 0, perror("tcsetattr"); error = OT_ERROR_GENERIC);
}
return error;
exit:
close(s_in_fd);
close(s_out_fd);
return error;
}
otError otPlatUartDisable(void)
{
otError error = OT_ERROR_NONE;
close(s_in_fd);
close(s_out_fd);
return error;
}
otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
{
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(s_write_length == 0, error = OT_ERROR_BUSY);
s_write_buffer = aBuf;
s_write_length = aBufLength;
qorvoAlarmScheduleEventArg(0, platformDummy, (void *)&s_in_fd);
exit:
return error;
}
void platformUartUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, fd_set *aErrorFdSet, int *aMaxFd)
{
if (aReadFdSet != NULL)
{
FD_SET(s_in_fd, aReadFdSet);
if (aErrorFdSet != NULL)
{
FD_SET(s_in_fd, aErrorFdSet);
}
if (aMaxFd != NULL && *aMaxFd < s_in_fd)
{
*aMaxFd = s_in_fd;
}
}
if ((aWriteFdSet != NULL) && (s_write_length > 0))
{
FD_SET(s_out_fd, aWriteFdSet);
if (aErrorFdSet != NULL)
{
FD_SET(s_out_fd, aErrorFdSet);
}
if (aMaxFd != NULL && *aMaxFd < s_out_fd)
{
*aMaxFd = s_out_fd;
}
}
}
otError otPlatUartFlush(void)
{
otError error = OT_ERROR_NONE;
ssize_t count;
otEXPECT_ACTION(s_write_buffer != NULL && s_write_length > 0, error = OT_ERROR_INVALID_STATE);
while ((count = write(s_out_fd, s_write_buffer, s_write_length)) > 0 && (s_write_length -= count) > 0)
{
s_write_buffer += count;
}
if (count != -1)
{
assert(s_write_length == 0);
s_write_buffer = NULL;
}
else
{
perror("write(UART)");
exit(EXIT_FAILURE);
}
exit:
return error;
}
void platformUartProcess(void)
{
ssize_t rval;
const int error_flags = POLLERR | POLLNVAL | POLLHUP;
struct pollfd pollfd[] = {
{s_in_fd, POLLIN | error_flags, 0},
{s_out_fd, POLLOUT | error_flags, 0},
};
errno = 0;
rval = poll(pollfd, sizeof(pollfd) / sizeof(*pollfd), 0);
if (rval < 0)
{
perror("poll");
exit(EXIT_FAILURE);
}
if (rval > 0)
{
if ((pollfd[0].revents & error_flags) != 0)
{
perror("s_in_fd");
exit(EXIT_FAILURE);
}
if ((pollfd[1].revents & error_flags) != 0)
{
perror("s_out_fd");
exit(EXIT_FAILURE);
}
if (pollfd[0].revents & POLLIN)
{
rval = read(s_in_fd, s_receive_buffer, sizeof(s_receive_buffer));
if (rval <= 0)
{
perror("read");
exit(EXIT_FAILURE);
}
otPlatUartReceived(s_receive_buffer, (uint16_t)rval);
}
if ((s_write_length > 0) && (pollfd[1].revents & POLLOUT))
{
rval = write(s_out_fd, s_write_buffer, s_write_length);
if (rval >= 0)
{
s_write_buffer += (uint16_t)rval;
s_write_length -= (uint16_t)rval;
if (s_write_length == 0)
{
otPlatUartSendDone();
}
}
else if (errno != EINTR)
{
perror("write");
exit(EXIT_FAILURE);
}
}
}
}
/**
* The weak stubs functions definition.
*/
OT_TOOL_WEAK void otPlatUartSendDone(void)
{
}
OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
{
(void)aBuf;
(void)aBufLength;
}
-88
View File
@@ -1,88 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes the declarations of the uart functions from the Qorvo library.
*
*/
#ifndef UART_QORVO_H_
#define UART_QORVO_H_
#include <stdint.h>
#include <openthread/platform/logging.h>
/**
* This function enables the UART driver.
*
*/
void qorvoUartInit(void);
/**
* This function disables the UART driver.
*
*/
void qorvoUartDeInit(void);
/**
* Callback function which will be called when uart transmission is done.
*
*/
void cbQorvoUartTxDone(void);
/**
* Callback function which will be called when uart data is received.
*
* @param[in] aBuf A pointer to an array of received bytes.
* @param[in] aBufLength The number of bytes received from the uart.
*
*/
void qorvoUartSendInput(uint8_t *aBuf, uint16_t aBufLength);
/**
* Function which transmits data via the uart.
*
* @param[out] aBuf A pointer to an array of bytes which need to be transmitted.
* @param[in] aBufLength The number of bytes to be transmitted via the uart.
*
*/
void qorvoUartSendOutput(const uint8_t *aBuf, uint16_t aBufLength);
/**
* Function which transmits logging via the qorvo platform.
*
* @param[in] aLogLevel The severity level of logging.
* @param[in] aLogRegion The code region where the logging originated from.
* @param[in] aFormat The format strings.
* @param[in] varargs The arguments for the format string.
*
*/
void qorvoUartLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...);
#endif // UART_QORVO_H_
-104
View File
@@ -1,104 +0,0 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
set(OT_PLATFORM_LIB "openthread-qpg6095" PARENT_SCOPE)
if(NOT OT_CONFIG)
set(OT_CONFIG "openthread-core-qpg6095-config.h")
set(OT_CONFIG ${OT_CONFIG} PARENT_SCOPE)
endif()
list(APPEND OT_PLATFORM_DEFINES
"OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-qpg6095-config-check.h\""
)
set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)
target_compile_definitions(ot-config INTERFACE "MBEDTLS_USER_CONFIG_FILE=\"qpg6095-mbedtls-config.h\"")
list(APPEND OT_PUBLIC_INCLUDES
"${CMAKE_CURRENT_SOURCE_DIR}/crypto"
)
set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE)
if(OT_CFLAGS MATCHES "-pedantic-errors")
string(REPLACE "-pedantic-errors" "" OT_CFLAGS "${OT_CFLAGS}")
endif()
if(OT_CFLAGS MATCHES "-Wno-c\\+\\+14-compat")
string(REPLACE "-Wno-c++14-compat" "" OT_CFLAGS "${OT_CFLAGS}")
endif()
list(APPEND OT_PLATFORM_DEFINES "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${OT_CONFIG}\"")
add_library(openthread-qpg6095
alarm.c
diag.c
entropy.c
logging.c
misc.c
platform.c
radio.c
settings.cpp
uart.c
)
set_target_properties(
openthread-qpg6095
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_link_libraries(openthread-qpg6095
PRIVATE
qpg6095-driver
${OT_MBEDTLS}
ot-config
PUBLIC
-T${PROJECT_SOURCE_DIR}/third_party/Qorvo/repo/qpg6095/ld/qpg6095.ld
-nostdlib
-Wl,--gc-sections
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map,--cref
)
target_compile_definitions(openthread-qpg6095
PUBLIC
${OT_PLATFORM_DEFINES}
)
target_compile_options(openthread-qpg6095
PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-qpg6095
PRIVATE
${OT_PUBLIC_INCLUDES}
${PROJECT_SOURCE_DIR}/src/core
${PROJECT_SOURCE_DIR}/examples/platforms
)
-80
View File
@@ -1,80 +0,0 @@
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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 $(abs_top_nlbuild_autotools_dir)/automake/pre.am
# Do not enable -Wcast-align for this platform
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
lib_LIBRARIES = libopenthread-qpg6095.a
libopenthread_qpg6095_a_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/core \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/examples/platforms/utils \
-I$(top_srcdir)/examples/platforms/qpg6095 \
-lrt \
-lpthread \
$(NULL)
PLATFORM_SOURCES = \
alarm.c \
alarm_qorvo.h \
diag.c \
entropy.c \
logging.c \
misc.c \
misc_qorvo.h \
openthread-core-qpg6095-config.h \
openthread-core-qpg6095-config-check.h \
platform.c \
platform_qorvo.h \
radio.c \
radio_qorvo.h \
random_qorvo.h \
settings.cpp \
settings_qorvo.h \
uart.c \
uart_qorvo.h \
$(NULL)
libopenthread_qpg6095_a_SOURCES = \
$(PLATFORM_SOURCES) \
$(NULL)
Dash = -
libopenthread_qpg6095_a_LIBADD = \
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
if OPENTHREAD_BUILD_COVERAGE
CLEANFILES = $(wildcard *.gcda *.gcno)
endif # OPENTHREAD_BUILD_COVERAGE
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
@@ -1,49 +0,0 @@
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
#
# qpg6095 platform-specific Makefile
#
LDADD_COMMON += \
$(top_builddir)/examples/platforms/qpg6095/libopenthread-qpg6095.a \
$(NULL)
if OPENTHREAD_ENABLE_FTD
LDADD_COMMON += \
$(top_srcdir)/third_party/Qorvo/repo/qpg6095/lib/libQorvoQPG6095_ftd.a \
$(NULL)
else # OPENTHREAD_ENABLE_FTD
if OPENTHREAD_ENABLE_MTD
LDADD_COMMON += \
$(top_srcdir)/third_party/Qorvo/repo/qpg6095/lib/libQorvoQPG6095_mtd.a \
$(NULL)
endif # OPENTHREAD_ENABLE_MTD
endif
LDFLAGS_COMMON += \
-T $(top_srcdir)/third_party/Qorvo/repo/qpg6095/ld/qpg6095.ld \
$(NULL)
+1
View File
@@ -0,0 +1 @@
The OpenThread on QPG6095 example has moved to https://github.com/openthread/ot-qorvo
-62
View File
@@ -1,62 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file implements the OpenThread platform abstraction for the alarm.
*
*/
#include <stdbool.h>
#include <stdint.h>
#include "alarm_qorvo.h"
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/diag.h>
uint32_t otPlatAlarmMilliGetNow(void)
{
return qorvoAlarmGetTimeMs();
}
static void qorvoAlarmFired(void *aInstance)
{
otPlatAlarmMilliFired((otInstance *)aInstance);
}
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
{
OT_UNUSED_VARIABLE(t0);
qorvoAlarmUnScheduleEventArg((qorvoAlarmCallback_t)qorvoAlarmFired, aInstance);
qorvoAlarmScheduleEventArg(dt, qorvoAlarmFired, aInstance);
}
void otPlatAlarmMilliStop(otInstance *aInstance)
{
qorvoAlarmUnScheduleEventArg((qorvoAlarmCallback_t)qorvoAlarmFired, aInstance);
}
-78
View File
@@ -1,78 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes the declarations of the Alarm functions from the Qorvo library.
*
*/
#ifndef ALARM_QORVO_H_
#define ALARM_QORVO_H_
#include <stdbool.h>
#include <stdint.h>
#include <sys/time.h>
#include <unistd.h>
typedef void (*qorvoAlarmCallback_t)(void *);
/**
* This function initializes the alarm service used by OpenThread.
*
*/
void qorvoAlarmInit(void);
/**
* This function retrieves the current time.
*
* @param[out] The current time in ms.
*
*/
uint32_t qorvoAlarmGetTimeMs(void);
/**
* This function schedules a callback after a relative amount of time.
*
* @param[in] rel_time The relative time in ms.
* @param[in] callback A callback function which will be called.
* @param[in] arg A context pointer which will be passed as an argument to the callback.
*
*/
void qorvoAlarmScheduleEventArg(uint32_t rel_time, qorvoAlarmCallback_t callback, void *arg);
/**
* This function unschedules the callback.
*
* @param[in] callback A callback function which will be removed from the list.
* @param[in] arg A context pointer which will be passed as an argument to the callback.
*
*/
bool qorvoAlarmUnScheduleEventArg(qorvoAlarmCallback_t callback, void *arg);
#endif // ALARM_QORVO_H_
@@ -1,42 +0,0 @@
#
# Copyright (c) 2021, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR ARM)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
set(CMAKE_ASM_COMPILER arm-none-eabi-as)
set(CMAKE_RANLIB arm-none-eabi-ranlib)
set(COMMON_C_FLAGS "-mcpu=cortex-m4 -mthumb -fdata-sections -ffunction-sections")
set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS} -std=gnu99")
set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti")
set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS} -specs=nano.specs -specs=nosys.specs")
@@ -1,40 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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 QGP6095_MBEDTLS_CONFIG_H
#define QGP6095_MBEDTLS_CONFIG_H
/* enable this to speed up crypto calculations by using a ram patch for bignum.c */
#define MBEDTLS_BIGNUM_RAMPATCH 0
/* enable this in case the QPG6095 runs too slow for the crypto calculations */
#define MBEDTLS_SLOW_CPU 1
#define MBEDTLS_COMPUTATION_UNTILL_SEQ_NR 6
#include "mbedtls/check_config.h"
#endif // QGP6095_MBEDTLS_CONFIG_H
-78
View File
@@ -1,78 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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 <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <openthread-core-config.h>
#include <openthread/platform/alarm-milli.h>
#include <openthread/platform/radio.h>
#if OPENTHREAD_CONFIG_DIAG_ENABLE
/**
* Diagnostics mode variables.
*
*/
static bool sDiagMode = false;
void otPlatDiagModeSet(bool aMode)
{
sDiagMode = aMode;
}
bool otPlatDiagModeGet()
{
return sDiagMode;
}
void otPlatDiagChannelSet(uint8_t aChannel)
{
OT_UNUSED_VARIABLE(aChannel);
}
void otPlatDiagTxPowerSet(int8_t aTxPower)
{
OT_UNUSED_VARIABLE(aTxPower);
}
void otPlatDiagRadioReceived(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aFrame);
OT_UNUSED_VARIABLE(aError);
}
void otPlatDiagAlarmCallback(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
}
#endif // OPENTHREAD_CONFIG_DIAG_ENABLE
-49
View File
@@ -1,49 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file implements an entropy source.
*
*/
#include <openthread/platform/entropy.h>
#include "assert.h"
#include "random_qorvo.h"
#include <common/code_utils.hpp>
#include <openthread/platform/radio.h>
otError otPlatEntropyGet(uint8_t *aOutput, uint16_t aOutputLength)
{
otError error = OT_ERROR_NONE;
assert(aOutputLength < 256);
qorvoRandomGet((uint8_t *)aOutput, (uint8_t)aOutputLength);
return error;
}
-50
View File
@@ -1,50 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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 "openthread-core-config.h"
#include "platform_qorvo.h"
#include <ctype.h>
#include <inttypes.h>
#include <stdarg.h>
#include <openthread/platform/logging.h>
#include "uart_qorvo.h"
#include "utils/code_utils.h"
#if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED)
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
{
va_list args;
va_start(args, aFormat);
qorvoUartLog(aLogLevel, aLogRegion, aFormat, args);
va_end(args);
}
#endif
-49
View File
@@ -1,49 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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 "misc_qorvo.h"
#include <stdlib.h>
#include <openthread/platform/misc.h>
void otPlatReset(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoPlatReset();
}
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
// TODO: Write me!
return OT_PLAT_RESET_REASON_POWER_ON;
}
void otPlatWakeHost(void)
{
// TODO: implement an operation to wake the host from sleep state.
}
-43
View File
@@ -1,43 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes the declarations of the misc functions from the Qorvo library.
*
*/
#ifndef MISC_QORVO_H_
#define MISC_QORVO_H_
#include <stdbool.h>
#include <stdint.h>
void qorvoPlatReset(void);
#endif // MISC_QORVO_H_
@@ -1,40 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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 OPENTHREAD_CORE_QPG6095_CONFIG_CHECK_H_
#define OPENTHREAD_CORE_QPG6095_CONFIG_CHECK_H_
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
#error "Platform qpg6095 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
#endif
#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
#error "Platform qpg6095 doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
#endif
#endif /* OPENTHREAD_CORE_QPG6095_CONFIG_CHECK_H_ */
@@ -1,53 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes qpg6095 compile-time configuration constants for OpenThread.
*/
#ifndef OPENTHREAD_CORE_QPG6095_CONFIG_H_
#define OPENTHREAD_CORE_QPG6095_CONFIG_H_
/**
* @def OPENTHREAD_CONFIG_LEGACY_TRANSMIT_DONE
*
* Define to 1 if you want use legacy transmit done.
*
*/
#define OPENTHREAD_CONFIG_LEGACY_TRANSMIT_DONE 1
/**
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
*
* The platform-specific string to insert into the OpenThread version string.
*
*/
#define OPENTHREAD_CONFIG_PLATFORM_INFO "QPG6095"
#endif // OPENTHREAD_CORE_QPG6095_CONFIG_H_
-91
View File
@@ -1,91 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* @brief
* This file includes the platform-specific initializers.
*/
#include "alarm_qorvo.h"
#include "platform_qorvo.h"
#include "radio_qorvo.h"
#include "random_qorvo.h"
#include "uart_qorvo.h"
#include <openthread/tasklet.h>
#include "stdio.h"
#include "stdlib.h"
static otInstance *localInstance = NULL;
#ifdef QORVO_USE_ROM
extern void flash_jump_gpJumpTables_GetRomVersion(void);
#endif // QORVO_USE_ROM
uint8_t qorvoPlatGotoSleepCheck(void)
{
if (localInstance)
{
return !otTaskletsArePending(localInstance);
}
else
{
return true;
}
}
void otSysInit(int argc, char *argv[])
{
OT_UNUSED_VARIABLE(argc);
OT_UNUSED_VARIABLE(argv);
#ifdef QORVO_USE_ROM
flash_jump_gpJumpTables_GetRomVersion();
#endif // QORVO_USE_ROM
qorvoPlatInit((qorvoPlatGotoSleepCheckCallback_t)qorvoPlatGotoSleepCheck);
qorvoUartInit();
qorvoAlarmInit();
qorvoRandomInit();
qorvoRadioInit();
}
bool otSysPseudoResetWasRequested(void)
{
return false;
}
void otSysProcessDrivers(otInstance *aInstance)
{
if (localInstance == NULL)
{
// local copy in case we need to perform a callback.
localInstance = aInstance;
}
qorvoPlatMainLoop(!otTaskletsArePending(aInstance));
}
@@ -1,59 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes the platform-specific initializers.
*
*/
#ifndef PLATFORM_QORVO_H_
#define PLATFORM_QORVO_H_
#include <stdbool.h>
#include <stdint.h>
typedef uint8_t (*qorvoPlatGotoSleepCheckCallback_t)(void);
/**
* This function initializes the platform.
*
* @param[in] gotoSleepCheckCallback The callback which needs to return if sleep is allowed.
*
*/
void qorvoPlatInit(qorvoPlatGotoSleepCheckCallback_t gotoSleepCheckCallback);
/**
* This function runs the main loop of the platform once.
*
* @param[in] canGoToSleep Indicates if the platform can got to sleep.
*
*/
void qorvoPlatMainLoop(bool canGoToSleep);
#endif // PLATFORM_QORVO_H_
-420
View File
@@ -1,420 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file implements the OpenThread platform abstraction for radio communication.
*
*/
#include <string.h>
#include <openthread/platform/diag.h>
#include <openthread/platform/radio.h>
#include "utils/code_utils.h"
#include "radio_qorvo.h"
enum
{
QPG6095_RECEIVE_SENSITIVITY = -100, // dBm
};
enum
{
IEEE802154_MIN_LENGTH = 5,
IEEE802154_MAX_LENGTH = 127,
IEEE802154_ACK_LENGTH = 5,
IEEE802154_FRAME_TYPE_MASK = 0x7,
IEEE802154_FRAME_TYPE_ACK = 0x2,
IEEE802154_FRAME_PENDING = 1 << 4,
IEEE802154_ACK_REQUEST = 1 << 5,
IEEE802154_DSN_OFFSET = 2,
};
enum
{
QORVO_RSSI_OFFSET = 73,
QORVO_CRC_BIT_MASK = 0x80,
QORVO_LQI_BIT_MASK = 0x7f,
};
extern otRadioFrame sTransmitFrame;
static otRadioState sState;
static otInstance * pQorvoInstance;
typedef struct otCachedSettings_s
{
uint16_t panid;
} otCachedSettings_t;
static otCachedSettings_t otCachedSettings;
/* Upper layer relies on txpower could be set before receive, but MAC have per-channel config for it.
Store txpower until channel set in Receive(). */
#define PENDING_TX_POWER_NONE (-1)
static int8_t pendingTxPower = PENDING_TX_POWER_NONE;
static uint8_t sScanstate = 0;
static int8_t sLastReceivedPower = 127;
void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioGetIeeeEui64(aIeeeEui64);
}
void otPlatRadioSetPanId(otInstance *aInstance, uint16_t panid)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioSetPanId(panid);
otCachedSettings.panid = panid;
}
void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *address)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioSetExtendedAddress(address->m8);
}
void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t address)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioSetShortAddress(address);
}
bool otPlatRadioIsEnabled(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (sState != OT_RADIO_STATE_DISABLED);
}
otError otPlatRadioEnable(otInstance *aInstance)
{
pQorvoInstance = aInstance;
memset(&otCachedSettings, 0x00, sizeof(otCachedSettings_t));
if (!otPlatRadioIsEnabled(aInstance))
{
sState = OT_RADIO_STATE_SLEEP;
}
return OT_ERROR_NONE;
}
otError otPlatRadioDisable(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
otEXPECT(otPlatRadioIsEnabled(aInstance));
if (sState == OT_RADIO_STATE_RECEIVE)
{
qorvoRadioSetRxOnWhenIdle(false);
}
sState = OT_RADIO_STATE_DISABLED;
exit:
return OT_ERROR_NONE;
}
otError otPlatRadioSleep(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_INVALID_STATE;
if (sState == OT_RADIO_STATE_RECEIVE || sState == OT_RADIO_STATE_SLEEP)
{
qorvoRadioSetRxOnWhenIdle(false);
error = OT_ERROR_NONE;
sState = OT_RADIO_STATE_SLEEP;
}
return error;
}
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
{
otError error = OT_ERROR_INVALID_STATE;
pQorvoInstance = aInstance;
if ((sState != OT_RADIO_STATE_DISABLED) && (sScanstate == 0))
{
qorvoRadioSetCurrentChannel(aChannel);
if (pendingTxPower != PENDING_TX_POWER_NONE)
{
qorvoRadioSetTransmitPower(pendingTxPower);
pendingTxPower = PENDING_TX_POWER_NONE;
}
error = OT_ERROR_NONE;
}
if (sState == OT_RADIO_STATE_SLEEP)
{
qorvoRadioSetRxOnWhenIdle(true);
error = OT_ERROR_NONE;
sState = OT_RADIO_STATE_RECEIVE;
}
return error;
}
otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aPacket)
{
otError err = OT_ERROR_NONE;
pQorvoInstance = aInstance;
otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, err = OT_ERROR_INVALID_STATE);
err = qorvoRadioTransmit(aPacket);
exit:
return err;
}
void cbQorvoRadioTransmitDone(otRadioFrame *aPacket, bool aFramePending, otError aError)
{
// TODO: pass received ACK frame instead of generating one.
otRadioFrame ackFrame;
uint8_t psdu[IEEE802154_ACK_LENGTH];
ackFrame.mPsdu = psdu;
ackFrame.mLength = IEEE802154_ACK_LENGTH;
ackFrame.mPsdu[0] = IEEE802154_FRAME_TYPE_ACK;
if (aFramePending)
{
ackFrame.mPsdu[0] |= IEEE802154_FRAME_PENDING;
}
ackFrame.mPsdu[1] = 0;
ackFrame.mPsdu[2] = aPacket->mPsdu[IEEE802154_DSN_OFFSET];
otPlatRadioTxDone(pQorvoInstance, aPacket, &ackFrame, aError);
}
void cbQorvoRadioReceiveDone(otRadioFrame *aPacket, otError aError)
{
if (aError == OT_ERROR_NONE)
{
sLastReceivedPower = aPacket->mInfo.mRxInfo.mRssi;
}
otPlatRadioReceiveDone(pQorvoInstance, aPacket, aError);
}
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return &sTransmitFrame;
}
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sLastReceivedPower;
}
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_TRANSMIT_RETRIES;
}
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return false;
}
void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aEnable);
}
void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioEnableSrcMatch(aEnable);
}
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
return qorvoRadioAddSrcMatchShortEntry(aShortAddress, otCachedSettings.panid);
}
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
return qorvoRadioAddSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid);
}
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
return qorvoRadioClearSrcMatchShortEntry(aShortAddress, otCachedSettings.panid);
}
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
return qorvoRadioClearSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid);
}
void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
/* clear both short and extended addresses here */
qorvoRadioClearSrcMatchEntries();
}
void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
/* not implemented */
/* assumes clearing of short and extended entries is done simultaniously by the openthread stack */
}
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
{
OT_UNUSED_VARIABLE(aInstance);
sScanstate = 1;
return qorvoRadioEnergyScan(aScanChannel, aScanDuration);
}
void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi)
{
sScanstate = 0;
otPlatRadioEnergyScanDone(pQorvoInstance, aEnergyScanMaxRssi);
}
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
{
OT_UNUSED_VARIABLE(aInstance);
otError result;
if (aPower == NULL)
{
return OT_ERROR_INVALID_ARGS;
}
if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0))
{
*aPower = (pendingTxPower == PENDING_TX_POWER_NONE) ? 0 : pendingTxPower;
return OT_ERROR_NONE;
}
result = qorvoRadioGetTransmitPower(aPower);
if (result == OT_ERROR_INVALID_STATE)
{
// Channel was not set, so txpower is ambigious
*aPower = (pendingTxPower == PENDING_TX_POWER_NONE) ? 0 : pendingTxPower;
return OT_ERROR_NONE;
}
return result;
}
otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
{
OT_UNUSED_VARIABLE(aInstance);
otError result;
if ((sState == OT_RADIO_STATE_DISABLED) || (sScanstate != 0))
{
pendingTxPower = aPower;
return OT_ERROR_NONE;
}
result = qorvoRadioSetTransmitPower(aPower);
if (result == OT_ERROR_INVALID_STATE)
{
// Channel was not set, so txpower is ambigious
pendingTxPower = aPower;
result = OT_ERROR_NONE;
}
return result;
}
otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aThreshold);
return OT_ERROR_NOT_IMPLEMENTED;
}
otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aThreshold);
return OT_ERROR_NOT_IMPLEMENTED;
}
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return QPG6095_RECEIVE_SENSITIVITY;
}
const char *otPlatRadioGetVersionString(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return "OPENTHREAD/Qorvo/0.0";
}
-220
View File
@@ -1,220 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes the declarations of the radio functions from the Qorvo library.
*
*/
#ifndef RADIO_QORVO_H_
#define RADIO_QORVO_H_
#include <stdbool.h>
#include <stdint.h>
#include <openthread/error.h>
#include <openthread/platform/radio.h>
/**
* This function initializes the radio.
*
*/
void qorvoRadioInit(void);
/**
* This function resets the radio.
*
*/
void qorvoRadioReset(void);
/**
* This function processes event to/from the radio.
*
*/
void qorvoRadioProcess(void);
/**
* This function starts an ED scan.
*
* @param[in] aScanChannel The channel which needs to be scanned.
* @param[in] aScanDuration The amount of time in ms which needs to be scanned.
*
*/
otError qorvoRadioEnergyScan(uint8_t aScanChannel, uint16_t aScanDuration);
/**
* This function sets the current channel.
*
* @param[in] channel The channel index.
*
*/
void qorvoRadioSetCurrentChannel(uint8_t channel);
/**
* This function sets the idle behaviour of the radio.
*
* @param[in] rxOnWhenIdle If true, the radio remains on which not transmitting.
*
*/
void qorvoRadioSetRxOnWhenIdle(bool rxOnWhenIdle);
/**
* This function retrieves the MAC address of the radio.
*
* @param[out] aIeeeEui64 The MAC address of the radio.
*
*/
void qorvoRadioGetIeeeEui64(uint8_t *aIeeeEui64);
/**
* This function transmits a frame.
*
* @param[in] aPacket The frame which needs to be transmitted.
*
*/
otError qorvoRadioTransmit(otRadioFrame *aPacket);
/**
* This function sets the PanId.
*
* @param[in] panid The panId.
*
*/
void qorvoRadioSetPanId(uint16_t panid);
/**
* This function sets the short address.
*
* @param[in] address The short address.
*
*/
void qorvoRadioSetShortAddress(uint16_t address);
/**
* This function sets the extended address.
*
* @param[in] address The extended address.
*
*/
void qorvoRadioSetExtendedAddress(const uint8_t *address);
/**
* This function enables source address matching for indirect transmit.
*
* @param[in] aEnable if True will enable source address matching, false will disable.
*
*/
void qorvoRadioEnableSrcMatch(bool aEnable);
/**
* This function clears all entries from the source address match list.
*
*/
void qorvoRadioClearSrcMatchEntries(void);
/**
* This function adds an short address plus panid to the source address match list.
*
* @param[in] aShortAddress The short address which should be added.
* @param[in] panid The panid.
*
*/
otError qorvoRadioAddSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid);
/**
* This function adds an extended address plus panid to the source address match list.
*
* @param[in] aExtAddress The extended address which should be added.
* @param[in] panid The panid.
*
*/
otError qorvoRadioAddSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid);
/**
* This function removes an short address plus panid from the source address match list.
*
* @param[in] aShortAddress The short address which should be removed.
* @param[in] panid The panid.
*
*/
otError qorvoRadioClearSrcMatchShortEntry(uint16_t aShortAddress, uint16_t panid);
/**
* This function removes an extended address plus panid from the source address match list.
*
* @param[in] aExtAddress The extended address which should be removed.
* @param[in] panid The panid.
*
*/
otError qorvoRadioClearSrcMatchExtEntry(const uint8_t *aExtAddress, uint16_t panid);
/**
* This function gets the transmit power for current channel
*
* @param[out] aPower The transmit power
*
*/
otError qorvoRadioGetTransmitPower(int8_t *aPower);
/**
* This function sets the transmit power for current channel
*
* @param[in] aPower The transmit power
*
*/
otError qorvoRadioSetTransmitPower(int8_t aPower);
/**
* This callback is called when the energy scan is finished.
*
* @param[in] aEnergyScanMaxRssi The amount of energy detected during the ED scan.
*
*/
void cbQorvoRadioEnergyScanDone(int8_t aEnergyScanMaxRssi);
/**
* This callback is called after a transmission is completed (and if required an ACK is received).
*
* @param[in] aPacket The packet which was transmitted.
* @param[in] aFramePending Indicates if the FP bit was set in the ACK frame or not.
* @param[in] aError Indicates if an error occurred during transmission.
*
*/
void cbQorvoRadioTransmitDone(otRadioFrame *aPacket, bool aFramePending, otError aError);
/**
* This callback is called after a frame is received.
*
* @param[in] aPacket The packet which was received.
* @param[in] aError Any error which occurred during reception of the packet.
*
*/
void cbQorvoRadioReceiveDone(otRadioFrame *aPacket, otError aError);
#endif // RADIO_QORVO_H_
-56
View File
@@ -1,56 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes the declarations of the random functions from the Qorvo library.
*
*/
#ifndef RANDOM_QORVO_H_
#define RANDOM_QORVO_H_
#include <stdbool.h>
#include <stdint.h>
/**
* This function initializes the random number service used by OpenThread.
*
*/
void qorvoRandomInit(void);
/**
* This function returns an array of random numbers.
*
* @param[out] aOutput Pointer to an array which will be filled with random data.
* @param[in] aOutputLength number of bytes which will be written into the array.
*
*/
void qorvoRandomGet(uint8_t *aOutput, uint8_t aOutputLength);
#endif // RANDOM_QORVO_H_
-129
View File
@@ -1,129 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file implements the OpenThread platform abstraction for non-volatile storage of settings.
*
*/
#include <openthread-core-config.h>
#include <stdbool.h>
#include "openthread/platform/settings.h"
#include <utils/code_utils.h>
#include <utils/settings.h>
#include "settings_qorvo.h"
#if !OPENTHREAD_SETTINGS_RAM
/*****************************************************************************
* Public Function Definitions
*****************************************************************************/
// settings API
void otPlatSettingsInit(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoSettingsInit();
}
void otPlatSettingsDeinit(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
}
otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
{
otError error = OT_ERROR_NOT_FOUND;
OT_UNUSED_VARIABLE(aInstance);
/* we only support multiple entries for the ChildInfo */
/* Note: removed the assert, since the settings types are protected now */
// assert((aIndex == 0) || (aKey == ot::Settings::kKeyChildInfo));
error = qorvoSettingsGet(aKey, aIndex, aValue, aValueLength);
if (error == OT_ERROR_NOT_FOUND)
{
if (aValue != nullptr)
{
*aValueLength = 0;
}
}
return error;
}
static otError PlatformSettingsAdd(otInstance * aInstance,
uint16_t aKey,
bool aIndex0,
const uint8_t *aValue,
uint16_t aValueLength)
{
otError error = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aInstance);
error = qorvoSettingsAdd(aKey, aIndex0, aValue, aValueLength);
return error;
}
otError otPlatSettingsSet(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
{
return PlatformSettingsAdd(aInstance, aKey, true, aValue, aValueLength);
}
otError otPlatSettingsAdd(otInstance *aInstance, uint16_t aKey, const uint8_t *aValue, uint16_t aValueLength)
{
return PlatformSettingsAdd(aInstance, aKey, false, aValue, aValueLength);
}
otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex)
{
otError error = OT_ERROR_NOT_FOUND;
OT_UNUSED_VARIABLE(aInstance);
if (otPlatSettingsGet(aInstance, aKey, 0, nullptr, nullptr) == OT_ERROR_NONE)
{
qorvoSettingsDelete(aKey, aIndex);
error = OT_ERROR_NONE;
}
return error;
}
void otPlatSettingsWipe(otInstance *aInstance)
{
qorvoSettingsWipe();
otPlatSettingsInit(aInstance);
}
#endif /* OPENTHREAD_SETTINGS_RAM */
@@ -1,59 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes the declarations of the settings functions from the Qorvo library.
*
*/
#ifndef SETTINGS_QORVO_H_
#define SETTINGS_QORVO_H_
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
void qorvoSettingsInit(void);
otError qorvoSettingsGet(uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength);
otError qorvoSettingsAdd(uint16_t aKey, bool aIndex0, const uint8_t *aValue, uint16_t aValueLength);
otError qorvoSettingsDelete(uint16_t aKey, int aIndex);
void qorvoSettingsWipe(void);
#ifdef __cplusplus
}
#endif
#endif // SETTINGS_QORVO_H_
-91
View File
@@ -1,91 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file implements the OpenThread platform abstraction for UART communication.
*
*/
#include "uart_qorvo.h"
/* work-around to avoid access to openthread-config.h */
/* Define to 1 if stdbool.h conforms to C99. */
#define HAVE_STDBOOL_H 1
/* Define to 1 if the system has the type `_Bool'. */
#define HAVE__BOOL 1
#include <common/code_utils.hpp>
#include "utils/uart.h"
otError otPlatUartEnable(void)
{
otError error = OT_ERROR_NONE;
qorvoUartInit();
return error;
}
otError otPlatUartDisable(void)
{
otError error = OT_ERROR_NONE;
qorvoUartDeInit();
return error;
}
otError otPlatUartFlush(void)
{
return OT_ERROR_NOT_IMPLEMENTED;
}
otError otPlatUartSend(const uint8_t *aBuf, uint16_t aBufLength)
{
otError error = OT_ERROR_NONE;
qorvoUartSendOutput(aBuf, aBufLength);
return error;
}
void qorvoUartSendInput(uint8_t *buffer, uint16_t length)
{
otPlatUartReceived(buffer, length);
}
void cbQorvoUartTxDone(void)
{
otPlatUartSendDone();
}
OT_TOOL_WEAK void otPlatUartSendDone(void)
{
}
OT_TOOL_WEAK void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
{
OT_UNUSED_VARIABLE(aBuf);
OT_UNUSED_VARIABLE(aBufLength);
}
-89
View File
@@ -1,89 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes the declarations of the uart functions from the Qorvo library.
*
*/
#ifndef _UART_QORVO_H_
#define _UART_QORVO_H_
#include <stdbool.h>
#include <stdint.h>
#include <openthread/platform/logging.h>
/**
* This function enables the UART driver.
*
*/
void qorvoUartInit(void);
/**
* This function disables the UART driver.
*
*/
void qorvoUartDeInit(void);
/**
* Callback function which will be called when uart transmission is done.
*
*/
void cbQorvoUartTxDone(void);
/**
* Callback function which will be called when uart data is received.
*
* @param[in] aBuf A pointer to an array of received bytes.
* @param[in] aBufLength The number of bytes received from the uart.
*
*/
void qorvoUartSendInput(uint8_t *aBuf, uint16_t aBufLength);
/**
* Function which transmits data via the uart.
*
* @param[out] aBuf A pointer to an array of bytes which need to be transmitted.
* @param[in] aBufLength The number of bytes to be transmitted via the uart.
*
*/
void qorvoUartSendOutput(const uint8_t *aBuf, uint16_t aBufLength);
/**
* Function which transmits logging via the qorvo platform.
*
* @param[in] aLogLevel The severity level of logging.
* @param[in] aLogRegion The code region where the logging originated from.
* @param[in] aFormat The format strings.
* @param[in] varargs The arguments for the format string.
*
*/
void qorvoUartLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...);
#endif // _UART_QORVO_H_
-104
View File
@@ -1,104 +0,0 @@
#
# Copyright (c) 2021, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
set(OT_PLATFORM_LIB "openthread-qpg6100" PARENT_SCOPE)
if(NOT OT_CONFIG)
set(OT_CONFIG "openthread-core-qpg6100-config.h")
set(OT_CONFIG ${OT_CONFIG} PARENT_SCOPE)
endif()
list(APPEND OT_PLATFORM_DEFINES
"OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-qpg6100-config-check.h\""
)
set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)
target_compile_definitions(ot-config INTERFACE "MBEDTLS_USER_CONFIG_FILE=\"qpg6100-mbedtls-config.h\"")
list(APPEND OT_PUBLIC_INCLUDES
"${CMAKE_CURRENT_SOURCE_DIR}/crypto"
)
set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE)
if(OT_CFLAGS MATCHES "-pedantic-errors")
string(REPLACE "-pedantic-errors" "" OT_CFLAGS "${OT_CFLAGS}")
endif()
if(OT_CFLAGS MATCHES "-Wno-c\\+\\+14-compat")
string(REPLACE "-Wno-c++14-compat" "" OT_CFLAGS "${OT_CFLAGS}")
endif()
list(APPEND OT_PLATFORM_DEFINES "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${OT_CONFIG}\"")
add_library(openthread-qpg6100
alarm.c
diag.c
entropy.c
logging.c
misc.c
platform.c
radio.c
settings.cpp
uart.c
)
set_target_properties(
openthread-qpg6100
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_link_libraries(openthread-qpg6100
PRIVATE
qpg6100-driver
${OT_MBEDTLS}
ot-config
PUBLIC
-T${PROJECT_SOURCE_DIR}/third_party/Qorvo/repo/qpg6100/ld/qpg6100.ld
-nostdlib
-Wl,--gc-sections
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map,--cref
)
target_compile_definitions(openthread-qpg6100
PUBLIC
${OT_PLATFORM_DEFINES}
)
target_compile_options(openthread-qpg6100
PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-qpg6100
PRIVATE
${OT_PUBLIC_INCLUDES}
${PROJECT_SOURCE_DIR}/src/core
${PROJECT_SOURCE_DIR}/examples/platforms
)
-80
View File
@@ -1,80 +0,0 @@
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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 $(abs_top_nlbuild_autotools_dir)/automake/pre.am
# Do not enable -Wcast-align for this platform
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
lib_LIBRARIES = libopenthread-qpg6100.a
libopenthread_qpg6100_a_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/core \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/examples/platforms/utils \
-I$(top_srcdir)/examples/platforms/qpg6100 \
-lrt \
-lpthread \
$(NULL)
PLATFORM_SOURCES = \
alarm.c \
alarm_qorvo.h \
diag.c \
entropy.c \
logging.c \
misc.c \
misc_qorvo.h \
openthread-core-qpg6100-config.h \
openthread-core-qpg6100-config-check.h \
platform.c \
platform_qorvo.h \
radio.c \
radio_qorvo.h \
random_qorvo.h \
settings.cpp \
settings_qorvo.h \
uart.c \
uart_qorvo.h \
$(NULL)
libopenthread_qpg6100_a_SOURCES = \
$(PLATFORM_SOURCES) \
$(NULL)
Dash = -
libopenthread_qpg6100_a_LIBADD = \
$(shell find $(top_builddir)/examples/platforms/utils $(Dash)type f $(Dash)name "*.o")
if OPENTHREAD_BUILD_COVERAGE
CLEANFILES = $(wildcard *.gcda *.gcno)
endif # OPENTHREAD_BUILD_COVERAGE
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
@@ -1,54 +0,0 @@
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
#
# qpg6100 platform-specific Makefile
#
LDADD_COMMON += \
$(top_builddir)/examples/platforms/qpg6100/libopenthread-qpg6100.a \
$(NULL)
if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
LDADD_COMMON += \
$(top_srcdir)/third_party/Qorvo/repo/qpg6100/lib/libmbedtls_alt.a \
$(NULL)
endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
if OPENTHREAD_ENABLE_FTD
LDADD_COMMON += \
$(top_srcdir)/third_party/Qorvo/repo/qpg6100/lib/libQorvoQPG6100_ftd.a \
$(NULL)
else # OPENTHREAD_ENABLE_FTD
if OPENTHREAD_ENABLE_MTD
LDADD_COMMON += \
$(top_srcdir)/third_party/Qorvo/repo/qpg6100/lib/libQorvoQPG6100_mtd.a \
$(NULL)
endif # OPENTHREAD_ENABLE_MTD
endif
LDFLAGS_COMMON += \
-T $(top_srcdir)/third_party/Qorvo/repo/qpg6100/ld/qpg6100.ld \
$(NULL)
+1
View File
@@ -0,0 +1 @@
The OpenThread on QPG6100 example has moved to https://github.com/openthread/ot-qorvo
-1
View File
@@ -1 +0,0 @@
../qpg6095/alarm.c
-1
View File
@@ -1 +0,0 @@
../qpg6095/alarm_qorvo.h
@@ -1 +0,0 @@
../qpg6095/arm-none-eabi.cmake
-230
View File
@@ -1,230 +0,0 @@
/**
* \file aes_alt.h
*
* \brief AES block cipher
*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
#ifndef MBEDTLS_AES_ALT_H
#define MBEDTLS_AES_ALT_H
#if defined(MBEDTLS_AES_ALT)
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief AES context structure
*
* \note buf is able to hold 32 extra bytes, which can be used:
* - for alignment purposes if VIA padlock is used, and/or
* - to simplify key expansion in the 256-bit case by
* generating an extra round key
*/
typedef struct
{
uint32_t buf[68]; /*!< unaligned data */
unsigned char key[32]; /*!< internal copy of the key */
unsigned int keysize; /*!< size in bytes of the key */
} mbedtls_aes_context;
/**
* \brief Initialize AES context
*
* \param ctx AES context to be initialized
*/
void mbedtls_aes_init(mbedtls_aes_context *ctx);
/**
* \brief Clear AES context
*
* \param ctx AES context to be cleared
*/
void mbedtls_aes_free(mbedtls_aes_context *ctx);
/**
* \brief AES key schedule (encryption)
*
* \param ctx AES context to be initialized
* \param key encryption key
* \param keybits must be 128, 192 or 256
*
* \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
*/
int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits);
/**
* \brief AES key schedule (decryption)
*
* \param ctx AES context to be initialized
* \param key decryption key
* \param keybits must be 128, 192 or 256
*
* \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_KEY_LENGTH
*/
int mbedtls_aes_setkey_dec(mbedtls_aes_context *ctx, const unsigned char *key, unsigned int keybits);
/**
* \brief AES-ECB block encryption/decryption
*
* \param ctx AES context
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
* \param input 16-byte input block
* \param output 16-byte output block
*
* \return 0 if successful
*/
int mbedtls_aes_crypt_ecb(mbedtls_aes_context *ctx, int mode, const unsigned char input[16], unsigned char output[16]);
#if defined(MBEDTLS_CIPHER_MODE_CBC)
/**
* \brief AES-CBC buffer encryption/decryption
* Length should be a multiple of the block
* size (16 bytes)
*
* \note Upon exit, the content of the IV is updated so that you can
* call the function same function again on the following
* block(s) of data and get the same result as if it was
* encrypted in one call. This allows a "streaming" usage.
* If on the other hand you need to retain the contents of the
* IV, you should either save it manually or use the cipher
* module instead.
*
* \param ctx AES context
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
* \param length length of the input data
* \param iv initialization vector (updated after use)
* \param input buffer holding the input data
* \param output buffer holding the output data
*
* \return 0 if successful, or MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH
*/
int mbedtls_aes_crypt_cbc(mbedtls_aes_context *ctx,
int mode,
size_t length,
unsigned char iv[16],
const unsigned char *input,
unsigned char * output);
#endif /* MBEDTLS_CIPHER_MODE_CBC */
#if defined(MBEDTLS_CIPHER_MODE_CFB)
/**
* \brief AES-CFB128 buffer encryption/decryption.
*
* Note: Due to the nature of CFB you should use the same key schedule for
* both encryption and decryption. So a context initialized with
* mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT.
*
* \note Upon exit, the content of the IV is updated so that you can
* call the function same function again on the following
* block(s) of data and get the same result as if it was
* encrypted in one call. This allows a "streaming" usage.
* If on the other hand you need to retain the contents of the
* IV, you should either save it manually or use the cipher
* module instead.
*
* \param ctx AES context
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
* \param length length of the input data
* \param iv_off offset in IV (updated after use)
* \param iv initialization vector (updated after use)
* \param input buffer holding the input data
* \param output buffer holding the output data
*
* \return 0 if successful
*/
int mbedtls_aes_crypt_cfb128(mbedtls_aes_context *ctx,
int mode,
size_t length,
size_t * iv_off,
unsigned char iv[16],
const unsigned char *input,
unsigned char * output);
/**
* \brief AES-CFB8 buffer encryption/decryption.
*
* Note: Due to the nature of CFB you should use the same key schedule for
* both encryption and decryption. So a context initialized with
* mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT.
*
* \note Upon exit, the content of the IV is updated so that you can
* call the function same function again on the following
* block(s) of data and get the same result as if it was
* encrypted in one call. This allows a "streaming" usage.
* If on the other hand you need to retain the contents of the
* IV, you should either save it manually or use the cipher
* module instead.
*
* \param ctx AES context
* \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT
* \param length length of the input data
* \param iv initialization vector (updated after use)
* \param input buffer holding the input data
* \param output buffer holding the output data
*
* \return 0 if successful
*/
int mbedtls_aes_crypt_cfb8(mbedtls_aes_context *ctx,
int mode,
size_t length,
unsigned char iv[16],
const unsigned char *input,
unsigned char * output);
#endif /*MBEDTLS_CIPHER_MODE_CFB */
#if defined(MBEDTLS_CIPHER_MODE_CTR)
/**
* \brief AES-CTR buffer encryption/decryption
*
* Warning: You have to keep the maximum use of your counter in mind!
*
* Note: Due to the nature of CTR you should use the same key schedule for
* both encryption and decryption. So a context initialized with
* mbedtls_aes_setkey_enc() for both MBEDTLS_AES_ENCRYPT and MBEDTLS_AES_DECRYPT.
*
* \param ctx AES context
* \param length The length of the data
* \param nc_off The offset in the current stream_block (for resuming
* within current cipher stream). The offset pointer to
* should be 0 at the start of a stream.
* \param nonce_counter The 128-bit nonce and counter.
* \param stream_block The saved stream-block for resuming. Is overwritten
* by the function.
* \param input The input data stream
* \param output The output data stream
*
* \return 0 if successful
*/
int mbedtls_aes_crypt_ctr(mbedtls_aes_context *ctx,
size_t length,
size_t * nc_off,
unsigned char nonce_counter[16],
unsigned char stream_block[16],
const unsigned char *input,
unsigned char * output);
#endif /* MBEDTLS_CIPHER_MODE_CTR */
#ifdef __cplusplus
}
#endif
#endif /* MBEDTLS_AES_ALT */
#endif /* aes_alt.h */
-163
View File
@@ -1,163 +0,0 @@
/**
* \file ccm_alt.h
*
* \brief CCM combines Counter mode encryption with CBC-MAC authentication
* for 128-bit block ciphers.
*
* Input to CCM includes the following elements:
* <ul><li>Payload - data that is both authenticated and encrypted.</li>
* <li>Associated data (Adata) - data that is authenticated but not
* encrypted, For example, a header.</li>
* <li>Nonce - A unique value that is assigned to the payload and the
* associated data.</li></ul>
*
*/
/*
* Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of Mbed TLS (https://tls.mbed.org)
*/
#ifndef MBEDTLS_CCM_ALT_H
#define MBEDTLS_CCM_ALT_H
#if defined(MBEDTLS_CCM_ALT)
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef MBEDTLS_AES_MAX_KEY_SIZE
#define MBEDTLS_AES_MAX_KEY_SIZE 32
#endif
/**
* \brief The CCM context-type definition. The CCM context is passed
* to the APIs called.
*/
typedef struct
{
uint8_t key[MBEDTLS_AES_MAX_KEY_SIZE];
int keysize;
} mbedtls_ccm_context;
/**
* \brief This function initializes the specified CCM context,
* to make references valid, and prepare the context
* for mbedtls_ccm_setkey() or mbedtls_ccm_free().
*
* \param ctx The CCM context to initialize.
*/
void mbedtls_ccm_init(mbedtls_ccm_context *ctx);
/**
* \brief This function initializes the CCM context set in the
* \p ctx parameter and sets the encryption key.
*
* \param ctx The CCM context to initialize.
* \param cipher The 128-bit block cipher to use.
* \param key The encryption key.
* \param keybits The key size in bits. This must be acceptable by the cipher.
*
* \return \c 0 on success, or a cipher-specific error code.
*/
int mbedtls_ccm_setkey(mbedtls_ccm_context *ctx,
mbedtls_cipher_id_t cipher,
const unsigned char *key,
unsigned int keybits);
/**
* \brief This function releases and clears the specified CCM context
* and underlying cipher sub-context.
*
* \param ctx The CCM context to clear.
*/
void mbedtls_ccm_free(mbedtls_ccm_context *ctx);
/**
* \brief This function encrypts a buffer using CCM.
*
* \param ctx The CCM context to use for encryption.
* \param length The length of the input data in Bytes.
* \param iv Initialization vector (nonce).
* \param iv_len The length of the IV in Bytes: 7, 8, 9, 10, 11, 12, or 13.
* \param add The additional data field.
* \param add_len The length of additional data in Bytes.
* Must be less than 2^16 - 2^8.
* \param input The buffer holding the input data.
* \param output The buffer holding the output data.
* Must be at least \p length Bytes wide.
* \param tag The buffer holding the tag.
* \param tag_len The length of the tag to generate in Bytes:
* 4, 6, 8, 10, 14 or 16.
*
* \note The tag is written to a separate buffer. To concatenate
* the \p tag with the \p output, as done in <em>RFC-3610:
* Counter with CBC-MAC (CCM)</em>, use
* \p tag = \p output + \p length, and make sure that the
* output buffer is at least \p length + \p tag_len wide.
*
* \return \c 0 on success.
*/
int mbedtls_ccm_encrypt_and_tag(mbedtls_ccm_context *ctx,
size_t length,
const unsigned char *iv,
size_t iv_len,
const unsigned char *add,
size_t add_len,
const unsigned char *input,
unsigned char * output,
unsigned char * tag,
size_t tag_len);
/**
* \brief This function performs a CCM authenticated decryption of a
* buffer.
*
* \param ctx The CCM context to use for decryption.
* \param length The length of the input data in Bytes.
* \param iv Initialization vector.
* \param iv_len The length of the IV in Bytes: 7, 8, 9, 10, 11, 12, or 13.
* \param add The additional data field.
* \param add_len The length of additional data in Bytes.
* \param input The buffer holding the input data.
* \param output The buffer holding the output data.
* \param tag The buffer holding the tag.
* \param tag_len The length of the tag in Bytes.
*
* \return 0 if successful and authenticated, or
* #MBEDTLS_ERR_CCM_AUTH_FAILED if the tag does not match.
*/
int mbedtls_ccm_auth_decrypt(mbedtls_ccm_context *ctx,
size_t length,
const unsigned char *iv,
size_t iv_len,
const unsigned char *add,
size_t add_len,
const unsigned char *input,
unsigned char * output,
const unsigned char *tag,
size_t tag_len);
#ifdef __cplusplus
}
#endif
#endif /* MBEDTLS_CCM_ALT */
#endif /* MBEDTLS_CCM_ALT_H */
@@ -1,233 +0,0 @@
/**
* \file ecjpake_alt.h
*
* \brief Elliptic curve J-PAKE
*/
/*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
#ifndef MBEDTLS_ECJPAKE_ALT_H
#define MBEDTLS_ECJPAKE_ALT_H
#if defined(MBEDTLS_ECJPAKE_ALT)
#ifdef __cplusplus
extern "C" {
#endif
#ifndef MBEDTLS_ECJPAKE_ALT // QORVO
/**
* Roles in the EC J-PAKE exchange
*/
typedef enum
{
MBEDTLS_ECJPAKE_CLIENT = 0, /**< Client */
MBEDTLS_ECJPAKE_SERVER, /**< Server */
} mbedtls_ecjpake_role;
#endif // MBEDTLS_ECJPAKE_ALT // QORVO
#ifndef MBEDTLS_ECJPAKE_MAX_BYTES
/** The maximum size in bytes for a ECJPAKE number or coordinate.
*
* Default size works for P256 as MbedTLS and the Thread standard officially
* only support P256. To support larger curves, chose MBEDTLS_ECP_MAX_BYTES.
*/
#define MBEDTLS_ECJPAKE_MAX_BYTES (256 / 8)
#endif
/**
* EC J-PAKE context structure.
*
* J-PAKE is a symmetric protocol, except for the identifiers used in
* Zero-Knowledge Proofs, and the serialization of the second message
* (KeyExchange) as defined by the Thread spec.
*
* In order to benefit from this symmetry, we choose a different naming
* convetion from the Thread v1.0 spec. Correspondance is indicated in the
* description as a pair C: client name, S: server name
*/
typedef struct
{
mbedtls_ecp_group grp; /**< Elliptic curve */
mbedtls_ecjpake_role role; /**< Are we client or server? */
int point_format; /**< Format for point export */
mbedtls_ecp_point Xm1; /**< My public key 1 C: X1, S: X3 */
mbedtls_ecp_point Xm2; /**< My public key 2 C: X2, S: X4 */
mbedtls_ecp_point Xp1; /**< Peer public key 1 C: X3, S: X1 */
mbedtls_ecp_point Xp2; /**< Peer public key 2 C: X4, S: X2 */
mbedtls_ecp_point Xp; /**< Peer public key C: Xs, S: Xc */
mbedtls_mpi xm1; /**< My private key 1 C: x1, S: x3 */
mbedtls_mpi xm2; /**< My private key 2 C: x2, S: x4 */
mbedtls_mpi s; /**< Pre-shared secret (passphrase) */
const struct sx_ecc_curve_t *curve; /**< Elliptic curve for HW offload */
int hashalg; /**< Hash algorithm for HW offload */
} mbedtls_ecjpake_context;
#ifndef MBEDTLS_ECJPAKE_ALT // QORVO
/**
* \brief Initialize a context
* (just makes it ready for setup() or free()).
*
* \param ctx context to initialize
*/
void mbedtls_ecjpake_init(mbedtls_ecjpake_context *ctx);
/**
* \brief Set up a context for use
*
* \note Currently the only values for hash/curve allowed by the
* standard are MBEDTLS_MD_SHA256/MBEDTLS_ECP_DP_SECP256R1.
*
* \param ctx context to set up
* \param role Our role: client or server
* \param hash hash function to use (MBEDTLS_MD_XXX)
* \param curve elliptic curve identifier (MBEDTLS_ECP_DP_XXX)
* \param secret pre-shared secret (passphrase)
* \param len length of the shared secret
*
* \return 0 if successfull,
* a negative error code otherwise
*/
int mbedtls_ecjpake_setup(mbedtls_ecjpake_context *ctx,
mbedtls_ecjpake_role role,
mbedtls_md_type_t hash,
mbedtls_ecp_group_id curve,
const unsigned char * secret,
size_t len);
/**
* \brief Check if a context is ready for use
*
* \param ctx Context to check
*
* \return 0 if the context is ready for use,
* MBEDTLS_ERR_ECP_BAD_INPUT_DATA otherwise
*/
int mbedtls_ecjpake_check(const mbedtls_ecjpake_context *ctx);
/**
* \brief Generate and write the first round message
* (TLS: contents of the Client/ServerHello extension,
* excluding extension type and length bytes)
*
* \param ctx Context to use
* \param buf Buffer to write the contents to
* \param len Buffer size
* \param olen Will be updated with the number of bytes written
* \param f_rng RNG function
* \param p_rng RNG parameter
*
* \return 0 if successfull,
* a negative error code otherwise
*/
int mbedtls_ecjpake_write_round_one(mbedtls_ecjpake_context *ctx,
unsigned char * buf,
size_t len,
size_t * olen,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng);
/**
* \brief Read and process the first round message
* (TLS: contents of the Client/ServerHello extension,
* excluding extension type and length bytes)
*
* \param ctx Context to use
* \param buf Pointer to extension contents
* \param len Extension length
*
* \return 0 if successfull,
* a negative error code otherwise
*/
int mbedtls_ecjpake_read_round_one(mbedtls_ecjpake_context *ctx, const unsigned char *buf, size_t len);
/**
* \brief Generate and write the second round message
* (TLS: contents of the Client/ServerKeyExchange)
*
* \param ctx Context to use
* \param buf Buffer to write the contents to
* \param len Buffer size
* \param olen Will be updated with the number of bytes written
* \param f_rng RNG function
* \param p_rng RNG parameter
*
* \return 0 if successfull,
* a negative error code otherwise
*/
int mbedtls_ecjpake_write_round_two(mbedtls_ecjpake_context *ctx,
unsigned char * buf,
size_t len,
size_t * olen,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng);
/**
* \brief Read and process the second round message
* (TLS: contents of the Client/ServerKeyExchange)
*
* \param ctx Context to use
* \param buf Pointer to the message
* \param len Message length
*
* \return 0 if successfull,
* a negative error code otherwise
*/
int mbedtls_ecjpake_read_round_two(mbedtls_ecjpake_context *ctx, const unsigned char *buf, size_t len);
/**
* \brief Derive the shared secret
* (TLS: Pre-Master Secret)
*
* \param ctx Context to use
* \param buf Buffer to write the contents to
* \param len Buffer size
* \param olen Will be updated with the number of bytes written
* \param f_rng RNG function
* \param p_rng RNG parameter
*
* \return 0 if successfull,
* a negative error code otherwise
*/
int mbedtls_ecjpake_derive_secret(mbedtls_ecjpake_context *ctx,
unsigned char * buf,
size_t len,
size_t * olen,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng);
/**
* \brief Free a context's content
*
* \param ctx context to free
*/
void mbedtls_ecjpake_free(mbedtls_ecjpake_context *ctx);
#endif // MBEDTLS_ECJPAKE_ALT // QORVO
#ifdef __cplusplus
}
#endif
#endif /* MBEDTLS_ECJPAKE_ALT */
#endif /* ecjpake.h */
-657
View File
@@ -1,657 +0,0 @@
/**
* \file ecp_alt.h
*
* \brief Elliptic curves over GF(p)
*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
/* Adapted for hardware acceleration by CryptoSoc
* Copyright (c) 2018 Barco Silex
* Copyright (c) 2018 François Beerten
*/
#ifndef MBEDTLS_ECP_ALT_H
#define MBEDTLS_ECP_ALT_H
/*
* default mbed TLS elliptic curve arithmetic implementation
*
* (in case MBEDTLS_ECP_ALT is defined then the developer has to provide an
* alternative implementation for the whole module and it will replace this
* one.)
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef MBEDTLS_ECP_ALT // QORVO
/**
* Domain parameters (curve, subgroup and generator) identifiers.
*
* Only curves over prime fields are supported.
*
* \warning This library does not support validation of arbitrary domain
* parameters. Therefore, only well-known domain parameters from trusted
* sources should be used. See mbedtls_ecp_group_load().
*/
typedef enum
{
MBEDTLS_ECP_DP_NONE = 0,
MBEDTLS_ECP_DP_SECP192R1, /*!< 192-bits NIST curve */
MBEDTLS_ECP_DP_SECP224R1, /*!< 224-bits NIST curve */
MBEDTLS_ECP_DP_SECP256R1, /*!< 256-bits NIST curve */
MBEDTLS_ECP_DP_SECP384R1, /*!< 384-bits NIST curve */
MBEDTLS_ECP_DP_SECP521R1, /*!< 521-bits NIST curve */
MBEDTLS_ECP_DP_BP256R1, /*!< 256-bits Brainpool curve */
MBEDTLS_ECP_DP_BP384R1, /*!< 384-bits Brainpool curve */
MBEDTLS_ECP_DP_BP512R1, /*!< 512-bits Brainpool curve */
MBEDTLS_ECP_DP_CURVE25519, /*!< Curve25519 */
MBEDTLS_ECP_DP_SECP192K1, /*!< 192-bits "Koblitz" curve */
MBEDTLS_ECP_DP_SECP224K1, /*!< 224-bits "Koblitz" curve */
MBEDTLS_ECP_DP_SECP256K1, /*!< 256-bits "Koblitz" curve */
} mbedtls_ecp_group_id;
/**
* Number of supported curves (plus one for NONE).
*
* (Montgomery curves excluded for now.)
*/
#define MBEDTLS_ECP_DP_MAX 12
/**
* Curve information for use by other modules
*/
typedef struct
{
mbedtls_ecp_group_id grp_id; /*!< Internal identifier */
uint16_t tls_id; /*!< TLS NamedCurve identifier */
uint16_t bit_size; /*!< Curve size in bits */
const char * name; /*!< Human-friendly name */
} mbedtls_ecp_curve_info;
/**
* \brief ECP point structure (jacobian coordinates)
*
* \note All functions expect and return points satisfying
* the following condition: Z == 0 or Z == 1. (Other
* values of Z are used by internal functions only.)
* The point is zero, or "at infinity", if Z == 0.
* Otherwise, X and Y are its standard (affine) coordinates.
*/
typedef struct
{
mbedtls_mpi X; /*!< the point's X coordinate */
mbedtls_mpi Y; /*!< the point's Y coordinate */
mbedtls_mpi Z; /*!< the point's Z coordinate */
} mbedtls_ecp_point;
#endif // MBEDTLS_ECP_ALT // QORVO
/**
* \brief ECP group structure
*
* We consider two types of curves equations:
* 1. Short Weierstrass y^2 = x^3 + A x + B mod P (SEC1 + RFC 4492)
* 2. Montgomery, y^2 = x^3 + A x^2 + x mod P (Curve25519 + draft)
* In both cases, a generator G for a prime-order subgroup is fixed. In the
* short weierstrass, this subgroup is actually the whole curve, and its
* cardinal is denoted by N.
*
* In the case of Short Weierstrass curves, our code requires that N is an odd
* prime. (Use odd in mbedtls_ecp_mul() and prime in mbedtls_ecdsa_sign() for blinding.)
*
* In the case of Montgomery curves, we don't store A but (A + 2) / 4 which is
* the quantity actually used in the formulas. Also, nbits is not the size of N
* but the required size for private keys.
*
* If modp is NULL, reduction modulo P is done using a generic algorithm.
* Otherwise, it must point to a function that takes an mbedtls_mpi in the range
* 0..2^(2*pbits)-1 and transforms it in-place in an integer of little more
* than pbits, so that the integer may be efficiently brought in the 0..P-1
* range by a few additions or substractions. It must return 0 on success and
* non-zero on failure.
*/
typedef struct
{
mbedtls_ecp_group_id id; /*!< internal group identifier */
mbedtls_mpi P; /*!< prime modulus of the base field */
mbedtls_mpi A; /*!< 1. A in the equation, or 2. (A + 2) / 4. for pkparse only. */
mbedtls_mpi B; /*!< 1. B in the equation, or 2. unused. for pkparse only. */
mbedtls_ecp_point G; /*!< generator of the (sub)group used */
mbedtls_mpi N; /*!< 1. the order of G, or 2. unused */
size_t pbits; /*!< number of bits in P */
size_t nbits; /*!< number of bits in 1. P, or 2. private keys */
unsigned int h; /*!< internal: 1 if the constants are static */
int (*modp)(mbedtls_mpi *); /*!< Internally unused. NULL to build some tests. */
mbedtls_ecp_point *T; /*!< Internally unused. Needed to build benchmark. */
size_t T_size; /*!< Internally unused. Needed to build benchmark. */
} mbedtls_ecp_group;
#ifndef MBEDTLS_ECP_ALT // QORVO
/**
* \brief ECP key pair structure
*
* A generic key pair that could be used for ECDSA, fixed ECDH, etc.
*
* \note Members purposefully in the same order as struc mbedtls_ecdsa_context.
*/
typedef struct
{
mbedtls_ecp_group grp; /*!< Elliptic curve and base point */
mbedtls_mpi d; /*!< our secret value */
mbedtls_ecp_point Q; /*!< our public value */
} mbedtls_ecp_keypair;
#endif // MBEDTLS_ECP_ALT // QORVO
/**
* \name SECTION: Module settings
*
* The configuration options you can set for this module are in this section.
* Either change them in config.h or define them on the compiler command line.
* \{
*/
#if !defined(MBEDTLS_ECP_MAX_BITS)
/**
* Maximum size of the groups (that is, of N and P)
*/
#define MBEDTLS_ECP_MAX_BITS 521 /**< Maximum bit size of groups */
#endif
#define MBEDTLS_ECP_MAX_BYTES ((MBEDTLS_ECP_MAX_BITS + 7) / 8)
#define MBEDTLS_ECP_MAX_PT_LEN (2 * MBEDTLS_ECP_MAX_BYTES + 1)
#if defined(MBEDTLS_ECP_WINDOW_SIZE)
#error "MBEDTLS_ECP_WINDOW_SIZE not applicable for HW accel"
#endif /* MBEDTLS_ECP_WINDOW_SIZE */
#if defined(MBEDTLS_ECP_FIXED_POINT_OPTIM)
#error "MBEDTLS_ECP_FIXED_POINT_OPTIM not applicable for HW accel"
#endif /* MBEDTLS_ECP_FIXED_POINT_OPTIM */
/* \} name SECTION: Module settings */
/*
* Point formats, from RFC 4492's enum ECPointFormat
*/
#define MBEDTLS_ECP_PF_UNCOMPRESSED 0 /**< Uncompressed point format */
#define MBEDTLS_ECP_PF_COMPRESSED 1 /**< Compressed point format */
/*
* Some other constants from RFC 4492
*/
#define MBEDTLS_ECP_TLS_NAMED_CURVE 3 /**< ECCurveType's named_curve */
#ifndef MBEDTLS_ECP_ALT // QORVO
/**
* \brief Get the list of supported curves in order of preferrence
* (full information)
*
* \return A statically allocated array, the last entry is 0.
*/
const mbedtls_ecp_curve_info *mbedtls_ecp_curve_list(void);
/**
* \brief Get the list of supported curves in order of preferrence
* (grp_id only)
*
* \return A statically allocated array,
* terminated with MBEDTLS_ECP_DP_NONE.
*/
const mbedtls_ecp_group_id *mbedtls_ecp_grp_id_list(void);
/**
* \brief Get curve information from an internal group identifier
*
* \param grp_id A MBEDTLS_ECP_DP_XXX value
*
* \return The associated curve information or NULL
*/
const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_grp_id(mbedtls_ecp_group_id grp_id);
/**
* \brief Get curve information from a TLS NamedCurve value
*
* \param tls_id A MBEDTLS_ECP_DP_XXX value
*
* \return The associated curve information or NULL
*/
const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_tls_id(uint16_t tls_id);
/**
* \brief Get curve information from a human-readable name
*
* \param name The name
*
* \return The associated curve information or NULL
*/
const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_name(const char *name);
/**
* \brief Initialize a point (as zero)
*/
void mbedtls_ecp_point_init(mbedtls_ecp_point *pt);
/**
* \brief Initialize a group (to something meaningless)
*/
void mbedtls_ecp_group_init(mbedtls_ecp_group *grp);
/**
* \brief Initialize a key pair (as an invalid one)
*/
void mbedtls_ecp_keypair_init(mbedtls_ecp_keypair *key);
/**
* \brief Free the components of a point
*/
void mbedtls_ecp_point_free(mbedtls_ecp_point *pt);
/**
* \brief Free the components of an ECP group
*/
void mbedtls_ecp_group_free(mbedtls_ecp_group *grp);
/**
* \brief Free the components of a key pair
*/
void mbedtls_ecp_keypair_free(mbedtls_ecp_keypair *key);
/**
* \brief Copy the contents of point Q into P
*
* \param P Destination point
* \param Q Source point
*
* \return 0 if successful,
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed
*/
int mbedtls_ecp_copy(mbedtls_ecp_point *P, const mbedtls_ecp_point *Q);
/**
* \brief Copy the contents of a group object
*
* \param dst Destination group
* \param src Source group
*
* \return 0 if successful,
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed
*/
int mbedtls_ecp_group_copy(mbedtls_ecp_group *dst, const mbedtls_ecp_group *src);
/**
* \brief Set a point to zero
*
* \param pt Destination point
*
* \return 0 if successful,
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed
*/
int mbedtls_ecp_set_zero(mbedtls_ecp_point *pt);
/**
* \brief Tell if a point is zero
*
* \param pt Point to test
*
* \return 1 if point is zero, 0 otherwise
*/
int mbedtls_ecp_is_zero(mbedtls_ecp_point *pt);
/**
* \brief Compare two points
*
* \note This assumes the points are normalized. Otherwise,
* they may compare as "not equal" even if they are.
*
* \param P First point to compare
* \param Q Second point to compare
*
* \return 0 if the points are equal,
* MBEDTLS_ERR_ECP_BAD_INPUT_DATA otherwise
*/
int mbedtls_ecp_point_cmp(const mbedtls_ecp_point *P, const mbedtls_ecp_point *Q);
/**
* \brief Import a non-zero point from two ASCII strings
*
* \param P Destination point
* \param radix Input numeric base
* \param x First affine coordinate as a null-terminated string
* \param y Second affine coordinate as a null-terminated string
*
* \return 0 if successful, or a MBEDTLS_ERR_MPI_XXX error code
*/
int mbedtls_ecp_point_read_string(mbedtls_ecp_point *P, int radix, const char *x, const char *y);
/**
* \brief Export a point into unsigned binary data
*
* \param grp Group to which the point should belong
* \param P Point to export
* \param format Point format, should be a MBEDTLS_ECP_PF_XXX macro
* \param olen Length of the actual output
* \param buf Output buffer
* \param buflen Length of the output buffer
*
* \return 0 if successful,
* or MBEDTLS_ERR_ECP_BAD_INPUT_DATA
* or MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL
*/
int mbedtls_ecp_point_write_binary(const mbedtls_ecp_group *grp,
const mbedtls_ecp_point *P,
int format,
size_t * olen,
unsigned char * buf,
size_t buflen);
/**
* \brief Import a point from unsigned binary data
*
* \param grp Group to which the point should belong
* \param P Point to import
* \param buf Input buffer
* \param ilen Actual length of input
*
* \return 0 if successful,
* MBEDTLS_ERR_ECP_BAD_INPUT_DATA if input is invalid,
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed,
* MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the point format
* is not implemented.
*
* \note This function does NOT check that the point actually
* belongs to the given group, see mbedtls_ecp_check_pubkey() for
* that.
*/
int mbedtls_ecp_point_read_binary(const mbedtls_ecp_group *grp,
mbedtls_ecp_point * P,
const unsigned char * buf,
size_t ilen);
/**
* \brief Import a point from a TLS ECPoint record
*
* \param grp ECP group used
* \param pt Destination point
* \param buf $(Start of input buffer)
* \param len Buffer length
*
* \note buf is updated to point right after the ECPoint on exit
*
* \return 0 if successful,
* MBEDTLS_ERR_MPI_XXX if initialization failed
* MBEDTLS_ERR_ECP_BAD_INPUT_DATA if input is invalid
*/
int mbedtls_ecp_tls_read_point(const mbedtls_ecp_group *grp,
mbedtls_ecp_point * pt,
const unsigned char ** buf,
size_t len);
/**
* \brief Export a point as a TLS ECPoint record
*
* \param grp ECP group used
* \param pt Point to export
* \param format Export format
* \param olen length of data written
* \param buf Buffer to write to
* \param blen Buffer length
*
* \return 0 if successful,
* or MBEDTLS_ERR_ECP_BAD_INPUT_DATA
* or MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL
*/
int mbedtls_ecp_tls_write_point(const mbedtls_ecp_group *grp,
const mbedtls_ecp_point *pt,
int format,
size_t * olen,
unsigned char * buf,
size_t blen);
/**
* \brief Set a group using well-known domain parameters
*
* \param grp Destination group
* \param id Index in the list of well-known domain parameters
*
* \return 0 if successful,
* MBEDTLS_ERR_MPI_XXX if initialization failed
* MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE for unkownn groups
*
* \note Index should be a value of RFC 4492's enum NamedCurve,
* usually in the form of a MBEDTLS_ECP_DP_XXX macro.
*/
int mbedtls_ecp_group_load(mbedtls_ecp_group *grp, mbedtls_ecp_group_id id);
/**
* \brief Set a group from a TLS ECParameters record
*
* \param grp Destination group
* \param buf &(Start of input buffer)
* \param len Buffer length
*
* \note buf is updated to point right after ECParameters on exit
*
* \return 0 if successful,
* MBEDTLS_ERR_MPI_XXX if initialization failed
* MBEDTLS_ERR_ECP_BAD_INPUT_DATA if input is invalid
*/
int mbedtls_ecp_tls_read_group(mbedtls_ecp_group *grp, const unsigned char **buf, size_t len);
/**
* \brief Write the TLS ECParameters record for a group
*
* \param grp ECP group used
* \param olen Number of bytes actually written
* \param buf Buffer to write to
* \param blen Buffer length
*
* \return 0 if successful,
* or MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL
*/
int mbedtls_ecp_tls_write_group(const mbedtls_ecp_group *grp, size_t *olen, unsigned char *buf, size_t blen);
/**
* \brief Multiplication by an integer: R = m * P
* (Not thread-safe to use same group in multiple threads)
*
* \note In order to prevent timing attacks, this function
* executes the exact same sequence of (base field)
* operations for any valid m. It avoids any if-branch or
* array index depending on the value of m.
*
* \note If f_rng is not NULL, it is used to randomize intermediate
* results in order to prevent potential timing attacks
* targeting these results. It is recommended to always
* provide a non-NULL f_rng (the overhead is negligible).
*
* \param grp ECP group
* \param R Destination point
* \param m Integer by which to multiply
* \param P Point to multiply
* \param f_rng RNG function (see notes)
* \param p_rng RNG parameter
*
* \return 0 if successful,
* MBEDTLS_ERR_ECP_INVALID_KEY if m is not a valid privkey
* or P is not a valid pubkey,
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed
*/
int mbedtls_ecp_mul(mbedtls_ecp_group * grp,
mbedtls_ecp_point * R,
const mbedtls_mpi * m,
const mbedtls_ecp_point *P,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng);
/**
* \brief Multiplication and addition of two points by integers:
* R = m * P + n * Q
* (Not thread-safe to use same group in multiple threads)
*
* \note In contrast to mbedtls_ecp_mul(), this function does not guarantee
* a constant execution flow and timing.
*
* \param grp ECP group
* \param R Destination point
* \param m Integer by which to multiply P
* \param P Point to multiply by m
* \param n Integer by which to multiply Q
* \param Q Point to be multiplied by n
*
* \return 0 if successful,
* MBEDTLS_ERR_ECP_INVALID_KEY if m or n is not a valid privkey
* or P or Q is not a valid pubkey,
* MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed
*/
int mbedtls_ecp_muladd(mbedtls_ecp_group * grp,
mbedtls_ecp_point * R,
const mbedtls_mpi * m,
const mbedtls_ecp_point *P,
const mbedtls_mpi * n,
const mbedtls_ecp_point *Q);
/**
* \brief Check that a point is a valid public key on this curve
*
* \param grp Curve/group the point should belong to
* \param pt Point to check
*
* \return 0 if point is a valid public key,
* MBEDTLS_ERR_ECP_INVALID_KEY otherwise.
*
* \note This function only checks the point is non-zero, has valid
* coordinates and lies on the curve, but not that it is
* indeed a multiple of G. This is additional check is more
* expensive, isn't required by standards, and shouldn't be
* necessary if the group used has a small cofactor. In
* particular, it is useless for the NIST groups which all
* have a cofactor of 1.
*
* \note Uses bare components rather than an mbedtls_ecp_keypair structure
* in order to ease use with other structures such as
* mbedtls_ecdh_context of mbedtls_ecdsa_context.
*/
int mbedtls_ecp_check_pubkey(const mbedtls_ecp_group *grp, const mbedtls_ecp_point *pt);
/**
* \brief Check that an mbedtls_mpi is a valid private key for this curve
*
* \param grp Group used
* \param d Integer to check
*
* \return 0 if point is a valid private key,
* MBEDTLS_ERR_ECP_INVALID_KEY otherwise.
*
* \note Uses bare components rather than an mbedtls_ecp_keypair structure
* in order to ease use with other structures such as
* mbedtls_ecdh_context of mbedtls_ecdsa_context.
*/
int mbedtls_ecp_check_privkey(const mbedtls_ecp_group *grp, const mbedtls_mpi *d);
/**
* \brief Generate a keypair with configurable base point
*
* \param grp ECP group
* \param G Chosen base point
* \param d Destination MPI (secret part)
* \param Q Destination point (public part)
* \param f_rng RNG function
* \param p_rng RNG parameter
*
* \return 0 if successful,
* or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_MPI_XXX error code
*
* \note Uses bare components rather than an mbedtls_ecp_keypair structure
* in order to ease use with other structures such as
* mbedtls_ecdh_context of mbedtls_ecdsa_context.
*/
int mbedtls_ecp_gen_keypair_base(mbedtls_ecp_group * grp,
const mbedtls_ecp_point *G,
mbedtls_mpi * d,
mbedtls_ecp_point * Q,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng);
/**
* \brief Generate a keypair
*
* \param grp ECP group
* \param d Destination MPI (secret part)
* \param Q Destination point (public part)
* \param f_rng RNG function
* \param p_rng RNG parameter
*
* \return 0 if successful,
* or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_MPI_XXX error code
*
* \note Uses bare components rather than an mbedtls_ecp_keypair structure
* in order to ease use with other structures such as
* mbedtls_ecdh_context of mbedtls_ecdsa_context.
*/
int mbedtls_ecp_gen_keypair(mbedtls_ecp_group *grp,
mbedtls_mpi * d,
mbedtls_ecp_point *Q,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng);
/**
* \brief Generate a keypair
*
* \param grp_id ECP group identifier
* \param key Destination keypair
* \param f_rng RNG function
* \param p_rng RNG parameter
*
* \return 0 if successful,
* or a MBEDTLS_ERR_ECP_XXX or MBEDTLS_MPI_XXX error code
*/
int mbedtls_ecp_gen_key(mbedtls_ecp_group_id grp_id,
mbedtls_ecp_keypair *key,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng);
/**
* \brief Check a public-private key pair
*
* \param pub Keypair structure holding a public key
* \param prv Keypair structure holding a private (plus public) key
*
* \return 0 if successful (keys are valid and match), or
* MBEDTLS_ERR_ECP_BAD_INPUT_DATA, or
* a MBEDTLS_ERR_ECP_XXX or MBEDTLS_ERR_MPI_XXX code.
*/
int mbedtls_ecp_check_pub_priv(const mbedtls_ecp_keypair *pub, const mbedtls_ecp_keypair *prv);
#endif // MBEDTLS_ECP_ALT // QORVO
#if defined(MBEDTLS_SELF_TEST)
/**
* \brief Checkup routine
*
* \return 0 if successful, or 1 if a test failed
*/
int mbedtls_ecp_self_test(int verbose);
#endif /* MBEDTLS_SELF_TEST */
#ifdef __cplusplus
}
#endif
#endif /* ecp_alt.h */
@@ -1,52 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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 QGP6100_MBEDTLS_CONFIG_H
#define QGP6100_MBEDTLS_CONFIG_H
#ifdef QORVO_CRYPTO_ENGINE
#undef MBEDTLS_ECP_WINDOW_SIZE
#undef MBEDTLS_ECP_FIXED_POINT_OPTIM
#define MBEDTLS_AES_ALT
#define MBEDTLS_CCM_ALT
#define MBEDTLS_ECP_ALT
#define MBEDTLS_ECJPAKE_ALT
#define MBEDTLS_SHA256_ALT
#else
#define MBEDTLS_SLOW_CPU 1
#define MBEDTLS_COMPUTATION_UNTILL_SEQ_NR 6
#endif // QORVO_CRYPTO_ENGINE
#include "mbedtls/check_config.h"
#endif // QGP6100_MBEDTLS_CONFIG_H
@@ -1,194 +0,0 @@
/**
* \file mbedtls_sha256.h
*
* \brief SHA-224 and SHA-256 cryptographic hash function
*
* Copyright (C) 2006-2014, ARM Limited, All Rights Reserved
*
* This file is part of mbed TLS (https://tls.mbed.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MBEDTLS_SHA256_ALT_H
#define MBEDTLS_SHA256_ALT_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief SHA-256 context structure
*/
typedef struct
{
uint32_t total[2]; /*!< number of bytes processed */
uint32_t state[8]; /*!< intermediate digest state */
unsigned char buffer[64]; /*!< data block being processed */
int is224; /*!< 0 => SHA-256, else SHA-224 */
} mbedtls_sha256_context;
/**
* \brief This function initializes a SHA-256 context.
*
* \param ctx The SHA-256 context to initialize.
*/
void mbedtls_sha256_init(mbedtls_sha256_context *ctx);
/**
* \brief This function clears a SHA-256 context.
*
* \param ctx The SHA-256 context to clear.
*/
void mbedtls_sha256_free(mbedtls_sha256_context *ctx);
/**
* \brief This function clones the state of a SHA-256 context.
*
* \param dst The destination context.
* \param src The context to clone.
*/
void mbedtls_sha256_clone(mbedtls_sha256_context *dst, const mbedtls_sha256_context *src);
/**
* \brief This function starts a SHA-224 or SHA-256 checksum
* calculation.
*
* \param ctx The context to initialize.
* \param is224 Determines which function to use.
* <ul><li>0: Use SHA-256.</li>
* <li>1: Use SHA-224.</li></ul>
*
* \return \c 0 on success.
*/
int mbedtls_sha256_starts_ret(mbedtls_sha256_context *ctx, int is224);
/**
* \brief This function feeds an input buffer into an ongoing
* SHA-256 checksum calculation.
*
* \param ctx SHA-256 context
* \param input buffer holding the data
* \param ilen length of the input data
*
* \return \c 0 on success.
*/
int mbedtls_sha256_update_ret(mbedtls_sha256_context *ctx, const unsigned char *input, size_t ilen);
/**
* \brief This function finishes the SHA-256 operation, and writes
* the result to the output buffer.
*
* \param ctx The SHA-256 context.
* \param output The SHA-224 or SHA-256 checksum result.
*
* \return \c 0 on success.
*/
int mbedtls_sha256_finish_ret(mbedtls_sha256_context *ctx, unsigned char output[32]);
/**
* \brief This function processes a single data block within
* the ongoing SHA-256 computation. This function is for
* internal use only.
*
* \param ctx The SHA-256 context.
* \param data The buffer holding one block of data.
*
* \return \c 0 on success.
*/
int mbedtls_internal_sha256_process(mbedtls_sha256_context *ctx, const unsigned char data[64]);
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
#if defined(MBEDTLS_DEPRECATED_WARNING)
#define MBEDTLS_DEPRECATED __attribute__((deprecated))
#else
#define MBEDTLS_DEPRECATED
#endif
/**
* \brief This function starts a SHA-256 checksum calculation.
*
* \deprecated Superseded by mbedtls_sha256_starts_ret() in 2.7.0.
*
* \param ctx The SHA-256 context to initialize.
* \param is224 Determines which function to use.
* <ul><li>0: Use SHA-256.</li>
* <li>1: Use SHA-224.</li></ul>
*/
MBEDTLS_DEPRECATED static inline void mbedtls_sha256_starts(mbedtls_sha256_context *ctx, int is224)
{
mbedtls_sha256_starts_ret(ctx, is224);
}
/**
* \brief This function feeds an input buffer into an ongoing
* SHA-256 checksum calculation.
*
* \deprecated Superseded by mbedtls_sha256_update_ret() in 2.7.0.
*
* \param ctx The SHA-256 context to initialize.
* \param input The buffer holding the data.
* \param ilen The length of the input data.
*/
MBEDTLS_DEPRECATED static inline void mbedtls_sha256_update(mbedtls_sha256_context *ctx,
const unsigned char * input,
size_t ilen)
{
mbedtls_sha256_update_ret(ctx, input, ilen);
}
/**
* \brief This function finishes the SHA-256 operation, and writes
* the result to the output buffer.
*
* \deprecated Superseded by mbedtls_sha256_finish_ret() in 2.7.0.
*
* \param ctx The SHA-256 context.
* \param output The SHA-224or SHA-256 checksum result.
*/
MBEDTLS_DEPRECATED static inline void mbedtls_sha256_finish(mbedtls_sha256_context *ctx, unsigned char output[32])
{
mbedtls_sha256_finish_ret(ctx, output);
}
/**
* \brief This function processes a single data block within
* the ongoing SHA-256 computation. This function is for
* internal use only.
*
* \deprecated Superseded by mbedtls_internal_sha256_process() in 2.7.0.
*
* \param ctx The SHA-256 context.
* \param data The buffer holding one block of data.
*/
MBEDTLS_DEPRECATED static inline void mbedtls_sha256_process(mbedtls_sha256_context *ctx, const unsigned char data[64])
{
mbedtls_internal_sha256_process(ctx, data);
}
#undef MBEDTLS_DEPRECATED
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
#ifdef __cplusplus
}
#endif
#endif
-1
View File
@@ -1 +0,0 @@
../qpg6095/diag.c
-1
View File
@@ -1 +0,0 @@
../qpg6095/entropy.c
-1
View File
@@ -1 +0,0 @@
../qpg6095/logging.c
-1
View File
@@ -1 +0,0 @@
../qpg6095/misc.c
-1
View File
@@ -1 +0,0 @@
../qpg6095/misc_qorvo.h
@@ -1,40 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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 OPENTHREAD_CORE_QPG6100_CONFIG_CHECK_H_
#define OPENTHREAD_CORE_QPG6100_CONFIG_CHECK_H_
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
#error "Platform qpg6100 doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
#endif
#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
#error "Platform qpg6100 doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
#endif
#endif /* OPENTHREAD_CORE_QPG6100_CONFIG_CHECK_H_ */
@@ -1,53 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes qpg6100 compile-time configuration constants for OpenThread.
*/
#ifndef OPENTHREAD_CORE_QPG6100_CONFIG_H_
#define OPENTHREAD_CORE_QPG6100_CONFIG_H_
/**
* @def OPENTHREAD_CONFIG_LEGACY_TRANSMIT_DONE
*
* Define to 1 if you want use legacy transmit done.
*
*/
#define OPENTHREAD_CONFIG_LEGACY_TRANSMIT_DONE 1
/**
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
*
* The platform-specific string to insert into the OpenThread version string.
*
*/
#define OPENTHREAD_CONFIG_PLATFORM_INFO "QPG6100"
#endif // OPENTHREAD_CORE_QPG6100_CONFIG_H_
-1
View File
@@ -1 +0,0 @@
../qpg6095/platform.c
@@ -1 +0,0 @@
../qpg6095/platform_qorvo.h
-1
View File
@@ -1 +0,0 @@
../qpg6095/radio.c
-1
View File
@@ -1 +0,0 @@
../qpg6095/radio_qorvo.h
@@ -1 +0,0 @@
../qpg6095/random_qorvo.h
-1
View File
@@ -1 +0,0 @@
../qpg6095/settings.cpp
@@ -1 +0,0 @@
../qpg6095/settings_qorvo.h
-1
View File
@@ -1 +0,0 @@
../qpg6095/uart.c
-1
View File
@@ -1 +0,0 @@
../qpg6095/uart_qorvo.h
-105
View File
@@ -1,105 +0,0 @@
#
# Copyright (c) 2021, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
set(OT_PLATFORM_LIB "openthread-qpg7015m" PARENT_SCOPE)
if(NOT OT_CONFIG)
set(OT_CONFIG "openthread-core-qpg7015m-config.h")
set(OT_CONFIG ${OT_CONFIG} PARENT_SCOPE)
endif()
list(APPEND OT_PLATFORM_DEFINES
"OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-qpg7015m-config-check.h\""
)
list(APPEND OT_PLATFORM_DEFINES
"_BSD_SOURCE=1"
"_DEFAULT_SOURCE=1"
)
set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)
set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE)
if(OT_CFLAGS MATCHES "-pedantic-errors")
string(REPLACE "-pedantic-errors" "" OT_CFLAGS "${OT_CFLAGS}")
endif()
if(OT_CFLAGS MATCHES "-Wno-c\\+\\+14-compat")
string(REPLACE "-Wno-c++14-compat" "" OT_CFLAGS "${OT_CFLAGS}")
endif()
list(APPEND OT_PLATFORM_DEFINES "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${OT_CONFIG}\"")
add_library(openthread-qpg7015m
alarm.c
diag.c
entropy.c
flash.c
logging.c
misc.c
radio.c
system.c
uart-posix.c
)
set_target_properties(
openthread-qpg7015m
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_link_libraries(openthread-qpg7015m
PRIVATE
qpg7015m-driver
${OT_MBEDTLS}
ot-config
PUBLIC
-lrt
-pthread
-Wl,--gc-sections
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
)
target_compile_definitions(openthread-qpg7015m
PUBLIC
${OT_PLATFORM_DEFINES}
)
target_compile_options(openthread-qpg7015m
PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-qpg7015m
PRIVATE
${OT_PUBLIC_INCLUDES}
${PROJECT_SOURCE_DIR}/src/core
${PROJECT_SOURCE_DIR}/examples/platforms
)
-73
View File
@@ -1,73 +0,0 @@
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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 $(abs_top_nlbuild_autotools_dir)/automake/pre.am
# Do not enable -Wcast-align for this platform
override CFLAGS := $(filter-out -Wcast-align,$(CFLAGS))
override CXXFLAGS := $(filter-out -Wcast-align,$(CXXFLAGS))
lib_LIBRARIES = libopenthread-qpg7015m.a
libopenthread_qpg7015m_a_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/core \
-I$(top_srcdir)/examples/platforms \
-I$(top_srcdir)/examples/platforms/qpg7015m \
-lrt \
-pthread \
$(NULL)
PLATFORM_SOURCES = \
alarm.c \
alarm_qorvo.h \
diag.c \
entropy.c \
flash.c \
logging.c \
misc.c \
openthread-core-qpg7015m-config.h \
openthread-core-qpg7015m-config-check.h \
platform_qorvo.h \
radio.c \
radio_qorvo.h \
random_qorvo.h \
system.c \
uart-posix.c \
uart_qorvo.h \
$(NULL)
libopenthread_qpg7015m_a_SOURCES = \
$(PLATFORM_SOURCES) \
$(NULL)
if OPENTHREAD_BUILD_COVERAGE
CLEANFILES = $(wildcard *.gcda *.gcno)
endif # OPENTHREAD_BUILD_COVERAGE
include $(abs_top_nlbuild_autotools_dir)/automake/post.am
@@ -1,46 +0,0 @@
#
# Copyright (c) 2019, The OpenThread Authors.
# 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 of the copyright holder 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 HOLDER 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.
#
#
# qpg7015m platform-specific Makefile
#
LDADD_COMMON += \
$(top_builddir)/examples/platforms/qpg7015m/libopenthread-qpg7015m.a \
$(NULL)
if OPENTHREAD_ENABLE_FTD
LDADD_COMMON += \
$(top_srcdir)/third_party/Qorvo/repo/qpg7015m/lib/libQorvoQPG7015M_ftd.a \
$(NULL)
else # OPENTHREAD_ENABLE_FTD
if OPENTHREAD_ENABLE_MTD
LDADD_COMMON += \
$(top_srcdir)/third_party/Qorvo/repo/qpg7015m/lib/libQorvoQPG7015M_mtd.a \
$(NULL)
endif # OPENTHREAD_ENABLE_MTD
endif
+1 -87
View File
@@ -1,87 +1 @@
# OpenThread on Qorvo qpg7015m Example
This directory contains example platform drivers for Qorvo qpg7015m on RPi.
## Toolchain
This example uses the GNU GCC toolchain on the Raspberry Pi. To build on the Pi:
1. Download the repo to the Pi
2. go to the subfolder in the openthread repo: third_party/nlbuild-autotools/repo/tools/packages and enter this command:
```bash
$ sudo /bin/bash build
```
Note that you may need to install additional packages to make this build work, depending on your actual RPi OS version. The build process will complain if additional packages are required.
## Build Examples
```bash
$ cd <path-to-openthread>
$ ./script/bootstrap
$ ./bootstrap
$ REFERENCE_DEVICE=1 CLI_LOGGING=1 COMMISSIONER=1 JOINER=1 DHCP6_CLIENT=1 DHCP6_SERVER=1 BORDER_ROUTER=1 make -f examples/Makefile-qpg7015m
```
After a successful build, the `elf` files are found in `<path-to-openthread>/output/qpg7015m/bin`.
Building a variant which interfaces via a tcp socket is also possible. Replace the uart-posix.c with uart-socket.c in the Makefile.am from examples/platforms/qpg7015m/Makefile.am and rebuild. Now it should be possible to open a telnet to socket 9190 of the raspberry pi from a remote PC. This also easier testing with the official Thread Test Harness.
## Cmake build
Make sure arm-linux-gnueabihf-gcc compiler installed in `$PATH`
```bash
cd <path-to-openthread>
./script/cmake-build qpg7015m
```
After a successful build, binary files will be generated:
```
./build/qpg7015m/examples/apps/ncp/ot-rcp
./build/qpg7015m/examples/apps/cli/ot-cli-ftd
```
##
## Interact
1. Spawn the process:
```bash
$ cd <path-to-openthread>/output/qpg7015m/bin
$ ./qpg7015m-ot-cli-ftd
```
2. Type `help` for list of commands.
```bash
> help
help
channel
childtimeout
contextreusedelay
extaddr
extpanid
ipaddr
keysequence
leaderweight
masterkey
mode
netdata register
networkidtimeout
networkname
panid
ping
prefix
releaserouterid
rloc16
route
routerupgradethreshold
scan
start
state
stop
```
The OpenThread on QPG7015m example has moved to https://github.com/openthread/ot-qorvo
-1
View File
@@ -1 +0,0 @@
../gp712/alarm.c
@@ -1 +0,0 @@
../gp712/alarm_qorvo.h
@@ -1 +0,0 @@
../gp712/arm-linux-gnueabihf.cmake
-1
View File
@@ -1 +0,0 @@
../gp712/diag.c
-1
View File
@@ -1 +0,0 @@
../gp712/entropy.c
-1
View File
@@ -1 +0,0 @@
../gp712/flash.c
-1
View File
@@ -1 +0,0 @@
../gp712/logging.c
-1
View File
@@ -1 +0,0 @@
../gp712/misc.c
@@ -1,40 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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 OPENTHREAD_CORE_QPG7015M_CONFIG_CHECK_H_
#define OPENTHREAD_CORE_QPG7015M_CONFIG_CHECK_H_
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
#error "Platform qpg7015m doesn't support configuration option: OPENTHREAD_CONFIG_TIME_SYNC_ENABLE"
#endif
#if OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT
#error "Platform qpg7015m doesn't support configuration option: OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT"
#endif
#endif /* OPENTHREAD_CORE_QPG7015M_CONFIG_CHECK_H_ */
@@ -1,136 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* 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 of the copyright holder 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 HOLDER 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.
*/
/**
* @file
* This file includes qpg7015m compile-time configuration constants for OpenThread.
*/
#ifndef OPENTHREAD_CORE_QPG7015M_CONFIG_H_
#define OPENTHREAD_CORE_QPG7015M_CONFIG_H_
/**
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
*
* The platform-specific string to insert into the OpenThread version string.
*
*/
#define OPENTHREAD_CONFIG_PLATFORM_INFO "QPG7015M"
/**
* @def OPENTHREAD_CONFIG_PLATFORM_INFO
*
* Define to 1 to enable otPlatFlash* APIs to support non-volatile storage.
*
* When defined to 1, the platform MUST implement the otPlatFlash* APIs
* instead of the otPlatSettings*
*
*/
#define OPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE 1
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
*
* Define to 1 if you want to enable software ACK timeout logic.
*
*/
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
*
* Define to 1 if you want to enable software retransmission logic.
*
*/
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
*
* Define to 1 if you want to enable software CSMA-CA backoff logic.
*
*/
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
*
* Define to 1 if you want to enable software transmission security logic.
*
*/
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
#endif
/**
* @def OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE
*
* Define to 1 to enable software transmission target time logic.
*
*/
#ifndef OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE
#define OPENTHREAD_CONFIG_MAC_SOFTWARE_TX_TIMING_ENABLE (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2)
#endif
/**
* @def OPENTHREAD_CONFIG_DIAG_ENABLE
*
* Define as 1 to enable the diag feature.
*
*/
#ifndef OPENTHREAD_CONFIG_DIAG_ENABLE
#define OPENTHREAD_CONFIG_DIAG_ENABLE 1
#endif
/**
* @def OPENTHREAD_CONFIG_NCP_SPI_ENABLE
*
* Define as 1 to enable SPI NCP interface.
*
*/
#ifndef OPENTHREAD_CONFIG_NCP_SPI_ENABLE
#define OPENTHREAD_CONFIG_NCP_SPI_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
*
* Define as 1 to enable UART NCP interface.
*
*/
#ifndef OPENTHREAD_CONFIG_NCP_HDLC_ENABLE
#define OPENTHREAD_CONFIG_NCP_HDLC_ENABLE 1
#endif
#endif // OPENTHREAD_CORE_QPG7015M_CONFIG_H_
@@ -1 +0,0 @@
../gp712/platform_qorvo.h
-1
View File
@@ -1 +0,0 @@
../gp712/radio.c
@@ -1 +0,0 @@
../gp712/radio_qorvo.h
@@ -1 +0,0 @@
../gp712/random_qorvo.h

Some files were not shown because too many files have changed in this diff Show More